up | Inhaltsverzeichniss | Kommentar

Manual page for IOCTL(2)

ioctl - control device


int ioctl(fd, request, arg)
int fd, request;
caddr_t arg;


ioctl() performs a special function on the object referred to by the open descriptor fd. The set of functions that may be performed depends on the object that fd refers to. For example, many operating characteristics of character special files (for instance, terminals) may be controlled with ioctl() requests. The writeups in section 4 discuss how ioctl() applies to various objects.

The request codes for particular functions are specified in include files specific to objects or to families of objects; the writeups in section 4 indicate which include files specify which requests.

For most ioctl() functions, arg is a pointer to data to be used by the function or to be filled in by the function. Other functions may ignore arg or may treat it directly as a data item; they may, for example, be passed an int value.


ioctl() returns 0 on success for most requests. Some specialized requests may return non-zero values on success; see the description of the request in the man page for the object. On failure, ioctl() returns -1 and sets errno to indicate the error.


fd is not a valid descriptor.
request requires a data transfer to or from a buffer pointed to by arg, but some part of the buffer is outside the process's allocated space.
request or arg is not valid.
The specified request does not apply to the kind of object to which the descriptor fd refers.

ioctl() will also fail if the object on which the function is being performed detects an error. In this case, an error code specific to the object and the function will be returned.


execve.2v fcntl.2v filio.4 mtio.4 sockio.4 streamio.4 termio.4

index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 21/April/97