1IOCTL(2) System Calls Manual IOCTL(2)
2
3
4
6 ioctl, stty, gtty - control device
7
9 #include <sgtty.h>
10
11 ioctl(fildes, request, argp)
12 struct sgttyb *argp;
13
14 stty(fildes, argp)
15 struct sgttyb *argp;
16
17 gtty(fildes, argp)
18 struct sgttyb *argp;
19
21 Ioctl performs a variety of functions on character special files
22 (devices). The writeups of various devices in section 4 discuss how
23 ioctl applies to them.
24
25 For certain status setting and status inquiries about terminal devices,
26 the functions stty and gtty are equivalent to
27 ioctl(fildes, TIOCSETP, argp)
28 ioctl(fildes, TIOCGETP, argp)
29
30 respectively; see tty(4).
31
32 The following two calls, however, apply to any open file:
33
34 ioctl(fildes, FIOCLEX, NULL);
35 ioctl(fildes, FIONCLEX, NULL);
36
37 The first causes the file to be closed automatically during a success‐
38 ful exec operation; the second reverses the effect of the first.
39
41 stty(1), tty(4), exec(2)
42
44 Zero is returned if the call was successful; -1 if the file descriptor
45 does not refer to the kind of file for which it was intended.
46
48 Strictly speaking, since ioctl may be extended in different ways to
49 devices with different properties, argp should have an open-ended dec‐
50 laration like
51
52 union { struct sgttyb ...; ... } *argp;
53
54 The important thing is that the size is fixed by `struct sgttyb'.
55
57 (ioctl = 54.)
58 sys ioctl; fildes; request; argp
59
60 (stty = 31.)
61 (file descriptor in r0)
62 stty; argp
63
64 (gtty = 32.)
65 (file descriptor in r0)
66 sys gtty; argp
67
68
69
70 IOCTL(2)