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