Commit | Line | Data |
---|---|---|
e6817382 BJ |
1 | .TH IOCTL 2 |
2 | .SH NAME | |
3 | ioctl, 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 | |
20 | performs a variety of functions | |
21 | on character special files (devices). | |
22 | The writeups of various devices | |
23 | in section 4 discuss how | |
24 | .I ioctl | |
25 | applies to them. | |
26 | .PP | |
27 | For certain status setting and status inquiries | |
28 | about terminal devices, the functions | |
29 | .I stty | |
30 | and | |
31 | .I gtty | |
32 | are equivalent to | |
33 | .RS | |
34 | .B ioctl(fildes, TIOCSETP, argp) | |
35 | .br | |
36 | .B ioctl(fildes, TIOCGETP, argp) | |
37 | .RE | |
38 | .LP | |
39 | respectively; see | |
40 | .IR tty (4). | |
41 | .PP | |
42 | The 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 | |
50 | The first causes the file to be closed automatically during | |
51 | a successful | |
52 | .I exec | |
53 | operation; | |
54 | the second reverses the effect of the first. | |
55 | .SH "SEE ALSO" | |
56 | stty(1), tty(4), exec(2) | |
57 | .SH DIAGNOSTICS | |
58 | Zero is returned if the call was successful; | |
59 | \-1 if the file descriptor does not refer to | |
60 | the kind of file for which it was intended. | |
61 | .SH BUGS | |
62 | Strictly speaking, | |
63 | since | |
64 | .I ioctl | |
65 | may be extended in different ways to devices with | |
66 | different properties, | |
67 | .I argp | |
68 | should have an open-ended declaration like | |
69 | .IP | |
70 | .B union { struct sgttyb | |
71 | .RB ... ; | |
72 | \&... | |
73 | .B } *argp; | |
74 | .PP | |
75 | The 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 |