NetBSD/share/man/man9/ufetch.9

89 lines
3.0 KiB
Groff

.\" $NetBSD: ufetch.9,v 1.1 2019/04/06 03:06:24 thorpej Exp $
.\"
.\" Copyright (c) 2019 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Jason R. Thorpe.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 18, 2019
.Dt UFETCH 9
.Os
.Sh NAME
.Nm ufetch ,
.Nm ufetch_8 ,
.Nm ufetch_16 ,
.Nm ufetch_32 ,
.Nm ufetch_64 ,
.Nm ufetch_char ,
.Nm ufetch_short ,
.Nm ufetch_int ,
.Nm ufetch_long ,
.Nm ufetch_ptr
.Nd fetch data from user-space
.Sh SYNOPSIS
.In sys/systm.h
.Ft int
.Fn ufetch_8 "const uint8_t *uaddr" "uint8_t *valp"
.Ft int
.Fn ufetch_16 "const uint16_t *uaddr" "uint16_t *valp"
.Ft int
.Fn ufetch_32 "const uint32_t *uaddr" "uint32_t *valp"
.Ft int
.Fn ufetch_64 "const uint64_t *uaddr" "uint64_t *valp"
.Ft int
.Fn ufetch_char "const unsigned char *uaddr" "unsigned char *valp"
.Ft int
.Fn ufetch_short "const unsigned short *uaddr" "unsigned short *valp"
.Ft int
.Fn ufetch_int "const unsigned int *uaddr" "unsigned int *valp"
.Ft int
.Fn ufetch_long "const unsigned long *uaddr" "unsigned long *valp"
.Ft int
.Fn ufetch_ptr "const void **uaddr" "void **valp"
.Sh DESCRIPTION
The
.Nm
functions provide a way to fetch the values of single memory cells from
user-space.
In each case, the value referenced by the user-space address
.Ar uaddr
is retrieved and stored at the kernel memory location referenced by
.Ar valp .
.Pp
The
.Nm ufetch_64
function is only available on systems employing the
.Sq LP64
memory model, which can be determined by testing for the presence of the
.Dv _LP64
C preprocessor macro.
.Sh RETURN VALUES
The
.Nm
functions return 0 on success and an error number on failure.
.Sh SEE ALSO
.Xr copy 9 ,
.Xr ustore 9