内容简介
#include <sys/ioctl.h>int ioctl(int%uA0d, int%uA0request, ...)
描述
The%uA0ioctl() function manipulates the underlying device parameters of special files. In particular, many operating characteristics of character special files (e.g. terminals) may be controlled with%uA0ioctl() requests. The argument%uA0d%uA0must be an open file descriptor.The second argument is a device-dependent request code. The third argument is an untyped yiibaier to memory. It’s traditionally%uA0char *argp%uA0(from the days before%uA0void *was valid C), and will be so named for this discussion.
An%uA0ioctl()%uA0request%uA0has encoded in it whether the argument is an%uA0in%uA0parameter or%uA0outparameter, and the size of the argument%uA0argp%uA0in bytes. Macros and defines used in specifying an%uA0ioctl()%uA0request%uA0are located in the file%uA0<sys/ioctl.h>.
返回值
Usually, on success zero is returned. A few%uA0ioctl() requests use the return value as an output parameter and return a nonnegative value on success. On error, -1 is returned, and%uA0errno%uA0is set appropriately.错误
标签 | 描述 |
---|---|
EBADF | d%uA0is not a valid descriptor. |
EFAULT | argp%uA0references an inaccessible memory area. |
EINVAL | Request%uA0or%uA0argp%uA0is not valid. |
ENOTTY | d%uA0is not associated with a character special device. |
ENOTTY | The specified request does not apply to the kind of object that the descriptor%uA0d%uA0references. |