Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ioctl(5) — HP-UX 5.50

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ioctl(2)

IOCTL(5)  —  HP-UX

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 page section (7).  If a device does not support an ioctl request it will return EINVAL. 

FIONREAD
Returns in the long integer whose address is  arg the number of characters immediately readable from the device file.

FIOSSAIOSTAT
For those character device files which support this command, if the integer whose address is arg is non-zero, 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 designated 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 will not be 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.  The super-user may designate that any process receive the SIGIO signals.  If the request is not made by the super-user, the calling process is only 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 process 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 another process whose real or saved effective user ID matches its real or effective user ID, or a process which is not a descendant of the calling process, the call will fail, with errno set to EPERM.  If the designated process subsequently exits, the SIGIO signal will not be sent to any process. The default on open of 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 non-zero, non-blocking I/O is enabled.  That is, subsequent reads and writes to the device file will be handled in a non-blocking manner (see below).  If the integer whose address is arg is 0, non-blocking I/O is disabled.  For reads, non-blocking I/O will prevent all read requests to that device from blocking, whether the requests succeed or fail. Such a read request will complete in one of three ways: (1) If there is enough data available to satisfy the entire request, the read will complete successfully, having read all of the data, and return the number of bytes read; (2) If there is not enough data available to satisfy the entire request, the read will complete successfully, having read as much data as possible, and return the number of bytes it was able to read; (3) If there is no data available, the read will fail and errno will be set to EWOULDBLOCK.  For writes, non-blocking I/O will prevent all write requests to that device file from blocking, whether the requests succeed or fail. Such a write request will complete in one of three ways: (1) If there is enough space available in the system to buffer all the data, the write will complete successfully, having written out all of the data, and return the number of bytes written; (2) If there is not enough space in the buffer to write out the entire request, the write will complete successfully, having written as much data as possible, and return the number of bytes it was able to write; (3) If there is no space in the buffer, the write will fail and errno will be set to EWOULDBLOCK.  To prohibit non-blocking I/O from interfering with the O_NDELAY flag (see open(2) and fcntl(2) ), the functionality of O_NDELAY always supercedes the functionality of non-blocking I/O. This means that if O_NDELAY is set, the driver will perform read requests in accordance with the definition of O_NDELAY. When O_NDELAY is not set, the definition of non-blocking I/O applies. The default on open of a device file is that non-blocking I/O is disabled.

FIOGNBIO
For those character device files which support this command, the integer whose address is arg is set to 1, if non-blocking I/O is enabled.  Otherwise, the integer whose address is arg is set to 0. 

WARNINGS

FIOSSAIOSTAT is similar to 4.2 BSD FIOASYNC, with the addition of provisions for security.  FIOGSAIOSTAT is of HP origin, complements FIOSSAIOSTAT, and allows saving and restoring system asynchronous I/O TTY state for BSD style job control.  FIOSSAIOOWN is similar to 4.2 BSD FIOSETOWN, with the addition of provisions for security.  FIOGSAIOOWN is similar to 4.2 BSD FIOGETOWN.  Note also the difference that the 4.2 BSD version of this functionality used process groups, while the HP-UX version only uses processes.  FIOSNBIO is the same as 4.2 BSD FIONBIO, except that it does not interfere with the AT&T O_NDELAY open and fcntl flag.  FIOGNBIO is of HP origin, complements FIOSNBIO, and allows saving and restoring non-blocking I/O TTY state for BSD style job control. 

HARDWARE DEPENDENCIES

Series 200, 300, 500
Asynchronous I/O is not supported.

SEE ALSO

ioctl(2).  Section (7) of this manual.

Hewlett-Packard Company  —  Version B.1,  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026