UFETCH(9)

UFETCH(9) | Kernel Developer's Manual | UFETCH(9)

# NAME

`ufetch`, `ufetch_8`, `ufetch_16`, `ufetch_32`, `ufetch_64`, `ufetch_char`, `ufetch_short`, `ufetch_int`, `ufetch_long`, `ufetch_ptr` —
fetch data from user-space

# SYNOPSIS

`#include <sys/systm.h>`

int
`ufetch_8`(const uint8_t *uaddr, uint8_t *valp);

int
`ufetch_16`(const uint16_t *uaddr, uint16_t *valp);

int
`ufetch_32`(const uint32_t *uaddr, uint32_t *valp);

int
`ufetch_64`(const uint64_t *uaddr, uint64_t *valp);

int
`ufetch_char`(const unsigned char *uaddr, unsigned char *valp);

int
`ufetch_short`(const unsigned short *uaddr, unsigned short *valp);

int
`ufetch_int`(const unsigned int *uaddr, unsigned int *valp);

int
`ufetch_long`(const unsigned long *uaddr, unsigned long *valp);

int
`ufetch_ptr`(const void **uaddr, void **valp);

# DESCRIPTION

The `ufetch` 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 uaddr is retrieved and stored at the kernel memory location referenced by valp.

The `ufetch_64` function is only available on systems employing the ‘LP64’ memory model, which can be determined by testing for the presence of the `_LP64` C preprocessor macro.

# RETURN VALUES

The `ufetch` functions return 0 on success and an error number on failure.

# SEE ALSO

copy(9), ustore(9)

March 18, 2019 | NetBSD 9.5