1 #define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) )
2 #define _IOC_NONE  1U
3 #define _IOC_WRITE 4U
4 #define _IOC_READ  2U
5 
6 #define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
7 #define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
8 #define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
9 #define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
10 
11 #define FIONCLEX	_IO('f', 2)
12 #define FIOCLEX		_IO('f', 1)
13 #define FIOASYNC	_IOW('f', 125, int)
14 #define FIONBIO		_IOW('f', 126, int)
15 #define FIONREAD	_IOR('f', 127, int)
16 #define TIOCINQ		FIONREAD
17 #define FIOQSIZE	_IOR('f', 128, char[8])
18 #define TIOCGETP	_IOR('t', 8, char[6])
19 #define TIOCSETP	_IOW('t', 9, char[6])
20 #define TIOCSETN	_IOW('t', 10, char[6])
21 
22 #define TIOCSETC	_IOW('t', 17, char[6])
23 #define TIOCGETC	_IOR('t', 18, char[6])
24 #define TCGETS		_IOR('t', 19, char[44])
25 #define TCSETS		_IOW('t', 20, char[44])
26 #define TCSETSW		_IOW('t', 21, char[44])
27 #define TCSETSF		_IOW('t', 22, char[44])
28 
29 #define TCGETA		_IOR('t', 23, char[20])
30 #define TCSETA		_IOW('t', 24, char[20])
31 #define TCSETAW		_IOW('t', 25, char[20])
32 #define TCSETAF		_IOW('t', 28, char[20])
33 
34 #define TCSBRK		_IO('t', 29)
35 #define TCXONC		_IO('t', 30)
36 #define TCFLSH		_IO('t', 31)
37 
38 #define TIOCSWINSZ	_IOW('t', 103, char[8])
39 #define TIOCGWINSZ	_IOR('t', 104, char[8])
40 #define TIOCSTART	_IO('t', 110)
41 #define TIOCSTOP	_IO('t', 111)
42 
43 #define TIOCOUTQ	_IOR('t', 115, int)
44 
45 #define TIOCGLTC	_IOR('t', 116, char[6])
46 #define TIOCSLTC	_IOW('t', 117, char[6])
47 #define TIOCSPGRP	_IOW('t', 118, int)
48 #define TIOCGPGRP	_IOR('t', 119, int)
49 
50 #define TIOCEXCL	0x540C
51 #define TIOCNXCL	0x540D
52 #define TIOCSCTTY	0x540E
53 
54 #define TIOCSTI		0x5412
55 #define TIOCMGET	0x5415
56 #define TIOCMBIS	0x5416
57 #define TIOCMBIC	0x5417
58 #define TIOCMSET	0x5418
59 #define TIOCM_LE	0x001
60 #define TIOCM_DTR	0x002
61 #define TIOCM_RTS	0x004
62 #define TIOCM_ST	0x008
63 #define TIOCM_SR	0x010
64 #define TIOCM_CTS	0x020
65 #define TIOCM_CAR	0x040
66 #define TIOCM_RNG	0x080
67 #define TIOCM_DSR	0x100
68 #define TIOCM_CD	TIOCM_CAR
69 #define TIOCM_RI	TIOCM_RNG
70 #define TIOCM_OUT1	0x2000
71 #define TIOCM_OUT2	0x4000
72 #define TIOCM_LOOP	0x8000
73 
74 #define TIOCGSOFTCAR	0x5419
75 #define TIOCSSOFTCAR	0x541A
76 #define TIOCLINUX	0x541C
77 #define TIOCCONS	0x541D
78 #define TIOCGSERIAL	0x541E
79 #define TIOCSSERIAL	0x541F
80 #define TIOCPKT	0x5420
81 
82 #define TIOCNOTTY	0x5422
83 #define TIOCSETD	0x5423
84 #define TIOCGETD	0x5424
85 #define TCSBRKP		0x5425
86 #define TIOCSBRK	0x5427
87 #define TIOCCBRK	0x5428
88 #define TIOCGSID	0x5429
89 #define TIOCGRS485	0x542e
90 #define TIOCSRS485	0x542f
91 #define TIOCGPTN	_IOR('T',0x30, unsigned int)
92 #define TIOCSPTLCK	_IOW('T',0x31, int)
93 #define TIOCGDEV	_IOR('T',0x32, unsigned int)
94 #define TIOCSIG		_IOW('T',0x36, int)
95 #define TIOCVHANGUP	0x5437
96 #define TIOCGPKT	_IOR('T', 0x38, int)
97 #define TIOCGPTLCK	_IOR('T', 0x39, int)
98 #define TIOCGEXCL	_IOR('T', 0x40, int)
99 #define TIOCGPTPEER	_IO('T', 0x41)
100 
101 #define TIOCSERCONFIG	0x5453
102 #define TIOCSERGWILD	0x5454
103 #define TIOCSERSWILD	0x5455
104 #define TIOCGLCKTRMIOS	0x5456
105 #define TIOCSLCKTRMIOS	0x5457
106 #define TIOCSERGSTRUCT	0x5458
107 #define TIOCSERGETLSR	0x5459
108 #define TIOCSERGETMULTI	0x545A
109 #define TIOCSERSETMULTI	0x545B
110 
111 #define TIOCMIWAIT	0x545C
112 #define TIOCGICOUNT	0x545D
113 
114 #define FIOSETOWN       0x8901
115 #define SIOCSPGRP       0x8902
116 #define FIOGETOWN       0x8903
117 #define SIOCGPGRP       0x8904
118 #define SIOCATMARK      0x8905
119 #define SIOCGSTAMP      _IOR(0x89, 6, char[16])
120 #define SIOCGSTAMPNS    _IOR(0x89, 7, char[16])