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