ioctl.5 (2010 09)

i
ioctl(5) ioctl(5)
NAME
ioctl - generic device control commands
SYNOPSIS
#include <sys/ioctl.h>
ioctl(fildes, request, arg)
int fildes, request;
DESCRIPTION
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 HP-UX Refer-
ence. If a device does not support an ioctl request it returns [EINVAL].
FIONREAD Returns in the long integer whose address is arg the number of characters immedi-
ately readable from the device file.
FIOSSAIOSTAT 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
SIGIO to be sent to the process currently designated with
FIOSSAIOOWN (see
below) whenever device-file-dependent events occur. If no process has been desig-
nated with
FIOSSAIOOWN, then enable SIGIO to be sent to the first process to
open the device file.
If the designated process has exited, the
SIGIO signal is not sent to any process.
If the integer whose address is arg is 0, system asynchronous I/O is disabled.
FIOGSAIOSTAT 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.
FIOSSAIOOWN For those character device files which support this command, set process ID to
receive the SIGIO 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 SIGIO 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 SIGIO signals. If no pro-
cess can be found corresponding to that specified by the integer whose address is
arg, the call will fail, with errno set to [ESRCH]. 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 errno set to [EPERM].
If the designated process subsequently exits, the
SIGIO 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
SIGIO signals.
FIOGSAIOOWN For those character device files which support this command, the integer whose
address is arg is set to the process ID designated to receive SIGIO signals.
FIOSNBIO 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 disabled.
For reads, nonblocking I/O prevents all read requests to that device from blocking,
whether the requests succeed or fail. Such read requests complete 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 number of bytes read;
If there is not enough data available to satisfy the entire request, the read com-
pletes successfully, having read as much data as possible, and returns the number
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (2 pages)