ioctl(5)ioctl(5)NAMEioctl - generic device control commands
SYNOPSISDESCRIPTION
The ioctl(2) system call provides for control over open devices. This
include file describes requests and arguments used in ioctl(2) which
are of a generic nature. For details about how individual requests
will affect any particular device, see the corresponding device manual
entry in Section 7 of the If a device does not support an ioctl request
it returns
Returns in the long integer whose address is
arg the number of characters immediately readable
from the device file.
For those character device files which support this command,
if the integer whose address is arg is nonzero,
system asynchronous I/O is enabled; that is, enable
to be sent to the process currently designated with
(see below) whenever device-file-dependent events
occur. If no process has been designated with then
enable to be sent to the first process to open the
device file.
If the designated process has exited, the signal is
not sent to any process.
If the integer whose address is arg is 0, system
asynchronous I/O is disabled.
For those character device files which support this command,
the integer whose address is arg is set to 1, if
system asynchronous I/O is enabled. Otherwise, the
integer whose address is arg is set to 0.
For those character device files which support this command,
set process ID to receive the signals with system
asynchronous I/O to the value of the integer whose
address is arg. Users with appropriate privileges
can designate that any process receive the signals.
If the request is not made by the super-user, only
the calling process is allowed to designate that
itself or another process whose real or saved
effective user ID matches its real or effective
user ID, or a process which is a descendant of the
calling process, receive the signals. If no
process can be found corresponding to that speci‐
fied by the integer whose address is arg, the call
will fail, with set to If the request is not made
by the super-user and the calling process attempts
to designate a process other than itself or (1)
another process whose real or saved effective user
ID matches its real or effective user ID, or (2) a
process which is not a descendant of the calling
process, the call fails, with set to
If the designated process subsequently exits, the
signal will not be sent to any process.
The default when opening a device file is that the
process performing the open is set to receive the
signals.
For those character device files which support this command,
the integer whose address is arg is set to the
process ID designated to receive signals.
For those character device files which support this command,
if the integer whose address is arg is nonzero,
nonblocking I/O is enabled; that is, subsequent
reads and writes to the device file are handled in
a nonblocking manner (see below). If the integer
whose address is arg is 0, nonblocking I/O is dis‐
abled.
For reads, nonblocking I/O prevents all read
requests to that device from blocking, whether the
requests succeed or fail. Such read requests com‐
plete in one of three ways:
· If there is enough data available to satisfy the
entire request, the read completes successfully,
having read all of the data, and returns the num‐
ber of bytes read;
· If there is not enough data available to satisfy
the entire request, the read completes success‐
fully, having read as much data as possible, and
returns the number of bytes it was able to read;
· If there is no data available, the read fails and
errno is set to
For writes, nonblocking I/O prevents all write
requests to that device file from blocking, whether
the requests succeed or fail. Such a write request
completes in one of three ways:
· If there is enough space available in the system
to buffer all the data, the write completes suc‐
cessfully, having written out all of the data, and
returns the number of bytes written;
· If there is not enough space in the buffer to
write out the entire request, the write completes
successfully, having written as much data as pos‐
sible, and returns the number of bytes it was able
to write;
· If there is no space in the buffer, the write
fails and is set to
To prohibit nonblocking I/O from interfering with
the flag (see open(2) and fcntl(2)), the function‐
ality of always supersedes the functionality of
nonblocking I/O. This means that if is set, the
driver performs read requests in accordance with
the definition of When is not set, the definition
of nonblocking I/O applies.
The default on open of a device file is that non‐
blocking I/O is disabled.
For those character device files which support this command,
the integer whose address is arg is set to 1, if
nonblocking I/O is enabled. Otherwise, the integer
whose address is arg is set to 0.
WARNINGS
is similar to 4.2 BSD with the addition of provisions for security.
is of HP origin, complements and allows saving and restoring system
asynchronous I/O TTY state for BSD-style job control.
is similar to 4.2 BSD with the addition of provisions for security.
is similar to 4.2 BSD Note also the difference that the 4.2 BSD version
of this functionality used process groups, while the HP-UX version only
uses processes.
is the same as 4.2 BSD except that it does not interfere with the AT&T
open and fcntl flag.
is of HP origin, complements and allows saving and restoring nonblock‐
ing I/O TTY state for BSD-style job control.
SEE ALSOioctl(2), arp(7), socket(7).
Section 7 of the
ioctl(5)