libc/unix/linux_like/linux/arch/generic/
mod.rs
1use crate::prelude::*;
2use crate::Ioctl;
3
4s! {
5 pub struct termios2 {
6 pub c_iflag: crate::tcflag_t,
7 pub c_oflag: crate::tcflag_t,
8 pub c_cflag: crate::tcflag_t,
9 pub c_lflag: crate::tcflag_t,
10 pub c_line: crate::cc_t,
11 pub c_cc: [crate::cc_t; 19],
12 pub c_ispeed: crate::speed_t,
13 pub c_ospeed: crate::speed_t,
14 }
15}
16
17pub const SOL_SOCKET: c_int = 1;
22
23pub const SO_REUSEADDR: c_int = 2;
26pub const SO_TYPE: c_int = 3;
27pub const SO_ERROR: c_int = 4;
28pub const SO_DONTROUTE: c_int = 5;
29pub const SO_BROADCAST: c_int = 6;
30pub const SO_SNDBUF: c_int = 7;
31pub const SO_RCVBUF: c_int = 8;
32pub const SO_KEEPALIVE: c_int = 9;
33pub const SO_OOBINLINE: c_int = 10;
34pub const SO_NO_CHECK: c_int = 11;
35pub const SO_PRIORITY: c_int = 12;
36pub const SO_LINGER: c_int = 13;
37pub const SO_BSDCOMPAT: c_int = 14;
38pub const SO_REUSEPORT: c_int = 15;
39pub const SO_PASSCRED: c_int = 16;
40pub const SO_PEERCRED: c_int = 17;
41pub const SO_RCVLOWAT: c_int = 18;
42pub const SO_SNDLOWAT: c_int = 19;
43const SO_RCVTIMEO_OLD: c_int = 20;
44const SO_SNDTIMEO_OLD: c_int = 21;
45pub const SO_SECURITY_AUTHENTICATION: c_int = 22;
46pub const SO_SECURITY_ENCRYPTION_TRANSPORT: c_int = 23;
47pub const SO_SECURITY_ENCRYPTION_NETWORK: c_int = 24;
48pub const SO_BINDTODEVICE: c_int = 25;
49pub const SO_ATTACH_FILTER: c_int = 26;
50pub const SO_DETACH_FILTER: c_int = 27;
51pub const SO_GET_FILTER: c_int = SO_ATTACH_FILTER;
52pub const SO_PEERNAME: c_int = 28;
53const SO_TIMESTAMP_OLD: c_int = 29;
54const SO_TIMESTAMPNS_OLD: c_int = 35;
55const SO_TIMESTAMPING_OLD: c_int = 37;
56
57cfg_if! {
58 if #[cfg(all(
59 linux_time_bits64,
60 any(target_arch = "arm", target_arch = "x86"),
61 not(any(target_env = "musl", target_env = "ohos"))
62 ))] {
63 pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_NEW;
64 pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_NEW;
65 pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_NEW;
66 pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_NEW;
67 pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_NEW;
68 } else if #[cfg(all(
69 linux_time_bits64,
70 any(target_arch = "arm", target_arch = "x86"),
71 any(target_env = "musl", target_env = "ohos")
72 ))] {
73 pub const SO_TIMESTAMP: c_int = 63;
74 pub const SO_TIMESTAMPNS: c_int = 64;
75 pub const SO_TIMESTAMPING: c_int = 65;
76 pub const SO_RCVTIMEO: c_int = 66;
77 pub const SO_SNDTIMEO: c_int = 67;
78 } else {
79 pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_OLD;
80 pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_OLD;
81 pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_OLD;
82 pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_OLD;
83 pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_OLD;
84 }
85}
86
87pub const SO_ACCEPTCONN: c_int = 30;
88pub const SO_PEERSEC: c_int = 31;
89pub const SO_SNDBUFFORCE: c_int = 32;
90pub const SO_RCVBUFFORCE: c_int = 33;
91pub const SO_PASSSEC: c_int = 34;
92pub const SO_MARK: c_int = 36;
93pub const SO_PROTOCOL: c_int = 38;
94pub const SO_DOMAIN: c_int = 39;
95pub const SO_RXQ_OVFL: c_int = 40;
96pub const SO_WIFI_STATUS: c_int = 41;
97pub const SCM_WIFI_STATUS: c_int = SO_WIFI_STATUS;
98pub const SO_PEEK_OFF: c_int = 42;
99pub const SO_NOFCS: c_int = 43;
100pub const SO_LOCK_FILTER: c_int = 44;
101pub const SO_SELECT_ERR_QUEUE: c_int = 45;
102pub const SO_BUSY_POLL: c_int = 46;
103pub const SO_MAX_PACING_RATE: c_int = 47;
104pub const SO_BPF_EXTENSIONS: c_int = 48;
105pub const SO_INCOMING_CPU: c_int = 49;
106pub const SO_ATTACH_BPF: c_int = 50;
107pub const SO_DETACH_BPF: c_int = SO_DETACH_FILTER;
108pub const SO_ATTACH_REUSEPORT_CBPF: c_int = 51;
109pub const SO_ATTACH_REUSEPORT_EBPF: c_int = 52;
110pub const SO_CNX_ADVICE: c_int = 53;
111pub const SCM_TIMESTAMPING_OPT_STATS: c_int = 54;
112pub const SO_MEMINFO: c_int = 55;
113pub const SO_INCOMING_NAPI_ID: c_int = 56;
114pub const SO_COOKIE: c_int = 57;
115pub const SCM_TIMESTAMPING_PKTINFO: c_int = 58;
116pub const SO_PEERGROUPS: c_int = 59;
117pub const SO_ZEROCOPY: c_int = 60;
118pub const SO_TXTIME: c_int = 61;
119pub const SCM_TXTIME: c_int = SO_TXTIME;
120pub const SO_BINDTOIFINDEX: c_int = 62;
121cfg_if! {
122 if #[cfg(all(
125 any(
126 target_arch = "x86",
127 target_arch = "x86_64",
128 target_arch = "arm",
129 target_arch = "aarch64",
130 target_arch = "csky",
131 target_arch = "loongarch64"
132 ),
133 not(any(target_env = "musl", target_env = "ohos"))
139 ))] {
140 pub const SO_TIMESTAMP_NEW: c_int = 63;
141 pub const SO_TIMESTAMPNS_NEW: c_int = 64;
142 pub const SO_TIMESTAMPING_NEW: c_int = 65;
143 pub const SO_RCVTIMEO_NEW: c_int = 66;
144 pub const SO_SNDTIMEO_NEW: c_int = 67;
145 pub const SO_DETACH_REUSEPORT_BPF: c_int = 68;
146 }
147}
148pub const SO_PREFER_BUSY_POLL: c_int = 69;
149pub const SO_BUSY_POLL_BUDGET: c_int = 70;
150pub const SO_NETNS_COOKIE: c_int = 71;
151pub const SO_BUF_LOCK: c_int = 72;
152pub const SO_RESERVE_MEM: c_int = 73;
153pub const SO_TXREHASH: c_int = 74;
154pub const SO_RCVMARK: c_int = 75;
155pub const SO_PASSPIDFD: c_int = 76;
156pub const SO_PEERPIDFD: c_int = 77;
157pub const SO_DEVMEM_LINEAR: c_int = 78;
158pub const SO_DEVMEM_DMABUF: c_int = 79;
159pub const SO_DEVMEM_DONTNEED: c_int = 80;
160
161cfg_if! {
162 if #[cfg(any(
163 target_arch = "x86",
164 target_arch = "x86_64",
165 target_arch = "arm",
166 target_arch = "aarch64",
167 target_arch = "riscv64",
168 target_arch = "s390x",
169 target_arch = "csky",
170 target_arch = "loongarch64"
171 ))] {
172 pub const FICLONE: c_ulong = 0x40049409;
173 pub const FICLONERANGE: c_ulong = 0x4020940D;
174 }
175}
176
177pub const SCM_TIMESTAMPNS: c_int = SO_TIMESTAMPNS;
180pub const SCM_TIMESTAMPING: c_int = SO_TIMESTAMPING;
181
182pub const SCM_DEVMEM_LINEAR: c_int = SO_DEVMEM_LINEAR;
183pub const SCM_DEVMEM_DMABUF: c_int = SO_DEVMEM_DMABUF;
184
185pub const TCGETS: Ioctl = 0x5401;
188pub const TCSETS: Ioctl = 0x5402;
189pub const TCSETSW: Ioctl = 0x5403;
190pub const TCSETSF: Ioctl = 0x5404;
191pub const TCGETA: Ioctl = 0x5405;
192pub const TCSETA: Ioctl = 0x5406;
193pub const TCSETAW: Ioctl = 0x5407;
194pub const TCSETAF: Ioctl = 0x5408;
195pub const TCSBRK: Ioctl = 0x5409;
196pub const TCXONC: Ioctl = 0x540A;
197pub const TCFLSH: Ioctl = 0x540B;
198pub const TIOCEXCL: Ioctl = 0x540C;
199pub const TIOCNXCL: Ioctl = 0x540D;
200pub const TIOCSCTTY: Ioctl = 0x540E;
201pub const TIOCGPGRP: Ioctl = 0x540F;
202pub const TIOCSPGRP: Ioctl = 0x5410;
203pub const TIOCOUTQ: Ioctl = 0x5411;
204pub const TIOCSTI: Ioctl = 0x5412;
205pub const TIOCGWINSZ: Ioctl = 0x5413;
206pub const TIOCSWINSZ: Ioctl = 0x5414;
207pub const TIOCMGET: Ioctl = 0x5415;
208pub const TIOCMBIS: Ioctl = 0x5416;
209pub const TIOCMBIC: Ioctl = 0x5417;
210pub const TIOCMSET: Ioctl = 0x5418;
211pub const TIOCGSOFTCAR: Ioctl = 0x5419;
212pub const TIOCSSOFTCAR: Ioctl = 0x541A;
213pub const FIONREAD: Ioctl = 0x541B;
214pub const TIOCINQ: Ioctl = FIONREAD;
215pub const TIOCLINUX: Ioctl = 0x541C;
216pub const TIOCCONS: Ioctl = 0x541D;
217pub const TIOCGSERIAL: Ioctl = 0x541E;
218pub const TIOCSSERIAL: Ioctl = 0x541F;
219pub const TIOCPKT: Ioctl = 0x5420;
220pub const FIONBIO: Ioctl = 0x5421;
221pub const TIOCNOTTY: Ioctl = 0x5422;
222pub const TIOCSETD: Ioctl = 0x5423;
223pub const TIOCGETD: Ioctl = 0x5424;
224pub const TCSBRKP: Ioctl = 0x5425;
225pub const TIOCSBRK: Ioctl = 0x5427;
226pub const TIOCCBRK: Ioctl = 0x5428;
227pub const TIOCGSID: Ioctl = 0x5429;
228pub const TCGETS2: Ioctl = 0x802c542a;
229pub const TCSETS2: Ioctl = 0x402c542b;
230pub const TCSETSW2: Ioctl = 0x402c542c;
231pub const TCSETSF2: Ioctl = 0x402c542d;
232pub const TIOCGRS485: Ioctl = 0x542E;
233pub const TIOCSRS485: Ioctl = 0x542F;
234pub const TIOCGPTN: Ioctl = 0x80045430;
235pub const TIOCSPTLCK: Ioctl = 0x40045431;
236pub const TIOCGDEV: Ioctl = 0x80045432;
237pub const TCGETX: Ioctl = 0x5432;
238pub const TCSETX: Ioctl = 0x5433;
239pub const TCSETXF: Ioctl = 0x5434;
240pub const TCSETXW: Ioctl = 0x5435;
241pub const TIOCSIG: Ioctl = 0x40045436;
242pub const TIOCVHANGUP: Ioctl = 0x5437;
243pub const TIOCGPKT: Ioctl = 0x80045438;
244pub const TIOCGPTLCK: Ioctl = 0x80045439;
245pub const TIOCGEXCL: Ioctl = 0x80045440;
246pub const TIOCGPTPEER: Ioctl = 0x5441;
247pub const FIONCLEX: Ioctl = 0x5450;
250pub const FIOCLEX: Ioctl = 0x5451;
251pub const FIOASYNC: Ioctl = 0x5452;
252pub const TIOCSERCONFIG: Ioctl = 0x5453;
253pub const TIOCSERGWILD: Ioctl = 0x5454;
254pub const TIOCSERSWILD: Ioctl = 0x5455;
255pub const TIOCGLCKTRMIOS: Ioctl = 0x5456;
256pub const TIOCSLCKTRMIOS: Ioctl = 0x5457;
257pub const TIOCSERGSTRUCT: Ioctl = 0x5458;
258pub const TIOCSERGETLSR: Ioctl = 0x5459;
259pub const TIOCSERGETMULTI: Ioctl = 0x545A;
260pub const TIOCSERSETMULTI: Ioctl = 0x545B;
261pub const TIOCMIWAIT: Ioctl = 0x545C;
262pub const TIOCGICOUNT: Ioctl = 0x545D;
263pub const BLKIOMIN: Ioctl = 0x1278;
264pub const BLKIOOPT: Ioctl = 0x1279;
265pub const BLKSSZGET: Ioctl = 0x1268;
266pub const BLKPBSZGET: Ioctl = 0x127B;
267pub const TUNSETNOCSUM: Ioctl = 0x400454c8;
269pub const TUNSETDEBUG: Ioctl = 0x400454c9;
270pub const TUNSETIFF: Ioctl = 0x400454ca;
271pub const TUNSETPERSIST: Ioctl = 0x400454cb;
272pub const TUNSETOWNER: Ioctl = 0x400454cc;
273pub const TUNSETLINK: Ioctl = 0x400454cd;
274pub const TUNSETGROUP: Ioctl = 0x400454ce;
275pub const TUNGETFEATURES: Ioctl = 0x800454cf;
276pub const TUNSETOFFLOAD: Ioctl = 0x400454d0;
277pub const TUNSETTXFILTER: Ioctl = 0x400454d1;
278pub const TUNGETIFF: Ioctl = 0x800454d2;
279pub const TUNGETSNDBUF: Ioctl = 0x800454d3;
280pub const TUNSETSNDBUF: Ioctl = 0x400454d4;
281pub const TUNGETVNETHDRSZ: Ioctl = 0x800454d7;
282pub const TUNSETVNETHDRSZ: Ioctl = 0x400454d8;
283pub const TUNSETQUEUE: Ioctl = 0x400454d9;
284pub const TUNSETIFINDEX: Ioctl = 0x400454da;
285pub const TUNSETVNETLE: Ioctl = 0x400454dc;
286pub const TUNGETVNETLE: Ioctl = 0x800454dd;
287pub const TUNSETVNETBE: Ioctl = 0x400454de;
292pub const TUNGETVNETBE: Ioctl = 0x800454df;
293pub const TUNSETSTEERINGEBPF: Ioctl = 0x800454e0;
294pub const TUNSETFILTEREBPF: Ioctl = 0x800454e1;
295
296cfg_if! {
297 if #[cfg(any(
304 target_arch = "x86",
305 target_arch = "arm",
306 target_arch = "csky"
307 ))] {
308 pub const FS_IOC_GETFLAGS: Ioctl = 0x80046601;
309 pub const FS_IOC_SETFLAGS: Ioctl = 0x40046602;
310 pub const FS_IOC_GETVERSION: Ioctl = 0x80047601;
311 pub const FS_IOC_SETVERSION: Ioctl = 0x40047602;
312 pub const FS_IOC32_GETFLAGS: Ioctl = 0x80046601;
313 pub const FS_IOC32_SETFLAGS: Ioctl = 0x40046602;
314 pub const FS_IOC32_GETVERSION: Ioctl = 0x80047601;
315 pub const FS_IOC32_SETVERSION: Ioctl = 0x40047602;
316 pub const TUNATTACHFILTER: Ioctl = 0x400854d5;
317 pub const TUNDETACHFILTER: Ioctl = 0x400854d6;
318 pub const TUNGETFILTER: Ioctl = 0x800854db;
319 } else if #[cfg(any(
320 target_arch = "x86_64",
321 target_arch = "riscv64",
322 target_arch = "aarch64",
323 target_arch = "s390x",
324 target_arch = "loongarch64",
325 target_arch = "wasm32"
326 ))] {
327 pub const FS_IOC_GETFLAGS: Ioctl = 0x80086601;
328 pub const FS_IOC_SETFLAGS: Ioctl = 0x40086602;
329 pub const FS_IOC_GETVERSION: Ioctl = 0x80087601;
330 pub const FS_IOC_SETVERSION: Ioctl = 0x40087602;
331 pub const FS_IOC32_GETFLAGS: Ioctl = 0x80046601;
332 pub const FS_IOC32_SETFLAGS: Ioctl = 0x40046602;
333 pub const FS_IOC32_GETVERSION: Ioctl = 0x80047601;
334 pub const FS_IOC32_SETVERSION: Ioctl = 0x40047602;
335 pub const TUNATTACHFILTER: Ioctl = 0x401054d5;
336 pub const TUNDETACHFILTER: Ioctl = 0x401054d6;
337 pub const TUNGETFILTER: Ioctl = 0x801054db;
338 }
339}
340
341cfg_if! {
342 if #[cfg(any(target_arch = "arm", target_arch = "s390x"))] {
343 pub const FIOQSIZE: Ioctl = 0x545E;
344 } else {
345 pub const FIOQSIZE: Ioctl = 0x5460;
346 }
347}
348
349pub const TIOCM_LE: c_int = 0x001;
350pub const TIOCM_DTR: c_int = 0x002;
351pub const TIOCM_RTS: c_int = 0x004;
352pub const TIOCM_ST: c_int = 0x008;
353pub const TIOCM_SR: c_int = 0x010;
354pub const TIOCM_CTS: c_int = 0x020;
355pub const TIOCM_CAR: c_int = 0x040;
356pub const TIOCM_CD: c_int = TIOCM_CAR;
357pub const TIOCM_RNG: c_int = 0x080;
358pub const TIOCM_RI: c_int = TIOCM_RNG;
359pub const TIOCM_DSR: c_int = 0x100;
360
361pub const BOTHER: crate::speed_t = 0o010000;
362pub const IBSHIFT: crate::tcflag_t = 16;
363
364cfg_if! {
367 if #[cfg(any(target_env = "gnu", target_env = "uclibc"))] {
368 pub const RLIMIT_CPU: crate::__rlimit_resource_t = 0;
369 pub const RLIMIT_FSIZE: crate::__rlimit_resource_t = 1;
370 pub const RLIMIT_DATA: crate::__rlimit_resource_t = 2;
371 pub const RLIMIT_STACK: crate::__rlimit_resource_t = 3;
372 pub const RLIMIT_CORE: crate::__rlimit_resource_t = 4;
373 pub const RLIMIT_RSS: crate::__rlimit_resource_t = 5;
374 pub const RLIMIT_NPROC: crate::__rlimit_resource_t = 6;
375 pub const RLIMIT_NOFILE: crate::__rlimit_resource_t = 7;
376 pub const RLIMIT_MEMLOCK: crate::__rlimit_resource_t = 8;
377 pub const RLIMIT_AS: crate::__rlimit_resource_t = 9;
378 pub const RLIMIT_LOCKS: crate::__rlimit_resource_t = 10;
379 pub const RLIMIT_SIGPENDING: crate::__rlimit_resource_t = 11;
380 pub const RLIMIT_MSGQUEUE: crate::__rlimit_resource_t = 12;
381 pub const RLIMIT_NICE: crate::__rlimit_resource_t = 13;
382 pub const RLIMIT_RTPRIO: crate::__rlimit_resource_t = 14;
383 pub const RLIMIT_RTTIME: crate::__rlimit_resource_t = 15;
384 #[allow(deprecated)]
385 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
386 pub const RLIMIT_NLIMITS: crate::__rlimit_resource_t = RLIM_NLIMITS;
387 } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
388 pub const RLIMIT_CPU: c_int = 0;
389 pub const RLIMIT_FSIZE: c_int = 1;
390 pub const RLIMIT_DATA: c_int = 2;
391 pub const RLIMIT_STACK: c_int = 3;
392 pub const RLIMIT_CORE: c_int = 4;
393 pub const RLIMIT_RSS: c_int = 5;
394 pub const RLIMIT_NPROC: c_int = 6;
395 pub const RLIMIT_NOFILE: c_int = 7;
396 pub const RLIMIT_MEMLOCK: c_int = 8;
397 pub const RLIMIT_AS: c_int = 9;
398 pub const RLIMIT_LOCKS: c_int = 10;
399 pub const RLIMIT_SIGPENDING: c_int = 11;
400 pub const RLIMIT_MSGQUEUE: c_int = 12;
401 pub const RLIMIT_NICE: c_int = 13;
402 pub const RLIMIT_RTPRIO: c_int = 14;
403 pub const RLIMIT_RTTIME: c_int = 15;
404 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
405 #[cfg(not(target_arch = "loongarch64"))]
406 pub const RLIM_NLIMITS: c_int = 15;
407 #[cfg(target_arch = "loongarch64")]
408 pub const RLIM_NLIMITS: c_int = 16;
409 #[allow(deprecated)]
410 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
411 pub const RLIMIT_NLIMITS: c_int = RLIM_NLIMITS;
412 }
413}
414
415cfg_if! {
416 if #[cfg(target_env = "gnu")] {
417 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
418 pub const RLIM_NLIMITS: crate::__rlimit_resource_t = 16;
419 } else if #[cfg(target_env = "uclibc")] {
420 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
421 pub const RLIM_NLIMITS: crate::__rlimit_resource_t = 15;
422 }
423}
424
425pub const RLIM_INFINITY: crate::rlim_t = !0;