copyinstr Kernel Service

Purpose

Copies a character string (including the terminating null character) from user to kernel space.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/uio.h>
On the 32-bit kernel, the syntax for the copyinstr Kernel Service is:
int copyinstr (from, to, max, actual)
caddr_t from;
caddr_t to;
uint max;
uint *actual;
On the 64-bit kernel, the syntax for the copyinstr subroutine is:
int copyinstr (from, to, max, actual)
void *from;
void *to;
size_t max;
size_t *actual;

Parameters

Item Description
from Specifies the address of the character string to copy.
to Specifies the address to which the character string is to be copied.
max Specifies the number of characters to be copied.
actual Specifies a parameter, passed by reference, that is updated by the copyinstr service with the actual number of characters copied.

Description

The copyinstr kernel service permits a user to copy character data from one location to another. The source location must be in user space or can be in kernel space if the caller is a kernel process. The destination is in kernel space.

Execution Environment

The copyinstr kernel service can be called from the process environment only.

Return Values

Item Description
0 Indicates a successful operation.
E2BIG Indicates insufficient space to complete the copy.
EIO Indicates that a permanent I/O error occurred while referencing data.
ENOSPC Indicates insufficient file system or paging space.
EFAULT Indicates that the user has insufficient authority to access the data or the address specified in the uaddr parameter is not valid.