

ioctl()                COHERENT System Call               ioctl()




Device-dependent control

iiooccttll(_f_d, _c_o_m_m_a_n_d, _i_n_f_o)
iinntt _f_d, _c_o_m_m_a_n_d;
cchhaarr *_i_n_f_o;

ioctl provides direct interaction with a device driver.  Possible
uses include  setting or retrieving parameters  for devices (line
printers,  communications   lines,  terminals)  and  non-standard
spacing operations for tape drives.

ioctl acts upon a block  special file or a character special file
associated  with the  already open  file descriptor  fd.  command
points  to the  specific request.  A  system header  file defines
symbolic command  parameters for each device  type.  For example,
sgtty.h defines commands for terminals and mtioctl.h defines com-
mands  for  magnetic tape  drives.   Using  the symbolic  command
definitions  from the header  files promotes  device independence
within  each device  type.  The  entry  for device  drivers names
other sections that detail specific devices.

info passes a buffer of information (defined by structures in the
appropriate  header files)  to the driver.   For any  command not
needing additional information, this argument should be NULL.

Some ioctl requests work on all  files, and are not passed to any
driver.   The commands  FIOCLEX and  FIONCLEX enable  and disable
closing of the given file descriptor when an exec call completes.

***** Files *****

<sgtty.h>
<lpioctl.h>
<mtioctl.h>

***** See Also *****

COHERENT system calls, exec, getty, open(), read(), stty, write()

***** Diagnostics *****

ioctl  returns  -1 on  errors,  such as  a  bad file  descriptor.
Because  the call  is device  dependent,  almost any  other error
could be returned.

***** Notes *****

The type  of the  info argument  to ioctl is  declared as  char *
mainly for portability  reasons.  In most cases, the actual argu-
ment type  will be something  like struct sgttyb  *, depending on
the particular device and command.  The actual argument should be
cast to type char * to ensure cross-machine portability.




COHERENT Lexicon                                           Page 1


