xref: /netbsd-src/share/man/man9/ufetch.9 (revision 91bfaeb6759937927739ef3693f1c0059f6796f8)
1.\"	$NetBSD: ufetch.9,v 1.1 2019/04/06 03:06:24 thorpej Exp $
2.\"
3.\" Copyright (c) 2019 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jason R. Thorpe.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd March 18, 2019
31.Dt UFETCH 9
32.Os
33.Sh NAME
34.Nm ufetch ,
35.Nm ufetch_8 ,
36.Nm ufetch_16 ,
37.Nm ufetch_32 ,
38.Nm ufetch_64 ,
39.Nm ufetch_char ,
40.Nm ufetch_short ,
41.Nm ufetch_int ,
42.Nm ufetch_long ,
43.Nm ufetch_ptr
44.Nd fetch data from user-space
45.Sh SYNOPSIS
46.In sys/systm.h
47.Ft int
48.Fn ufetch_8 "const uint8_t *uaddr" "uint8_t *valp"
49.Ft int
50.Fn ufetch_16 "const uint16_t *uaddr" "uint16_t *valp"
51.Ft int
52.Fn ufetch_32 "const uint32_t *uaddr" "uint32_t *valp"
53.Ft int
54.Fn ufetch_64 "const uint64_t *uaddr" "uint64_t *valp"
55.Ft int
56.Fn ufetch_char "const unsigned char *uaddr" "unsigned char *valp"
57.Ft int
58.Fn ufetch_short "const unsigned short *uaddr" "unsigned short *valp"
59.Ft int
60.Fn ufetch_int "const unsigned int *uaddr" "unsigned int *valp"
61.Ft int
62.Fn ufetch_long "const unsigned long *uaddr" "unsigned long *valp"
63.Ft int
64.Fn ufetch_ptr "const void **uaddr" "void **valp"
65.Sh DESCRIPTION
66The
67.Nm
68functions provide a way to fetch the values of single memory cells from
69user-space.
70In each case, the value referenced by the user-space address
71.Ar uaddr
72is retrieved and stored at the kernel memory location referenced by
73.Ar valp .
74.Pp
75The
76.Nm ufetch_64
77function is only available on systems employing the
78.Sq LP64
79memory model, which can be determined by testing for the presence of the
80.Dv _LP64
81C preprocessor macro.
82.Sh RETURN VALUES
83The
84.Nm
85functions return 0 on success and an error number on failure.
86.Sh SEE ALSO
87.Xr copy 9 ,
88.Xr ustore 9
89