Bell 32V development
[unix-history] / usr / man / man2 / ioctl.2
CommitLineData
cb67878b
TL
1.TH IOCTL 2
2.SH NAME
3ioctl, stty, gtty \- control device
4.SH SYNOPSIS
5.B #include <sgtty.h>
6.PP
7.B ioctl(fildes, request, argp)
8.br
9.B struct sgttyb *argp;
10.PP
11.B stty(fildes, argp)
12.br
13.B struct sgttyb *argp;
14.PP
15.B gtty(fildes, argp)
16.br
17.B struct sgttyb *argp;
18.SH DESCRIPTION
19.I Ioctl
20performs a variety of functions
21on character special files (devices).
22The writeups of various devices
23in section 4 discuss how
24.I ioctl
25applies to them.
26.PP
27For certain status setting and status inquiries
28about terminal devices, the functions
29.I stty
30and
31.I gtty
32are equivalent to
33.RS
34.B ioctl(fildes, TIOCSETP, argp)
35.br
36.B ioctl(fildes, TIOCGETP, argp)
37.RE
38.LP
39respectively; see
40.IR tty (4).
41.PP
42The following two calls, however, apply to any open file:
43.PP
44.RS
45.B ioctl(fildes, FIOCLEX, NULL);
46.br
47.B ioctl(fildes, FIONCLEX, NULL);
48.RE
49.LP
50The first causes the file to be closed automatically during
51a successful
52.I exec
53operation;
54the second reverses the effect of the first.
55.SH "SEE ALSO"
56stty(1), tty(4), exec(2)
57.SH DIAGNOSTICS
58Zero is returned if the call was successful;
59\-1 if the file descriptor does not refer to
60the kind of file for which it was intended.
61.SH BUGS
62Strictly speaking,
63since
64.I ioctl
65may be extended in different ways to devices with
66different properties,
67.I argp
68should have an open-ended declaration like
69.IP
70.B union { struct sgttyb
71.RB ... ;
72\&...
73.B } *argp;
74.PP
75The important thing is that the size is fixed by `struct sgttyb'.
76.SH "ASSEMBLER (PDP-11)"
77(ioctl = 54.)
78.br
79.B sys ioctl; fildes; request; argp
80.PP
81(stty = 31.)
82.br
83(file descriptor in r0)
84.br
85.B stty; argp
86.PP
87(gtty = 32.)
88.br
89(file descriptor in r0)
90.br
91.B sys gtty; argp