Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ioctl(2) — GENIX 4.1A

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

stty(1)

tty(4)

exec(2)



      IOCTL(2)                GENIX Programmer's Manual                IOCTL(2)



      NAME
           ioctl, stty, gtty - control device

      SYNOPSIS
           #include <sgtty.h>

           ioctl(fildes, request, argp)
           struct sgttyb *argp;

           stty(fildes, argp)
           struct sgttyb *argp;

           gtty(fildes, argp)
           struct sgttyb *argp;

      DESCRIPTION
           Ioctl performs a variety of functions  on  character  special  files
           (devices).  The writeups of various devices in section 4 discuss how
           ioctl applies to them.

           For certain status setting and status inquiries about terminal  dev-
           ices, the functions stty and gtty are implemented by
                ioctl(fildes, TIOCSETP, argp)
                ioctl(fildes, TIOCGETP, argp)

           respectively and via ioctl exactly this way; see tty(4).

           The following two standard calls, however, apply to any open file:

                ioctl(fildes, FIOCLEX, NULL);
                ioctl(fildes, FIONCLEX, NULL);

           The first causes the file to be closed automatically during  a  suc-
           cessful exec operation; the second reverses the effect of the first.

           The following call is peculiar to the Berkeley  implementation,  and
           also applies to any open file:

                ioctl(fildes, FIONREAD, &count)

           returning, in the longword count the number of characters  available
           for reading from fildes.

      SEE ALSO
           stty(1), tty(4), exec(2)

      DIAGNOSTICS
           Zero is returned if the call was successful; -1 if the file descrip-
           tor does not refer to the kind of file for which it was intended, or
           if request attempts to modify the state of a terminal when fildes is
           not writeable.




      Printed 11/16/83                                                        1





      IOCTL(2)                GENIX Programmer's Manual                IOCTL(2)



           Ioctl calls which attempt to modify the state of a  process  control
           terminal  while a process is not in the process group of the control
           terminal will cause a SIGTTOU signal to be sent to the process' pro-
           cess  group.   Such ioctls are allowed, however, if SIGTTOU is being
           held, ignored, if the process is an orphan which has been  inherited
           by init, or is the child in an incomplete vfork (see jobs(3))

      BUGS
           Strictly speaking, since ioctl may be extended in different ways  to
           devices  with  different  properties, argp should have an open-ended
           declaration like

                union { struct sgttyb ...; ...  } *argp;

           The important thing is that the size is fixed by `struct sgttyb'.








































      Printed 11/16/83                                                        2



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