User-Memory-Access Kernel Services

In a system call or kernel extension running under a user process, data in the user process can be moved in or out of the kernel using the kernel services listed in this section.

The kernel services that are used to move data in or out of the kernel are the copyin and copyout services. The uiomove service is used for scatter and gather operations. If user data is to be referenced asynchronously, such as from an interrupt handler or a kernel process, the cross memory services must be used.

The User-Memory-Access kernel services are:

Item Description
copyin, copyin64 Copies data between user and kernel memory.
copyinstr, copyinstr64 Copies a character string (including the terminating null character) from user to kernel space.
copyout, copyout64 Copies data between user and kernel memory.
fubyte, fubyte64 Fetches, or retrieves, a byte of data from user memory.
fuword, fuword64 Fetches, or retrieves, a word of data from user memory.
subyte, subyte64 Stores a byte of data in user memory.
suword, suword64 Stores a word of data in user memory.
uiomove Moves a block of data between kernel space and a space defined by a uio structure.
ureadc Writes a character to a buffer described by a uio structure.
uwritec Retrieves a character from a buffer described by a uio structure.
Note: The copyin64, copyout64, copyinstr64, fubyte64, fuword64, subyte64, and suword64 kernel services are defined as macros when compiling kernel extensions on the 64–bit kernel. The macros invoke the corresponding kernel services without the "64" suffix.