#include <sys/ioctl.h> int
ioctl (int d unsigned long request ...);
DESCRIPTION
The
ioctl ();
system call manipulates the underlying device parameters of special files.
In particular, many operating
characteristics of character special files (e.g. terminals)
may be controlled with
ioctl ();
requests.
The argument
Fa d
must be an open file descriptor.
The third argument to
ioctl ();
is traditionally named
char *argp
Most uses of
ioctl (,);
however, require the third argument to be a
Vt caddr_t
or an
Vt int .
An
ioctl ();
Fa request
has encoded in it whether the argument is an
``in''
argument
or
``out''
argument, and the size of the argument
Fa argp
in bytes.
Macros and defines used in specifying an ioctl
Fa request
are located in the file
In sys/ioctl.h .
RETURN VALUES
If an error has occurred, a value of -1 is returned and
errno
is set to indicate the error.
ERRORS
The
ioctl ();
system call
will fail if:
Bq Er EBADF
The
Fa d
argument
is not a valid descriptor.
Bq Er ENOTTY
The
Fa d
argument
is not associated with a character
special device.
Bq Er ENOTTY
The specified request does not apply to the kind
of object that the descriptor
Fa d
references.
Bq Er EINVAL
The
Fa request
or
Fa argp
argument
is not valid.
Bq Er EFAULT
The
Fa argp
argument
points outside the process's allocated address space.