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