IOCTLX(2,L) AIX Technical Reference IOCTLX(2,L)
-------------------------------------------------------------------------------
ioctlx, ioctl, gtty, stty
PURPOSE
Controls input/output devices.
LIBRARY
Standard C Library (libc.a)
SYNTAX
#include <sys/ioctl.h>
#include <sys/devinfo.h>
#include <sgtty.h>
int ioctlx (fildes, op, arg, ext) int gtty (fildes, argp)
int fildes, op; int fildes
char *arg; struct sgttyb *argp;
int ext;
int stty (fildes, argp)
int ioctl (fildes, op, arg) int fildes
int fildes, op; struct sgttyb *argp;
char *arg;
DESCRIPTION
The ioctlx and ioctl system calls perform a variety of control operations on
the block or character special file (device) specified by the fildes parameter.
The op parameter specifies the operation, and the use of the arg parameter
depends on the particular operation performed. The ext parameter provides
additional device-specific information. For more information on the ioctl and
ioctlx operations for 4.3BSD functions, see "BSD4.3 library."
The following two standard calls, however, apply to any open file:
ioctl(fildes, FIOCLEX, 0)
ioctl(fildes, FIONCLEX, 0)
The first of these calls causes the file to be closed automatically during a
successful exec, rexec, or run system call; the second causes the file to
Processed November 7, 1990 IOCTLX(2,L) 1
IOCTLX(2,L) AIX Technical Reference IOCTLX(2,L)
remain open across these calls (see "exec: execl, execv, execle, execve,
execlp, execvp" and "fcntl.h").
Two operations are valid for all types of devices that support ioctl and ioctlx
system calls. These two operations are:
IOCTYPE Returns the device type associated with fildes, left shifted 8
bits. The device types are defined in the sys/devinfo.h header
file, which is discussed in "devinfo."
IOCINFO Stores device information for the file specified by fildes into the
buffer pointed to by the arg parameter. See "devinfo" for the
format of the device information structure.
Some devices support additional requests.
COMPATIBILITY INTERFACE
ioctl (fildes, cmd, arg)
is equivalent to:
octlx (fildes, cmd, arg, 0)
The functions gtty and stty are equivalent to
ioctl(fildes, TIOCGETP, argp)
and
ioctl(fildes, TIOCSETP, argp)
respectively (see "termio").
RETURN VALUE
If the ioctlx, ioctl, gtty, or stty call fails, a value of -1 is returned and
errno is set to indicate the error.
ERROR CONDITIONS
The ioctlx, ioctl, gtty, or stty calls fail if one or more of the following are
true:
EBADF fildes is not a valid open file descriptor.
ENOTTY fildes is not associated with a character special file.
ENODEV The device associated with fildes does not support the ioctlx system
call.
EFAULT The arg parameter points to a location outside of the process's
allocated address space.
Processed November 7, 1990 IOCTLX(2,L) 2
IOCTLX(2,L) AIX Technical Reference IOCTLX(2,L)
EINVAL op or arg is not valid.
EINTR A signal was caught during the ioctlx system call.
If the Transparent Computing Facility is installed on your system, ioctlx can
also fail if one or more of the following are true:
ESITEDN1
The device is on a site which is not currently on the network.
ESITEDN2
The operation was terminated because a site failed.
RELATED INFORMATION
In this book: "getsockopt, setsockopt," and "devinfo."
The stty command in AIX Operating System Commands Reference.
The discussion of termio in AIX Programming Tools and Interfaces.
Processed November 7, 1990 IOCTLX(2,L) 3