1use crate::prelude::*;
2
3pub type sa_family_t = u16;
4pub type speed_t = c_uint;
5pub type tcflag_t = c_uint;
6pub type clockid_t = c_int;
7pub type timer_t = *mut c_void;
8pub type key_t = c_int;
9pub type id_t = c_uint;
10
11missing! {
12 #[cfg_attr(feature = "extra_traits", derive(Debug))]
13 pub enum timezone {}
14}
15
16s! {
17 pub struct in_addr {
18 pub s_addr: crate::in_addr_t,
19 }
20
21 pub struct ip_mreq {
22 pub imr_multiaddr: in_addr,
23 pub imr_interface: in_addr,
24 }
25
26 pub struct ip_mreqn {
27 pub imr_multiaddr: in_addr,
28 pub imr_address: in_addr,
29 pub imr_ifindex: c_int,
30 }
31
32 pub struct ip_mreq_source {
33 pub imr_multiaddr: in_addr,
34 pub imr_interface: in_addr,
35 pub imr_sourceaddr: in_addr,
36 }
37
38 pub struct sockaddr {
39 pub sa_family: sa_family_t,
40 pub sa_data: [c_char; 14],
41 }
42
43 pub struct sockaddr_in {
44 pub sin_family: sa_family_t,
45 pub sin_port: crate::in_port_t,
46 pub sin_addr: crate::in_addr,
47 pub sin_zero: [u8; 8],
48 }
49
50 pub struct sockaddr_in6 {
51 pub sin6_family: sa_family_t,
52 pub sin6_port: crate::in_port_t,
53 pub sin6_flowinfo: u32,
54 pub sin6_addr: crate::in6_addr,
55 pub sin6_scope_id: u32,
56 }
57
58 pub struct addrinfo {
61 pub ai_flags: c_int,
62 pub ai_family: c_int,
63 pub ai_socktype: c_int,
64 pub ai_protocol: c_int,
65 pub ai_addrlen: socklen_t,
66
67 #[cfg(any(target_os = "linux", target_os = "emscripten"))]
68 pub ai_addr: *mut crate::sockaddr,
69
70 pub ai_canonname: *mut c_char,
71
72 #[cfg(target_os = "android")]
73 pub ai_addr: *mut crate::sockaddr,
74
75 pub ai_next: *mut addrinfo,
76 }
77
78 pub struct sockaddr_ll {
79 pub sll_family: c_ushort,
80 pub sll_protocol: c_ushort,
81 pub sll_ifindex: c_int,
82 pub sll_hatype: c_ushort,
83 pub sll_pkttype: c_uchar,
84 pub sll_halen: c_uchar,
85 pub sll_addr: [c_uchar; 8],
86 }
87
88 pub struct fd_set {
89 fds_bits: [c_ulong; FD_SETSIZE as usize / ULONG_SIZE],
90 }
91
92 pub struct tm {
93 pub tm_sec: c_int,
94 pub tm_min: c_int,
95 pub tm_hour: c_int,
96 pub tm_mday: c_int,
97 pub tm_mon: c_int,
98 pub tm_year: c_int,
99 pub tm_wday: c_int,
100 pub tm_yday: c_int,
101 pub tm_isdst: c_int,
102 pub tm_gmtoff: c_long,
103 pub tm_zone: *const c_char,
104 }
105
106 pub struct sched_param {
107 pub sched_priority: c_int,
108 #[cfg(any(target_env = "musl", target_os = "emscripten", target_env = "ohos"))]
109 pub sched_ss_low_priority: c_int,
110 #[cfg(any(target_env = "musl", target_os = "emscripten", target_env = "ohos"))]
111 pub sched_ss_repl_period: crate::timespec,
112 #[cfg(any(target_env = "musl", target_os = "emscripten", target_env = "ohos"))]
113 pub sched_ss_init_budget: crate::timespec,
114 #[cfg(any(target_env = "musl", target_os = "emscripten", target_env = "ohos"))]
115 pub sched_ss_max_repl: c_int,
116 }
117
118 pub struct Dl_info {
119 pub dli_fname: *const c_char,
120 pub dli_fbase: *mut c_void,
121 pub dli_sname: *const c_char,
122 pub dli_saddr: *mut c_void,
123 }
124
125 pub struct lconv {
126 pub decimal_point: *mut c_char,
127 pub thousands_sep: *mut c_char,
128 pub grouping: *mut c_char,
129 pub int_curr_symbol: *mut c_char,
130 pub currency_symbol: *mut c_char,
131 pub mon_decimal_point: *mut c_char,
132 pub mon_thousands_sep: *mut c_char,
133 pub mon_grouping: *mut c_char,
134 pub positive_sign: *mut c_char,
135 pub negative_sign: *mut c_char,
136 pub int_frac_digits: c_char,
137 pub frac_digits: c_char,
138 pub p_cs_precedes: c_char,
139 pub p_sep_by_space: c_char,
140 pub n_cs_precedes: c_char,
141 pub n_sep_by_space: c_char,
142 pub p_sign_posn: c_char,
143 pub n_sign_posn: c_char,
144 pub int_p_cs_precedes: c_char,
145 pub int_p_sep_by_space: c_char,
146 pub int_n_cs_precedes: c_char,
147 pub int_n_sep_by_space: c_char,
148 pub int_p_sign_posn: c_char,
149 pub int_n_sign_posn: c_char,
150 }
151
152 pub struct in_pktinfo {
153 pub ipi_ifindex: c_int,
154 pub ipi_spec_dst: crate::in_addr,
155 pub ipi_addr: crate::in_addr,
156 }
157
158 pub struct ifaddrs {
159 pub ifa_next: *mut ifaddrs,
160 pub ifa_name: *mut c_char,
161 pub ifa_flags: c_uint,
162 pub ifa_addr: *mut crate::sockaddr,
163 pub ifa_netmask: *mut crate::sockaddr,
164 pub ifa_ifu: *mut crate::sockaddr, pub ifa_data: *mut c_void,
166 }
167
168 pub struct in6_rtmsg {
169 rtmsg_dst: crate::in6_addr,
170 rtmsg_src: crate::in6_addr,
171 rtmsg_gateway: crate::in6_addr,
172 rtmsg_type: u32,
173 rtmsg_dst_len: u16,
174 rtmsg_src_len: u16,
175 rtmsg_metric: u32,
176 rtmsg_info: c_ulong,
177 rtmsg_flags: u32,
178 rtmsg_ifindex: c_int,
179 }
180
181 pub struct arpreq {
182 pub arp_pa: crate::sockaddr,
183 pub arp_ha: crate::sockaddr,
184 pub arp_flags: c_int,
185 pub arp_netmask: crate::sockaddr,
186 pub arp_dev: [c_char; 16],
187 }
188
189 pub struct arpreq_old {
190 pub arp_pa: crate::sockaddr,
191 pub arp_ha: crate::sockaddr,
192 pub arp_flags: c_int,
193 pub arp_netmask: crate::sockaddr,
194 }
195
196 pub struct arphdr {
197 pub ar_hrd: u16,
198 pub ar_pro: u16,
199 pub ar_hln: u8,
200 pub ar_pln: u8,
201 pub ar_op: u16,
202 }
203
204 pub struct mmsghdr {
205 pub msg_hdr: crate::msghdr,
206 pub msg_len: c_uint,
207 }
208}
209
210cfg_if! {
211 if #[cfg(any(target_env = "gnu", target_os = "android"))] {
212 s! {
213 pub struct statx {
214 pub stx_mask: crate::__u32,
215 pub stx_blksize: crate::__u32,
216 pub stx_attributes: crate::__u64,
217 pub stx_nlink: crate::__u32,
218 pub stx_uid: crate::__u32,
219 pub stx_gid: crate::__u32,
220 pub stx_mode: crate::__u16,
221 __statx_pad1: [crate::__u16; 1],
222 pub stx_ino: crate::__u64,
223 pub stx_size: crate::__u64,
224 pub stx_blocks: crate::__u64,
225 pub stx_attributes_mask: crate::__u64,
226 pub stx_atime: statx_timestamp,
227 pub stx_btime: statx_timestamp,
228 pub stx_ctime: statx_timestamp,
229 pub stx_mtime: statx_timestamp,
230 pub stx_rdev_major: crate::__u32,
231 pub stx_rdev_minor: crate::__u32,
232 pub stx_dev_major: crate::__u32,
233 pub stx_dev_minor: crate::__u32,
234 pub stx_mnt_id: crate::__u64,
235 pub stx_dio_mem_align: crate::__u32,
236 pub stx_dio_offset_align: crate::__u32,
237 __statx_pad3: [crate::__u64; 12],
238 }
239
240 pub struct statx_timestamp {
241 pub tv_sec: crate::__s64,
242 pub tv_nsec: crate::__u32,
243 __statx_timestamp_pad1: [crate::__s32; 1],
244 }
245 }
246 }
247}
248
249s_no_extra_traits! {
250 #[cfg_attr(
251 any(
252 all(
253 target_arch = "x86",
254 not(target_env = "musl"),
255 not(target_os = "android")
256 ),
257 target_arch = "x86_64"
258 ),
259 repr(packed)
260 )]
261 pub struct epoll_event {
262 pub events: u32,
263 pub u64: u64,
264 }
265
266 pub struct sockaddr_un {
267 pub sun_family: sa_family_t,
268 pub sun_path: [c_char; 108],
269 }
270
271 pub struct sockaddr_storage {
272 pub ss_family: sa_family_t,
273 #[cfg(target_pointer_width = "32")]
274 __ss_pad2: [u8; 128 - 2 - 4],
275 #[cfg(target_pointer_width = "64")]
276 __ss_pad2: [u8; 128 - 2 - 8],
277 __ss_align: size_t,
278 }
279
280 pub struct utsname {
281 pub sysname: [c_char; 65],
282 pub nodename: [c_char; 65],
283 pub release: [c_char; 65],
284 pub version: [c_char; 65],
285 pub machine: [c_char; 65],
286 pub domainname: [c_char; 65],
287 }
288
289 pub struct sigevent {
290 pub sigev_value: crate::sigval,
291 pub sigev_signo: c_int,
292 pub sigev_notify: c_int,
293 pub sigev_notify_thread_id: c_int,
296 #[cfg(target_pointer_width = "64")]
297 __unused1: [c_int; 11],
298 #[cfg(target_pointer_width = "32")]
299 __unused1: [c_int; 12],
300 }
301}
302
303cfg_if! {
304 if #[cfg(feature = "extra_traits")] {
305 impl PartialEq for epoll_event {
306 fn eq(&self, other: &epoll_event) -> bool {
307 self.events == other.events && self.u64 == other.u64
308 }
309 }
310 impl Eq for epoll_event {}
311 impl fmt::Debug for epoll_event {
312 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
313 let events = self.events;
314 let u64 = self.u64;
315 f.debug_struct("epoll_event")
316 .field("events", &events)
317 .field("u64", &u64)
318 .finish()
319 }
320 }
321 impl hash::Hash for epoll_event {
322 fn hash<H: hash::Hasher>(&self, state: &mut H) {
323 let events = self.events;
324 let u64 = self.u64;
325 events.hash(state);
326 u64.hash(state);
327 }
328 }
329
330 impl PartialEq for sockaddr_un {
331 fn eq(&self, other: &sockaddr_un) -> bool {
332 self.sun_family == other.sun_family
333 && self
334 .sun_path
335 .iter()
336 .zip(other.sun_path.iter())
337 .all(|(a, b)| a == b)
338 }
339 }
340 impl Eq for sockaddr_un {}
341 impl fmt::Debug for sockaddr_un {
342 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
343 f.debug_struct("sockaddr_un")
344 .field("sun_family", &self.sun_family)
345 .finish()
347 }
348 }
349 impl hash::Hash for sockaddr_un {
350 fn hash<H: hash::Hasher>(&self, state: &mut H) {
351 self.sun_family.hash(state);
352 self.sun_path.hash(state);
353 }
354 }
355
356 impl PartialEq for sockaddr_storage {
357 fn eq(&self, other: &sockaddr_storage) -> bool {
358 self.ss_family == other.ss_family
359 && self
360 .__ss_pad2
361 .iter()
362 .zip(other.__ss_pad2.iter())
363 .all(|(a, b)| a == b)
364 }
365 }
366
367 impl Eq for sockaddr_storage {}
368
369 impl fmt::Debug for sockaddr_storage {
370 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
371 f.debug_struct("sockaddr_storage")
372 .field("ss_family", &self.ss_family)
373 .field("__ss_align", &self.__ss_align)
374 .finish()
376 }
377 }
378
379 impl hash::Hash for sockaddr_storage {
380 fn hash<H: hash::Hasher>(&self, state: &mut H) {
381 self.ss_family.hash(state);
382 self.__ss_pad2.hash(state);
383 }
384 }
385
386 impl PartialEq for utsname {
387 fn eq(&self, other: &utsname) -> bool {
388 self.sysname
389 .iter()
390 .zip(other.sysname.iter())
391 .all(|(a, b)| a == b)
392 && self
393 .nodename
394 .iter()
395 .zip(other.nodename.iter())
396 .all(|(a, b)| a == b)
397 && self
398 .release
399 .iter()
400 .zip(other.release.iter())
401 .all(|(a, b)| a == b)
402 && self
403 .version
404 .iter()
405 .zip(other.version.iter())
406 .all(|(a, b)| a == b)
407 && self
408 .machine
409 .iter()
410 .zip(other.machine.iter())
411 .all(|(a, b)| a == b)
412 && self
413 .domainname
414 .iter()
415 .zip(other.domainname.iter())
416 .all(|(a, b)| a == b)
417 }
418 }
419
420 impl Eq for utsname {}
421
422 impl fmt::Debug for utsname {
423 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
424 f.debug_struct("utsname")
425 .finish()
432 }
433 }
434
435 impl hash::Hash for utsname {
436 fn hash<H: hash::Hasher>(&self, state: &mut H) {
437 self.sysname.hash(state);
438 self.nodename.hash(state);
439 self.release.hash(state);
440 self.version.hash(state);
441 self.machine.hash(state);
442 self.domainname.hash(state);
443 }
444 }
445
446 impl PartialEq for sigevent {
447 fn eq(&self, other: &sigevent) -> bool {
448 self.sigev_value == other.sigev_value
449 && self.sigev_signo == other.sigev_signo
450 && self.sigev_notify == other.sigev_notify
451 && self.sigev_notify_thread_id == other.sigev_notify_thread_id
452 }
453 }
454 impl Eq for sigevent {}
455 impl fmt::Debug for sigevent {
456 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
457 f.debug_struct("sigevent")
458 .field("sigev_value", &self.sigev_value)
459 .field("sigev_signo", &self.sigev_signo)
460 .field("sigev_notify", &self.sigev_notify)
461 .field("sigev_notify_thread_id", &self.sigev_notify_thread_id)
462 .finish()
463 }
464 }
465 impl hash::Hash for sigevent {
466 fn hash<H: hash::Hasher>(&self, state: &mut H) {
467 self.sigev_value.hash(state);
468 self.sigev_signo.hash(state);
469 self.sigev_notify.hash(state);
470 self.sigev_notify_thread_id.hash(state);
471 }
472 }
473 }
474}
475
476cfg_if! {
478 if #[cfg(target_pointer_width = "32")] {
479 const ULONG_SIZE: usize = 32;
480 } else if #[cfg(target_pointer_width = "64")] {
481 const ULONG_SIZE: usize = 64;
482 } else {
483 }
485}
486
487pub const EXIT_FAILURE: c_int = 1;
488pub const EXIT_SUCCESS: c_int = 0;
489pub const RAND_MAX: c_int = 2147483647;
490pub const EOF: c_int = -1;
491pub const SEEK_SET: c_int = 0;
492pub const SEEK_CUR: c_int = 1;
493pub const SEEK_END: c_int = 2;
494pub const _IOFBF: c_int = 0;
495pub const _IONBF: c_int = 2;
496pub const _IOLBF: c_int = 1;
497
498pub const F_DUPFD: c_int = 0;
499pub const F_GETFD: c_int = 1;
500pub const F_SETFD: c_int = 2;
501pub const F_GETFL: c_int = 3;
502pub const F_SETFL: c_int = 4;
503
504pub const F_SETLEASE: c_int = 1024;
506pub const F_GETLEASE: c_int = 1025;
507pub const F_NOTIFY: c_int = 1026;
508pub const F_CANCELLK: c_int = 1029;
509pub const F_DUPFD_CLOEXEC: c_int = 1030;
510pub const F_SETPIPE_SZ: c_int = 1031;
511pub const F_GETPIPE_SZ: c_int = 1032;
512pub const F_ADD_SEALS: c_int = 1033;
513pub const F_GET_SEALS: c_int = 1034;
514
515pub const F_SEAL_SEAL: c_int = 0x0001;
516pub const F_SEAL_SHRINK: c_int = 0x0002;
517pub const F_SEAL_GROW: c_int = 0x0004;
518pub const F_SEAL_WRITE: c_int = 0x0008;
519
520pub const SIGTRAP: c_int = 5;
523
524pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
525pub const PTHREAD_CREATE_DETACHED: c_int = 1;
526
527pub const CLOCK_REALTIME: crate::clockid_t = 0;
528pub const CLOCK_MONOTONIC: crate::clockid_t = 1;
529pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 2;
530pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 3;
531pub const CLOCK_MONOTONIC_RAW: crate::clockid_t = 4;
532pub const CLOCK_REALTIME_COARSE: crate::clockid_t = 5;
533pub const CLOCK_MONOTONIC_COARSE: crate::clockid_t = 6;
534pub const CLOCK_BOOTTIME: crate::clockid_t = 7;
535pub const CLOCK_REALTIME_ALARM: crate::clockid_t = 8;
536pub const CLOCK_BOOTTIME_ALARM: crate::clockid_t = 9;
537pub const CLOCK_TAI: crate::clockid_t = 11;
538pub const TIMER_ABSTIME: c_int = 1;
539
540pub const RUSAGE_SELF: c_int = 0;
541
542pub const O_RDONLY: c_int = 0;
543pub const O_WRONLY: c_int = 1;
544pub const O_RDWR: c_int = 2;
545
546pub const SOCK_CLOEXEC: c_int = O_CLOEXEC;
547
548pub const S_IFIFO: crate::mode_t = 0o1_0000;
549pub const S_IFCHR: crate::mode_t = 0o2_0000;
550pub const S_IFBLK: crate::mode_t = 0o6_0000;
551pub const S_IFDIR: crate::mode_t = 0o4_0000;
552pub const S_IFREG: crate::mode_t = 0o10_0000;
553pub const S_IFLNK: crate::mode_t = 0o12_0000;
554pub const S_IFSOCK: crate::mode_t = 0o14_0000;
555pub const S_IFMT: crate::mode_t = 0o17_0000;
556pub const S_IRWXU: crate::mode_t = 0o0700;
557pub const S_IXUSR: crate::mode_t = 0o0100;
558pub const S_IWUSR: crate::mode_t = 0o0200;
559pub const S_IRUSR: crate::mode_t = 0o0400;
560pub const S_IRWXG: crate::mode_t = 0o0070;
561pub const S_IXGRP: crate::mode_t = 0o0010;
562pub const S_IWGRP: crate::mode_t = 0o0020;
563pub const S_IRGRP: crate::mode_t = 0o0040;
564pub const S_IRWXO: crate::mode_t = 0o0007;
565pub const S_IXOTH: crate::mode_t = 0o0001;
566pub const S_IWOTH: crate::mode_t = 0o0002;
567pub const S_IROTH: crate::mode_t = 0o0004;
568pub const F_OK: c_int = 0;
569pub const R_OK: c_int = 4;
570pub const W_OK: c_int = 2;
571pub const X_OK: c_int = 1;
572pub const STDIN_FILENO: c_int = 0;
573pub const STDOUT_FILENO: c_int = 1;
574pub const STDERR_FILENO: c_int = 2;
575pub const SIGHUP: c_int = 1;
576pub const SIGINT: c_int = 2;
577pub const SIGQUIT: c_int = 3;
578pub const SIGILL: c_int = 4;
579pub const SIGABRT: c_int = 6;
580pub const SIGFPE: c_int = 8;
581pub const SIGKILL: c_int = 9;
582pub const SIGSEGV: c_int = 11;
583pub const SIGPIPE: c_int = 13;
584pub const SIGALRM: c_int = 14;
585pub const SIGTERM: c_int = 15;
586
587pub const PROT_NONE: c_int = 0;
588pub const PROT_READ: c_int = 1;
589pub const PROT_WRITE: c_int = 2;
590pub const PROT_EXEC: c_int = 4;
591
592pub const XATTR_CREATE: c_int = 0x1;
593pub const XATTR_REPLACE: c_int = 0x2;
594
595cfg_if! {
596 if #[cfg(target_os = "android")] {
597 pub const RLIM64_INFINITY: c_ulonglong = !0;
598 } else {
599 pub const RLIM64_INFINITY: crate::rlim64_t = !0;
600 }
601}
602
603cfg_if! {
604 if #[cfg(target_env = "ohos")] {
605 pub const LC_CTYPE: c_int = 0;
606 pub const LC_NUMERIC: c_int = 1;
607 pub const LC_TIME: c_int = 2;
608 pub const LC_COLLATE: c_int = 3;
609 pub const LC_MONETARY: c_int = 4;
610 pub const LC_MESSAGES: c_int = 5;
611 pub const LC_PAPER: c_int = 6;
612 pub const LC_NAME: c_int = 7;
613 pub const LC_ADDRESS: c_int = 8;
614 pub const LC_TELEPHONE: c_int = 9;
615 pub const LC_MEASUREMENT: c_int = 10;
616 pub const LC_IDENTIFICATION: c_int = 11;
617 pub const LC_ALL: c_int = 12;
618 } else if #[cfg(not(target_env = "uclibc"))] {
619 pub const LC_CTYPE: c_int = 0;
620 pub const LC_NUMERIC: c_int = 1;
621 pub const LC_TIME: c_int = 2;
622 pub const LC_COLLATE: c_int = 3;
623 pub const LC_MONETARY: c_int = 4;
624 pub const LC_MESSAGES: c_int = 5;
625 pub const LC_ALL: c_int = 6;
626 }
627}
628
629pub const LC_CTYPE_MASK: c_int = 1 << LC_CTYPE;
630pub const LC_NUMERIC_MASK: c_int = 1 << LC_NUMERIC;
631pub const LC_TIME_MASK: c_int = 1 << LC_TIME;
632pub const LC_COLLATE_MASK: c_int = 1 << LC_COLLATE;
633pub const LC_MONETARY_MASK: c_int = 1 << LC_MONETARY;
634pub const LC_MESSAGES_MASK: c_int = 1 << LC_MESSAGES;
635pub const MAP_FILE: c_int = 0x0000;
638pub const MAP_SHARED: c_int = 0x0001;
639pub const MAP_PRIVATE: c_int = 0x0002;
640pub const MAP_FIXED: c_int = 0x0010;
641
642pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
643
644pub const MS_ASYNC: c_int = 0x0001;
646pub const MS_INVALIDATE: c_int = 0x0002;
647pub const MS_SYNC: c_int = 0x0004;
648
649pub const MS_RDONLY: c_ulong = 0x01;
651pub const MS_NOSUID: c_ulong = 0x02;
652pub const MS_NODEV: c_ulong = 0x04;
653pub const MS_NOEXEC: c_ulong = 0x08;
654pub const MS_SYNCHRONOUS: c_ulong = 0x10;
655pub const MS_REMOUNT: c_ulong = 0x20;
656pub const MS_MANDLOCK: c_ulong = 0x40;
657pub const MS_DIRSYNC: c_ulong = 0x80;
658pub const MS_NOATIME: c_ulong = 0x0400;
659pub const MS_NODIRATIME: c_ulong = 0x0800;
660pub const MS_BIND: c_ulong = 0x1000;
661pub const MS_MOVE: c_ulong = 0x2000;
662pub const MS_REC: c_ulong = 0x4000;
663pub const MS_SILENT: c_ulong = 0x8000;
664pub const MS_POSIXACL: c_ulong = 0x010000;
665pub const MS_UNBINDABLE: c_ulong = 0x020000;
666pub const MS_PRIVATE: c_ulong = 0x040000;
667pub const MS_SLAVE: c_ulong = 0x080000;
668pub const MS_SHARED: c_ulong = 0x100000;
669pub const MS_RELATIME: c_ulong = 0x200000;
670pub const MS_KERNMOUNT: c_ulong = 0x400000;
671pub const MS_I_VERSION: c_ulong = 0x800000;
672pub const MS_STRICTATIME: c_ulong = 0x1000000;
673pub const MS_LAZYTIME: c_ulong = 0x2000000;
674pub const MS_ACTIVE: c_ulong = 0x40000000;
675pub const MS_MGC_VAL: c_ulong = 0xc0ed0000;
676pub const MS_MGC_MSK: c_ulong = 0xffff0000;
677
678pub const SCM_RIGHTS: c_int = 0x01;
679pub const SCM_CREDENTIALS: c_int = 0x02;
680
681pub const PROT_GROWSDOWN: c_int = 0x1000000;
682pub const PROT_GROWSUP: c_int = 0x2000000;
683
684pub const MAP_TYPE: c_int = 0x000f;
685
686pub const MADV_NORMAL: c_int = 0;
687pub const MADV_RANDOM: c_int = 1;
688pub const MADV_SEQUENTIAL: c_int = 2;
689pub const MADV_WILLNEED: c_int = 3;
690pub const MADV_DONTNEED: c_int = 4;
691pub const MADV_FREE: c_int = 8;
692pub const MADV_REMOVE: c_int = 9;
693pub const MADV_DONTFORK: c_int = 10;
694pub const MADV_DOFORK: c_int = 11;
695pub const MADV_MERGEABLE: c_int = 12;
696pub const MADV_UNMERGEABLE: c_int = 13;
697pub const MADV_HUGEPAGE: c_int = 14;
698pub const MADV_NOHUGEPAGE: c_int = 15;
699pub const MADV_DONTDUMP: c_int = 16;
700pub const MADV_DODUMP: c_int = 17;
701pub const MADV_WIPEONFORK: c_int = 18;
702pub const MADV_KEEPONFORK: c_int = 19;
703pub const MADV_COLD: c_int = 20;
704pub const MADV_PAGEOUT: c_int = 21;
705pub const MADV_HWPOISON: c_int = 100;
706cfg_if! {
707 if #[cfg(not(target_os = "emscripten"))] {
708 pub const MADV_POPULATE_READ: c_int = 22;
709 pub const MADV_POPULATE_WRITE: c_int = 23;
710 pub const MADV_DONTNEED_LOCKED: c_int = 24;
711 }
712}
713
714pub const IFF_UP: c_int = 0x1;
715pub const IFF_BROADCAST: c_int = 0x2;
716pub const IFF_DEBUG: c_int = 0x4;
717pub const IFF_LOOPBACK: c_int = 0x8;
718pub const IFF_POINTOPOINT: c_int = 0x10;
719pub const IFF_NOTRAILERS: c_int = 0x20;
720pub const IFF_RUNNING: c_int = 0x40;
721pub const IFF_NOARP: c_int = 0x80;
722pub const IFF_PROMISC: c_int = 0x100;
723pub const IFF_ALLMULTI: c_int = 0x200;
724pub const IFF_MASTER: c_int = 0x400;
725pub const IFF_SLAVE: c_int = 0x800;
726pub const IFF_MULTICAST: c_int = 0x1000;
727pub const IFF_PORTSEL: c_int = 0x2000;
728pub const IFF_AUTOMEDIA: c_int = 0x4000;
729pub const IFF_DYNAMIC: c_int = 0x8000;
730
731pub const SOL_IP: c_int = 0;
732pub const SOL_TCP: c_int = 6;
733pub const SOL_UDP: c_int = 17;
734pub const SOL_IPV6: c_int = 41;
735pub const SOL_ICMPV6: c_int = 58;
736pub const SOL_RAW: c_int = 255;
737pub const SOL_DECNET: c_int = 261;
738pub const SOL_X25: c_int = 262;
739pub const SOL_PACKET: c_int = 263;
740pub const SOL_ATM: c_int = 264;
741pub const SOL_AAL: c_int = 265;
742pub const SOL_IRDA: c_int = 266;
743pub const SOL_NETBEUI: c_int = 267;
744pub const SOL_LLC: c_int = 268;
745pub const SOL_DCCP: c_int = 269;
746pub const SOL_NETLINK: c_int = 270;
747pub const SOL_TIPC: c_int = 271;
748pub const SOL_BLUETOOTH: c_int = 274;
749pub const SOL_ALG: c_int = 279;
750
751pub const AF_UNSPEC: c_int = 0;
752pub const AF_UNIX: c_int = 1;
753pub const AF_LOCAL: c_int = 1;
754pub const AF_INET: c_int = 2;
755pub const AF_AX25: c_int = 3;
756pub const AF_IPX: c_int = 4;
757pub const AF_APPLETALK: c_int = 5;
758pub const AF_NETROM: c_int = 6;
759pub const AF_BRIDGE: c_int = 7;
760pub const AF_ATMPVC: c_int = 8;
761pub const AF_X25: c_int = 9;
762pub const AF_INET6: c_int = 10;
763pub const AF_ROSE: c_int = 11;
764pub const AF_DECnet: c_int = 12;
765pub const AF_NETBEUI: c_int = 13;
766pub const AF_SECURITY: c_int = 14;
767pub const AF_KEY: c_int = 15;
768pub const AF_NETLINK: c_int = 16;
769pub const AF_ROUTE: c_int = AF_NETLINK;
770pub const AF_PACKET: c_int = 17;
771pub const AF_ASH: c_int = 18;
772pub const AF_ECONET: c_int = 19;
773pub const AF_ATMSVC: c_int = 20;
774pub const AF_RDS: c_int = 21;
775pub const AF_SNA: c_int = 22;
776pub const AF_IRDA: c_int = 23;
777pub const AF_PPPOX: c_int = 24;
778pub const AF_WANPIPE: c_int = 25;
779pub const AF_LLC: c_int = 26;
780pub const AF_CAN: c_int = 29;
781pub const AF_TIPC: c_int = 30;
782pub const AF_BLUETOOTH: c_int = 31;
783pub const AF_IUCV: c_int = 32;
784pub const AF_RXRPC: c_int = 33;
785pub const AF_ISDN: c_int = 34;
786pub const AF_PHONET: c_int = 35;
787pub const AF_IEEE802154: c_int = 36;
788pub const AF_CAIF: c_int = 37;
789pub const AF_ALG: c_int = 38;
790
791pub const PF_UNSPEC: c_int = AF_UNSPEC;
792pub const PF_UNIX: c_int = AF_UNIX;
793pub const PF_LOCAL: c_int = AF_LOCAL;
794pub const PF_INET: c_int = AF_INET;
795pub const PF_AX25: c_int = AF_AX25;
796pub const PF_IPX: c_int = AF_IPX;
797pub const PF_APPLETALK: c_int = AF_APPLETALK;
798pub const PF_NETROM: c_int = AF_NETROM;
799pub const PF_BRIDGE: c_int = AF_BRIDGE;
800pub const PF_ATMPVC: c_int = AF_ATMPVC;
801pub const PF_X25: c_int = AF_X25;
802pub const PF_INET6: c_int = AF_INET6;
803pub const PF_ROSE: c_int = AF_ROSE;
804pub const PF_DECnet: c_int = AF_DECnet;
805pub const PF_NETBEUI: c_int = AF_NETBEUI;
806pub const PF_SECURITY: c_int = AF_SECURITY;
807pub const PF_KEY: c_int = AF_KEY;
808pub const PF_NETLINK: c_int = AF_NETLINK;
809pub const PF_ROUTE: c_int = AF_ROUTE;
810pub const PF_PACKET: c_int = AF_PACKET;
811pub const PF_ASH: c_int = AF_ASH;
812pub const PF_ECONET: c_int = AF_ECONET;
813pub const PF_ATMSVC: c_int = AF_ATMSVC;
814pub const PF_RDS: c_int = AF_RDS;
815pub const PF_SNA: c_int = AF_SNA;
816pub const PF_IRDA: c_int = AF_IRDA;
817pub const PF_PPPOX: c_int = AF_PPPOX;
818pub const PF_WANPIPE: c_int = AF_WANPIPE;
819pub const PF_LLC: c_int = AF_LLC;
820pub const PF_CAN: c_int = AF_CAN;
821pub const PF_TIPC: c_int = AF_TIPC;
822pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH;
823pub const PF_IUCV: c_int = AF_IUCV;
824pub const PF_RXRPC: c_int = AF_RXRPC;
825pub const PF_ISDN: c_int = AF_ISDN;
826pub const PF_PHONET: c_int = AF_PHONET;
827pub const PF_IEEE802154: c_int = AF_IEEE802154;
828pub const PF_CAIF: c_int = AF_CAIF;
829pub const PF_ALG: c_int = AF_ALG;
830
831pub const MSG_OOB: c_int = 1;
832pub const MSG_PEEK: c_int = 2;
833pub const MSG_DONTROUTE: c_int = 4;
834pub const MSG_CTRUNC: c_int = 8;
835pub const MSG_TRUNC: c_int = 0x20;
836pub const MSG_DONTWAIT: c_int = 0x40;
837pub const MSG_EOR: c_int = 0x80;
838pub const MSG_WAITALL: c_int = 0x100;
839pub const MSG_FIN: c_int = 0x200;
840pub const MSG_SYN: c_int = 0x400;
841pub const MSG_CONFIRM: c_int = 0x800;
842pub const MSG_RST: c_int = 0x1000;
843pub const MSG_ERRQUEUE: c_int = 0x2000;
844pub const MSG_NOSIGNAL: c_int = 0x4000;
845pub const MSG_MORE: c_int = 0x8000;
846pub const MSG_WAITFORONE: c_int = 0x10000;
847pub const MSG_FASTOPEN: c_int = 0x20000000;
848pub const MSG_CMSG_CLOEXEC: c_int = 0x40000000;
849
850pub const SCM_TIMESTAMP: c_int = SO_TIMESTAMP;
851
852pub const SOCK_RAW: c_int = 3;
853pub const SOCK_RDM: c_int = 4;
854pub const IP_TOS: c_int = 1;
855pub const IP_TTL: c_int = 2;
856pub const IP_HDRINCL: c_int = 3;
857pub const IP_OPTIONS: c_int = 4;
858pub const IP_ROUTER_ALERT: c_int = 5;
859pub const IP_RECVOPTS: c_int = 6;
860pub const IP_RETOPTS: c_int = 7;
861pub const IP_PKTINFO: c_int = 8;
862pub const IP_PKTOPTIONS: c_int = 9;
863pub const IP_MTU_DISCOVER: c_int = 10;
864pub const IP_RECVERR: c_int = 11;
865pub const IP_RECVTTL: c_int = 12;
866pub const IP_RECVTOS: c_int = 13;
867pub const IP_MTU: c_int = 14;
868pub const IP_FREEBIND: c_int = 15;
869pub const IP_IPSEC_POLICY: c_int = 16;
870pub const IP_XFRM_POLICY: c_int = 17;
871pub const IP_PASSSEC: c_int = 18;
872pub const IP_TRANSPARENT: c_int = 19;
873pub const IP_ORIGDSTADDR: c_int = 20;
874pub const IP_RECVORIGDSTADDR: c_int = IP_ORIGDSTADDR;
875pub const IP_MINTTL: c_int = 21;
876pub const IP_NODEFRAG: c_int = 22;
877pub const IP_CHECKSUM: c_int = 23;
878pub const IP_BIND_ADDRESS_NO_PORT: c_int = 24;
879pub const IP_MULTICAST_IF: c_int = 32;
880pub const IP_MULTICAST_TTL: c_int = 33;
881pub const IP_MULTICAST_LOOP: c_int = 34;
882pub const IP_ADD_MEMBERSHIP: c_int = 35;
883pub const IP_DROP_MEMBERSHIP: c_int = 36;
884pub const IP_UNBLOCK_SOURCE: c_int = 37;
885pub const IP_BLOCK_SOURCE: c_int = 38;
886pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 39;
887pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 40;
888pub const IP_MSFILTER: c_int = 41;
889pub const IP_MULTICAST_ALL: c_int = 49;
890pub const IP_UNICAST_IF: c_int = 50;
891
892pub const IP_DEFAULT_MULTICAST_TTL: c_int = 1;
893pub const IP_DEFAULT_MULTICAST_LOOP: c_int = 1;
894
895pub const IP_PMTUDISC_DONT: c_int = 0;
896pub const IP_PMTUDISC_WANT: c_int = 1;
897pub const IP_PMTUDISC_DO: c_int = 2;
898pub const IP_PMTUDISC_PROBE: c_int = 3;
899pub const IP_PMTUDISC_INTERFACE: c_int = 4;
900pub const IP_PMTUDISC_OMIT: c_int = 5;
901
902pub const IPPROTO_HOPOPTS: c_int = 0;
905pub const IPPROTO_IGMP: c_int = 2;
908pub const IPPROTO_IPIP: c_int = 4;
910pub const IPPROTO_EGP: c_int = 8;
913pub const IPPROTO_PUP: c_int = 12;
915pub const IPPROTO_IDP: c_int = 22;
918pub const IPPROTO_TP: c_int = 29;
920pub const IPPROTO_DCCP: c_int = 33;
922pub const IPPROTO_ROUTING: c_int = 43;
925pub const IPPROTO_FRAGMENT: c_int = 44;
927pub const IPPROTO_RSVP: c_int = 46;
929pub const IPPROTO_GRE: c_int = 47;
931pub const IPPROTO_ESP: c_int = 50;
933pub const IPPROTO_AH: c_int = 51;
935pub const IPPROTO_NONE: c_int = 59;
938pub const IPPROTO_DSTOPTS: c_int = 60;
940pub const IPPROTO_MTP: c_int = 92;
941pub const IPPROTO_ENCAP: c_int = 98;
943pub const IPPROTO_PIM: c_int = 103;
945pub const IPPROTO_COMP: c_int = 108;
947pub const IPPROTO_SCTP: c_int = 132;
949pub const IPPROTO_MH: c_int = 135;
950pub const IPPROTO_UDPLITE: c_int = 136;
951pub const IPPROTO_RAW: c_int = 255;
953pub const IPPROTO_BEETPH: c_int = 94;
954pub const IPPROTO_MPLS: c_int = 137;
955pub const IPPROTO_MPTCP: c_int = 262;
957pub const IPPROTO_ETHERNET: c_int = 143;
959
960pub const MCAST_EXCLUDE: c_int = 0;
961pub const MCAST_INCLUDE: c_int = 1;
962pub const MCAST_JOIN_GROUP: c_int = 42;
963pub const MCAST_BLOCK_SOURCE: c_int = 43;
964pub const MCAST_UNBLOCK_SOURCE: c_int = 44;
965pub const MCAST_LEAVE_GROUP: c_int = 45;
966pub const MCAST_JOIN_SOURCE_GROUP: c_int = 46;
967pub const MCAST_LEAVE_SOURCE_GROUP: c_int = 47;
968pub const MCAST_MSFILTER: c_int = 48;
969
970pub const IPV6_ADDRFORM: c_int = 1;
971pub const IPV6_2292PKTINFO: c_int = 2;
972pub const IPV6_2292HOPOPTS: c_int = 3;
973pub const IPV6_2292DSTOPTS: c_int = 4;
974pub const IPV6_2292RTHDR: c_int = 5;
975pub const IPV6_2292PKTOPTIONS: c_int = 6;
976pub const IPV6_CHECKSUM: c_int = 7;
977pub const IPV6_2292HOPLIMIT: c_int = 8;
978pub const IPV6_NEXTHOP: c_int = 9;
979pub const IPV6_AUTHHDR: c_int = 10;
980pub const IPV6_UNICAST_HOPS: c_int = 16;
981pub const IPV6_MULTICAST_IF: c_int = 17;
982pub const IPV6_MULTICAST_HOPS: c_int = 18;
983pub const IPV6_MULTICAST_LOOP: c_int = 19;
984pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
985pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
986pub const IPV6_ROUTER_ALERT: c_int = 22;
987pub const IPV6_MTU_DISCOVER: c_int = 23;
988pub const IPV6_MTU: c_int = 24;
989pub const IPV6_RECVERR: c_int = 25;
990pub const IPV6_V6ONLY: c_int = 26;
991pub const IPV6_JOIN_ANYCAST: c_int = 27;
992pub const IPV6_LEAVE_ANYCAST: c_int = 28;
993pub const IPV6_IPSEC_POLICY: c_int = 34;
994pub const IPV6_XFRM_POLICY: c_int = 35;
995pub const IPV6_HDRINCL: c_int = 36;
996pub const IPV6_RECVPKTINFO: c_int = 49;
997pub const IPV6_PKTINFO: c_int = 50;
998pub const IPV6_RECVHOPLIMIT: c_int = 51;
999pub const IPV6_HOPLIMIT: c_int = 52;
1000pub const IPV6_RECVHOPOPTS: c_int = 53;
1001pub const IPV6_HOPOPTS: c_int = 54;
1002pub const IPV6_RTHDRDSTOPTS: c_int = 55;
1003pub const IPV6_RECVRTHDR: c_int = 56;
1004pub const IPV6_RTHDR: c_int = 57;
1005pub const IPV6_RECVDSTOPTS: c_int = 58;
1006pub const IPV6_DSTOPTS: c_int = 59;
1007pub const IPV6_RECVPATHMTU: c_int = 60;
1008pub const IPV6_PATHMTU: c_int = 61;
1009pub const IPV6_DONTFRAG: c_int = 62;
1010pub const IPV6_RECVTCLASS: c_int = 66;
1011pub const IPV6_TCLASS: c_int = 67;
1012pub const IPV6_AUTOFLOWLABEL: c_int = 70;
1013pub const IPV6_ADDR_PREFERENCES: c_int = 72;
1014pub const IPV6_MINHOPCOUNT: c_int = 73;
1015pub const IPV6_ORIGDSTADDR: c_int = 74;
1016pub const IPV6_RECVORIGDSTADDR: c_int = IPV6_ORIGDSTADDR;
1017pub const IPV6_TRANSPARENT: c_int = 75;
1018pub const IPV6_UNICAST_IF: c_int = 76;
1019pub const IPV6_PREFER_SRC_TMP: c_int = 0x0001;
1020pub const IPV6_PREFER_SRC_PUBLIC: c_int = 0x0002;
1021pub const IPV6_PREFER_SRC_PUBTMP_DEFAULT: c_int = 0x0100;
1022pub const IPV6_PREFER_SRC_COA: c_int = 0x0004;
1023pub const IPV6_PREFER_SRC_HOME: c_int = 0x0400;
1024pub const IPV6_PREFER_SRC_CGA: c_int = 0x0008;
1025pub const IPV6_PREFER_SRC_NONCGA: c_int = 0x0800;
1026
1027pub const IPV6_PMTUDISC_DONT: c_int = 0;
1028pub const IPV6_PMTUDISC_WANT: c_int = 1;
1029pub const IPV6_PMTUDISC_DO: c_int = 2;
1030pub const IPV6_PMTUDISC_PROBE: c_int = 3;
1031pub const IPV6_PMTUDISC_INTERFACE: c_int = 4;
1032pub const IPV6_PMTUDISC_OMIT: c_int = 5;
1033
1034pub const TCP_NODELAY: c_int = 1;
1035pub const TCP_MAXSEG: c_int = 2;
1036pub const TCP_CORK: c_int = 3;
1037pub const TCP_KEEPIDLE: c_int = 4;
1038pub const TCP_KEEPINTVL: c_int = 5;
1039pub const TCP_KEEPCNT: c_int = 6;
1040pub const TCP_SYNCNT: c_int = 7;
1041pub const TCP_LINGER2: c_int = 8;
1042pub const TCP_DEFER_ACCEPT: c_int = 9;
1043pub const TCP_WINDOW_CLAMP: c_int = 10;
1044pub const TCP_INFO: c_int = 11;
1045pub const TCP_QUICKACK: c_int = 12;
1046pub const TCP_CONGESTION: c_int = 13;
1047pub const TCP_MD5SIG: c_int = 14;
1048cfg_if! {
1049 if #[cfg(all(
1050 target_os = "linux",
1051 any(target_env = "gnu", target_env = "musl", target_env = "ohos")
1052 ))] {
1053 pub const TCP_COOKIE_TRANSACTIONS: c_int = 15;
1055 }
1056}
1057pub const TCP_THIN_LINEAR_TIMEOUTS: c_int = 16;
1058pub const TCP_THIN_DUPACK: c_int = 17;
1059pub const TCP_USER_TIMEOUT: c_int = 18;
1060pub const TCP_REPAIR: c_int = 19;
1061pub const TCP_REPAIR_QUEUE: c_int = 20;
1062pub const TCP_QUEUE_SEQ: c_int = 21;
1063pub const TCP_REPAIR_OPTIONS: c_int = 22;
1064pub const TCP_FASTOPEN: c_int = 23;
1065pub const TCP_TIMESTAMP: c_int = 24;
1066pub const TCP_NOTSENT_LOWAT: c_int = 25;
1067pub const TCP_CC_INFO: c_int = 26;
1068pub const TCP_SAVE_SYN: c_int = 27;
1069pub const TCP_SAVED_SYN: c_int = 28;
1070cfg_if! {
1071 if #[cfg(not(target_os = "emscripten"))] {
1072 pub const TCP_REPAIR_WINDOW: c_int = 29;
1075 pub const TCP_FASTOPEN_CONNECT: c_int = 30;
1076 pub const TCP_ULP: c_int = 31;
1077 pub const TCP_MD5SIG_EXT: c_int = 32;
1078 pub const TCP_FASTOPEN_KEY: c_int = 33;
1079 pub const TCP_FASTOPEN_NO_COOKIE: c_int = 34;
1080 pub const TCP_ZEROCOPY_RECEIVE: c_int = 35;
1081 pub const TCP_INQ: c_int = 36;
1082 pub const TCP_CM_INQ: c_int = TCP_INQ;
1083 pub const TCP_MD5SIG_MAXKEYLEN: usize = 80;
1086 }
1087}
1088
1089pub const SO_DEBUG: c_int = 1;
1090
1091pub const SHUT_RD: c_int = 0;
1092pub const SHUT_WR: c_int = 1;
1093pub const SHUT_RDWR: c_int = 2;
1094
1095pub const LOCK_SH: c_int = 1;
1096pub const LOCK_EX: c_int = 2;
1097pub const LOCK_NB: c_int = 4;
1098pub const LOCK_UN: c_int = 8;
1099
1100pub const SS_ONSTACK: c_int = 1;
1101pub const SS_DISABLE: c_int = 2;
1102
1103pub const PATH_MAX: c_int = 4096;
1104
1105pub const UIO_MAXIOV: c_int = 1024;
1106
1107pub const FD_SETSIZE: usize = 1024;
1108
1109pub const EPOLLIN: c_int = 0x1;
1110pub const EPOLLPRI: c_int = 0x2;
1111pub const EPOLLOUT: c_int = 0x4;
1112pub const EPOLLERR: c_int = 0x8;
1113pub const EPOLLHUP: c_int = 0x10;
1114pub const EPOLLRDNORM: c_int = 0x40;
1115pub const EPOLLRDBAND: c_int = 0x80;
1116pub const EPOLLWRNORM: c_int = 0x100;
1117pub const EPOLLWRBAND: c_int = 0x200;
1118pub const EPOLLMSG: c_int = 0x400;
1119pub const EPOLLRDHUP: c_int = 0x2000;
1120pub const EPOLLEXCLUSIVE: c_int = 0x10000000;
1121pub const EPOLLWAKEUP: c_int = 0x20000000;
1122pub const EPOLLONESHOT: c_int = 0x40000000;
1123pub const EPOLLET: c_int = 0x80000000;
1124
1125pub const EPOLL_CTL_ADD: c_int = 1;
1126pub const EPOLL_CTL_MOD: c_int = 3;
1127pub const EPOLL_CTL_DEL: c_int = 2;
1128
1129pub const MNT_FORCE: c_int = 0x1;
1130pub const MNT_DETACH: c_int = 0x2;
1131pub const MNT_EXPIRE: c_int = 0x4;
1132pub const UMOUNT_NOFOLLOW: c_int = 0x8;
1133
1134pub const Q_GETFMT: c_int = 0x800004;
1135pub const Q_GETINFO: c_int = 0x800005;
1136pub const Q_SETINFO: c_int = 0x800006;
1137pub const QIF_BLIMITS: u32 = 1;
1138pub const QIF_SPACE: u32 = 2;
1139pub const QIF_ILIMITS: u32 = 4;
1140pub const QIF_INODES: u32 = 8;
1141pub const QIF_BTIME: u32 = 16;
1142pub const QIF_ITIME: u32 = 32;
1143pub const QIF_LIMITS: u32 = 5;
1144pub const QIF_USAGE: u32 = 10;
1145pub const QIF_TIMES: u32 = 48;
1146pub const QIF_ALL: u32 = 63;
1147
1148pub const Q_SYNC: c_int = 0x800001;
1149pub const Q_QUOTAON: c_int = 0x800002;
1150pub const Q_QUOTAOFF: c_int = 0x800003;
1151pub const Q_GETQUOTA: c_int = 0x800007;
1152pub const Q_SETQUOTA: c_int = 0x800008;
1153
1154pub const TCIOFF: c_int = 2;
1155pub const TCION: c_int = 3;
1156pub const TCOOFF: c_int = 0;
1157pub const TCOON: c_int = 1;
1158pub const TCIFLUSH: c_int = 0;
1159pub const TCOFLUSH: c_int = 1;
1160pub const TCIOFLUSH: c_int = 2;
1161pub const NL0: crate::tcflag_t = 0x00000000;
1162pub const NL1: crate::tcflag_t = 0x00000100;
1163pub const TAB0: crate::tcflag_t = 0x00000000;
1164pub const CR0: crate::tcflag_t = 0x00000000;
1165pub const FF0: crate::tcflag_t = 0x00000000;
1166pub const BS0: crate::tcflag_t = 0x00000000;
1167pub const VT0: crate::tcflag_t = 0x00000000;
1168pub const VERASE: usize = 2;
1169pub const VKILL: usize = 3;
1170pub const VINTR: usize = 0;
1171pub const VQUIT: usize = 1;
1172pub const VLNEXT: usize = 15;
1173pub const IGNBRK: crate::tcflag_t = 0x00000001;
1174pub const BRKINT: crate::tcflag_t = 0x00000002;
1175pub const IGNPAR: crate::tcflag_t = 0x00000004;
1176pub const PARMRK: crate::tcflag_t = 0x00000008;
1177pub const INPCK: crate::tcflag_t = 0x00000010;
1178pub const ISTRIP: crate::tcflag_t = 0x00000020;
1179pub const INLCR: crate::tcflag_t = 0x00000040;
1180pub const IGNCR: crate::tcflag_t = 0x00000080;
1181pub const ICRNL: crate::tcflag_t = 0x00000100;
1182pub const IXANY: crate::tcflag_t = 0x00000800;
1183pub const IMAXBEL: crate::tcflag_t = 0x00002000;
1184pub const OPOST: crate::tcflag_t = 0x1;
1185pub const CS5: crate::tcflag_t = 0x00000000;
1186pub const CRTSCTS: crate::tcflag_t = 0x80000000;
1187pub const ECHO: crate::tcflag_t = 0x00000008;
1188pub const OCRNL: crate::tcflag_t = 0o000010;
1189pub const ONOCR: crate::tcflag_t = 0o000020;
1190pub const ONLRET: crate::tcflag_t = 0o000040;
1191pub const OFILL: crate::tcflag_t = 0o000100;
1192pub const OFDEL: crate::tcflag_t = 0o000200;
1193
1194pub const CLONE_VM: c_int = 0x100;
1195pub const CLONE_FS: c_int = 0x200;
1196pub const CLONE_FILES: c_int = 0x400;
1197pub const CLONE_SIGHAND: c_int = 0x800;
1198pub const CLONE_PTRACE: c_int = 0x2000;
1199pub const CLONE_VFORK: c_int = 0x4000;
1200pub const CLONE_PARENT: c_int = 0x8000;
1201pub const CLONE_THREAD: c_int = 0x10000;
1202pub const CLONE_NEWNS: c_int = 0x20000;
1203pub const CLONE_SYSVSEM: c_int = 0x40000;
1204pub const CLONE_SETTLS: c_int = 0x80000;
1205pub const CLONE_PARENT_SETTID: c_int = 0x100000;
1206pub const CLONE_CHILD_CLEARTID: c_int = 0x200000;
1207pub const CLONE_DETACHED: c_int = 0x400000;
1208pub const CLONE_UNTRACED: c_int = 0x800000;
1209pub const CLONE_CHILD_SETTID: c_int = 0x01000000;
1210pub const CLONE_NEWCGROUP: c_int = 0x02000000;
1211pub const CLONE_NEWUTS: c_int = 0x04000000;
1212pub const CLONE_NEWIPC: c_int = 0x08000000;
1213pub const CLONE_NEWUSER: c_int = 0x10000000;
1214pub const CLONE_NEWPID: c_int = 0x20000000;
1215pub const CLONE_NEWNET: c_int = 0x40000000;
1216pub const CLONE_IO: c_int = 0x80000000;
1217
1218pub const WNOHANG: c_int = 0x00000001;
1219pub const WUNTRACED: c_int = 0x00000002;
1220pub const WSTOPPED: c_int = WUNTRACED;
1221pub const WEXITED: c_int = 0x00000004;
1222pub const WCONTINUED: c_int = 0x00000008;
1223pub const WNOWAIT: c_int = 0x01000000;
1224
1225pub const ADDR_NO_RANDOMIZE: c_int = 0x0040000;
1227pub const MMAP_PAGE_ZERO: c_int = 0x0100000;
1228pub const ADDR_COMPAT_LAYOUT: c_int = 0x0200000;
1229pub const READ_IMPLIES_EXEC: c_int = 0x0400000;
1230pub const ADDR_LIMIT_32BIT: c_int = 0x0800000;
1231pub const SHORT_INODE: c_int = 0x1000000;
1232pub const WHOLE_SECONDS: c_int = 0x2000000;
1233pub const STICKY_TIMEOUTS: c_int = 0x4000000;
1234pub const ADDR_LIMIT_3GB: c_int = 0x8000000;
1235
1236pub const PTRACE_O_TRACESYSGOOD: c_int = 0x00000001;
1238pub const PTRACE_O_TRACEFORK: c_int = 0x00000002;
1239pub const PTRACE_O_TRACEVFORK: c_int = 0x00000004;
1240pub const PTRACE_O_TRACECLONE: c_int = 0x00000008;
1241pub const PTRACE_O_TRACEEXEC: c_int = 0x00000010;
1242pub const PTRACE_O_TRACEVFORKDONE: c_int = 0x00000020;
1243pub const PTRACE_O_TRACEEXIT: c_int = 0x00000040;
1244pub const PTRACE_O_TRACESECCOMP: c_int = 0x00000080;
1245pub const PTRACE_O_SUSPEND_SECCOMP: c_int = 0x00200000;
1246pub const PTRACE_O_EXITKILL: c_int = 0x00100000;
1247pub const PTRACE_O_MASK: c_int = 0x003000ff;
1248
1249pub const PTRACE_EVENT_FORK: c_int = 1;
1251pub const PTRACE_EVENT_VFORK: c_int = 2;
1252pub const PTRACE_EVENT_CLONE: c_int = 3;
1253pub const PTRACE_EVENT_EXEC: c_int = 4;
1254pub const PTRACE_EVENT_VFORK_DONE: c_int = 5;
1255pub const PTRACE_EVENT_EXIT: c_int = 6;
1256pub const PTRACE_EVENT_SECCOMP: c_int = 7;
1257
1258pub const __WNOTHREAD: c_int = 0x20000000;
1259pub const __WALL: c_int = 0x40000000;
1260pub const __WCLONE: c_int = 0x80000000;
1261
1262pub const SPLICE_F_MOVE: c_uint = 0x01;
1263pub const SPLICE_F_NONBLOCK: c_uint = 0x02;
1264pub const SPLICE_F_MORE: c_uint = 0x04;
1265pub const SPLICE_F_GIFT: c_uint = 0x08;
1266
1267pub const RTLD_LOCAL: c_int = 0;
1268pub const RTLD_LAZY: c_int = 1;
1269
1270pub const POSIX_FADV_NORMAL: c_int = 0;
1271pub const POSIX_FADV_RANDOM: c_int = 1;
1272pub const POSIX_FADV_SEQUENTIAL: c_int = 2;
1273pub const POSIX_FADV_WILLNEED: c_int = 3;
1274
1275pub const AT_FDCWD: c_int = -100;
1276pub const AT_SYMLINK_NOFOLLOW: c_int = 0x100;
1277pub const AT_REMOVEDIR: c_int = 0x200;
1278pub const AT_SYMLINK_FOLLOW: c_int = 0x400;
1279pub const AT_NO_AUTOMOUNT: c_int = 0x800;
1280pub const AT_EMPTY_PATH: c_int = 0x1000;
1281pub const AT_RECURSIVE: c_int = 0x8000;
1282
1283pub const LOG_CRON: c_int = 9 << 3;
1284pub const LOG_AUTHPRIV: c_int = 10 << 3;
1285pub const LOG_FTP: c_int = 11 << 3;
1286pub const LOG_PERROR: c_int = 0x20;
1287
1288pub const PIPE_BUF: usize = 4096;
1289
1290pub const SI_LOAD_SHIFT: c_uint = 16;
1291
1292pub const SI_USER: c_int = 0;
1294pub const SI_KERNEL: c_int = 0x80;
1295pub const SI_QUEUE: c_int = -1;
1296pub const SI_TIMER: c_int = -2;
1297pub const SI_MESGQ: c_int = -3;
1298pub const SI_ASYNCIO: c_int = -4;
1299pub const SI_SIGIO: c_int = -5;
1300pub const SI_TKILL: c_int = -6;
1301pub const SI_ASYNCNL: c_int = -60;
1302
1303pub const BUS_ADRALN: c_int = 1;
1305pub const BUS_ADRERR: c_int = 2;
1306pub const BUS_OBJERR: c_int = 3;
1307pub const BUS_MCEERR_AR: c_int = 4;
1309pub const BUS_MCEERR_AO: c_int = 5;
1310
1311pub const TRAP_BRKPT: c_int = 1;
1313pub const TRAP_TRACE: c_int = 2;
1314pub const TRAP_BRANCH: c_int = 3;
1315pub const TRAP_HWBKPT: c_int = 4;
1316pub const TRAP_UNK: c_int = 5;
1317
1318pub const CLD_EXITED: c_int = 1;
1320pub const CLD_KILLED: c_int = 2;
1321pub const CLD_DUMPED: c_int = 3;
1322pub const CLD_TRAPPED: c_int = 4;
1323pub const CLD_STOPPED: c_int = 5;
1324pub const CLD_CONTINUED: c_int = 6;
1325
1326pub const SIGEV_SIGNAL: c_int = 0;
1327pub const SIGEV_NONE: c_int = 1;
1328pub const SIGEV_THREAD: c_int = 2;
1329
1330pub const P_ALL: idtype_t = 0;
1331pub const P_PID: idtype_t = 1;
1332pub const P_PGID: idtype_t = 2;
1333cfg_if! {
1334 if #[cfg(not(target_os = "emscripten"))] {
1335 pub const P_PIDFD: idtype_t = 3;
1336 }
1337}
1338
1339pub const UTIME_OMIT: c_long = 1073741822;
1340pub const UTIME_NOW: c_long = 1073741823;
1341
1342pub const POLLIN: c_short = 0x1;
1343pub const POLLPRI: c_short = 0x2;
1344pub const POLLOUT: c_short = 0x4;
1345pub const POLLERR: c_short = 0x8;
1346pub const POLLHUP: c_short = 0x10;
1347pub const POLLNVAL: c_short = 0x20;
1348pub const POLLRDNORM: c_short = 0x040;
1349pub const POLLRDBAND: c_short = 0x080;
1350#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
1351pub const POLLRDHUP: c_short = 0x2000;
1352#[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
1353pub const POLLRDHUP: c_short = 0x800;
1354
1355pub const IPTOS_LOWDELAY: u8 = 0x10;
1356pub const IPTOS_THROUGHPUT: u8 = 0x08;
1357pub const IPTOS_RELIABILITY: u8 = 0x04;
1358pub const IPTOS_MINCOST: u8 = 0x02;
1359
1360pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0;
1361pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0;
1362pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0;
1363pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80;
1364pub const IPTOS_PREC_FLASH: u8 = 0x60;
1365pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40;
1366pub const IPTOS_PREC_PRIORITY: u8 = 0x20;
1367pub const IPTOS_PREC_ROUTINE: u8 = 0x00;
1368
1369pub const IPTOS_ECN_MASK: u8 = 0x03;
1370pub const IPTOS_ECN_ECT1: u8 = 0x01;
1371pub const IPTOS_ECN_ECT0: u8 = 0x02;
1372pub const IPTOS_ECN_CE: u8 = 0x03;
1373
1374pub const IPOPT_COPY: u8 = 0x80;
1375pub const IPOPT_CLASS_MASK: u8 = 0x60;
1376pub const IPOPT_NUMBER_MASK: u8 = 0x1f;
1377
1378pub const IPOPT_CONTROL: u8 = 0x00;
1379pub const IPOPT_RESERVED1: u8 = 0x20;
1380pub const IPOPT_MEASUREMENT: u8 = 0x40;
1381pub const IPOPT_RESERVED2: u8 = 0x60;
1382pub const IPOPT_END: u8 = 0 | IPOPT_CONTROL;
1383pub const IPOPT_NOOP: u8 = 1 | IPOPT_CONTROL;
1384pub const IPOPT_SEC: u8 = 2 | IPOPT_CONTROL | IPOPT_COPY;
1385pub const IPOPT_LSRR: u8 = 3 | IPOPT_CONTROL | IPOPT_COPY;
1386pub const IPOPT_TIMESTAMP: u8 = 4 | IPOPT_MEASUREMENT;
1387pub const IPOPT_RR: u8 = 7 | IPOPT_CONTROL;
1388pub const IPOPT_SID: u8 = 8 | IPOPT_CONTROL | IPOPT_COPY;
1389pub const IPOPT_SSRR: u8 = 9 | IPOPT_CONTROL | IPOPT_COPY;
1390pub const IPOPT_RA: u8 = 20 | IPOPT_CONTROL | IPOPT_COPY;
1391pub const IPVERSION: u8 = 4;
1392pub const MAXTTL: u8 = 255;
1393pub const IPDEFTTL: u8 = 64;
1394pub const IPOPT_OPTVAL: u8 = 0;
1395pub const IPOPT_OLEN: u8 = 1;
1396pub const IPOPT_OFFSET: u8 = 2;
1397pub const IPOPT_MINOFF: u8 = 4;
1398pub const MAX_IPOPTLEN: u8 = 40;
1399pub const IPOPT_NOP: u8 = IPOPT_NOOP;
1400pub const IPOPT_EOL: u8 = IPOPT_END;
1401pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP;
1402pub const IPOPT_TS_TSONLY: u8 = 0;
1403pub const IPOPT_TS_TSANDADDR: u8 = 1;
1404pub const IPOPT_TS_PRESPEC: u8 = 3;
1405
1406pub const ARPOP_RREQUEST: u16 = 3;
1407pub const ARPOP_RREPLY: u16 = 4;
1408pub const ARPOP_InREQUEST: u16 = 8;
1409pub const ARPOP_InREPLY: u16 = 9;
1410pub const ARPOP_NAK: u16 = 10;
1411
1412pub const ATF_NETMASK: c_int = 0x20;
1413pub const ATF_DONTPUB: c_int = 0x40;
1414
1415pub const ARPHRD_NETROM: u16 = 0;
1416pub const ARPHRD_ETHER: u16 = 1;
1417pub const ARPHRD_EETHER: u16 = 2;
1418pub const ARPHRD_AX25: u16 = 3;
1419pub const ARPHRD_PRONET: u16 = 4;
1420pub const ARPHRD_CHAOS: u16 = 5;
1421pub const ARPHRD_IEEE802: u16 = 6;
1422pub const ARPHRD_ARCNET: u16 = 7;
1423pub const ARPHRD_APPLETLK: u16 = 8;
1424pub const ARPHRD_DLCI: u16 = 15;
1425pub const ARPHRD_ATM: u16 = 19;
1426pub const ARPHRD_METRICOM: u16 = 23;
1427pub const ARPHRD_IEEE1394: u16 = 24;
1428pub const ARPHRD_EUI64: u16 = 27;
1429pub const ARPHRD_INFINIBAND: u16 = 32;
1430
1431pub const ARPHRD_SLIP: u16 = 256;
1432pub const ARPHRD_CSLIP: u16 = 257;
1433pub const ARPHRD_SLIP6: u16 = 258;
1434pub const ARPHRD_CSLIP6: u16 = 259;
1435pub const ARPHRD_RSRVD: u16 = 260;
1436pub const ARPHRD_ADAPT: u16 = 264;
1437pub const ARPHRD_ROSE: u16 = 270;
1438pub const ARPHRD_X25: u16 = 271;
1439pub const ARPHRD_HWX25: u16 = 272;
1440pub const ARPHRD_CAN: u16 = 280;
1441pub const ARPHRD_PPP: u16 = 512;
1442pub const ARPHRD_CISCO: u16 = 513;
1443pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO;
1444pub const ARPHRD_LAPB: u16 = 516;
1445pub const ARPHRD_DDCMP: u16 = 517;
1446pub const ARPHRD_RAWHDLC: u16 = 518;
1447
1448pub const ARPHRD_TUNNEL: u16 = 768;
1449pub const ARPHRD_TUNNEL6: u16 = 769;
1450pub const ARPHRD_FRAD: u16 = 770;
1451pub const ARPHRD_SKIP: u16 = 771;
1452pub const ARPHRD_LOOPBACK: u16 = 772;
1453pub const ARPHRD_LOCALTLK: u16 = 773;
1454pub const ARPHRD_FDDI: u16 = 774;
1455pub const ARPHRD_BIF: u16 = 775;
1456pub const ARPHRD_SIT: u16 = 776;
1457pub const ARPHRD_IPDDP: u16 = 777;
1458pub const ARPHRD_IPGRE: u16 = 778;
1459pub const ARPHRD_PIMREG: u16 = 779;
1460pub const ARPHRD_HIPPI: u16 = 780;
1461pub const ARPHRD_ASH: u16 = 781;
1462pub const ARPHRD_ECONET: u16 = 782;
1463pub const ARPHRD_IRDA: u16 = 783;
1464pub const ARPHRD_FCPP: u16 = 784;
1465pub const ARPHRD_FCAL: u16 = 785;
1466pub const ARPHRD_FCPL: u16 = 786;
1467pub const ARPHRD_FCFABRIC: u16 = 787;
1468pub const ARPHRD_IEEE802_TR: u16 = 800;
1469pub const ARPHRD_IEEE80211: u16 = 801;
1470pub const ARPHRD_IEEE80211_PRISM: u16 = 802;
1471pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803;
1472pub const ARPHRD_IEEE802154: u16 = 804;
1473
1474pub const ARPHRD_VOID: u16 = 0xFFFF;
1475pub const ARPHRD_NONE: u16 = 0xFFFE;
1476
1477cfg_if! {
1478 if #[cfg(target_os = "emscripten")] {
1479 } else if #[cfg(not(target_arch = "s390x"))] {
1481 pub const ADFS_SUPER_MAGIC: c_long = 0x0000adf5;
1482 pub const AFFS_SUPER_MAGIC: c_long = 0x0000adff;
1483 pub const AFS_SUPER_MAGIC: c_long = 0x5346414f;
1484 pub const AUTOFS_SUPER_MAGIC: c_long = 0x0187;
1485 pub const BPF_FS_MAGIC: c_long = 0xcafe4a11;
1486 pub const BTRFS_SUPER_MAGIC: c_long = 0x9123683e;
1487 pub const CGROUP2_SUPER_MAGIC: c_long = 0x63677270;
1488 pub const CGROUP_SUPER_MAGIC: c_long = 0x27e0eb;
1489 pub const CODA_SUPER_MAGIC: c_long = 0x73757245;
1490 pub const CRAMFS_MAGIC: c_long = 0x28cd3d45;
1491 pub const DEBUGFS_MAGIC: c_long = 0x64626720;
1492 pub const DEVPTS_SUPER_MAGIC: c_long = 0x1cd1;
1493 pub const ECRYPTFS_SUPER_MAGIC: c_long = 0xf15f;
1494 pub const EFS_SUPER_MAGIC: c_long = 0x00414a53;
1495 pub const EXT2_SUPER_MAGIC: c_long = 0x0000ef53;
1496 pub const EXT3_SUPER_MAGIC: c_long = 0x0000ef53;
1497 pub const EXT4_SUPER_MAGIC: c_long = 0x0000ef53;
1498 pub const F2FS_SUPER_MAGIC: c_long = 0xf2f52010;
1499 pub const FUSE_SUPER_MAGIC: c_long = 0x65735546;
1500 pub const FUTEXFS_SUPER_MAGIC: c_long = 0xbad1dea;
1501 pub const HOSTFS_SUPER_MAGIC: c_long = 0x00c0ffee;
1502 pub const HPFS_SUPER_MAGIC: c_long = 0xf995e849;
1503 pub const HUGETLBFS_MAGIC: c_long = 0x958458f6;
1504 pub const ISOFS_SUPER_MAGIC: c_long = 0x00009660;
1505 pub const JFFS2_SUPER_MAGIC: c_long = 0x000072b6;
1506 pub const MINIX2_SUPER_MAGIC2: c_long = 0x00002478;
1507 pub const MINIX2_SUPER_MAGIC: c_long = 0x00002468;
1508 pub const MINIX3_SUPER_MAGIC: c_long = 0x4d5a;
1509 pub const MINIX_SUPER_MAGIC2: c_long = 0x0000138f;
1510 pub const MINIX_SUPER_MAGIC: c_long = 0x0000137f;
1511 pub const MSDOS_SUPER_MAGIC: c_long = 0x00004d44;
1512 pub const NCP_SUPER_MAGIC: c_long = 0x0000564c;
1513 pub const NFS_SUPER_MAGIC: c_long = 0x00006969;
1514 pub const NILFS_SUPER_MAGIC: c_long = 0x3434;
1515 pub const OCFS2_SUPER_MAGIC: c_long = 0x7461636f;
1516 pub const OPENPROM_SUPER_MAGIC: c_long = 0x00009fa1;
1517 pub const OVERLAYFS_SUPER_MAGIC: c_long = 0x794c7630;
1518 pub const PROC_SUPER_MAGIC: c_long = 0x00009fa0;
1519 pub const QNX4_SUPER_MAGIC: c_long = 0x0000002f;
1520 pub const QNX6_SUPER_MAGIC: c_long = 0x68191122;
1521 pub const RDTGROUP_SUPER_MAGIC: c_long = 0x7655821;
1522 pub const REISERFS_SUPER_MAGIC: c_long = 0x52654973;
1523 pub const SECURITYFS_MAGIC: c_long = 0x73636673;
1524 pub const SELINUX_MAGIC: c_long = 0xf97cff8c;
1525 pub const SMACK_MAGIC: c_long = 0x43415d53;
1526 pub const SMB_SUPER_MAGIC: c_long = 0x0000517b;
1527 pub const SYSFS_MAGIC: c_long = 0x62656572;
1528 pub const TMPFS_MAGIC: c_long = 0x01021994;
1529 pub const TRACEFS_MAGIC: c_long = 0x74726163;
1530 pub const UDF_SUPER_MAGIC: c_long = 0x15013346;
1531 pub const USBDEVICE_SUPER_MAGIC: c_long = 0x00009fa2;
1532 pub const XENFS_SUPER_MAGIC: c_long = 0xabba1974;
1533 pub const NSFS_MAGIC: c_long = 0x6e736673;
1534 } else if #[cfg(target_arch = "s390x")] {
1535 pub const ADFS_SUPER_MAGIC: c_uint = 0x0000adf5;
1536 pub const AFFS_SUPER_MAGIC: c_uint = 0x0000adff;
1537 pub const AFS_SUPER_MAGIC: c_uint = 0x5346414f;
1538 pub const AUTOFS_SUPER_MAGIC: c_uint = 0x0187;
1539 pub const BPF_FS_MAGIC: c_uint = 0xcafe4a11;
1540 pub const BTRFS_SUPER_MAGIC: c_uint = 0x9123683e;
1541 pub const CGROUP2_SUPER_MAGIC: c_uint = 0x63677270;
1542 pub const CGROUP_SUPER_MAGIC: c_uint = 0x27e0eb;
1543 pub const CODA_SUPER_MAGIC: c_uint = 0x73757245;
1544 pub const CRAMFS_MAGIC: c_uint = 0x28cd3d45;
1545 pub const DEBUGFS_MAGIC: c_uint = 0x64626720;
1546 pub const DEVPTS_SUPER_MAGIC: c_uint = 0x1cd1;
1547 pub const ECRYPTFS_SUPER_MAGIC: c_uint = 0xf15f;
1548 pub const EFS_SUPER_MAGIC: c_uint = 0x00414a53;
1549 pub const EXT2_SUPER_MAGIC: c_uint = 0x0000ef53;
1550 pub const EXT3_SUPER_MAGIC: c_uint = 0x0000ef53;
1551 pub const EXT4_SUPER_MAGIC: c_uint = 0x0000ef53;
1552 pub const F2FS_SUPER_MAGIC: c_uint = 0xf2f52010;
1553 pub const FUSE_SUPER_MAGIC: c_uint = 0x65735546;
1554 pub const FUTEXFS_SUPER_MAGIC: c_uint = 0xbad1dea;
1555 pub const HOSTFS_SUPER_MAGIC: c_uint = 0x00c0ffee;
1556 pub const HPFS_SUPER_MAGIC: c_uint = 0xf995e849;
1557 pub const HUGETLBFS_MAGIC: c_uint = 0x958458f6;
1558 pub const ISOFS_SUPER_MAGIC: c_uint = 0x00009660;
1559 pub const JFFS2_SUPER_MAGIC: c_uint = 0x000072b6;
1560 pub const MINIX2_SUPER_MAGIC2: c_uint = 0x00002478;
1561 pub const MINIX2_SUPER_MAGIC: c_uint = 0x00002468;
1562 pub const MINIX3_SUPER_MAGIC: c_uint = 0x4d5a;
1563 pub const MINIX_SUPER_MAGIC2: c_uint = 0x0000138f;
1564 pub const MINIX_SUPER_MAGIC: c_uint = 0x0000137f;
1565 pub const MSDOS_SUPER_MAGIC: c_uint = 0x00004d44;
1566 pub const NCP_SUPER_MAGIC: c_uint = 0x0000564c;
1567 pub const NFS_SUPER_MAGIC: c_uint = 0x00006969;
1568 pub const NILFS_SUPER_MAGIC: c_uint = 0x3434;
1569 pub const OCFS2_SUPER_MAGIC: c_uint = 0x7461636f;
1570 pub const OPENPROM_SUPER_MAGIC: c_uint = 0x00009fa1;
1571 pub const OVERLAYFS_SUPER_MAGIC: c_uint = 0x794c7630;
1572 pub const PROC_SUPER_MAGIC: c_uint = 0x00009fa0;
1573 pub const QNX4_SUPER_MAGIC: c_uint = 0x0000002f;
1574 pub const QNX6_SUPER_MAGIC: c_uint = 0x68191122;
1575 pub const RDTGROUP_SUPER_MAGIC: c_uint = 0x7655821;
1576 pub const REISERFS_SUPER_MAGIC: c_uint = 0x52654973;
1577 pub const SECURITYFS_MAGIC: c_uint = 0x73636673;
1578 pub const SELINUX_MAGIC: c_uint = 0xf97cff8c;
1579 pub const SMACK_MAGIC: c_uint = 0x43415d53;
1580 pub const SMB_SUPER_MAGIC: c_uint = 0x0000517b;
1581 pub const SYSFS_MAGIC: c_uint = 0x62656572;
1582 pub const TMPFS_MAGIC: c_uint = 0x01021994;
1583 pub const TRACEFS_MAGIC: c_uint = 0x74726163;
1584 pub const UDF_SUPER_MAGIC: c_uint = 0x15013346;
1585 pub const USBDEVICE_SUPER_MAGIC: c_uint = 0x00009fa2;
1586 pub const XENFS_SUPER_MAGIC: c_uint = 0xabba1974;
1587 pub const NSFS_MAGIC: c_uint = 0x6e736673;
1588 }
1589}
1590
1591cfg_if! {
1592 if #[cfg(any(target_env = "gnu", target_os = "android"))] {
1593 pub const AT_STATX_SYNC_TYPE: c_int = 0x6000;
1594 pub const AT_STATX_SYNC_AS_STAT: c_int = 0x0000;
1595 pub const AT_STATX_FORCE_SYNC: c_int = 0x2000;
1596 pub const AT_STATX_DONT_SYNC: c_int = 0x4000;
1597 pub const STATX_TYPE: c_uint = 0x0001;
1598 pub const STATX_MODE: c_uint = 0x0002;
1599 pub const STATX_NLINK: c_uint = 0x0004;
1600 pub const STATX_UID: c_uint = 0x0008;
1601 pub const STATX_GID: c_uint = 0x0010;
1602 pub const STATX_ATIME: c_uint = 0x0020;
1603 pub const STATX_MTIME: c_uint = 0x0040;
1604 pub const STATX_CTIME: c_uint = 0x0080;
1605 pub const STATX_INO: c_uint = 0x0100;
1606 pub const STATX_SIZE: c_uint = 0x0200;
1607 pub const STATX_BLOCKS: c_uint = 0x0400;
1608 pub const STATX_BASIC_STATS: c_uint = 0x07ff;
1609 pub const STATX_BTIME: c_uint = 0x0800;
1610 pub const STATX_ALL: c_uint = 0x0fff;
1611 pub const STATX_MNT_ID: c_uint = 0x1000;
1612 pub const STATX_DIOALIGN: c_uint = 0x2000;
1613 pub const STATX__RESERVED: c_int = 0x80000000;
1614 pub const STATX_ATTR_COMPRESSED: c_int = 0x0004;
1615 pub const STATX_ATTR_IMMUTABLE: c_int = 0x0010;
1616 pub const STATX_ATTR_APPEND: c_int = 0x0020;
1617 pub const STATX_ATTR_NODUMP: c_int = 0x0040;
1618 pub const STATX_ATTR_ENCRYPTED: c_int = 0x0800;
1619 pub const STATX_ATTR_AUTOMOUNT: c_int = 0x1000;
1620 pub const STATX_ATTR_MOUNT_ROOT: c_int = 0x2000;
1621 pub const STATX_ATTR_VERITY: c_int = 0x100000;
1622 pub const STATX_ATTR_DAX: c_int = 0x200000;
1623 }
1624}
1625
1626const_fn! {
1627 {const} fn CMSG_ALIGN(len: usize) -> usize {
1628 len + mem::size_of::<usize>() - 1 & !(mem::size_of::<usize>() - 1)
1629 }
1630}
1631
1632f! {
1633 pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
1634 if (*mhdr).msg_controllen as usize >= mem::size_of::<cmsghdr>() {
1635 (*mhdr).msg_control as *mut cmsghdr
1636 } else {
1637 0 as *mut cmsghdr
1638 }
1639 }
1640
1641 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
1642 cmsg.offset(1) as *mut c_uchar
1643 }
1644
1645 pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
1646 (CMSG_ALIGN(length as usize) + CMSG_ALIGN(mem::size_of::<cmsghdr>())) as c_uint
1647 }
1648
1649 pub {const} fn CMSG_LEN(length: c_uint) -> c_uint {
1650 CMSG_ALIGN(mem::size_of::<cmsghdr>()) as c_uint + length
1651 }
1652
1653 pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () {
1654 let fd = fd as usize;
1655 let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
1656 (*set).fds_bits[fd / size] &= !(1 << (fd % size));
1657 return;
1658 }
1659
1660 pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool {
1661 let fd = fd as usize;
1662 let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
1663 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0;
1664 }
1665
1666 pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () {
1667 let fd = fd as usize;
1668 let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
1669 (*set).fds_bits[fd / size] |= 1 << (fd % size);
1670 return;
1671 }
1672
1673 pub fn FD_ZERO(set: *mut fd_set) -> () {
1674 for slot in (*set).fds_bits.iter_mut() {
1675 *slot = 0;
1676 }
1677 }
1678}
1679
1680safe_f! {
1681 pub fn SIGRTMAX() -> c_int {
1682 unsafe { __libc_current_sigrtmax() }
1683 }
1684
1685 pub fn SIGRTMIN() -> c_int {
1686 unsafe { __libc_current_sigrtmin() }
1687 }
1688
1689 pub {const} fn WIFSTOPPED(status: c_int) -> bool {
1690 (status & 0xff) == 0x7f
1691 }
1692
1693 pub {const} fn WSTOPSIG(status: c_int) -> c_int {
1694 (status >> 8) & 0xff
1695 }
1696
1697 pub {const} fn WIFCONTINUED(status: c_int) -> bool {
1698 status == 0xffff
1699 }
1700
1701 pub {const} fn WIFSIGNALED(status: c_int) -> bool {
1702 ((status & 0x7f) + 1) as i8 >= 2
1703 }
1704
1705 pub {const} fn WTERMSIG(status: c_int) -> c_int {
1706 status & 0x7f
1707 }
1708
1709 pub {const} fn WIFEXITED(status: c_int) -> bool {
1710 (status & 0x7f) == 0
1711 }
1712
1713 pub {const} fn WEXITSTATUS(status: c_int) -> c_int {
1714 (status >> 8) & 0xff
1715 }
1716
1717 pub {const} fn WCOREDUMP(status: c_int) -> bool {
1718 (status & 0x80) != 0
1719 }
1720
1721 pub {const} fn W_EXITCODE(ret: c_int, sig: c_int) -> c_int {
1722 (ret << 8) | sig
1723 }
1724
1725 pub {const} fn W_STOPCODE(sig: c_int) -> c_int {
1726 (sig << 8) | 0x7f
1727 }
1728
1729 pub {const} fn QCMD(cmd: c_int, type_: c_int) -> c_int {
1730 (cmd << 8) | (type_ & 0x00ff)
1731 }
1732
1733 pub {const} fn IPOPT_COPIED(o: u8) -> u8 {
1734 o & IPOPT_COPY
1735 }
1736
1737 pub {const} fn IPOPT_CLASS(o: u8) -> u8 {
1738 o & IPOPT_CLASS_MASK
1739 }
1740
1741 pub {const} fn IPOPT_NUMBER(o: u8) -> u8 {
1742 o & IPOPT_NUMBER_MASK
1743 }
1744
1745 pub {const} fn IPTOS_ECN(x: u8) -> u8 {
1746 x & crate::IPTOS_ECN_MASK
1747 }
1748
1749 #[allow(ellipsis_inclusive_range_patterns)]
1750 pub {const} fn KERNEL_VERSION(a: u32, b: u32, c: u32) -> u32 {
1751 ((a << 16) + (b << 8))
1752 + match c {
1753 0..=255 => c,
1754 _ => 255,
1755 }
1756 }
1757}
1758
1759extern "C" {
1760 #[doc(hidden)]
1761 pub fn __libc_current_sigrtmax() -> c_int;
1762 #[doc(hidden)]
1763 pub fn __libc_current_sigrtmin() -> c_int;
1764
1765 pub fn sem_destroy(sem: *mut sem_t) -> c_int;
1766 pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int;
1767 pub fn fdatasync(fd: c_int) -> c_int;
1768 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar) -> c_int;
1769
1770 pub fn clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
1771 pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
1772 pub fn clock_settime(clk_id: crate::clockid_t, tp: *const crate::timespec) -> c_int;
1773 pub fn clock_getcpuclockid(pid: crate::pid_t, clk_id: *mut crate::clockid_t) -> c_int;
1774
1775 pub fn dirfd(dirp: *mut crate::DIR) -> c_int;
1776
1777 pub fn pthread_getattr_np(native: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
1778 pub fn pthread_attr_getstack(
1779 attr: *const crate::pthread_attr_t,
1780 stackaddr: *mut *mut c_void,
1781 stacksize: *mut size_t,
1782 ) -> c_int;
1783 pub fn memalign(align: size_t, size: size_t) -> *mut c_void;
1784 pub fn setgroups(ngroups: size_t, ptr: *const crate::gid_t) -> c_int;
1785 pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int;
1786 pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
1787 pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;
1788 pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
1789 pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int;
1790 pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
1791 pub fn utimensat(
1792 dirfd: c_int,
1793 path: *const c_char,
1794 times: *const crate::timespec,
1795 flag: c_int,
1796 ) -> c_int;
1797 pub fn duplocale(base: crate::locale_t) -> crate::locale_t;
1798 pub fn freelocale(loc: crate::locale_t);
1799 pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t;
1800 pub fn uselocale(loc: crate::locale_t) -> crate::locale_t;
1801 pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t, dev: dev_t)
1802 -> c_int;
1803 pub fn pthread_condattr_getclock(
1804 attr: *const pthread_condattr_t,
1805 clock_id: *mut clockid_t,
1806 ) -> c_int;
1807 pub fn pthread_condattr_setclock(
1808 attr: *mut pthread_condattr_t,
1809 clock_id: crate::clockid_t,
1810 ) -> c_int;
1811 pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: c_int) -> c_int;
1812 pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int;
1813 pub fn pthread_rwlockattr_getpshared(
1814 attr: *const pthread_rwlockattr_t,
1815 val: *mut c_int,
1816 ) -> c_int;
1817 pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: c_int) -> c_int;
1818 pub fn ptsname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
1819 pub fn clearenv() -> c_int;
1820 pub fn waitid(
1821 idtype: idtype_t,
1822 id: id_t,
1823 infop: *mut crate::siginfo_t,
1824 options: c_int,
1825 ) -> c_int;
1826 pub fn getresuid(
1827 ruid: *mut crate::uid_t,
1828 euid: *mut crate::uid_t,
1829 suid: *mut crate::uid_t,
1830 ) -> c_int;
1831 pub fn getresgid(
1832 rgid: *mut crate::gid_t,
1833 egid: *mut crate::gid_t,
1834 sgid: *mut crate::gid_t,
1835 ) -> c_int;
1836 pub fn acct(filename: *const c_char) -> c_int;
1837 pub fn brk(addr: *mut c_void) -> c_int;
1838 pub fn sbrk(increment: intptr_t) -> *mut c_void;
1839 #[deprecated(
1840 since = "0.2.66",
1841 note = "causes memory corruption, see rust-lang/libc#1596"
1842 )]
1843 pub fn vfork() -> crate::pid_t;
1844 pub fn setresgid(rgid: crate::gid_t, egid: crate::gid_t, sgid: crate::gid_t) -> c_int;
1845 pub fn setresuid(ruid: crate::uid_t, euid: crate::uid_t, suid: crate::uid_t) -> c_int;
1846 pub fn wait4(
1847 pid: crate::pid_t,
1848 status: *mut c_int,
1849 options: c_int,
1850 rusage: *mut crate::rusage,
1851 ) -> crate::pid_t;
1852 pub fn login_tty(fd: c_int) -> c_int;
1853
1854 pub fn execvpe(
1856 file: *const c_char,
1857 argv: *const *const c_char,
1858 envp: *const *const c_char,
1859 ) -> c_int;
1860 pub fn fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int;
1861
1862 pub fn getifaddrs(ifap: *mut *mut crate::ifaddrs) -> c_int;
1863 pub fn freeifaddrs(ifa: *mut crate::ifaddrs);
1864 pub fn bind(
1865 socket: c_int,
1866 address: *const crate::sockaddr,
1867 address_len: crate::socklen_t,
1868 ) -> c_int;
1869
1870 pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
1871 pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
1872
1873 pub fn sendmsg(fd: c_int, msg: *const crate::msghdr, flags: c_int) -> ssize_t;
1874 pub fn recvmsg(fd: c_int, msg: *mut crate::msghdr, flags: c_int) -> ssize_t;
1875 pub fn uname(buf: *mut crate::utsname) -> c_int;
1876
1877 pub fn strchrnul(s: *const c_char, c: c_int) -> *mut c_char;
1878
1879 pub fn strftime(
1880 s: *mut c_char,
1881 max: size_t,
1882 format: *const c_char,
1883 tm: *const crate::tm,
1884 ) -> size_t;
1885 pub fn strftime_l(
1886 s: *mut c_char,
1887 max: size_t,
1888 format: *const c_char,
1889 tm: *const crate::tm,
1890 locale: crate::locale_t,
1891 ) -> size_t;
1892 pub fn strptime(s: *const c_char, format: *const c_char, tm: *mut crate::tm) -> *mut c_char;
1893
1894 pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int;
1895 pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int;
1896
1897 pub fn getdomainname(name: *mut c_char, len: size_t) -> c_int;
1898 pub fn setdomainname(name: *const c_char, len: size_t) -> c_int;
1899}
1900
1901cfg_if! {
1906 if #[cfg(not(any(target_env = "musl", target_os = "emscripten")))] {
1907 extern "C" {
1908 pub fn fstatfs64(fd: c_int, buf: *mut statfs64) -> c_int;
1909 pub fn statvfs64(path: *const c_char, buf: *mut statvfs64) -> c_int;
1910 pub fn fstatvfs64(fd: c_int, buf: *mut statvfs64) -> c_int;
1911 pub fn statfs64(path: *const c_char, buf: *mut statfs64) -> c_int;
1912 pub fn creat64(path: *const c_char, mode: mode_t) -> c_int;
1913 pub fn fstat64(fildes: c_int, buf: *mut stat64) -> c_int;
1914 pub fn fstatat64(
1915 dirfd: c_int,
1916 pathname: *const c_char,
1917 buf: *mut stat64,
1918 flags: c_int,
1919 ) -> c_int;
1920 pub fn ftruncate64(fd: c_int, length: off64_t) -> c_int;
1921 pub fn lseek64(fd: c_int, offset: off64_t, whence: c_int) -> off64_t;
1922 pub fn lstat64(path: *const c_char, buf: *mut stat64) -> c_int;
1923 pub fn mmap64(
1924 addr: *mut c_void,
1925 len: size_t,
1926 prot: c_int,
1927 flags: c_int,
1928 fd: c_int,
1929 offset: off64_t,
1930 ) -> *mut c_void;
1931 pub fn open64(path: *const c_char, oflag: c_int, ...) -> c_int;
1932 pub fn openat64(fd: c_int, path: *const c_char, oflag: c_int, ...) -> c_int;
1933 pub fn posix_fadvise64(
1934 fd: c_int,
1935 offset: off64_t,
1936 len: off64_t,
1937 advise: c_int,
1938 ) -> c_int;
1939 pub fn pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: off64_t) -> ssize_t;
1940 pub fn pwrite64(
1941 fd: c_int,
1942 buf: *const c_void,
1943 count: size_t,
1944 offset: off64_t,
1945 ) -> ssize_t;
1946 pub fn readdir64(dirp: *mut crate::DIR) -> *mut crate::dirent64;
1947 pub fn readdir64_r(
1948 dirp: *mut crate::DIR,
1949 entry: *mut crate::dirent64,
1950 result: *mut *mut crate::dirent64,
1951 ) -> c_int;
1952 pub fn stat64(path: *const c_char, buf: *mut stat64) -> c_int;
1953 pub fn truncate64(path: *const c_char, length: off64_t) -> c_int;
1954 }
1955 }
1956}
1957
1958cfg_if! {
1959 if #[cfg(not(any(
1960 target_env = "uclibc",
1961 target_env = "musl",
1962 target_os = "emscripten"
1963 )))] {
1964 extern "C" {
1965 pub fn preadv64(
1966 fd: c_int,
1967 iov: *const crate::iovec,
1968 iovcnt: c_int,
1969 offset: off64_t,
1970 ) -> ssize_t;
1971 pub fn pwritev64(
1972 fd: c_int,
1973 iov: *const crate::iovec,
1974 iovcnt: c_int,
1975 offset: off64_t,
1976 ) -> ssize_t;
1977 }
1978 }
1979}
1980
1981cfg_if! {
1982 if #[cfg(not(target_env = "uclibc"))] {
1983 extern "C" {
1984 pub fn forkpty(
1986 amaster: *mut c_int,
1987 name: *mut c_char,
1988 termp: *const termios,
1989 winp: *const crate::winsize,
1990 ) -> crate::pid_t;
1991 pub fn openpty(
1993 amaster: *mut c_int,
1994 aslave: *mut c_int,
1995 name: *mut c_char,
1996 termp: *const termios,
1997 winp: *const crate::winsize,
1998 ) -> c_int;
1999 }
2000 }
2001}
2002
2003cfg_if! {
2005 if #[cfg(any(target_env = "gnu", target_os = "android"))] {
2006 extern "C" {
2007 pub fn statx(
2008 dirfd: c_int,
2009 pathname: *const c_char,
2010 flags: c_int,
2011 mask: c_uint,
2012 statxbuf: *mut statx,
2013 ) -> c_int;
2014 }
2015 }
2016}
2017
2018cfg_if! {
2019 if #[cfg(target_os = "emscripten")] {
2020 mod emscripten;
2021 pub use self::emscripten::*;
2022 } else if #[cfg(target_os = "linux")] {
2023 mod linux;
2024 pub use self::linux::*;
2025 } else if #[cfg(target_os = "l4re")] {
2026 mod linux;
2027 pub use self::linux::*;
2028 } else if #[cfg(target_os = "android")] {
2029 mod android;
2030 pub use self::android::*;
2031 } else {
2032 }
2034}