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