libc/unix/linux_like/linux/arch/generic/
mod.rs1use 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"))
134 ))] {
135 pub const SO_TIMESTAMP_NEW: c_int = 63;
136 pub const SO_TIMESTAMPNS_NEW: c_int = 64;
137 pub const SO_TIMESTAMPING_NEW: c_int = 65;
138 pub const SO_RCVTIMEO_NEW: c_int = 66;
139 pub const SO_SNDTIMEO_NEW: c_int = 67;
140 pub const SO_DETACH_REUSEPORT_BPF: c_int = 68;
141 }
142}
143cfg_if! {
147 if #[cfg(any(
148 target_arch = "x86",
149 target_arch = "x86_64",
150 target_arch = "arm",
151 target_arch = "aarch64",
152 target_arch = "riscv64",
153 target_arch = "s390x",
154 target_arch = "csky",
155 target_arch = "loongarch64"
156 ))] {
157 pub const FICLONE: c_ulong = 0x40049409;
158 pub const FICLONERANGE: c_ulong = 0x4020940D;
159 }
160}
161
162pub const SCM_TIMESTAMPNS: c_int = SO_TIMESTAMPNS;
165pub const SCM_TIMESTAMPING: c_int = SO_TIMESTAMPING;
166
167pub const TCGETS: Ioctl = 0x5401;
170pub const TCSETS: Ioctl = 0x5402;
171pub const TCSETSW: Ioctl = 0x5403;
172pub const TCSETSF: Ioctl = 0x5404;
173pub const TCGETA: Ioctl = 0x5405;
174pub const TCSETA: Ioctl = 0x5406;
175pub const TCSETAW: Ioctl = 0x5407;
176pub const TCSETAF: Ioctl = 0x5408;
177pub const TCSBRK: Ioctl = 0x5409;
178pub const TCXONC: Ioctl = 0x540A;
179pub const TCFLSH: Ioctl = 0x540B;
180pub const TIOCEXCL: Ioctl = 0x540C;
181pub const TIOCNXCL: Ioctl = 0x540D;
182pub const TIOCSCTTY: Ioctl = 0x540E;
183pub const TIOCGPGRP: Ioctl = 0x540F;
184pub const TIOCSPGRP: Ioctl = 0x5410;
185pub const TIOCOUTQ: Ioctl = 0x5411;
186pub const TIOCSTI: Ioctl = 0x5412;
187pub const TIOCGWINSZ: Ioctl = 0x5413;
188pub const TIOCSWINSZ: Ioctl = 0x5414;
189pub const TIOCMGET: Ioctl = 0x5415;
190pub const TIOCMBIS: Ioctl = 0x5416;
191pub const TIOCMBIC: Ioctl = 0x5417;
192pub const TIOCMSET: Ioctl = 0x5418;
193pub const TIOCGSOFTCAR: Ioctl = 0x5419;
194pub const TIOCSSOFTCAR: Ioctl = 0x541A;
195pub const FIONREAD: Ioctl = 0x541B;
196pub const TIOCINQ: Ioctl = FIONREAD;
197pub const TIOCLINUX: Ioctl = 0x541C;
198pub const TIOCCONS: Ioctl = 0x541D;
199pub const TIOCGSERIAL: Ioctl = 0x541E;
200pub const TIOCSSERIAL: Ioctl = 0x541F;
201pub const TIOCPKT: Ioctl = 0x5420;
202pub const FIONBIO: Ioctl = 0x5421;
203pub const TIOCNOTTY: Ioctl = 0x5422;
204pub const TIOCSETD: Ioctl = 0x5423;
205pub const TIOCGETD: Ioctl = 0x5424;
206pub const TCSBRKP: Ioctl = 0x5425;
207pub const TIOCSBRK: Ioctl = 0x5427;
208pub const TIOCCBRK: Ioctl = 0x5428;
209pub const TIOCGSID: Ioctl = 0x5429;
210pub const TCGETS2: Ioctl = 0x802c542a;
211pub const TCSETS2: Ioctl = 0x402c542b;
212pub const TCSETSW2: Ioctl = 0x402c542c;
213pub const TCSETSF2: Ioctl = 0x402c542d;
214pub const TIOCGRS485: Ioctl = 0x542E;
215pub const TIOCSRS485: Ioctl = 0x542F;
216pub const TIOCGPTN: Ioctl = 0x80045430;
217pub const TIOCSPTLCK: Ioctl = 0x40045431;
218pub const TIOCGDEV: Ioctl = 0x80045432;
219pub const TCGETX: Ioctl = 0x5432;
220pub const TCSETX: Ioctl = 0x5433;
221pub const TCSETXF: Ioctl = 0x5434;
222pub const TCSETXW: Ioctl = 0x5435;
223pub const TIOCSIG: Ioctl = 0x40045436;
224pub const TIOCVHANGUP: Ioctl = 0x5437;
225pub const TIOCGPKT: Ioctl = 0x80045438;
226pub const TIOCGPTLCK: Ioctl = 0x80045439;
227pub const TIOCGEXCL: Ioctl = 0x80045440;
228pub const TIOCGPTPEER: Ioctl = 0x5441;
229pub const FIONCLEX: Ioctl = 0x5450;
232pub const FIOCLEX: Ioctl = 0x5451;
233pub const FIOASYNC: Ioctl = 0x5452;
234pub const TIOCSERCONFIG: Ioctl = 0x5453;
235pub const TIOCSERGWILD: Ioctl = 0x5454;
236pub const TIOCSERSWILD: Ioctl = 0x5455;
237pub const TIOCGLCKTRMIOS: Ioctl = 0x5456;
238pub const TIOCSLCKTRMIOS: Ioctl = 0x5457;
239pub const TIOCSERGSTRUCT: Ioctl = 0x5458;
240pub const TIOCSERGETLSR: Ioctl = 0x5459;
241pub const TIOCSERGETMULTI: Ioctl = 0x545A;
242pub const TIOCSERSETMULTI: Ioctl = 0x545B;
243pub const TIOCMIWAIT: Ioctl = 0x545C;
244pub const TIOCGICOUNT: Ioctl = 0x545D;
245pub const BLKIOMIN: Ioctl = 0x1278;
246pub const BLKIOOPT: Ioctl = 0x1279;
247pub const BLKSSZGET: Ioctl = 0x1268;
248pub const BLKPBSZGET: Ioctl = 0x127B;
249pub const TUNSETNOCSUM: Ioctl = 0x400454c8;
251pub const TUNSETDEBUG: Ioctl = 0x400454c9;
252pub const TUNSETIFF: Ioctl = 0x400454ca;
253pub const TUNSETPERSIST: Ioctl = 0x400454cb;
254pub const TUNSETOWNER: Ioctl = 0x400454cc;
255pub const TUNSETLINK: Ioctl = 0x400454cd;
256pub const TUNSETGROUP: Ioctl = 0x400454ce;
257pub const TUNGETFEATURES: Ioctl = 0x800454cf;
258pub const TUNSETOFFLOAD: Ioctl = 0x400454d0;
259pub const TUNSETTXFILTER: Ioctl = 0x400454d1;
260pub const TUNGETIFF: Ioctl = 0x800454d2;
261pub const TUNGETSNDBUF: Ioctl = 0x800454d3;
262pub const TUNSETSNDBUF: Ioctl = 0x400454d4;
263pub const TUNGETVNETHDRSZ: Ioctl = 0x800454d7;
264pub const TUNSETVNETHDRSZ: Ioctl = 0x400454d8;
265pub const TUNSETQUEUE: Ioctl = 0x400454d9;
266pub const TUNSETIFINDEX: Ioctl = 0x400454da;
267pub const TUNSETVNETLE: Ioctl = 0x400454dc;
268pub const TUNGETVNETLE: Ioctl = 0x800454dd;
269pub const TUNSETVNETBE: Ioctl = 0x400454de;
274pub const TUNGETVNETBE: Ioctl = 0x800454df;
275pub const TUNSETSTEERINGEBPF: Ioctl = 0x800454e0;
276pub const TUNSETFILTEREBPF: Ioctl = 0x800454e1;
277
278cfg_if! {
279 if #[cfg(any(
286 target_arch = "x86",
287 target_arch = "arm",
288 target_arch = "csky"
289 ))] {
290 pub const FS_IOC_GETFLAGS: Ioctl = 0x80046601;
291 pub const FS_IOC_SETFLAGS: Ioctl = 0x40046602;
292 pub const FS_IOC_GETVERSION: Ioctl = 0x80047601;
293 pub const FS_IOC_SETVERSION: Ioctl = 0x40047602;
294 pub const FS_IOC32_GETFLAGS: Ioctl = 0x80046601;
295 pub const FS_IOC32_SETFLAGS: Ioctl = 0x40046602;
296 pub const FS_IOC32_GETVERSION: Ioctl = 0x80047601;
297 pub const FS_IOC32_SETVERSION: Ioctl = 0x40047602;
298 pub const TUNATTACHFILTER: Ioctl = 0x400854d5;
299 pub const TUNDETACHFILTER: Ioctl = 0x400854d6;
300 pub const TUNGETFILTER: Ioctl = 0x800854db;
301 } else if #[cfg(any(
302 target_arch = "x86_64",
303 target_arch = "riscv64",
304 target_arch = "aarch64",
305 target_arch = "s390x",
306 target_arch = "loongarch64"
307 ))] {
308 pub const FS_IOC_GETFLAGS: Ioctl = 0x80086601;
309 pub const FS_IOC_SETFLAGS: Ioctl = 0x40086602;
310 pub const FS_IOC_GETVERSION: Ioctl = 0x80087601;
311 pub const FS_IOC_SETVERSION: Ioctl = 0x40087602;
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 = 0x401054d5;
317 pub const TUNDETACHFILTER: Ioctl = 0x401054d6;
318 pub const TUNGETFILTER: Ioctl = 0x801054db;
319 }
320}
321
322cfg_if! {
323 if #[cfg(any(target_arch = "arm", target_arch = "s390x"))] {
324 pub const FIOQSIZE: Ioctl = 0x545E;
325 } else {
326 pub const FIOQSIZE: Ioctl = 0x5460;
327 }
328}
329
330pub const TIOCM_LE: c_int = 0x001;
331pub const TIOCM_DTR: c_int = 0x002;
332pub const TIOCM_RTS: c_int = 0x004;
333pub const TIOCM_ST: c_int = 0x008;
334pub const TIOCM_SR: c_int = 0x010;
335pub const TIOCM_CTS: c_int = 0x020;
336pub const TIOCM_CAR: c_int = 0x040;
337pub const TIOCM_CD: c_int = TIOCM_CAR;
338pub const TIOCM_RNG: c_int = 0x080;
339pub const TIOCM_RI: c_int = TIOCM_RNG;
340pub const TIOCM_DSR: c_int = 0x100;
341
342pub const BOTHER: crate::speed_t = 0o010000;
343pub const IBSHIFT: crate::tcflag_t = 16;
344
345cfg_if! {
348 if #[cfg(any(target_env = "gnu", target_env = "uclibc"))] {
349 pub const RLIMIT_CPU: crate::__rlimit_resource_t = 0;
350 pub const RLIMIT_FSIZE: crate::__rlimit_resource_t = 1;
351 pub const RLIMIT_DATA: crate::__rlimit_resource_t = 2;
352 pub const RLIMIT_STACK: crate::__rlimit_resource_t = 3;
353 pub const RLIMIT_CORE: crate::__rlimit_resource_t = 4;
354 pub const RLIMIT_RSS: crate::__rlimit_resource_t = 5;
355 pub const RLIMIT_NPROC: crate::__rlimit_resource_t = 6;
356 pub const RLIMIT_NOFILE: crate::__rlimit_resource_t = 7;
357 pub const RLIMIT_MEMLOCK: crate::__rlimit_resource_t = 8;
358 pub const RLIMIT_AS: crate::__rlimit_resource_t = 9;
359 pub const RLIMIT_LOCKS: crate::__rlimit_resource_t = 10;
360 pub const RLIMIT_SIGPENDING: crate::__rlimit_resource_t = 11;
361 pub const RLIMIT_MSGQUEUE: crate::__rlimit_resource_t = 12;
362 pub const RLIMIT_NICE: crate::__rlimit_resource_t = 13;
363 pub const RLIMIT_RTPRIO: crate::__rlimit_resource_t = 14;
364 pub const RLIMIT_RTTIME: crate::__rlimit_resource_t = 15;
365 #[allow(deprecated)]
366 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
367 pub const RLIMIT_NLIMITS: crate::__rlimit_resource_t = RLIM_NLIMITS;
368 } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
369 pub const RLIMIT_CPU: c_int = 0;
370 pub const RLIMIT_FSIZE: c_int = 1;
371 pub const RLIMIT_DATA: c_int = 2;
372 pub const RLIMIT_STACK: c_int = 3;
373 pub const RLIMIT_CORE: c_int = 4;
374 pub const RLIMIT_RSS: c_int = 5;
375 pub const RLIMIT_NPROC: c_int = 6;
376 pub const RLIMIT_NOFILE: c_int = 7;
377 pub const RLIMIT_MEMLOCK: c_int = 8;
378 pub const RLIMIT_AS: c_int = 9;
379 pub const RLIMIT_LOCKS: c_int = 10;
380 pub const RLIMIT_SIGPENDING: c_int = 11;
381 pub const RLIMIT_MSGQUEUE: c_int = 12;
382 pub const RLIMIT_NICE: c_int = 13;
383 pub const RLIMIT_RTPRIO: c_int = 14;
384 pub const RLIMIT_RTTIME: c_int = 15;
385 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
386 #[cfg(not(target_arch = "loongarch64"))]
387 pub const RLIM_NLIMITS: c_int = 15;
388 #[cfg(target_arch = "loongarch64")]
389 pub const RLIM_NLIMITS: c_int = 16;
390 #[allow(deprecated)]
391 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
392 pub const RLIMIT_NLIMITS: c_int = RLIM_NLIMITS;
393 }
394}
395
396cfg_if! {
397 if #[cfg(target_env = "gnu")] {
398 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
399 pub const RLIM_NLIMITS: crate::__rlimit_resource_t = 16;
400 } else if #[cfg(target_env = "uclibc")] {
401 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
402 pub const RLIM_NLIMITS: crate::__rlimit_resource_t = 15;
403 }
404}
405
406pub const RLIM_INFINITY: crate::rlim_t = !0;