Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ioctl(2) — HP-UX 5.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

IOCTL(2)

NAME

ioctl − control device

SYNOPSIS

#include <sys/ioctl.h>

ioctl (fildes, request, arg)
int fildes, request;

HP-UX COMPATIBILITY

Level: HP-UX/RUN ONLY

Origin: System V

DESCRIPTION

Ioctl performs a variety of functions on character special files (devices).  The write-ups of various devices in Section 4 discuss how ioctl applies to them.  The type of Arg is dependent on the specific ioctl call, as described in Section 4. 

Ioctl will fail if one or more of the following are true:


­[EBADF] Fildes is not a valid open file descriptor. 

­[ENOTTY] The request is not appropriate to the selected device. 

­[EINVAL] Request or arg is not valid. 

­[EINTR] A signal was caught during the ioctl system call. 

Request is made up of several fields.  They encode the size and direction of the argument (referenced by arg ), as well as the desired command.  An enumeration of the request fields are:

IOC_IN (Bit 31)
Argument is read by the driver. (That is, the argument is copied from the application to the driver.)

IOC_OUT (Bit 30)
Argument is written by the driver. (That is, the argument is copied from the driver to the application.)

IOCSIZE_MASK
Number of bytes in the passed argument. A nonzero size indicates that arg is a pointer to the passed argument.  A zero size indicates that arg is the passed argument (if the driver wants to use it), and is not treated as a pointer. 

IOCCMD_MASK (Bits 15-0)
The request command itself.

When both IOC_IN and IOC_OUT are zero, it can be assumed that request is not encoded for size and direction, for compatibility purposes.  Requests which do not require any data to be passed and requests which use arg as a value (as opposed to a pointer), have the IOC_IN bit set to one and the IOCSIZE_MASK field set to zero. 

Note: any data structure referenced by arg may not contain any pointers. 

RETURN VALUE

If an error has occurred, a value of −1 is returned and errno is set to indicate the error. 

SEE ALSO

Section 4. 

Hewlett-Packard  —  last mod. May 11, 2021

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