Commit | Line | Data |
---|---|---|
4b72e2f9 | 1 | /* ioctl.h 4.21 82/08/01 */ |
d373b0dc BJ |
2 | /* |
3 | * ioctl definitions, and special character and local tty definitions | |
4 | */ | |
5 | #ifndef _IOCTL_ | |
6 | #define _IOCTL_ | |
7 | struct tchars { | |
8 | char t_intrc; /* interrupt */ | |
9 | char t_quitc; /* quit */ | |
10 | char t_startc; /* start output */ | |
11 | char t_stopc; /* stop output */ | |
12 | char t_eofc; /* end-of-file */ | |
13 | char t_brkc; /* input delimiter (like nl) */ | |
14 | }; | |
15 | struct ltchars { | |
16 | char t_suspc; /* stop process signal */ | |
a5ad116d | 17 | char t_dsuspc; /* delayed stop process signal */ |
d373b0dc BJ |
18 | char t_rprntc; /* reprint line */ |
19 | char t_flushc; /* flush output (toggles) */ | |
20 | char t_werasc; /* word erase */ | |
21 | char t_lnextc; /* literal next character */ | |
d373b0dc BJ |
22 | }; |
23 | ||
24 | /* | |
25 | * local mode settings | |
26 | */ | |
e27b8fac BJ |
27 | #define LCRTBS 0000001 /* correct backspacing for crt */ |
28 | #define LPRTERA 0000002 /* printing terminal \ ... / erase */ | |
29 | #define LCRTERA 0000004 /* do " \b " to wipe out character */ | |
30 | #define LTILDE 0000010 /* IIASA - hazeltine tilde kludge */ | |
31 | #define LMDMBUF 0000020 /* IIASA - start/stop output on carrier intr */ | |
32 | #define LLITOUT 0000040 /* IIASA - suppress any output translations */ | |
33 | #define LTOSTOP 0000100 /* send stop for any background tty output */ | |
34 | #define LFLUSHO 0000200 /* flush output sent to terminal */ | |
35 | #define LNOHANG 0000400 /* IIASA - don't send hangup on carrier drop */ | |
36 | #define LETXACK 0001000 /* IIASA - diablo style buffer hacking */ | |
37 | #define LCRTKIL 0002000 /* erase whole line on kill with " \b " */ | |
0e118a41 | 38 | #define L004000 0004000 |
e27b8fac BJ |
39 | #define LCTLECH 0010000 /* echo control characters as ^X */ |
40 | #define LPENDIN 0020000 /* tp->t_rawq is waiting to be reread */ | |
41 | #define LDECCTQ 0040000 /* only ^Q starts after ^S */ | |
f7d603de | 42 | #define LNOFLSH 0100000 /* dont flush output on signals */ |
d373b0dc BJ |
43 | |
44 | /* local state */ | |
4058e5c9 | 45 | #define LSBKSL 01 /* state bit for lowercase backslash work */ |
d373b0dc | 46 | #define LSQUOT 02 /* last character input was \ */ |
4058e5c9 | 47 | #define LSERASE 04 /* within a \.../ for LPRTRUB */ |
d373b0dc BJ |
48 | #define LSLNCH 010 /* next character is literal */ |
49 | #define LSTYPEN 020 /* retyping suspended input (LPENDIN) */ | |
e8f0919a | 50 | #define LSCNTTB 040 /* counting width of tab; leave LFLUSHO alone */ |
d373b0dc | 51 | |
35820102 BJ |
52 | /* modem control */ |
53 | #define MLE 0001 /* line enable */ | |
54 | #define MDTR 0002 /* data terminal ready */ | |
55 | #define MRTS 0004 /* request to send */ | |
56 | #define MST 0010 /* secondary transmit */ | |
57 | #define MSR 0020 /* secondary receive */ | |
58 | #define MCTS 0040 /* clear to send */ | |
59 | #define MCAR 0100 /* carrier detect */ | |
60 | #define MCD MCAR | |
61 | #define MRNG 0200 /* ring */ | |
62 | #define MRI MRNG | |
63 | #define MDSR 0400 /* data set ready */ | |
64 | ||
4b72e2f9 SL |
65 | /* |
66 | * Ioctl's have the command encoded in the lower word, | |
67 | * and the size of any in or out parameters in the upper | |
68 | * word. The high 2 bits of the upper word are used | |
69 | * to encode the in/out status of the parameter; for now | |
70 | * we restrict parameters to at most 128 bytes. | |
71 | */ | |
72 | #define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */ | |
73 | #define IOC_VOID 0x20000000 /* no parameters */ | |
74 | #define IOC_OUT 0x40000000 /* copy out parameters */ | |
75 | #define IOC_IN 0x80000000 /* copy in parameters */ | |
76 | #define IOC_INOUT (IOC_IN|IOC_OUT) | |
77 | /* the 0x20000000 is so we can distinguish new ioctl's from old */ | |
78 | #define _IO(x,y) (IOC_VOID|('x'<<8)|y) | |
79 | #define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) | |
80 | #define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) | |
81 | /* this should be _IORW, but stdio got there first */ | |
82 | #define _IOWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) | |
83 | ||
d373b0dc BJ |
84 | /* |
85 | * tty ioctl commands | |
86 | */ | |
4b72e2f9 SL |
87 | #define TIOCGETD _IOR(t, 0, int) /* get line discipline */ |
88 | #define TIOCSETD _IOW(t, 1, int) /* set line discipline */ | |
89 | #define TIOCHPCL _IO(t, 2) /* hang up on last close */ | |
90 | #define TIOCMODG _IOR(t, 3, int) /* get modem control state */ | |
91 | #define TIOCMODS _IOW(t, 4, int) /* set modem control state */ | |
92 | #define TIOCGETP _IOR(t, 8,struct sgttyb)/* get parameters -- gtty */ | |
93 | #define TIOCSETP _IOW(t, 9,struct sgttyb)/* set parameters -- stty */ | |
94 | #define TIOCSETN _IOW(t,10,struct sgttyb)/* as above, but no flushtty */ | |
95 | #define TIOCEXCL _IO(t, 13) /* set exclusive use of tty */ | |
96 | #define TIOCNXCL _IO(t, 14) /* reset exclusive use of tty */ | |
97 | #define TIOCFLUSH _IOW(t, 16, int) /* flush buffers */ | |
98 | #define TIOCSETC _IOW(t,17,struct tchars)/* set special characters */ | |
99 | #define TIOCGETC _IOR(t,18,struct tchars)/* get special characters */ | |
d373b0dc | 100 | /* locals, from 127 down */ |
4b72e2f9 SL |
101 | #define TIOCLBIS _IOW(t, 127, int) /* bis local mode bits */ |
102 | #define TIOCLBIC _IOW(t, 126, int) /* bic local mode bits */ | |
103 | #define TIOCLSET _IOW(t, 125, int) /* set entire local mode word */ | |
104 | #define TIOCLGET _IOR(t, 124, int) /* get local modes */ | |
105 | #define TIOCSBRK _IO(t, 123) /* set break bit */ | |
106 | #define TIOCCBRK _IO(t, 122) /* clear break bit */ | |
107 | #define TIOCSDTR _IO(t, 121) /* set data terminal ready */ | |
108 | #define TIOCCDTR _IO(t, 120) /* clear data terminal ready */ | |
109 | #define TIOCGPGRP _IOR(t, 119, int) /* get pgrp of tty */ | |
110 | #define TIOCSPGRP _IOW(t, 118, int) /* set pgrp of tty */ | |
111 | #define TIOCSLTC _IOW(t,117,struct ltchars)/* set local special chars */ | |
112 | #define TIOCGLTC _IOR(t,116,struct ltchars)/* get local special chars */ | |
113 | #define TIOCNOTTY _IO(t, 113) /* void tty association */ | |
114 | #define TIOCPKT _IOW(t, 112, int) /* pty: set/clear packet mode */ | |
0a2bd708 BJ |
115 | #define TIOCPKT_DATA 0x00 /* data packet */ |
116 | #define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ | |
117 | #define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ | |
118 | #define TIOCPKT_STOP 0x04 /* stop output */ | |
119 | #define TIOCPKT_START 0x08 /* start output */ | |
120 | #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ | |
121 | #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ | |
4b72e2f9 SL |
122 | #define TIOCSTOP _IO(t, 111) /* stop output, like ^S */ |
123 | #define TIOCSTART _IO(t, 110) /* start output, like ^Q */ | |
124 | #define TIOCMSET _IOW(t, 109, int) /* set all modem bits */ | |
125 | #define TIOCMBIS _IOW(t, 108, int) /* bis modem bits */ | |
126 | #define TIOCMBIC _IOW(t, 107, int) /* bic modem bits */ | |
127 | #define TIOCMGET _IOR(t, 106, int) /* get all modem bits */ | |
128 | #define TIOCREMOTE _IO(t, 105) /* remote input editing */ | |
d373b0dc | 129 | |
150e6005 | 130 | #define OTTYDISC 0 /* old, v7 std tty driver */ |
d373b0dc | 131 | #define NETLDISC 1 /* line discip for berk net */ |
150e6005 | 132 | #define NTTYDISC 2 /* new tty discipline */ |
b877fec3 SL |
133 | #define TABLDISC 3 /* hitachi tablet discipline */ |
134 | #define NTABLDISC 4 /* gtco tablet discipline */ | |
d373b0dc | 135 | |
4b72e2f9 SL |
136 | #define FIOCLEX _IO(f, 1) /* set exclusive use on fd */ |
137 | #define FIONCLEX _IO(f, 2) /* remove exclusive use */ | |
d373b0dc | 138 | /* another local */ |
4b72e2f9 SL |
139 | #define FIONREAD _IOR(f, 127, int) /* get # bytes to read */ |
140 | #define FIONBIO _IOW(f, 126, int) /* set/clear non-blocking i/o */ | |
141 | #define FIOASYNC _IOW(f, 125, int) /* set/clear async i/o */ | |
b335e111 | 142 | |
4b72e2f9 SL |
143 | /* socket i/o controls */ |
144 | #define SIOCDONE _IOW(s, 0, int) /* shutdown read/write */ | |
145 | #define SIOCSKEEP _IOW(s, 1, int) /* set keep alive */ | |
146 | #define SIOCGKEEP _IOR(s, 2, int) /* inspect keep alive */ | |
147 | #define SIOCSLINGER _IOW(s, 3, int) /* set linger time */ | |
148 | #define SIOCGLINGER _IOR(s, 4, int) /* get linger time */ | |
149 | /* these are really variable length */ | |
150 | #define SIOCSENDOOB _IOW(s, 5, char) /* send out of band */ | |
151 | #define SIOCRCVOOB _IOR(s, 6, char) /* get out of band */ | |
152 | #define SIOCATMARK _IOR(s, 7, int) /* at out of band mark? */ | |
153 | #define SIOCSPGRP _IOW(s, 8, int) /* set process group */ | |
154 | #define SIOCGPGRP _IOR(s, 9, int) /* get process group */ | |
155 | #define SIOCADDRT _IOW(s,10, struct rtentry)/* add route */ | |
156 | #define SIOCDELRT _IOW(s,11, struct rtentry)/* delete route */ | |
d373b0dc | 157 | #endif |