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