The ioctl() function shall manipulate the underlying device parameters of special files. fildes shall be an open file descriptor referring to a special file. The ioctl() function shall take three parameters; the type and value of the third parameter is dependent on the device and request.
Conforming LSB applications shall not call ioctl() except in situations explicitly stated in this specification.
On success, 0 is returned.
An ioctl() may use the return value as an
output parameter and return a non-negative value on success.
On error, -1 is returned and
the global variable
errno is set appropriately.
fildes is not a valid descriptor.
The third parameter references an inaccessible memory area.
fildes is not associated with a character special device.
The specified request does not apply to the kind of object that fildes references.
request or the third parameter is not valid.
It should be noted that POSIX 1003.1-2001 (ISO/IEC 9945-2003) contains an interface named ioctl(). The LSB only defines behavior when fildes refers to a socket (see sockio) or terminal device (see ttyio), while POSIX 1003.1-2001 (ISO/IEC 9945-2003) only defines behavior when fildes refers to a STREAMS device. An implementation may support both behaviors; the LSB does not require any STREAMS support.