1 s! {
2     pub struct termios2 {
3         pub c_iflag: ::tcflag_t,
4         pub c_oflag: ::tcflag_t,
5         pub c_cflag: ::tcflag_t,
6         pub c_lflag: ::tcflag_t,
7         pub c_line: ::cc_t,
8         pub c_cc: [::cc_t; 19],
9         pub c_ispeed: ::speed_t,
10         pub c_ospeed: ::speed_t,
11     }
12 }
13 
14 // include/uapi/asm-generic/socket.h
15 // arch/alpha/include/uapi/asm/socket.h
16 // tools/include/uapi/asm-generic/socket.h
17 // arch/mips/include/uapi/asm/socket.h
18 pub const SOL_SOCKET: ::c_int = 1;
19 
20 // Defined in unix/linux_like/mod.rs
21 // pub const SO_DEBUG: ::c_int = 1;
22 pub const SO_REUSEADDR: ::c_int = 2;
23 pub const SO_TYPE: ::c_int = 3;
24 pub const SO_ERROR: ::c_int = 4;
25 pub const SO_DONTROUTE: ::c_int = 5;
26 pub const SO_BROADCAST: ::c_int = 6;
27 pub const SO_SNDBUF: ::c_int = 7;
28 pub const SO_RCVBUF: ::c_int = 8;
29 pub const SO_KEEPALIVE: ::c_int = 9;
30 pub const SO_OOBINLINE: ::c_int = 10;
31 pub const SO_NO_CHECK: ::c_int = 11;
32 pub const SO_PRIORITY: ::c_int = 12;
33 pub const SO_LINGER: ::c_int = 13;
34 pub const SO_BSDCOMPAT: ::c_int = 14;
35 pub const SO_REUSEPORT: ::c_int = 15;
36 pub const SO_PASSCRED: ::c_int = 16;
37 pub const SO_PEERCRED: ::c_int = 17;
38 pub const SO_RCVLOWAT: ::c_int = 18;
39 pub const SO_SNDLOWAT: ::c_int = 19;
40 pub const SO_RCVTIMEO: ::c_int = 20;
41 pub const SO_SNDTIMEO: ::c_int = 21;
42 // pub const SO_RCVTIMEO_OLD: ::c_int = 20;
43 // pub const SO_SNDTIMEO_OLD: ::c_int = 21;
44 pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
45 pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
46 pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
47 pub const SO_BINDTODEVICE: ::c_int = 25;
48 pub const SO_ATTACH_FILTER: ::c_int = 26;
49 pub const SO_DETACH_FILTER: ::c_int = 27;
50 pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
51 pub const SO_PEERNAME: ::c_int = 28;
52 pub const SO_TIMESTAMP: ::c_int = 29;
53 // pub const SO_TIMESTAMP_OLD: ::c_int = 29;
54 pub const SO_ACCEPTCONN: ::c_int = 30;
55 pub const SO_PEERSEC: ::c_int = 31;
56 pub const SO_SNDBUFFORCE: ::c_int = 32;
57 pub const SO_RCVBUFFORCE: ::c_int = 33;
58 pub const SO_PASSSEC: ::c_int = 34;
59 pub const SO_TIMESTAMPNS: ::c_int = 35;
60 // pub const SO_TIMESTAMPNS_OLD: ::c_int = 35;
61 pub const SO_MARK: ::c_int = 36;
62 pub const SO_TIMESTAMPING: ::c_int = 37;
63 // pub const SO_TIMESTAMPING_OLD: ::c_int = 37;
64 pub const SO_PROTOCOL: ::c_int = 38;
65 pub const SO_DOMAIN: ::c_int = 39;
66 pub const SO_RXQ_OVFL: ::c_int = 40;
67 pub const SO_WIFI_STATUS: ::c_int = 41;
68 pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
69 pub const SO_PEEK_OFF: ::c_int = 42;
70 pub const SO_NOFCS: ::c_int = 43;
71 pub const SO_LOCK_FILTER: ::c_int = 44;
72 pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
73 pub const SO_BUSY_POLL: ::c_int = 46;
74 pub const SO_MAX_PACING_RATE: ::c_int = 47;
75 pub const SO_BPF_EXTENSIONS: ::c_int = 48;
76 pub const SO_INCOMING_CPU: ::c_int = 49;
77 pub const SO_ATTACH_BPF: ::c_int = 50;
78 pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
79 pub const SO_ATTACH_REUSEPORT_CBPF: ::c_int = 51;
80 pub const SO_ATTACH_REUSEPORT_EBPF: ::c_int = 52;
81 pub const SO_CNX_ADVICE: ::c_int = 53;
82 pub const SCM_TIMESTAMPING_OPT_STATS: ::c_int = 54;
83 pub const SO_MEMINFO: ::c_int = 55;
84 pub const SO_INCOMING_NAPI_ID: ::c_int = 56;
85 pub const SO_COOKIE: ::c_int = 57;
86 pub const SCM_TIMESTAMPING_PKTINFO: ::c_int = 58;
87 pub const SO_PEERGROUPS: ::c_int = 59;
88 pub const SO_ZEROCOPY: ::c_int = 60;
89 pub const SO_TXTIME: ::c_int = 61;
90 pub const SCM_TXTIME: ::c_int = SO_TXTIME;
91 pub const SO_BINDTOIFINDEX: ::c_int = 62;
92 cfg_if! {
93     // Some of these platforms in CI already have these constants.
94     // But they may still not have those _OLD ones.
95     if #[cfg(all(any(target_arch = "x86",
96                      target_arch = "x86_64",
97                      target_arch = "aarch64"),
98                  not(target_env = "musl")))] {
99         pub const SO_TIMESTAMP_NEW: ::c_int = 63;
100         pub const SO_TIMESTAMPNS_NEW: ::c_int = 64;
101         pub const SO_TIMESTAMPING_NEW: ::c_int = 65;
102         pub const SO_RCVTIMEO_NEW: ::c_int = 66;
103         pub const SO_SNDTIMEO_NEW: ::c_int = 67;
104         pub const SO_DETACH_REUSEPORT_BPF: ::c_int = 68;
105     }
106 }
107 // pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
108 // pub const SO_BUSY_POLL_BUDGET: ::c_int = 70;
109 
110 // Defined in unix/linux_like/mod.rs
111 // pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
112 pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
113 pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
114 
115 // Ioctl Constants
116 
117 cfg_if! {
118     if #[cfg(not(any(target_arch = "mips",
119                      target_arch = "mips64",
120                      target_arch = "powerpc",
121                      target_arch = "powerpc64",
122                      target_arch = "sparc",
123                      target_arch = "sparc64")))] {
124 
125         pub const TCGETS: ::Ioctl = 0x5401;
126         pub const TCSETS: ::Ioctl = 0x5402;
127         pub const TCSETSW: ::Ioctl = 0x5403;
128         pub const TCSETSF: ::Ioctl = 0x5404;
129         pub const TCGETA: ::Ioctl = 0x5405;
130         pub const TCSETA: ::Ioctl = 0x5406;
131         pub const TCSETAW: ::Ioctl = 0x5407;
132         pub const TCSETAF: ::Ioctl = 0x5408;
133         pub const TCSBRK: ::Ioctl = 0x5409;
134         pub const TCXONC: ::Ioctl = 0x540A;
135         pub const TCFLSH: ::Ioctl = 0x540B;
136         pub const TIOCEXCL: ::Ioctl = 0x540C;
137         pub const TIOCNXCL: ::Ioctl = 0x540D;
138         pub const TIOCSCTTY: ::Ioctl = 0x540E;
139         pub const TIOCGPGRP: ::Ioctl = 0x540F;
140         pub const TIOCSPGRP: ::Ioctl = 0x5410;
141         pub const TIOCOUTQ: ::Ioctl = 0x5411;
142         pub const TIOCSTI: ::Ioctl = 0x5412;
143         pub const TIOCGWINSZ: ::Ioctl = 0x5413;
144         pub const TIOCSWINSZ: ::Ioctl = 0x5414;
145         pub const TIOCMGET: ::Ioctl = 0x5415;
146         pub const TIOCMBIS: ::Ioctl = 0x5416;
147         pub const TIOCMBIC: ::Ioctl = 0x5417;
148         pub const TIOCMSET: ::Ioctl = 0x5418;
149         pub const TIOCGSOFTCAR: ::Ioctl = 0x5419;
150         pub const TIOCSSOFTCAR: ::Ioctl = 0x541A;
151         pub const FIONREAD: ::Ioctl = 0x541B;
152         pub const TIOCINQ: ::Ioctl = FIONREAD;
153         pub const TIOCLINUX: ::Ioctl = 0x541C;
154         pub const TIOCCONS: ::Ioctl = 0x541D;
155         pub const TIOCGSERIAL: ::Ioctl = 0x541E;
156         pub const TIOCSSERIAL: ::Ioctl = 0x541F;
157         pub const TIOCPKT: ::Ioctl = 0x5420;
158         pub const FIONBIO: ::Ioctl = 0x5421;
159         pub const TIOCNOTTY: ::Ioctl = 0x5422;
160         pub const TIOCSETD: ::Ioctl = 0x5423;
161         pub const TIOCGETD: ::Ioctl = 0x5424;
162         pub const TCSBRKP: ::Ioctl = 0x5425;
163         pub const TIOCSBRK: ::Ioctl = 0x5427;
164         pub const TIOCCBRK: ::Ioctl = 0x5428;
165         pub const TIOCGSID: ::Ioctl = 0x5429;
166         pub const TCGETS2: ::Ioctl = 0x802c542a;
167         pub const TCSETS2: ::Ioctl = 0x402c542b;
168         pub const TCSETSW2: ::Ioctl = 0x402c542c;
169         pub const TCSETSF2: ::Ioctl = 0x402c542d;
170         pub const TIOCGRS485: ::Ioctl = 0x542E;
171         pub const TIOCSRS485: ::Ioctl = 0x542F;
172         pub const TIOCGPTN: ::Ioctl = 0x80045430;
173         pub const TIOCSPTLCK: ::Ioctl = 0x40045431;
174         pub const TIOCGDEV: ::Ioctl = 0x80045432;
175         pub const TCGETX: ::Ioctl = 0x5432;
176         pub const TCSETX: ::Ioctl = 0x5433;
177         pub const TCSETXF: ::Ioctl = 0x5434;
178         pub const TCSETXW: ::Ioctl = 0x5435;
179         pub const TIOCSIG: ::Ioctl = 0x40045436;
180         pub const TIOCVHANGUP: ::Ioctl = 0x5437;
181         pub const TIOCGPKT: ::Ioctl = 0x80045438;
182         pub const TIOCGPTLCK: ::Ioctl = 0x80045439;
183         pub const TIOCGEXCL: ::Ioctl = 0x80045440;
184         pub const TIOCGPTPEER: ::Ioctl = 0x5441;
185 //        pub const TIOCGISO7816: ::Ioctl = 0x80285442;
186 //        pub const TIOCSISO7816: ::Ioctl = 0xc0285443;
187         pub const FIONCLEX: ::Ioctl = 0x5450;
188         pub const FIOCLEX: ::Ioctl = 0x5451;
189         pub const FIOASYNC: ::Ioctl = 0x5452;
190         pub const TIOCSERCONFIG: ::Ioctl = 0x5453;
191         pub const TIOCSERGWILD: ::Ioctl = 0x5454;
192         pub const TIOCSERSWILD: ::Ioctl = 0x5455;
193         pub const TIOCGLCKTRMIOS: ::Ioctl = 0x5456;
194         pub const TIOCSLCKTRMIOS: ::Ioctl = 0x5457;
195         pub const TIOCSERGSTRUCT: ::Ioctl = 0x5458;
196         pub const TIOCSERGETLSR: ::Ioctl = 0x5459;
197         pub const TIOCSERGETMULTI: ::Ioctl = 0x545A;
198         pub const TIOCSERSETMULTI: ::Ioctl = 0x545B;
199         pub const TIOCMIWAIT: ::Ioctl = 0x545C;
200         pub const TIOCGICOUNT: ::Ioctl = 0x545D;
201     }
202 }
203 
204 cfg_if! {
205     if #[cfg(any(target_arch = "arm",
206                  target_arch = "s390x"))] {
207         pub const FIOQSIZE: ::Ioctl = 0x545E;
208     } else if #[cfg(not(any(target_arch = "mips",
209                             target_arch = "mips64",
210                             target_arch = "powerpc",
211                             target_arch = "powerpc64",
212                             target_arch = "sparc",
213                             target_arch = "sparc64")))] {
214         pub const FIOQSIZE: ::Ioctl = 0x5460;
215     }
216 }
217 
218 pub const TIOCM_LE: ::c_int = 0x001;
219 pub const TIOCM_DTR: ::c_int = 0x002;
220 pub const TIOCM_RTS: ::c_int = 0x004;
221 pub const TIOCM_ST: ::c_int = 0x008;
222 pub const TIOCM_SR: ::c_int = 0x010;
223 pub const TIOCM_CTS: ::c_int = 0x020;
224 pub const TIOCM_CAR: ::c_int = 0x040;
225 pub const TIOCM_CD: ::c_int = TIOCM_CAR;
226 pub const TIOCM_RNG: ::c_int = 0x080;
227 pub const TIOCM_RI: ::c_int = TIOCM_RNG;
228 pub const TIOCM_DSR: ::c_int = 0x100;
229 
230 pub const BOTHER: ::speed_t = 0o010000;
231 pub const IBSHIFT: ::tcflag_t = 16;
232 
233 pub const BLKSSZGET: ::Ioctl = 0x1268;
234 pub const BLKPBSZGET: ::Ioctl = 0x127B;
235