manual page distributed with 4.1BSD
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Fri, 10 May 1985 07:04:26 +0000 (23:04 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Fri, 10 May 1985 07:04:26 +0000 (23:04 -0800)
SCCS-vsn: lib/libc/sys/ioctl.2 4.1

usr/src/lib/libc/sys/ioctl.2 [new file with mode: 0644]

diff --git a/usr/src/lib/libc/sys/ioctl.2 b/usr/src/lib/libc/sys/ioctl.2
new file mode 100644 (file)
index 0000000..138b8bf
--- /dev/null
@@ -0,0 +1,132 @@
+.\" Copyright (c) 1980 Regents of the University of California.
+.\" All rights reserved.  The Berkeley software License Agreement
+.\" specifies the terms and conditions for redistribution.
+.\"
+.\"    @(#)ioctl.2     4.1 (Berkeley) %G%
+.\"
+.TH IOCTL 2 
+.UC 4
+.SH NAME
+ioctl, stty, gtty \- control device
+.SH SYNOPSIS
+.nf
+.B #include <sgtty.h>
+.PP
+.B ioctl(fildes, request, argp)
+.B struct sgttyb *argp;
+.PP
+.B stty(fildes, argp)
+.B struct sgttyb *argp;
+.PP
+.B gtty(fildes, argp)
+.B struct sgttyb *argp;
+.fi
+.SH DESCRIPTION
+.I Ioctl
+performs a variety of functions
+on character special files (devices).
+The writeups of various devices
+in section 4 discuss how
+.I ioctl
+applies to them.
+.PP
+For certain status setting and status inquiries
+about terminal devices, the functions
+.I stty
+and
+.I gtty
+are equivalent to
+.RS
+.B ioctl(fildes, TIOCSETP, argp)
+.br
+.B ioctl(fildes, TIOCGETP, argp)
+.RE
+.LP
+respectively; see
+.IR tty (4).
+.PP
+The following two standard calls, however, apply to any open file:
+.PP
+.RS
+.B ioctl(fildes, FIOCLEX, NULL);
+.br
+.B ioctl(fildes, FIONCLEX, NULL);
+.RE
+.LP
+The first causes the file to be closed automatically during
+a successful
+.I exec
+operation;
+the second reverses the effect of the first.
+.PP
+The following call is peculiar to the Berkeley implementation, and
+also applies to any open file:
+.PP
+.RS
+.B ioctl(fildes, FIONREAD, &count)
+.RE
+.LP
+returning, in the longword
+.I count
+the number of characters available for reading from
+.I fildes.
+.SH "SEE ALSO"
+stty(1), tty(4), exec(2)
+.SH DIAGNOSTICS
+Zero is returned if the call was successful;
+\-1 if the file descriptor does not refer to
+the kind of file for which it was intended,
+or if
+.I request
+attempts to modify the state of a terminal
+when
+.I fildes
+is not writeable.
+.PP
+.I 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' process group.
+Such
+.IR ioctl s
+are allowed,
+however,
+if SIGTTOU is being held,
+ignored,
+if the process is an orphan which has been inherited by
+.IR init ,
+or is the child in an incomplete
+.I vfork
+(see
+.IR jobs (3))
+.SH BUGS
+Strictly speaking,
+since 
+.I ioctl
+may be extended in different ways to devices with
+different properties,
+.I argp
+should have an open-ended declaration like
+.IP
+.B union { struct sgttyb
+.RB ... ;
+\&...
+.B } *argp;
+.PP
+The important thing is that the size is fixed by `struct sgttyb'.
+.SH "ASSEMBLER (PDP-11)"
+(ioctl = 54.)
+.br
+.B sys ioctl; fildes; request; argp
+.PP
+(stty = 31.)
+.br
+(file descriptor in r0)
+.br
+.B stty; argp
+.PP
+(gtty = 32.)
+.br
+(file descriptor in r0)
+.br
+.B sys gtty; argp