ioctl()

control a device

Synopsis:

#include <sys/ioctl.h> 

int ioctl( int d, 
           long request, ... );

Description:

The ioctl() function manipulates the underlying parameters of files. In particular, it can be used to control many of the operating attributes of files (such as the attributes of terminals).

The request argument determines the number and type of any additional arguments. Macros and constants used in specifying a request are defined in <sys/ioctl.h>.


Note: The argument d must be an open file descriptor.

Returns:

A value based on the request, or -1 if an error occurs.

Errors:

If an error occurred, errno could contain one of the following:

EBADF
d isn't a valid descriptor.
EINVAL
The request or additional arguments aren't valid.
ENOTTY
d isn't associated with a character special device; the specified request doesn't apply to the kind of object that the descriptor d references.

Classification:

UNIX

Safety:
Interrupt handler No
Signal handler No
Thread No