fuword32(9)

fuword329

Fetch data from user-space

Part of fetch(9).

Usage

#include <sys/types.h>

#include <sys/systm.h>

int

fubyte(volatile const void *base);

long

fuword(volatile const void *base);

int

fuword16(volatile const void *base);

int32_t

fuword32(volatile const void *base);

int64_t

fuword64(volatile const void *base);

int

fueptr(volatile const void *base, intptr_t *val);

int

fueword(volatile const void *base, long *val);

int

fueword32(volatile const void *base, int32_t *val);

int

fueword64(volatile const void *base, int64_t *val);

Overview

The fetch functions are designed to copy small amounts of data from user-space of the current process. If the user address is naturally aligned, then the operation will be performed atomically. Otherwise it may fail or be performed non-atomically, depending on the platform.

The fetch routines provide the following functionality:

fubyte()

Fetches a byte of data from the user-space address base. The byte read is zero-extended into the results variable.

fuword()

Fetches a word of data (long) from the user-space address base.

fuword16()

Fetches 16 bits of data from the user-space address base. The half-word read is zero-extended into the results variable.

fuword32()

Fetches 32 bits of data from the user-space address base.

fuword64()

Fetches 64 bits of data from the user-space address base.

fueptr()

Fetches a pointer from the user-space address base and stores the result in the variable pointed by val. fueptr() preserves the provenance of pointers fetched from user-space (see memory_model(7) for further information).

fueword()

Fetches a word of data (long) from the user-space address base and stores the result in the variable pointed by val.

fueword32()

Fetches 32 bits of data from the user-space address base and stores the result in the variable pointed by val.

fueword64()

Fetches 64 bits of data from the user-space address base and stores the result in the variable pointed by val.

The callers of fuword(), fuword32() and fuword64() functions cannot distinguish between -1 read from userspace and function failure.

Return values

The fubyte(), fuword(), fuword16(), fuword32(), and fuword64() functions return the data fetched or -1 on failure. The fueptr(), fueword(), fueword32() and fueword64() functions return 0 on success and -1 on failure.

Releases

38 releases since FreeBSD 8.1-RELEASE; the text changed 26 times.

  1. 8.1
  2. 8.2
  3. 8.3
  4. 8.4
  5. 9.0
  6. 9.1
  7. 9.2
  8. 9.3
  9. 10.0
  10. 10.1
  11. 10.2
  12. 10.3
  13. 10.4
  14. 11.0
  15. 11.1
  16. 11.2
  17. 11.3
  18. 11.4
  19. 12.0
  20. 12.1
  21. 12.2
  22. 12.3
  23. 12.4
  24. 13.0
  25. 13.1–13.2
  26. 13.3–15.1
  27. 16.0

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.