Debian Codegraph @

third_party/rust/libc/src/unix/cygwin/mod.rs

raw
1 use crate::prelude::*;
2 use crate::*;
3
4 pub type wchar_t = c_ushort;
5
6 pub type blkcnt_t = i64;
7 pub type blksize_t = i32;
8 pub type dev_t = u32;
9 pub type fsblkcnt_t = c_ulong;
10 pub type fsfilcnt_t = c_ulong;
11 pub type ino_t = u64;
12 pub type key_t = c_longlong;
13 pub type sa_family_t = u16;
14 pub type socklen_t = c_int;
15
16 pub type off_t = c_long;
17 pub type id_t = u32;
18 pub type mode_t = u32;
19 pub type _off64_t = c_longlong;
20 pub type loff_t = _off64_t;
21 pub type iconv_t = *mut c_void;
22 pub type clock_t = c_ulong;
23 pub type time_t = c_long;
24 pub type clockid_t = c_ulong;
25 pub type timer_t = c_ulong;
26 pub type nl_item = c_int;
27 pub type nlink_t = c_ushort;
28 pub type suseconds_t = c_long;
29 pub type useconds_t = c_ulong;
30
31 #[cfg_attr(feature = "extra_traits", derive(Debug))]
32 pub enum timezone {}
33 impl Copy for timezone {}
34 impl Clone for timezone {
35 fn clone(&self) -> timezone {
36 *self
37 }
38 }
39
40 pub type sigset_t = c_ulong;
41
42 pub type fd_mask = c_ulong;
43
44 pub type pthread_t = *mut c_void;
45 pub type pthread_mutex_t = *mut c_void;
46
47 // Must be usize due to libstd/sys_common/thread_local.rs,
48 // should technically be *mut c_void
49 pub type pthread_key_t = usize;
50
51 pub type pthread_attr_t = *mut c_void;
52 pub type pthread_mutexattr_t = *mut c_void;
53 pub type pthread_condattr_t = *mut c_void;
54 pub type pthread_cond_t = *mut c_void;
55
56 // The following ones should be *mut c_void
57 pub type pthread_barrierattr_t = usize;
58 pub type pthread_barrier_t = usize;
59 pub type pthread_spinlock_t = usize;
60
61 pub type pthread_rwlock_t = *mut c_void;
62 pub type pthread_rwlockattr_t = *mut c_void;
63
64 pub type register_t = intptr_t;
65 pub type u_char = c_uchar;
66 pub type u_short = c_ushort;
67 pub type u_long = c_ulong;
68 pub type u_int = c_uint;
69 pub type caddr_t = *mut c_char;
70 pub type vm_size_t = c_ulong;
71
72 pub type rlim_t = c_ulong;
73
74 pub type nfds_t = c_uint;
75
76 pub type sem_t = *mut sem;
77
78 #[cfg_attr(feature = "extra_traits", derive(Debug))]
79 pub enum sem {}
80 impl Copy for sem {}
81 impl Clone for sem {
82 fn clone(&self) -> sem {
83 *self
84 }
85 }
86
87 pub type tcflag_t = c_uint;
88 pub type speed_t = c_uint;
89
90 pub type vm_offset_t = c_ulong;
91
92 pub type posix_spawn_file_actions_t = *mut c_void;
93 pub type posix_spawnattr_t = *mut c_void;
94
95 s! {
96 pub struct itimerspec {
97 pub it_interval: timespec,
98 pub it_value: timespec,
99 }
100
101 pub struct cpu_set_t {
102 bits: [u64; 16],
103 }
104
105 pub struct sigaction {
106 pub sa_sigaction: sighandler_t,
107 pub sa_mask: sigset_t,
108 pub sa_flags: c_int,
109 }
110
111 pub struct stack_t {
112 pub ss_sp: *mut c_void,
113 pub ss_flags: c_int,
114 pub ss_size: size_t,
115 }
116
117 pub struct tm {
118 pub tm_sec: c_int,
119 pub tm_min: c_int,
120 pub tm_hour: c_int,
121 pub tm_mday: c_int,
122 pub tm_mon: c_int,
123 pub tm_year: c_int,
124 pub tm_wday: c_int,
125 pub tm_yday: c_int,
126 pub tm_isdst: c_int,
127 pub tm_gmtoff: c_long,
128 pub tm_zone: *const c_char,
129 }
130
131 pub struct bintime {
132 pub sec: time_t,
133 pub frac: u64,
134 }
135
136 pub struct passwd {
137 pub pw_name: *mut c_char,
138 pub pw_passwd: *mut c_char,
139 pub pw_uid: uid_t,
140 pub pw_gid: gid_t,
141 pub pw_comment: *mut c_char,
142 pub pw_gecos: *mut c_char,
143 pub pw_dir: *mut c_char,
144 pub pw_shell: *mut c_char,
145 }
146
147 pub struct if_nameindex {
148 pub if_index: c_uint,
149 pub if_name: *mut c_char,
150 }
151
152 pub struct ucred {
153 pub pid: pid_t,
154 pub uid: uid_t,
155 pub gid: gid_t,
156 }
157
158 pub struct msghdr {
159 pub msg_name: *mut c_void,
160 pub msg_namelen: socklen_t,
161 pub msg_iov: *mut iovec,
162 pub msg_iovlen: c_int,
163 pub msg_control: *mut c_void,
164 pub msg_controllen: socklen_t,
165 pub msg_flags: c_int,
166 }
167
168 pub struct cmsghdr {
169 pub cmsg_len: size_t,
170 pub cmsg_level: c_int,
171 pub cmsg_type: c_int,
172 }
173
174 pub struct Dl_info {
175 pub dli_fname: [c_char; PATH_MAX as usize],
176 pub dli_fbase: *mut c_void,
177 pub dli_sname: *const c_char,
178 pub dli_saddr: *mut c_void,
179 }
180
181 pub struct in6_pktinfo {
182 pub ipi6_addr: in6_addr,
183 pub ipi6_ifindex: u32,
184 }
185
186 pub struct sockaddr_in6 {
187 pub sin6_family: sa_family_t,
188 pub sin6_port: in_port_t,
189 pub sin6_flowinfo: u32,
190 pub sin6_addr: in6_addr,
191 pub sin6_scope_id: u32,
192 }
193
194 pub struct ip_mreq_source {
195 pub imr_multiaddr: in_addr,
196 pub imr_sourceaddr: in_addr,
197 pub imr_interface: in_addr,
198 }
199
200 pub struct addrinfo {
201 pub ai_flags: c_int,
202 pub ai_family: c_int,
203 pub ai_socktype: c_int,
204 pub ai_protocol: c_int,
205 pub ai_addrlen: socklen_t,
206 pub ai_canonname: *mut c_char,
207 pub ai_addr: *mut sockaddr,
208 pub ai_next: *mut addrinfo,
209 }
210
211 pub struct lconv {
212 pub decimal_point: *mut c_char,
213 pub thousands_sep: *mut c_char,
214 pub grouping: *mut c_char,
215 pub int_curr_symbol: *mut c_char,
216 pub currency_symbol: *mut c_char,
217 pub mon_decimal_point: *mut c_char,
218 pub mon_thousands_sep: *mut c_char,
219 pub mon_grouping: *mut c_char,
220 pub positive_sign: *mut c_char,
221 pub negative_sign: *mut c_char,
222 pub int_frac_digits: c_char,
223 pub frac_digits: c_char,
224 pub p_cs_precedes: c_char,
225 pub p_sep_by_space: c_char,
226 pub n_cs_precedes: c_char,
227 pub n_sep_by_space: c_char,
228 pub p_sign_posn: c_char,
229 pub n_sign_posn: c_char,
230 pub int_n_cs_precedes: c_char,
231 pub int_n_sep_by_space: c_char,
232 pub int_n_sign_posn: c_char,
233 pub int_p_cs_precedes: c_char,
234 pub int_p_sep_by_space: c_char,
235 pub int_p_sign_posn: c_char,
236 }
237
238 pub struct termios {
239 pub c_iflag: tcflag_t,
240 pub c_oflag: tcflag_t,
241 pub c_cflag: tcflag_t,
242 pub c_lflag: tcflag_t,
243 pub c_line: c_char,
244 pub c_cc: [cc_t; NCCS],
245 pub c_ispeed: speed_t,
246 pub c_ospeed: speed_t,
247 }
248
249 pub struct sched_param {
250 pub sched_priority: c_int,
251 }
252
253 pub struct flock {
254 pub l_type: c_short,
255 pub l_whence: c_short,
256 pub l_start: off_t,
257 pub l_len: off_t,
258 pub l_pid: pid_t,
259 }
260
261 pub struct hostent {
262 pub h_name: *const c_char,
263 pub h_aliases: *mut *mut c_char,
264 pub h_addrtype: c_short,
265 pub h_length: c_short,
266 pub h_addr_list: *mut *mut c_char,
267 }
268
269 pub struct linger {
270 pub l_onoff: c_ushort,
271 pub l_linger: c_ushort,
272 }
273
274 pub struct fd_set {
275 fds_bits: [fd_mask; FD_SETSIZE / core::mem::size_of::<c_ulong>() / 8],
276 }
277
278 pub struct _uc_fpxreg {
279 pub significand: [u16; 4],
280 pub exponent: u16,
281 pub padding: [u16; 3],
282 }
283
284 pub struct _uc_xmmreg {
285 pub element: [u32; 4],
286 }
287
288 pub struct _fpstate {
289 pub cwd: u16,
290 pub swd: u16,
291 pub ftw: u16,
292 pub fop: u16,
293 pub rip: u64,
294 pub rdp: u64,
295 pub mxcsr: u32,
296 pub mxcr_mask: u32,
297 pub st: [_uc_fpxreg; 8],
298 pub xmm: [_uc_xmmreg; 16],
299 pub padding: [u32; 24],
300 }
301
302 #[repr(align(16))]
303 pub struct mcontext_t {
304 pub p1home: u64,
305 pub p2home: u64,
306 pub p3home: u64,
307 pub p4home: u64,
308 pub p5home: u64,
309 pub p6home: u64,
310 pub ctxflags: u32,
311 pub mxcsr: u32,
312 pub cs: u16,
313 pub ds: u16,
314 pub es: u16,
315 pub fs: u16,
316 pub gs: u16,
317 pub ss: u16,
318 pub eflags: u32,
319 pub dr0: u64,
320 pub dr1: u64,
321 pub dr2: u64,
322 pub dr3: u64,
323 pub dr6: u64,
324 pub dr7: u64,
325 pub rax: u64,
326 pub rcx: u64,
327 pub rdx: u64,
328 pub rbx: u64,
329 pub rsp: u64,
330 pub rbp: u64,
331 pub rsi: u64,
332 pub rdi: u64,
333 pub r8: u64,
334 pub r9: u64,
335 pub r10: u64,
336 pub r11: u64,
337 pub r12: u64,
338 pub r13: u64,
339 pub r14: u64,
340 pub r15: u64,
341 pub rip: u64,
342 pub fpregs: _fpstate,
343 pub vregs: [u64; 52],
344 pub vcx: u64,
345 pub dbc: u64,
346 pub btr: u64,
347 pub bfr: u64,
348 pub etr: u64,
349 pub efr: u64,
350 pub oldmask: u64,
351 pub cr2: u64,
352 }
353
354 pub struct sigevent {
355 pub sigev_value: sigval,
356 pub sigev_signo: c_int,
357 pub sigev_notify: c_int,
358 pub sigev_notify_function: Option<extern "C" fn(val: sigval)>,
359 pub sigev_notify_attributes: *mut pthread_attr_t,
360 }
361
362 #[repr(align(8))]
363 pub struct ucontext_t {
364 pub uc_mcontext: mcontext_t,
365 pub uc_link: *mut ucontext_t,
366 pub uc_sigmask: sigset_t,
367 pub uc_stack: stack_t,
368 pub uc_flags: c_ulong,
369 }
370
371 pub struct sockaddr {
372 pub sa_family: sa_family_t,
373 pub sa_data: [c_char; 14],
374 }
375
376 pub struct sockaddr_storage {
377 pub ss_family: sa_family_t,
378 __ss_pad1: [c_char; 6],
379 __ss_align: i64,
380 __ss_pad2: [c_char; 112],
381 }
382
383 pub struct stat {
384 pub st_dev: dev_t,
385 pub st_ino: ino_t,
386 pub st_mode: mode_t,
387 pub st_nlink: nlink_t,
388 pub st_uid: uid_t,
389 pub st_gid: gid_t,
390 pub st_rdev: dev_t,
391 pub st_size: off_t,
392 pub st_atime: time_t,
393 pub st_atime_nsec: c_long,
394 pub st_mtime: time_t,
395 pub st_mtime_nsec: c_long,
396 pub st_ctime: time_t,
397 pub st_ctime_nsec: c_long,
398 pub st_blksize: blksize_t,
399 pub st_blocks: blkcnt_t,
400 pub st_birthtime: time_t,
401 pub st_birthtime_nsec: c_long,
402 }
403
404 pub struct in_addr {
405 pub s_addr: in_addr_t,
406 }
407
408 pub struct ip_mreq {
409 pub imr_multiaddr: in_addr,
410 pub imr_interface: in_addr,
411 }
412
413 pub struct in_pktinfo {
414 pub ipi_addr: in_addr,
415 pub ipi_ifindex: u32,
416 }
417
418 pub struct sockaddr_in {
419 pub sin_family: sa_family_t,
420 pub sin_port: in_port_t,
421 pub sin_addr: in_addr,
422 pub sin_zero: [u8; 8],
423 }
424
425 pub struct statvfs {
426 pub f_bsize: c_ulong,
427 pub f_frsize: c_ulong,
428 pub f_blocks: fsblkcnt_t,
429 pub f_bfree: fsblkcnt_t,
430 pub f_bavail: fsblkcnt_t,
431 pub f_files: fsfilcnt_t,
432 pub f_ffree: fsfilcnt_t,
433 pub f_favail: fsfilcnt_t,
434 pub f_fsid: c_ulong,
435 pub f_flag: c_ulong,
436 pub f_namemax: c_ulong,
437 }
438 }
439
440 s_no_extra_traits! {
441 #[allow(missing_debug_implementations)]
442 #[repr(align(16))]
443 pub struct max_align_t {
444 priv_: [f64; 4],
445 }
446
447 pub struct siginfo_t {
448 pub si_signo: c_int,
449 pub si_code: c_int,
450 pub si_pid: pid_t,
451 pub si_uid: uid_t,
452 pub si_errno: c_int,
453 __pad: [u32; 32],
454 }
455
456 pub union __c_anonymous_ifr_ifru {
457 pub ifru_addr: sockaddr,
458 pub ifru_broadaddr: sockaddr,
459 pub ifru_dstaddr: sockaddr,
460 pub ifru_netmask: sockaddr,
461 pub ifru_hwaddr: sockaddr,
462 pub ifru_flags: c_int,
463 pub ifru_metric: c_int,
464 pub ifru_mtu: c_int,
465 pub ifru_ifindex: c_int,
466 pub ifru_data: *mut c_char,
467 __ifru_pad: [c_char; 28],
468 }
469
470 pub struct ifreq {
471 /// if name, e.g. "en0"
472 pub ifr_name: [c_char; IFNAMSIZ],
473 pub ifr_ifru: __c_anonymous_ifr_ifru,
474 }
475
476 pub union __c_anonymous_ifc_ifcu {
477 pub ifcu_buf: caddr_t,
478 pub ifcu_req: *mut ifreq,
479 }
480
481 pub struct ifconf {
482 pub ifc_len: c_int,
483 pub ifc_ifcu: __c_anonymous_ifc_ifcu,
484 }
485
486 pub struct dirent {
487 __d_version: u32,
488 pub d_ino: ino_t,
489 pub d_type: c_uchar,
490 __d_unused1: [c_uchar; 3],
491 __d_internal1: u32,
492 pub d_name: [c_char; 256],
493 }
494
495 pub struct sockaddr_un {
496 pub sun_family: sa_family_t,
497 pub sun_path: [c_char; 108],
498 }
499
500 pub struct utsname {
501 pub sysname: [c_char; 65],
502 pub nodename: [c_char; 65],
503 pub release: [c_char; 65],
504 pub version: [c_char; 65],
505 pub machine: [c_char; 65],
506 pub domainname: [c_char; 65],
507 }
508 }
509
510 impl siginfo_t {
511 pub unsafe fn si_addr(&self) -> *mut c_void {
512 #[repr(C)]
513 struct siginfo_si_addr {
514 _si_signo: c_int,
515 _si_code: c_int,
516 _si_pid: pid_t,
517 _si_uid: uid_t,
518 _si_errno: c_int,
519 si_addr: *mut c_void,
520 }
521 (*(self as *const siginfo_t as *const siginfo_si_addr)).si_addr
522 }
523
524 pub unsafe fn si_status(&self) -> c_int {
525 #[repr(C)]
526 struct siginfo_sigchld {
527 _si_signo: c_int,
528 _si_code: c_int,
529 _si_pid: pid_t,
530 _si_uid: uid_t,
531 _si_errno: c_int,
532 si_status: c_int,
533 }
534 (*(self as *const siginfo_t as *const siginfo_sigchld)).si_status
535 }
536
537 pub unsafe fn si_pid(&self) -> pid_t {
538 self.si_pid
539 }
540
541 pub unsafe fn si_uid(&self) -> uid_t {
542 self.si_uid
543 }
544
545 pub unsafe fn si_value(&self) -> sigval {
546 #[repr(C)]
547 struct siginfo_si_value {
548 _si_signo: c_int,
549 _si_code: c_int,
550 _si_pid: pid_t,
551 _si_uid: uid_t,
552 _si_errno: c_int,
553 si_value: sigval,
554 }
555 (*(self as *const siginfo_t as *const siginfo_si_value)).si_value
556 }
557 }
558
559 cfg_if! {
560 if #[cfg(feature = "extra_traits")] {
561 impl PartialEq for siginfo_t {
562 fn eq(&self, other: &siginfo_t) -> bool {
563 self.si_signo == other.si_signo
564 && self.si_code == other.si_code
565 && self.si_pid == other.si_pid
566 && self.si_uid == other.si_uid
567 && self.si_errno == other.si_errno
568 }
569 }
570
571 impl Eq for siginfo_t {}
572
573 impl fmt::Debug for siginfo_t {
574 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
575 f.debug_struct("siginfo_t")
576 .field("si_signo", &self.si_signo)
577 .field("si_code", &self.si_code)
578 .field("si_pid", &self.si_pid)
579 .field("si_uid", &self.si_uid)
580 .field("si_errno", &self.si_errno)
581 // Ignore __pad
582 .finish()
583 }
584 }
585
586 impl hash::Hash for siginfo_t {
587 fn hash<H: hash::Hasher>(&self, state: &mut H) {
588 self.si_signo.hash(state);
589 self.si_code.hash(state);
590 self.si_pid.hash(state);
591 self.si_uid.hash(state);
592 self.si_errno.hash(state);
593 // Ignore __pad
594 }
595 }
596
597 impl fmt::Debug for ifreq {
598 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
599 f.debug_struct("ifreq")
600 .field("ifr_name", &self.ifr_name)
601 .field("ifr_ifru", &self.ifr_ifru)
602 .finish()
603 }
604 }
605
606 impl fmt::Debug for ifconf {
607 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
608 f.debug_struct("ifconf")
609 .field("ifc_len", &self.ifc_len)
610 .field("ifc_ifcu", &self.ifc_ifcu)
611 .finish()
612 }
613 }
614
615 impl PartialEq for dirent {
616 fn eq(&self, other: &dirent) -> bool {
617 self.d_ino == other.d_ino
618 && self.d_type == other.d_type
619 && self
620 .d_name
621 .iter()
622 .zip(other.d_name.iter())
623 .all(|(a, b)| a == b)
624 }
625 }
626
627 impl Eq for dirent {}
628
629 impl fmt::Debug for dirent {
630 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
631 f.debug_struct("dirent")
632 .field("d_ino", &self.d_ino)
633 .field("d_type", &self.d_type)
634 // FIXME: .field("d_name", &self.d_name)
635 .finish()
636 }
637 }
638
639 impl hash::Hash for dirent {
640 fn hash<H: hash::Hasher>(&self, state: &mut H) {
641 self.d_ino.hash(state);
642 self.d_type.hash(state);
643 self.d_name.hash(state);
644 }
645 }
646
647 impl PartialEq for sockaddr_un {
648 fn eq(&self, other: &sockaddr_un) -> bool {
649 self.sun_family == other.sun_family
650 && self
651 .sun_path
652 .iter()
653 .zip(other.sun_path.iter())
654 .all(|(a, b)| a == b)
655 }
656 }
657
658 impl Eq for sockaddr_un {}
659
660 impl fmt::Debug for sockaddr_un {
661 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
662 f.debug_struct("sockaddr_un")
663 .field("sun_family", &self.sun_family)
664 // FIXME: .field("sun_path", &self.sun_path)
665 .finish()
666 }
667 }
668
669 impl hash::Hash for sockaddr_un {
670 fn hash<H: hash::Hasher>(&self, state: &mut H) {
671 self.sun_family.hash(state);
672 self.sun_path.hash(state);
673 }
674 }
675
676 impl PartialEq for utsname {
677 fn eq(&self, other: &utsname) -> bool {
678 self.sysname
679 .iter()
680 .zip(other.sysname.iter())
681 .all(|(a, b)| a == b)
682 && self
683 .nodename
684 .iter()
685 .zip(other.nodename.iter())
686 .all(|(a, b)| a == b)
687 && self
688 .release
689 .iter()
690 .zip(other.release.iter())
691 .all(|(a, b)| a == b)
692 && self
693 .version
694 .iter()
695 .zip(other.version.iter())
696 .all(|(a, b)| a == b)
697 && self
698 .machine
699 .iter()
700 .zip(other.machine.iter())
701 .all(|(a, b)| a == b)
702 && self
703 .domainname
704 .iter()
705 .zip(other.domainname.iter())
706 .all(|(a, b)| a == b)
707 }
708 }
709
710 impl Eq for utsname {}
711
712 impl fmt::Debug for utsname {
713 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
714 f.debug_struct("utsname")
715 // FIXME: .field("sysname", &self.sysname)
716 // FIXME: .field("nodename", &self.nodename)
717 // FIXME: .field("release", &self.release)
718 // FIXME: .field("version", &self.version)
719 // FIXME: .field("machine", &self.machine)
720 // FIXME: .field("domainname", &self.domainname)
721 .finish()
722 }
723 }
724
725 impl hash::Hash for utsname {
726 fn hash<H: hash::Hasher>(&self, state: &mut H) {
727 self.sysname.hash(state);
728 self.nodename.hash(state);
729 self.release.hash(state);
730 self.version.hash(state);
731 self.machine.hash(state);
732 self.domainname.hash(state);
733 }
734 }
735 }
736 }
737
738 pub const FD_SETSIZE: usize = 1024;
739
740 pub const CPU_SETSIZE: c_int = 0x400;
741
742 // si_code values for SIGBUS signal
743 pub const BUS_ADRALN: c_int = 25;
744 pub const BUS_ADRERR: c_int = 26;
745 pub const BUS_OBJERR: c_int = 27;
746
747 // si_code values for SIGCHLD signal
748 pub const CLD_EXITED: c_int = 28;
749 pub const CLD_KILLED: c_int = 29;
750 pub const CLD_DUMPED: c_int = 30;
751 pub const CLD_TRAPPED: c_int = 31;
752 pub const CLD_STOPPED: c_int = 32;
753 pub const CLD_CONTINUED: c_int = 33;
754
755 pub const SIGEV_SIGNAL: c_int = 0;
756 pub const SIGEV_NONE: c_int = 1;
757 pub const SIGEV_THREAD: c_int = 2;
758
759 pub const SA_NOCLDSTOP: c_int = 0x00000001;
760 pub const SA_NOCLDWAIT: c_int = 0; // FIXME: does not exist on Cygwin!
761 pub const SA_SIGINFO: c_int = 0x00000002;
762 pub const SA_RESTART: c_int = 0x10000000;
763 pub const SA_ONSTACK: c_int = 0x20000000;
764 pub const SA_NODEFER: c_int = 0x40000000;
765 pub const SA_RESETHAND: c_int = 0x80000000;
766 pub const MINSIGSTKSZ: size_t = 8192;
767 pub const SIGSTKSZ: size_t = 32768;
768 pub const SIGHUP: c_int = 1;
769 pub const SIGINT: c_int = 2;
770 pub const SIGQUIT: c_int = 3;
771 pub const SIGILL: c_int = 4;
772 pub const SIGTRAP: c_int = 5;
773 pub const SIGABRT: c_int = 6;
774 pub const SIGEMT: c_int = 7;
775 pub const SIGFPE: c_int = 8;
776 pub const SIGKILL: c_int = 9;
777 pub const SIGBUS: c_int = 10;
778 pub const SIGSEGV: c_int = 11;
779 pub const SIGSYS: c_int = 12;
780 pub const SIGPIPE: c_int = 13;
781 pub const SIGALRM: c_int = 14;
782 pub const SIGTERM: c_int = 15;
783 pub const SIGURG: c_int = 16;
784 pub const SIGSTOP: c_int = 17;
785 pub const SIGTSTP: c_int = 18;
786 pub const SIGCONT: c_int = 19;
787 pub const SIGCHLD: c_int = 20;
788 pub const SIGTTIN: c_int = 21;
789 pub const SIGTTOU: c_int = 22;
790 pub const SIGIO: c_int = 23;
791 pub const SIGPOLL: c_int = 23;
792 pub const SIGXCPU: c_int = 24;
793 pub const SIGXFSZ: c_int = 25;
794 pub const SIGVTALRM: c_int = 26;
795 pub const SIGPROF: c_int = 27;
796 pub const SIGWINCH: c_int = 28;
797 pub const SIGPWR: c_int = 29;
798 pub const SIGUSR1: c_int = 30;
799 pub const SIGUSR2: c_int = 31;
800
801 pub const SS_ONSTACK: c_int = 0x1;
802 pub const SS_DISABLE: c_int = 0x2;
803
804 pub const SIG_SETMASK: c_int = 0;
805 pub const SIG_BLOCK: c_int = 1;
806 pub const SIG_UNBLOCK: c_int = 2;
807
808 pub const TIMER_ABSTIME: c_int = 4;
809 pub const CLOCK_REALTIME_COARSE: clockid_t = 0;
810 pub const CLOCK_REALTIME: clockid_t = 1;
811 pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
812 pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
813 pub const CLOCK_MONOTONIC: clockid_t = 4;
814 pub const CLOCK_MONOTONIC_RAW: clockid_t = 5;
815 pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6;
816 pub const CLOCK_BOOTTIME: clockid_t = 7;
817 pub const CLOCK_REALTIME_ALARM: clockid_t = 8;
818 pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9;
819
820 pub const ITIMER_REAL: c_int = 0;
821 pub const ITIMER_VIRTUAL: c_int = 1;
822 pub const ITIMER_PROF: c_int = 2;
823
824 pub const PRIO_PROCESS: c_int = 0;
825 pub const PRIO_PGRP: c_int = 1;
826 pub const PRIO_USER: c_int = 2;
827 pub const RLIMIT_CPU: c_int = 0;
828 pub const RLIMIT_FSIZE: c_int = 1;
829 pub const RLIMIT_DATA: c_int = 2;
830 pub const RLIMIT_STACK: c_int = 3;
831 pub const RLIMIT_CORE: c_int = 4;
832 pub const RLIMIT_NOFILE: c_int = 5;
833 pub const RLIMIT_AS: c_int = 6;
834 pub const RLIM_NLIMITS: c_int = 7;
835 pub const RLIMIT_NLIMITS: c_int = RLIM_NLIMITS;
836 pub const RLIM_INFINITY: rlim_t = !0;
837 pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY;
838 pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY;
839
840 pub const RUSAGE_SELF: c_int = 0;
841 pub const RUSAGE_CHILDREN: c_int = -1;
842
843 pub const IFF_UP: c_int = 0x1; // interface is up
844 pub const IFF_BROADCAST: c_int = 0x2; // broadcast address valid
845 pub const IFF_LOOPBACK: c_int = 0x8; // is a loopback net
846 pub const IFF_POINTOPOINT: c_int = 0x10; // interface is point-to-point link
847 pub const IFF_NOTRAILERS: c_int = 0x20; // avoid use of trailers
848 pub const IFF_RUNNING: c_int = 0x40; // resources allocated
849 pub const IFF_NOARP: c_int = 0x80; // no address resolution protocol
850 pub const IFF_PROMISC: c_int = 0x100; // receive all packets
851 pub const IFF_MULTICAST: c_int = 0x1000; // supports multicast
852 pub const IFF_LOWER_UP: c_int = 0x10000; // driver signals L1 up
853 pub const IFF_DORMANT: c_int = 0x20000; // driver signals dormant
854
855 pub const IF_NAMESIZE: size_t = 44;
856 pub const IFNAMSIZ: size_t = IF_NAMESIZE;
857
858 pub const FIONREAD: c_int = 0x4008667f;
859 pub const FIONBIO: c_int = 0x8004667e;
860 pub const FIOASYNC: c_int = 0x8008667d;
861 pub const FIOCLEX: c_int = 0; // FIXME: does not exist on Cygwin!
862 pub const SIOCGIFCONF: c_ulong = 0x80107364;
863 pub const SIOCGIFFLAGS: c_ulong = 0x80507365;
864 pub const SIOCGIFADDR: c_ulong = 0x80507366;
865 pub const SIOCGIFBRDADDR: c_ulong = 0x80507367;
866 pub const SIOCGIFNETMASK: c_ulong = 0x80507368;
867 pub const SIOCGIFHWADDR: c_ulong = 0x80507369;
868 pub const SIOCGIFMETRIC: c_ulong = 0x8050736a;
869 pub const SIOCGIFMTU: c_ulong = 0x8050736b;
870 pub const SIOCGIFINDEX: c_ulong = 0x8050736c;
871 pub const SIOGIFINDEX: c_ulong = SIOCGIFINDEX;
872 pub const SIOCGIFDSTADDR: c_ulong = 0x8050736e;
873 pub const SOL_SOCKET: c_int = 0xffff;
874 pub const SO_DEBUG: c_int = 1;
875 pub const SO_ACCEPTCONN: c_int = 0x0002;
876 pub const SO_REUSEADDR: c_int = 0x0004;
877 pub const SO_KEEPALIVE: c_int = 0x0008;
878 pub const SO_DONTROUTE: c_int = 0x0010;
879 pub const SO_BROADCAST: c_int = 0x0020;
880 pub const SO_USELOOPBACK: c_int = 0x0040;
881 pub const SO_LINGER: c_int = 0x0080;
882 pub const SO_OOBINLINE: c_int = 0x0100;
883 pub const SO_PEERCRED: c_int = 0x0200;
884 pub const SO_PASSCRED: c_int = 0x0400;
885 pub const SO_SNDBUF: c_int = 0x1001;
886 pub const SO_RCVBUF: c_int = 0x1002;
887 pub const SO_SNDLOWAT: c_int = 0x1003;
888 pub const SO_RCVLOWAT: c_int = 0x1004;
889 pub const SO_SNDTIMEO: c_int = 0x1005;
890 pub const SO_RCVTIMEO: c_int = 0x1006;
891 pub const SO_ERROR: c_int = 0x1007;
892 pub const SO_TYPE: c_int = 0x1008;
893
894 pub const SCM_RIGHTS: c_int = 0x01;
895 pub const SCM_CREDENTIALS: c_int = 0x02;
896 pub const SOCK_STREAM: c_int = 1;
897 pub const SOCK_DGRAM: c_int = 2;
898 pub const SOCK_RAW: c_int = 3;
899 pub const SOCK_RDM: c_int = 4;
900 pub const SOCK_SEQPACKET: c_int = 5;
901 pub const SOCK_NONBLOCK: c_int = 0x01000000;
902 pub const SOCK_CLOEXEC: c_int = 0x02000000;
903 pub const AF_UNSPEC: c_int = 0;
904 pub const AF_LOCAL: c_int = 1;
905 pub const AF_UNIX: c_int = AF_LOCAL;
906 pub const AF_INET: c_int = 2;
907 pub const AF_IMPLINK: c_int = 3;
908 pub const AF_PUP: c_int = 4;
909 pub const AF_CHAOS: c_int = 5;
910 pub const AF_NS: c_int = 6;
911 pub const AF_ISO: c_int = 7;
912 pub const AF_OSI: c_int = AF_ISO;
913 pub const AF_ECMA: c_int = 8;
914 pub const AF_DATAKIT: c_int = 9;
915 pub const AF_CCITT: c_int = 10;
916 pub const AF_SNA: c_int = 11;
917 pub const AF_DECnet: c_int = 12;
918 pub const AF_DLI: c_int = 13;
919 pub const AF_LAT: c_int = 14;
920 pub const AF_HYLINK: c_int = 15;
921 pub const AF_APPLETALK: c_int = 16;
922 pub const AF_NETBIOS: c_int = 17;
923 pub const AF_INET6: c_int = 23;
924 pub const PF_UNSPEC: c_int = AF_UNSPEC;
925 pub const PF_LOCAL: c_int = AF_LOCAL;
926 pub const PF_UNIX: c_int = PF_LOCAL;
927 pub const PF_INET: c_int = AF_INET;
928 pub const PF_IMPLINK: c_int = AF_IMPLINK;
929 pub const PF_PUP: c_int = AF_PUP;
930 pub const PF_CHAOS: c_int = AF_CHAOS;
931 pub const PF_NS: c_int = AF_NS;
932 pub const PF_ISO: c_int = AF_ISO;
933 pub const PF_OSI: c_int = AF_ISO;
934 pub const PF_DATAKIT: c_int = AF_DATAKIT;
935 pub const PF_CCITT: c_int = AF_CCITT;
936 pub const PF_SNA: c_int = AF_SNA;
937 pub const PF_DECnet: c_int = AF_DECnet;
938 pub const PF_DLI: c_int = AF_DLI;
939 pub const PF_LAT: c_int = AF_LAT;
940 pub const PF_HYLINK: c_int = AF_HYLINK;
941 pub const PF_APPLETALK: c_int = AF_APPLETALK;
942 pub const PF_NETBIOS: c_int = AF_NETBIOS;
943 pub const PF_INET6: c_int = AF_INET6;
944 pub const SOMAXCONN: c_int = 0x7fffffff;
945 pub const MSG_OOB: c_int = 0x1;
946 pub const MSG_PEEK: c_int = 0x2;
947 pub const MSG_DONTROUTE: c_int = 0x4;
948 pub const MSG_WAITALL: c_int = 0x8;
949 pub const MSG_DONTWAIT: c_int = 0x10;
950 pub const MSG_NOSIGNAL: c_int = 0x20;
951 pub const MSG_TRUNC: c_int = 0x0100;
952 pub const MSG_CTRUNC: c_int = 0x0200;
953 pub const MSG_BCAST: c_int = 0x0400;
954 pub const MSG_MCAST: c_int = 0x0800;
955 pub const MSG_CMSG_CLOEXEC: c_int = 0x1000;
956 pub const MSG_EOR: c_int = 0x8000;
957 pub const SOL_IP: c_int = 0;
958 pub const SOL_IPV6: c_int = 41;
959 pub const SOL_TCP: c_int = 6;
960 pub const SOL_UDP: c_int = 17;
961 pub const IPTOS_LOWDELAY: u8 = 0x10;
962 pub const IPTOS_THROUGHPUT: u8 = 0x08;
963 pub const IPTOS_RELIABILITY: u8 = 0x04;
964 pub const IP_DEFAULT_MULTICAST_TTL: c_int = 1;
965 pub const IP_DEFAULT_MULTICAST_LOOP: c_int = 1;
966 pub const IP_OPTIONS: c_int = 1;
967 pub const IP_HDRINCL: c_int = 2;
968 pub const IP_TOS: c_int = 3;
969 pub const IP_TTL: c_int = 4;
970 pub const IP_MULTICAST_IF: c_int = 9;
971 pub const IP_MULTICAST_TTL: c_int = 10;
972 pub const IP_MULTICAST_LOOP: c_int = 11;
973 pub const IP_ADD_MEMBERSHIP: c_int = 12;
974 pub const IP_DROP_MEMBERSHIP: c_int = 13;
975 pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 15;
976 pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 16;
977 pub const IP_BLOCK_SOURCE: c_int = 17;
978 pub const IP_UNBLOCK_SOURCE: c_int = 18;
979 pub const IP_PKTINFO: c_int = 19;
980 pub const IP_UNICAST_IF: c_int = 31;
981 pub const IPV6_HOPOPTS: c_int = 1;
982 pub const IPV6_UNICAST_HOPS: c_int = 4;
983 pub const IPV6_MULTICAST_IF: c_int = 9;
984 pub const IPV6_MULTICAST_HOPS: c_int = 10;
985 pub const IPV6_MULTICAST_LOOP: c_int = 11;
986 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
987 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
988 pub const IPV6_JOIN_GROUP: c_int = 12;
989 pub const IPV6_LEAVE_GROUP: c_int = 13;
990 pub const IPV6_DONTFRAG: c_int = 14;
991 pub const IPV6_PKTINFO: c_int = 19;
992 pub const IPV6_HOPLIMIT: c_int = 21;
993 pub const IPV6_CHECKSUM: c_int = 26;
994 pub const IPV6_V6ONLY: c_int = 27;
995 pub const IPV6_UNICAST_IF: c_int = 31;
996 pub const IPV6_RTHDR: c_int = 32;
997 pub const IPV6_RECVRTHDR: c_int = 38;
998 pub const IPV6_TCLASS: c_int = 39;
999 pub const IPV6_RECVTCLASS: c_int = 40;
1000 pub const MCAST_JOIN_GROUP: c_int = 41;
1001 pub const MCAST_LEAVE_GROUP: c_int = 42;
1002 pub const MCAST_BLOCK_SOURCE: c_int = 43;
1003 pub const MCAST_UNBLOCK_SOURCE: c_int = 44;
1004 pub const MCAST_JOIN_SOURCE_GROUP: c_int = 45;
1005 pub const MCAST_LEAVE_SOURCE_GROUP: c_int = 46;
1006 pub const MCAST_INCLUDE: c_int = 0;
1007 pub const MCAST_EXCLUDE: c_int = 1;
1008 pub const SHUT_RD: c_int = 0;
1009 pub const SHUT_WR: c_int = 1;
1010 pub const SHUT_RDWR: c_int = 2;
1011
1012 pub const S_BLKSIZE: mode_t = 1024;
1013 pub const S_IREAD: mode_t = 256;
1014 pub const S_IWRITE: mode_t = 128;
1015 pub const S_IEXEC: mode_t = 64;
1016 pub const S_ENFMT: mode_t = 1024;
1017 pub const S_IFMT: mode_t = 61440;
1018 pub const S_IFDIR: mode_t = 16384;
1019 pub const S_IFCHR: mode_t = 8192;
1020 pub const S_IFBLK: mode_t = 24576;
1021 pub const S_IFREG: mode_t = 32768;
1022 pub const S_IFLNK: mode_t = 40960;
1023 pub const S_IFSOCK: mode_t = 49152;
1024 pub const S_IFIFO: mode_t = 4096;
1025 pub const S_IRWXU: mode_t = 448;
1026 pub const S_IRUSR: mode_t = 256;
1027 pub const S_IWUSR: mode_t = 128;
1028 pub const S_IXUSR: mode_t = 64;
1029 pub const S_IRWXG: mode_t = 56;
1030 pub const S_IRGRP: mode_t = 32;
1031 pub const S_IWGRP: mode_t = 16;
1032 pub const S_IXGRP: mode_t = 8;
1033 pub const S_IRWXO: mode_t = 7;
1034 pub const S_IROTH: mode_t = 4;
1035 pub const S_IWOTH: mode_t = 2;
1036 pub const S_IXOTH: mode_t = 1;
1037 pub const UTIME_NOW: c_long = -2;
1038 pub const UTIME_OMIT: c_long = -1;
1039
1040 pub const ARG_MAX: c_int = 32000;
1041 pub const CHILD_MAX: c_int = 256;
1042 pub const IOV_MAX: c_int = 1024;
1043 pub const PTHREAD_STACK_MIN: size_t = 65536;
1044 pub const PATH_MAX: c_int = 4096;
1045 pub const PIPE_BUF: usize = 4096;
1046 pub const NGROUPS_MAX: c_int = 1024;
1047
1048 pub const FORK_RELOAD: c_int = 1;
1049 pub const FORK_NO_RELOAD: c_int = 0;
1050
1051 pub const RTLD_DEFAULT: *mut c_void = 0isize as *mut c_void;
1052 pub const RTLD_LOCAL: c_int = 0;
1053 pub const RTLD_LAZY: c_int = 1;
1054 pub const RTLD_NOW: c_int = 2;
1055 pub const RTLD_GLOBAL: c_int = 4;
1056 pub const RTLD_NODELETE: c_int = 8;
1057 pub const RTLD_NOLOAD: c_int = 16;
1058 pub const RTLD_DEEPBIND: c_int = 32;
1059
1060 /// IP6 hop-by-hop options
1061 pub const IPPROTO_HOPOPTS: c_int = 0;
1062
1063 /// gateway mgmt protocol
1064 pub const IPPROTO_IGMP: c_int = 2;
1065
1066 /// IPIP tunnels (older KA9Q tunnels use 94)
1067 pub const IPPROTO_IPIP: c_int = 4;
1068
1069 /// exterior gateway protocol
1070 pub const IPPROTO_EGP: c_int = 8;
1071
1072 /// pup
1073 pub const IPPROTO_PUP: c_int = 12;
1074
1075 /// xns idp
1076 pub const IPPROTO_IDP: c_int = 22;
1077
1078 /// IP6 routing header
1079 pub const IPPROTO_ROUTING: c_int = 43;
1080
1081 /// IP6 fragmentation header
1082 pub const IPPROTO_FRAGMENT: c_int = 44;
1083
1084 /// IP6 Encap Sec. Payload
1085 pub const IPPROTO_ESP: c_int = 50;
1086
1087 /// IP6 Auth Header
1088 pub const IPPROTO_AH: c_int = 51;
1089
1090 /// IP6 no next header
1091 pub const IPPROTO_NONE: c_int = 59;
1092
1093 /// IP6 destination option
1094 pub const IPPROTO_DSTOPTS: c_int = 60;
1095
1096 pub const IPPROTO_RAW: c_int = 255;
1097 pub const IPPROTO_MAX: c_int = 256;
1098
1099 pub const AI_PASSIVE: c_int = 0x1;
1100 pub const AI_CANONNAME: c_int = 0x2;
1101 pub const AI_NUMERICHOST: c_int = 0x4;
1102 pub const AI_NUMERICSERV: c_int = 0x8;
1103 pub const AI_ALL: c_int = 0x100;
1104 pub const AI_ADDRCONFIG: c_int = 0x400;
1105 pub const AI_V4MAPPED: c_int = 0x800;
1106 pub const NI_NOFQDN: c_int = 0x1;
1107 pub const NI_NUMERICHOST: c_int = 0x2;
1108 pub const NI_NAMEREQD: c_int = 0x4;
1109 pub const NI_NUMERICSERV: c_int = 0x8;
1110 pub const NI_DGRAM: c_int = 0x10;
1111 pub const NI_MAXHOST: c_int = 1025;
1112 pub const NI_MAXSERV: c_int = 32;
1113 pub const EAI_AGAIN: c_int = 2;
1114 pub const EAI_BADFLAGS: c_int = 3;
1115 pub const EAI_FAIL: c_int = 4;
1116 pub const EAI_FAMILY: c_int = 5;
1117 pub const EAI_MEMORY: c_int = 6;
1118 pub const EAI_NODATA: c_int = 7;
1119 pub const EAI_NONAME: c_int = 8;
1120 pub const EAI_SERVICE: c_int = 9;
1121 pub const EAI_SOCKTYPE: c_int = 10;
1122 pub const EAI_SYSTEM: c_int = 11;
1123 pub const EAI_OVERFLOW: c_int = 14;
1124
1125 pub const POLLIN: c_short = 0x1;
1126 pub const POLLPRI: c_short = 0x2;
1127 pub const POLLOUT: c_short = 0x4;
1128 pub const POLLERR: c_short = 0x8;
1129 pub const POLLHUP: c_short = 0x10;
1130 pub const POLLNVAL: c_short = 0x20;
1131 pub const POLLRDNORM: c_short = 0x1;
1132 pub const POLLRDBAND: c_short = 0x2;
1133 pub const POLLWRNORM: c_short = 0x4;
1134 pub const POLLWRBAND: c_short = 0x4;
1135
1136 pub const LC_ALL: c_int = 0;
1137 pub const LC_COLLATE: c_int = 1;
1138 pub const LC_CTYPE: c_int = 2;
1139 pub const LC_MONETARY: c_int = 3;
1140 pub const LC_NUMERIC: c_int = 4;
1141 pub const LC_TIME: c_int = 5;
1142 pub const LC_MESSAGES: c_int = 6;
1143 pub const LC_ALL_MASK: c_int = 1 << 0;
1144 pub const LC_COLLATE_MASK: c_int = 1 << 1;
1145 pub const LC_CTYPE_MASK: c_int = 1 << 2;
1146 pub const LC_MONETARY_MASK: c_int = 1 << 3;
1147 pub const LC_NUMERIC_MASK: c_int = 1 << 4;
1148 pub const LC_TIME_MASK: c_int = 1 << 5;
1149 pub const LC_MESSAGES_MASK: c_int = 1 << 6;
1150 pub const LC_GLOBAL_LOCALE: locale_t = -1isize as locale_t;
1151
1152 pub const SEM_FAILED: *mut sem_t = core::ptr::null_mut();
1153
1154 pub const ST_RDONLY: c_ulong = 0x80000;
1155 pub const ST_NOSUID: c_ulong = 0;
1156
1157 pub const TIOCMGET: c_int = 0x5415;
1158 pub const TIOCMBIS: c_int = 0x5416;
1159 pub const TIOCMBIC: c_int = 0x5417;
1160 pub const TIOCMSET: c_int = 0x5418;
1161 pub const TIOCINQ: c_int = 0x541B;
1162 pub const TIOCSCTTY: c_int = 0x540E;
1163 pub const TIOCSBRK: c_int = 0x5427;
1164 pub const TIOCCBRK: c_int = 0x5428;
1165 pub const TIOCM_DTR: c_int = 0x002;
1166 pub const TIOCM_RTS: c_int = 0x004;
1167 pub const TIOCM_CTS: c_int = 0x020;
1168 pub const TIOCM_CAR: c_int = 0x040;
1169 pub const TIOCM_RNG: c_int = 0x080;
1170 pub const TIOCM_CD: c_int = TIOCM_CAR;
1171 pub const TIOCM_RI: c_int = TIOCM_RNG;
1172 pub const TCOOFF: c_int = 0;
1173 pub const TCOON: c_int = 1;
1174 pub const TCIOFF: c_int = 2;
1175 pub const TCION: c_int = 3;
1176 pub const TCGETA: c_int = 5;
1177 pub const TCSETA: c_int = 6;
1178 pub const TCSETAW: c_int = 7;
1179 pub const TCSETAF: c_int = 8;
1180 pub const TCIFLUSH: c_int = 0;
1181 pub const TCOFLUSH: c_int = 1;
1182 pub const TCIOFLUSH: c_int = 2;
1183 pub const TCFLSH: c_int = 3;
1184 pub const TCSAFLUSH: c_int = 1;
1185 pub const TCSANOW: c_int = 2;
1186 pub const TCSADRAIN: c_int = 3;
1187 pub const TIOCPKT: c_int = 6;
1188 pub const TIOCPKT_DATA: c_int = 0x0;
1189 pub const TIOCPKT_FLUSHREAD: c_int = 0x1;
1190 pub const TIOCPKT_FLUSHWRITE: c_int = 0x2;
1191 pub const TIOCPKT_STOP: c_int = 0x4;
1192 pub const TIOCPKT_START: c_int = 0x8;
1193 pub const TIOCPKT_NOSTOP: c_int = 0x10;
1194 pub const TIOCPKT_DOSTOP: c_int = 0x20;
1195 pub const IGNBRK: tcflag_t = 0x00001;
1196 pub const BRKINT: tcflag_t = 0x00002;
1197 pub const IGNPAR: tcflag_t = 0x00004;
1198 pub const IMAXBEL: tcflag_t = 0x00008;
1199 pub const INPCK: tcflag_t = 0x00010;
1200 pub const ISTRIP: tcflag_t = 0x00020;
1201 pub const INLCR: tcflag_t = 0x00040;
1202 pub const IGNCR: tcflag_t = 0x00080;
1203 pub const ICRNL: tcflag_t = 0x00100;
1204 pub const IXON: tcflag_t = 0x00400;
1205 pub const IXOFF: tcflag_t = 0x01000;
1206 pub const IUCLC: tcflag_t = 0x04000;
1207 pub const IXANY: tcflag_t = 0x08000;
1208 pub const PARMRK: tcflag_t = 0x10000;
1209 pub const IUTF8: tcflag_t = 0x20000;
1210 pub const OPOST: tcflag_t = 0x00001;
1211 pub const OLCUC: tcflag_t = 0x00002;
1212 pub const OCRNL: tcflag_t = 0x00004;
1213 pub const ONLCR: tcflag_t = 0x00008;
1214 pub const ONOCR: tcflag_t = 0x00010;
1215 pub const ONLRET: tcflag_t = 0x00020;
1216 pub const OFILL: tcflag_t = 0x00040;
1217 pub const CRDLY: tcflag_t = 0x00180;
1218 pub const CR0: tcflag_t = 0x00000;
1219 pub const CR1: tcflag_t = 0x00080;
1220 pub const CR2: tcflag_t = 0x00100;
1221 pub const CR3: tcflag_t = 0x00180;
1222 pub const NLDLY: tcflag_t = 0x00200;
1223 pub const NL0: tcflag_t = 0x00000;
1224 pub const NL1: tcflag_t = 0x00200;
1225 pub const BSDLY: tcflag_t = 0x00400;
1226 pub const BS0: tcflag_t = 0x00000;
1227 pub const BS1: tcflag_t = 0x00400;
1228 pub const TABDLY: tcflag_t = 0x01800;
1229 pub const TAB0: tcflag_t = 0x00000;
1230 pub const TAB1: tcflag_t = 0x00800;
1231 pub const TAB2: tcflag_t = 0x01000;
1232 pub const TAB3: tcflag_t = 0x01800;
1233 pub const XTABS: tcflag_t = 0x01800;
1234 pub const VTDLY: tcflag_t = 0x02000;
1235 pub const VT0: tcflag_t = 0x00000;
1236 pub const VT1: tcflag_t = 0x02000;
1237 pub const FFDLY: tcflag_t = 0x04000;
1238 pub const FF0: tcflag_t = 0x00000;
1239 pub const FF1: tcflag_t = 0x04000;
1240 pub const OFDEL: tcflag_t = 0x08000;
1241 pub const CBAUD: tcflag_t = 0x0100f;
1242 pub const B0: speed_t = 0x00000;
1243 pub const B50: speed_t = 0x00001;
1244 pub const B75: speed_t = 0x00002;
1245 pub const B110: speed_t = 0x00003;
1246 pub const B134: speed_t = 0x00004;
1247 pub const B150: speed_t = 0x00005;
1248 pub const B200: speed_t = 0x00006;
1249 pub const B300: speed_t = 0x00007;
1250 pub const B600: speed_t = 0x00008;
1251 pub const B1200: speed_t = 0x00009;
1252 pub const B1800: speed_t = 0x0000a;
1253 pub const B2400: speed_t = 0x0000b;
1254 pub const B4800: speed_t = 0x0000c;
1255 pub const B9600: speed_t = 0x0000d;
1256 pub const B19200: speed_t = 0x0000e;
1257 pub const B38400: speed_t = 0x0000f;
1258 pub const CSIZE: tcflag_t = 0x00030;
1259 pub const CS5: tcflag_t = 0x00000;
1260 pub const CS6: tcflag_t = 0x00010;
1261 pub const CS7: tcflag_t = 0x00020;
1262 pub const CS8: tcflag_t = 0x00030;
1263 pub const CSTOPB: tcflag_t = 0x00040;
1264 pub const CREAD: tcflag_t = 0x00080;
1265 pub const PARENB: tcflag_t = 0x00100;
1266 pub const PARODD: tcflag_t = 0x00200;
1267 pub const HUPCL: tcflag_t = 0x00400;
1268 pub const CLOCAL: tcflag_t = 0x00800;
1269 pub const CBAUDEX: tcflag_t = 0x0100f;
1270 pub const B57600: speed_t = 0x01001;
1271 pub const B115200: speed_t = 0x01002;
1272 pub const B230400: speed_t = 0x01004;
1273 pub const B460800: speed_t = 0x01006;
1274 pub const B500000: speed_t = 0x01007;
1275 pub const B576000: speed_t = 0x01008;
1276 pub const B921600: speed_t = 0x01009;
1277 pub const B1000000: speed_t = 0x0100a;
1278 pub const B1152000: speed_t = 0x0100b;
1279 pub const B1500000: speed_t = 0x0100c;
1280 pub const B2000000: speed_t = 0x0100d;
1281 pub const B2500000: speed_t = 0x0100e;
1282 pub const B3000000: speed_t = 0x0100f;
1283 pub const CRTSCTS: tcflag_t = 0x08000;
1284 pub const CMSPAR: tcflag_t = 0x40000000;
1285 pub const ISIG: tcflag_t = 0x0001;
1286 pub const ICANON: tcflag_t = 0x0002;
1287 pub const ECHO: tcflag_t = 0x0004;
1288 pub const ECHOE: tcflag_t = 0x0008;
1289 pub const ECHOK: tcflag_t = 0x0010;
1290 pub const ECHONL: tcflag_t = 0x0020;
1291 pub const NOFLSH: tcflag_t = 0x0040;
1292 pub const TOSTOP: tcflag_t = 0x0080;
1293 pub const IEXTEN: tcflag_t = 0x0100;
1294 pub const FLUSHO: tcflag_t = 0x0200;
1295 pub const ECHOKE: tcflag_t = 0x0400;
1296 pub const ECHOCTL: tcflag_t = 0x0800;
1297 pub const VDISCARD: usize = 1;
1298 pub const VEOL: usize = 2;
1299 pub const VEOL2: usize = 3;
1300 pub const VEOF: usize = 4;
1301 pub const VERASE: usize = 5;
1302 pub const VINTR: usize = 6;
1303 pub const VKILL: usize = 7;
1304 pub const VLNEXT: usize = 8;
1305 pub const VMIN: usize = 9;
1306 pub const VQUIT: usize = 10;
1307 pub const VREPRINT: usize = 11;
1308 pub const VSTART: usize = 12;
1309 pub const VSTOP: usize = 13;
1310 pub const VSUSP: usize = 14;
1311 pub const VSWTC: usize = 15;
1312 pub const VTIME: usize = 16;
1313 pub const VWERASE: usize = 17;
1314 pub const NCCS: usize = 18;
1315
1316 pub const TIOCGWINSZ: c_int = 0x5401;
1317 pub const TIOCSWINSZ: c_int = 0x5402;
1318 pub const TIOCLINUX: c_int = 0x5403;
1319 pub const TIOCGPGRP: c_int = 0x540f;
1320 pub const TIOCSPGRP: c_int = 0x5410;
1321
1322 pub const WNOHANG: c_int = 1;
1323 pub const WUNTRACED: c_int = 2;
1324 pub const WCONTINUED: c_int = 8;
1325
1326 pub const EXIT_FAILURE: c_int = 1;
1327 pub const EXIT_SUCCESS: c_int = 0;
1328
1329 pub const PROT_NONE: c_int = 0;
1330 pub const PROT_READ: c_int = 1;
1331 pub const PROT_WRITE: c_int = 2;
1332 pub const PROT_EXEC: c_int = 4;
1333 pub const MAP_FILE: c_int = 0;
1334 pub const MAP_SHARED: c_int = 1;
1335 pub const MAP_PRIVATE: c_int = 2;
1336 pub const MAP_TYPE: c_int = 0xf;
1337 pub const MAP_FIXED: c_int = 0x10;
1338 pub const MAP_ANON: c_int = 0x20;
1339 pub const MAP_ANONYMOUS: c_int = MAP_ANON;
1340 pub const MAP_NORESERVE: c_int = 0x4000;
1341 pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
1342 pub const MS_ASYNC: c_int = 1;
1343 pub const MS_SYNC: c_int = 2;
1344 pub const MS_INVALIDATE: c_int = 4;
1345 pub const POSIX_MADV_NORMAL: c_int = 0;
1346 pub const POSIX_MADV_SEQUENTIAL: c_int = 1;
1347 pub const POSIX_MADV_RANDOM: c_int = 2;
1348 pub const POSIX_MADV_WILLNEED: c_int = 3;
1349 pub const POSIX_MADV_DONTNEED: c_int = 4;
1350 pub const MADV_NORMAL: c_int = 0;
1351 pub const MADV_SEQUENTIAL: c_int = 1;
1352 pub const MADV_RANDOM: c_int = 2;
1353 pub const MADV_WILLNEED: c_int = 3;
1354 pub const MADV_DONTNEED: c_int = 4;
1355
1356 pub const F_ULOCK: c_int = 0;
1357 pub const F_LOCK: c_int = 1;
1358 pub const F_TLOCK: c_int = 2;
1359 pub const F_TEST: c_int = 3;
1360
1361 pub const F_OK: c_int = 0;
1362 pub const R_OK: c_int = 4;
1363 pub const W_OK: c_int = 2;
1364 pub const X_OK: c_int = 1;
1365 pub const SEEK_SET: c_int = 0;
1366 pub const SEEK_CUR: c_int = 1;
1367 pub const SEEK_END: c_int = 2;
1368 pub const STDIN_FILENO: c_int = 0;
1369 pub const STDOUT_FILENO: c_int = 1;
1370 pub const STDERR_FILENO: c_int = 2;
1371 pub const _SC_ARG_MAX: c_int = 0;
1372 pub const _SC_CHILD_MAX: c_int = 1;
1373 pub const _SC_CLK_TCK: c_int = 2;
1374 pub const _SC_NGROUPS_MAX: c_int = 3;
1375 pub const _SC_OPEN_MAX: c_int = 4;
1376 pub const _SC_JOB_CONTROL: c_int = 5;
1377 pub const _SC_SAVED_IDS: c_int = 6;
1378 pub const _SC_VERSION: c_int = 7;
1379 pub const _SC_PAGESIZE: c_int = 8;
1380 pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
1381 pub const _SC_NPROCESSORS_CONF: c_int = 9;
1382 pub const _SC_NPROCESSORS_ONLN: c_int = 10;
1383 pub const _SC_PHYS_PAGES: c_int = 11;
1384 pub const _SC_AVPHYS_PAGES: c_int = 12;
1385 pub const _SC_MQ_OPEN_MAX: c_int = 13;
1386 pub const _SC_MQ_PRIO_MAX: c_int = 14;
1387 pub const _SC_RTSIG_MAX: c_int = 15;
1388 pub const _SC_SEM_NSEMS_MAX: c_int = 16;
1389 pub const _SC_SEM_VALUE_MAX: c_int = 17;
1390 pub const _SC_SIGQUEUE_MAX: c_int = 18;
1391 pub const _SC_TIMER_MAX: c_int = 19;
1392 pub const _SC_TZNAME_MAX: c_int = 20;
1393 pub const _SC_ASYNCHRONOUS_IO: c_int = 21;
1394 pub const _SC_FSYNC: c_int = 22;
1395 pub const _SC_MAPPED_FILES: c_int = 23;
1396 pub const _SC_MEMLOCK: c_int = 24;
1397 pub const _SC_MEMLOCK_RANGE: c_int = 25;
1398 pub const _SC_MEMORY_PROTECTION: c_int = 26;
1399 pub const _SC_MESSAGE_PASSING: c_int = 27;
1400 pub const _SC_PRIORITIZED_IO: c_int = 28;
1401 pub const _SC_REALTIME_SIGNALS: c_int = 29;
1402 pub const _SC_SEMAPHORES: c_int = 30;
1403 pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 31;
1404 pub const _SC_SYNCHRONIZED_IO: c_int = 32;
1405 pub const _SC_TIMERS: c_int = 33;
1406 pub const _SC_AIO_LISTIO_MAX: c_int = 34;
1407 pub const _SC_AIO_MAX: c_int = 35;
1408 pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 36;
1409 pub const _SC_DELAYTIMER_MAX: c_int = 37;
1410 pub const _SC_THREAD_KEYS_MAX: c_int = 38;
1411 pub const _SC_THREAD_STACK_MIN: c_int = 39;
1412 pub const _SC_THREAD_THREADS_MAX: c_int = 40;
1413 pub const _SC_TTY_NAME_MAX: c_int = 41;
1414 pub const _SC_THREADS: c_int = 42;
1415 pub const _SC_THREAD_ATTR_STACKADDR: c_int = 43;
1416 pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 44;
1417 pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 45;
1418 pub const _SC_THREAD_PRIO_INHERIT: c_int = 46;
1419 pub const _SC_THREAD_PRIO_PROTECT: c_int = 47;
1420 pub const _SC_THREAD_PRIO_CEILING: c_int = _SC_THREAD_PRIO_PROTECT;
1421 pub const _SC_THREAD_PROCESS_SHARED: c_int = 48;
1422 pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 49;
1423 pub const _SC_GETGR_R_SIZE_MAX: c_int = 50;
1424 pub const _SC_GETPW_R_SIZE_MAX: c_int = 51;
1425 pub const _SC_LOGIN_NAME_MAX: c_int = 52;
1426 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 53;
1427 pub const _SC_ADVISORY_INFO: c_int = 54;
1428 pub const _SC_ATEXIT_MAX: c_int = 55;
1429 pub const _SC_BARRIERS: c_int = 56;
1430 pub const _SC_BC_BASE_MAX: c_int = 57;
1431 pub const _SC_BC_DIM_MAX: c_int = 58;
1432 pub const _SC_BC_SCALE_MAX: c_int = 59;
1433 pub const _SC_BC_STRING_MAX: c_int = 60;
1434 pub const _SC_CLOCK_SELECTION: c_int = 61;
1435 pub const _SC_COLL_WEIGHTS_MAX: c_int = 62;
1436 pub const _SC_CPUTIME: c_int = 63;
1437 pub const _SC_EXPR_NEST_MAX: c_int = 64;
1438 pub const _SC_HOST_NAME_MAX: c_int = 65;
1439 pub const _SC_IOV_MAX: c_int = 66;
1440 pub const _SC_IPV6: c_int = 67;
1441 pub const _SC_LINE_MAX: c_int = 68;
1442 pub const _SC_MONOTONIC_CLOCK: c_int = 69;
1443 pub const _SC_RAW_SOCKETS: c_int = 70;
1444 pub const _SC_READER_WRITER_LOCKS: c_int = 71;
1445 pub const _SC_REGEXP: c_int = 72;
1446 pub const _SC_RE_DUP_MAX: c_int = 73;
1447 pub const _SC_SHELL: c_int = 74;
1448 pub const _SC_SPAWN: c_int = 75;
1449 pub const _SC_SPIN_LOCKS: c_int = 76;
1450 pub const _SC_SPORADIC_SERVER: c_int = 77;
1451 pub const _SC_SS_REPL_MAX: c_int = 78;
1452 pub const _SC_SYMLOOP_MAX: c_int = 79;
1453 pub const _SC_THREAD_CPUTIME: c_int = 80;
1454 pub const _SC_THREAD_SPORADIC_SERVER: c_int = 81;
1455 pub const _SC_TIMEOUTS: c_int = 82;
1456 pub const _SC_TRACE: c_int = 83;
1457 pub const _SC_TRACE_EVENT_FILTER: c_int = 84;
1458 pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 85;
1459 pub const _SC_TRACE_INHERIT: c_int = 86;
1460 pub const _SC_TRACE_LOG: c_int = 87;
1461 pub const _SC_TRACE_NAME_MAX: c_int = 88;
1462 pub const _SC_TRACE_SYS_MAX: c_int = 89;
1463 pub const _SC_TRACE_USER_EVENT_MAX: c_int = 90;
1464 pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 91;
1465 pub const _SC_V7_ILP32_OFF32: c_int = 92;
1466 pub const _SC_V6_ILP32_OFF32: c_int = _SC_V7_ILP32_OFF32;
1467 pub const _SC_XBS5_ILP32_OFF32: c_int = _SC_V7_ILP32_OFF32;
1468 pub const _SC_V7_ILP32_OFFBIG: c_int = 93;
1469 pub const _SC_V6_ILP32_OFFBIG: c_int = _SC_V7_ILP32_OFFBIG;
1470 pub const _SC_XBS5_ILP32_OFFBIG: c_int = _SC_V7_ILP32_OFFBIG;
1471 pub const _SC_V7_LP64_OFF64: c_int = 94;
1472 pub const _SC_V6_LP64_OFF64: c_int = _SC_V7_LP64_OFF64;
1473 pub const _SC_XBS5_LP64_OFF64: c_int = _SC_V7_LP64_OFF64;
1474 pub const _SC_V7_LPBIG_OFFBIG: c_int = 95;
1475 pub const _SC_V6_LPBIG_OFFBIG: c_int = _SC_V7_LPBIG_OFFBIG;
1476 pub const _SC_XBS5_LPBIG_OFFBIG: c_int = _SC_V7_LPBIG_OFFBIG;
1477 pub const _SC_XOPEN_CRYPT: c_int = 96;
1478 pub const _SC_XOPEN_ENH_I18N: c_int = 97;
1479 pub const _SC_XOPEN_LEGACY: c_int = 98;
1480 pub const _SC_XOPEN_REALTIME: c_int = 99;
1481 pub const _SC_STREAM_MAX: c_int = 100;
1482 pub const _SC_PRIORITY_SCHEDULING: c_int = 101;
1483 pub const _SC_XOPEN_REALTIME_THREADS: c_int = 102;
1484 pub const _SC_XOPEN_SHM: c_int = 103;
1485 pub const _SC_XOPEN_STREAMS: c_int = 104;
1486 pub const _SC_XOPEN_UNIX: c_int = 105;
1487 pub const _SC_XOPEN_VERSION: c_int = 106;
1488 pub const _SC_2_CHAR_TERM: c_int = 107;
1489 pub const _SC_2_C_BIND: c_int = 108;
1490 pub const _SC_2_C_DEV: c_int = 109;
1491 pub const _SC_2_FORT_DEV: c_int = 110;
1492 pub const _SC_2_FORT_RUN: c_int = 111;
1493 pub const _SC_2_LOCALEDEF: c_int = 112;
1494 pub const _SC_2_PBS: c_int = 113;
1495 pub const _SC_2_PBS_ACCOUNTING: c_int = 114;
1496 pub const _SC_2_PBS_CHECKPOINT: c_int = 115;
1497 pub const _SC_2_PBS_LOCATE: c_int = 116;
1498 pub const _SC_2_PBS_MESSAGE: c_int = 117;
1499 pub const _SC_2_PBS_TRACK: c_int = 118;
1500 pub const _SC_2_SW_DEV: c_int = 119;
1501 pub const _SC_2_UPE: c_int = 120;
1502 pub const _SC_2_VERSION: c_int = 121;
1503 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 122;
1504 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 123;
1505 pub const _SC_XOPEN_UUCP: c_int = 124;
1506 pub const _SC_LEVEL1_ICACHE_SIZE: c_int = 125;
1507 pub const _SC_LEVEL1_ICACHE_ASSOC: c_int = 126;
1508 pub const _SC_LEVEL1_ICACHE_LINESIZE: c_int = 127;
1509 pub const _SC_LEVEL1_DCACHE_SIZE: c_int = 128;
1510 pub const _SC_LEVEL1_DCACHE_ASSOC: c_int = 129;
1511 pub const _SC_LEVEL1_DCACHE_LINESIZE: c_int = 130;
1512 pub const _SC_LEVEL2_CACHE_SIZE: c_int = 131;
1513 pub const _SC_LEVEL2_CACHE_ASSOC: c_int = 132;
1514 pub const _SC_LEVEL2_CACHE_LINESIZE: c_int = 133;
1515 pub const _SC_LEVEL3_CACHE_SIZE: c_int = 134;
1516 pub const _SC_LEVEL3_CACHE_ASSOC: c_int = 135;
1517 pub const _SC_LEVEL3_CACHE_LINESIZE: c_int = 136;
1518 pub const _SC_LEVEL4_CACHE_SIZE: c_int = 137;
1519 pub const _SC_LEVEL4_CACHE_ASSOC: c_int = 138;
1520 pub const _SC_LEVEL4_CACHE_LINESIZE: c_int = 139;
1521 pub const _PC_LINK_MAX: c_int = 0;
1522 pub const _PC_MAX_CANON: c_int = 1;
1523 pub const _PC_MAX_INPUT: c_int = 2;
1524 pub const _PC_NAME_MAX: c_int = 3;
1525 pub const _PC_PATH_MAX: c_int = 4;
1526 pub const _PC_PIPE_BUF: c_int = 5;
1527 pub const _PC_CHOWN_RESTRICTED: c_int = 6;
1528 pub const _PC_NO_TRUNC: c_int = 7;
1529 pub const _PC_VDISABLE: c_int = 8;
1530 pub const _PC_ASYNC_IO: c_int = 9;
1531 pub const _PC_PRIO_IO: c_int = 10;
1532 pub const _PC_SYNC_IO: c_int = 11;
1533 pub const _PC_FILESIZEBITS: c_int = 12;
1534 pub const _PC_2_SYMLINKS: c_int = 13;
1535 pub const _PC_SYMLINK_MAX: c_int = 14;
1536 pub const _PC_ALLOC_SIZE_MIN: c_int = 15;
1537 pub const _PC_REC_INCR_XFER_SIZE: c_int = 16;
1538 pub const _PC_REC_MAX_XFER_SIZE: c_int = 17;
1539 pub const _PC_REC_MIN_XFER_SIZE: c_int = 18;
1540 pub const _PC_REC_XFER_ALIGN: c_int = 19;
1541 pub const _PC_TIMESTAMP_RESOLUTION: c_int = 20;
1542 pub const _CS_PATH: c_int = 0;
1543
1544 pub const O_ACCMODE: c_int = 0x3;
1545 pub const O_RDONLY: c_int = 0;
1546 pub const O_WRONLY: c_int = 1;
1547 pub const O_RDWR: c_int = 2;
1548 pub const O_APPEND: c_int = 0x0008;
1549 pub const O_CREAT: c_int = 0x0200;
1550 pub const O_TRUNC: c_int = 0x0400;
1551 pub const O_EXCL: c_int = 0x0800;
1552 pub const O_SYNC: c_int = 0x2000;
1553 pub const O_NONBLOCK: c_int = 0x4000;
1554 pub const O_NOCTTY: c_int = 0x8000;
1555 pub const O_CLOEXEC: c_int = 0x40000;
1556 pub const O_NOFOLLOW: c_int = 0x100000;
1557 pub const O_DIRECTORY: c_int = 0x200000;
1558 pub const O_EXEC: c_int = 0x400000;
1559 pub const O_SEARCH: c_int = 0x400000;
1560 pub const O_DIRECT: c_int = 0x80000;
1561 pub const O_DSYNC: c_int = 0x2000;
1562 pub const O_RSYNC: c_int = 0x2000;
1563 pub const O_TMPFILE: c_int = 0x800000;
1564 pub const O_NOATIME: c_int = 0x1000000;
1565 pub const O_PATH: c_int = 0x2000000;
1566 pub const F_DUPFD: c_int = 0;
1567 pub const F_GETFD: c_int = 1;
1568 pub const F_SETFD: c_int = 2;
1569 pub const F_GETFL: c_int = 3;
1570 pub const F_SETFL: c_int = 4;
1571 pub const F_GETOWN: c_int = 5;
1572 pub const F_SETOWN: c_int = 6;
1573 pub const F_GETLK: c_int = 7;
1574 pub const F_SETLK: c_int = 8;
1575 pub const F_SETLKW: c_int = 9;
1576 pub const F_RGETLK: c_int = 10;
1577 pub const F_RSETLK: c_int = 11;
1578 pub const F_CNVT: c_int = 12;
1579 pub const F_RSETLKW: c_int = 13;
1580 pub const F_DUPFD_CLOEXEC: c_int = 14;
1581 pub const F_RDLCK: c_int = 1;
1582 pub const F_WRLCK: c_int = 2;
1583 pub const F_UNLCK: c_int = 3;
1584 pub const AT_FDCWD: c_int = -2;
1585 pub const AT_EACCESS: c_int = 1;
1586 pub const AT_SYMLINK_NOFOLLOW: c_int = 2;
1587 pub const AT_SYMLINK_FOLLOW: c_int = 4;
1588 pub const AT_REMOVEDIR: c_int = 8;
1589 pub const AT_EMPTY_PATH: c_int = 16;
1590 pub const LOCK_SH: c_int = 1;
1591 pub const LOCK_EX: c_int = 2;
1592 pub const LOCK_NB: c_int = 4;
1593 pub const LOCK_UN: c_int = 8;
1594
1595 pub const EPERM: c_int = 1;
1596 pub const ENOENT: c_int = 2;
1597 pub const ESRCH: c_int = 3;
1598 pub const EINTR: c_int = 4;
1599 pub const EIO: c_int = 5;
1600 pub const ENXIO: c_int = 6;
1601 pub const E2BIG: c_int = 7;
1602 pub const ENOEXEC: c_int = 8;
1603 pub const EBADF: c_int = 9;
1604 pub const ECHILD: c_int = 10;
1605 pub const EAGAIN: c_int = 11;
1606 pub const ENOMEM: c_int = 12;
1607 pub const EACCES: c_int = 13;
1608 pub const EFAULT: c_int = 14;
1609 pub const ENOTBLK: c_int = 15;
1610 pub const EBUSY: c_int = 16;
1611 pub const EEXIST: c_int = 17;
1612 pub const EXDEV: c_int = 18;
1613 pub const ENODEV: c_int = 19;
1614 pub const ENOTDIR: c_int = 20;
1615 pub const EISDIR: c_int = 21;
1616 pub const EINVAL: c_int = 22;
1617 pub const ENFILE: c_int = 23;
1618 pub const EMFILE: c_int = 24;
1619 pub const ENOTTY: c_int = 25;
1620 pub const ETXTBSY: c_int = 26;
1621 pub const EFBIG: c_int = 27;
1622 pub const ENOSPC: c_int = 28;
1623 pub const ESPIPE: c_int = 29;
1624 pub const EROFS: c_int = 30;
1625 pub const EMLINK: c_int = 31;
1626 pub const EPIPE: c_int = 32;
1627 pub const EDOM: c_int = 33;
1628 pub const ERANGE: c_int = 34;
1629 pub const ENOMSG: c_int = 35;
1630 pub const EIDRM: c_int = 36;
1631 pub const ECHRNG: c_int = 37;
1632 pub const EL2NSYNC: c_int = 38;
1633 pub const EL3HLT: c_int = 39;
1634 pub const EL3RST: c_int = 40;
1635 pub const ELNRNG: c_int = 41;
1636 pub const EUNATCH: c_int = 42;
1637 pub const ENOCSI: c_int = 43;
1638 pub const EL2HLT: c_int = 44;
1639 pub const EDEADLK: c_int = 45;
1640 pub const ENOLCK: c_int = 46;
1641 pub const EBADE: c_int = 50;
1642 pub const EBADR: c_int = 51;
1643 pub const EXFULL: c_int = 52;
1644 pub const ENOANO: c_int = 53;
1645 pub const EBADRQC: c_int = 54;
1646 pub const EBADSLT: c_int = 55;
1647 pub const EDEADLOCK: c_int = 56;
1648 pub const EBFONT: c_int = 57;
1649 pub const ENOSTR: c_int = 60;
1650 pub const ENODATA: c_int = 61;
1651 pub const ETIME: c_int = 62;
1652 pub const ENOSR: c_int = 63;
1653 pub const ENONET: c_int = 64;
1654 pub const ENOPKG: c_int = 65;
1655 pub const EREMOTE: c_int = 66;
1656 pub const ENOLINK: c_int = 67;
1657 pub const EADV: c_int = 68;
1658 pub const ESRMNT: c_int = 69;
1659 pub const ECOMM: c_int = 70;
1660 pub const EPROTO: c_int = 71;
1661 pub const EMULTIHOP: c_int = 74;
1662 pub const EDOTDOT: c_int = 76;
1663 pub const EBADMSG: c_int = 77;
1664 pub const EFTYPE: c_int = 79;
1665 pub const ENOTUNIQ: c_int = 80;
1666 pub const EBADFD: c_int = 81;
1667 pub const EREMCHG: c_int = 82;
1668 pub const ELIBACC: c_int = 83;
1669 pub const ELIBBAD: c_int = 84;
1670 pub const ELIBSCN: c_int = 85;
1671 pub const ELIBMAX: c_int = 86;
1672 pub const ELIBEXEC: c_int = 87;
1673 pub const ENOSYS: c_int = 88;
1674 pub const ENOTEMPTY: c_int = 90;
1675 pub const ENAMETOOLONG: c_int = 91;
1676 pub const ELOOP: c_int = 92;
1677 pub const EOPNOTSUPP: c_int = 95;
1678 pub const EPFNOSUPPORT: c_int = 96;
1679 pub const ECONNRESET: c_int = 104;
1680 pub const ENOBUFS: c_int = 105;
1681 pub const EAFNOSUPPORT: c_int = 106;
1682 pub const EPROTOTYPE: c_int = 107;
1683 pub const ENOTSOCK: c_int = 108;
1684 pub const ENOPROTOOPT: c_int = 109;
1685 pub const ESHUTDOWN: c_int = 110;
1686 pub const ECONNREFUSED: c_int = 111;
1687 pub const EADDRINUSE: c_int = 112;
1688 pub const ECONNABORTED: c_int = 113;
1689 pub const ENETUNREACH: c_int = 114;
1690 pub const ENETDOWN: c_int = 115;
1691 pub const ETIMEDOUT: c_int = 116;
1692 pub const EHOSTDOWN: c_int = 117;
1693 pub const EHOSTUNREACH: c_int = 118;
1694 pub const EINPROGRESS: c_int = 119;
1695 pub const EALREADY: c_int = 120;
1696 pub const EDESTADDRREQ: c_int = 121;
1697 pub const EMSGSIZE: c_int = 122;
1698 pub const EPROTONOSUPPORT: c_int = 123;
1699 pub const ESOCKTNOSUPPORT: c_int = 124;
1700 pub const EADDRNOTAVAIL: c_int = 125;
1701 pub const ENETRESET: c_int = 126;
1702 pub const EISCONN: c_int = 127;
1703 pub const ENOTCONN: c_int = 128;
1704 pub const ETOOMANYREFS: c_int = 129;
1705 pub const EPROCLIM: c_int = 130;
1706 pub const EUSERS: c_int = 131;
1707 pub const EDQUOT: c_int = 132;
1708 pub const ESTALE: c_int = 133;
1709 pub const ENOTSUP: c_int = 134;
1710 pub const ENOMEDIUM: c_int = 135;
1711 pub const EILSEQ: c_int = 138;
1712 pub const EOVERFLOW: c_int = 139;
1713 pub const ECANCELED: c_int = 140;
1714 pub const ENOTRECOVERABLE: c_int = 141;
1715 pub const EOWNERDEAD: c_int = 142;
1716 pub const ESTRPIPE: c_int = 143;
1717 pub const EWOULDBLOCK: c_int = EAGAIN; /* Operation would block */
1718
1719 pub const SCHED_OTHER: c_int = 3;
1720 pub const SCHED_FIFO: c_int = 1;
1721 pub const SCHED_RR: c_int = 2;
1722
1723 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 21 as *mut _;
1724 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
1725 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
1726 pub const PTHREAD_MUTEX_RECURSIVE: c_int = 0;
1727 pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
1728 pub const PTHREAD_MUTEX_NORMAL: c_int = 2;
1729 pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL;
1730 pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: pthread_mutex_t = 18 as *mut _;
1731 pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: pthread_mutex_t = 20 as *mut _;
1732 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 19 as *mut _;
1733 pub const PTHREAD_PROCESS_SHARED: c_int = 1;
1734 pub const PTHREAD_PROCESS_PRIVATE: c_int = 0;
1735 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 22 as *mut _;
1736
1737 pub const LITTLE_ENDIAN: c_int = 1234;
1738 pub const BIG_ENDIAN: c_int = 4321;
1739
1740 pub const TCP_NODELAY: c_int = 1;
1741 pub const TCP_KEEPIDLE: c_int = 3;
1742 pub const TCP_MAXSEG: c_int = 4;
1743 pub const TCP_QUICKACK: c_int = 12;
1744 pub const TCP_USER_TIMEOUT: c_int = 14;
1745 pub const TCP_FASTOPEN: c_int = 15;
1746 pub const TCP_KEEPCNT: c_int = 16;
1747 pub const TCP_KEEPINTVL: c_int = 17;
1748
1749 pub const WINDOWS_POST: c_int = 0;
1750 pub const WINDOWS_SEND: c_int = 1;
1751 pub const WINDOWS_HWND: c_int = 2;
1752
1753 pub const MOUNT_TEXT: c_uint = 0x01;
1754 pub const MOUNT_SYSTEM: c_uint = 0x08;
1755 pub const MOUNT_EXEC: c_uint = 0x10;
1756 pub const MOUNT_CYGDRIVE: c_uint = 0x20;
1757 pub const MOUNT_CYGWIN_EXEC: c_uint = 0x40;
1758 pub const MOUNT_SPARSE: c_uint = 0x80;
1759 pub const MOUNT_NOTEXEC: c_uint = 0x100;
1760 pub const MOUNT_DEVFS: c_uint = 0x200;
1761 pub const MOUNT_PROC: c_uint = 0x400;
1762 pub const MOUNT_RO: c_uint = 0x1000;
1763 pub const MOUNT_NOACL: c_uint = 0x2000;
1764 pub const MOUNT_NOPOSIX: c_uint = 0x4000;
1765 pub const MOUNT_OVERRIDE: c_uint = 0x8000;
1766 pub const MOUNT_IMMUTABLE: c_uint = 0x10000;
1767 pub const MOUNT_AUTOMATIC: c_uint = 0x20000;
1768 pub const MOUNT_DOS: c_uint = 0x40000;
1769 pub const MOUNT_IHASH: c_uint = 0x80000;
1770 pub const MOUNT_BIND: c_uint = 0x100000;
1771 pub const MOUNT_USER_TEMP: c_uint = 0x200000;
1772 pub const MOUNT_DONT_USE: c_uint = 0x80000000;
1773
1774 pub const _POSIX_VDISABLE: cc_t = 0;
1775
1776 pub const GRND_NONBLOCK: c_uint = 0x1;
1777 pub const GRND_RANDOM: c_uint = 0x2;
1778
1779 pub const _IONBF: c_int = 2;
1780 pub const BUFSIZ: c_int = 1024;
1781
1782 pub const POSIX_SPAWN_RESETIDS: c_int = 0x01;
1783 pub const POSIX_SPAWN_SETPGROUP: c_int = 0x02;
1784 pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 0x04;
1785 pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x08;
1786 pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x10;
1787 pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x20;
1788
1789 f! {
1790 pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () {
1791 let fd = fd as usize;
1792 let size = core::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1793 (*set).fds_bits[fd / size] &= !(1 << (fd % size));
1794 }
1795
1796 pub fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool {
1797 let fd = fd as usize;
1798 let size = core::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1799 ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
1800 }
1801
1802 pub fn FD_SET(fd: c_int, set: *mut fd_set) -> () {
1803 let fd = fd as usize;
1804 let size = core::mem::size_of_val(&(*set).fds_bits[0]) * 8;
1805 (*set).fds_bits[fd / size] |= 1 << (fd % size);
1806 }
1807
1808 pub fn FD_ZERO(set: *mut fd_set) -> () {
1809 for slot in (*set).fds_bits.iter_mut() {
1810 *slot = 0;
1811 }
1812 }
1813
1814 pub fn CPU_ALLOC_SIZE(count: c_int) -> size_t {
1815 let _dummy: cpu_set_t = cpu_set_t { bits: [0; 16] };
1816 let size_in_bits = 8 * core::mem::size_of_val(&_dummy.bits[0]);
1817 ((count as size_t + size_in_bits - 1) / 8) as size_t
1818 }
1819
1820 pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int {
1821 let mut s: u32 = 0;
1822 let size_of_mask = core::mem::size_of_val(&cpuset.bits[0]);
1823 for i in cpuset.bits[..(size / size_of_mask)].iter() {
1824 s += i.count_ones();
1825 }
1826 s as c_int
1827 }
1828
1829 pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
1830 for slot in cpuset.bits.iter_mut() {
1831 *slot = 0;
1832 }
1833 }
1834 pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1835 let size_in_bits = 8 * core::mem::size_of_val(&cpuset.bits[0]);
1836 if cpu < size_in_bits {
1837 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1838 cpuset.bits[idx] |= 1 << offset;
1839 }
1840 }
1841
1842 pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1843 let size_in_bits = 8 * core::mem::size_of_val(&cpuset.bits[0]);
1844 if cpu < size_in_bits {
1845 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1846 cpuset.bits[idx] &= !(1 << offset);
1847 }
1848 }
1849
1850 pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
1851 let size_in_bits = 8 * core::mem::size_of_val(&cpuset.bits[0]);
1852 if cpu < size_in_bits {
1853 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1854 0 != (cpuset.bits[idx] & (1 << offset))
1855 } else {
1856 false
1857 }
1858 }
1859
1860 pub fn CPU_COUNT(cpuset: &cpu_set_t) -> c_int {
1861 CPU_COUNT_S(::core::mem::size_of::<cpu_set_t>(), cpuset)
1862 }
1863
1864 pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
1865 set1.bits == set2.bits
1866 }
1867
1868 pub fn major(dev: dev_t) -> c_uint {
1869 ((dev >> 16) & 0xffff) as c_uint
1870 }
1871
1872 pub fn minor(dev: dev_t) -> c_uint {
1873 (dev & 0xffff) as c_uint
1874 }
1875
1876 pub fn CMSG_LEN(length: c_uint) -> c_uint {
1877 CMSG_ALIGN(::core::mem::size_of::<cmsghdr>()) as c_uint + length
1878 }
1879
1880 pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint {
1881 (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::core::mem::size_of::<cmsghdr>())) as c_uint
1882 }
1883
1884 pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
1885 if (*mhdr).msg_controllen as usize >= core::mem::size_of::<cmsghdr>() {
1886 (*mhdr).msg_control.cast()
1887 } else {
1888 core::ptr::null_mut()
1889 }
1890 }
1891
1892 pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
1893 let next = (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr;
1894 let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
1895 if next as usize + CMSG_ALIGN(::core::mem::size_of::<cmsghdr>()) as usize > max {
1896 core::ptr::null_mut()
1897 } else {
1898 next
1899 }
1900 }
1901
1902 pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
1903 cmsg.offset(1).cast_mut().cast()
1904 }
1905 }
1906
1907 safe_f! {
1908 pub {const} fn makedev(ma: c_uint, mi: c_uint) -> dev_t {
1909 let ma = ma as dev_t;
1910 let mi = mi as dev_t;
1911 (ma << 16) | (mi & 0xffff)
1912 }
1913
1914 pub {const} fn WIFEXITED(status: c_int) -> bool {
1915 (status & 0xff) == 0
1916 }
1917
1918 pub {const} fn WIFSIGNALED(status: c_int) -> bool {
1919 (status & 0o177) != 0o177 && (status & 0o177) != 0
1920 }
1921
1922 pub {const} fn WIFSTOPPED(status: c_int) -> bool {
1923 (status & 0xff) == 0o177
1924 }
1925
1926 pub {const} fn WIFCONTINUED(status: c_int) -> bool {
1927 (status & 0o177777) == 0o177777
1928 }
1929
1930 pub {const} fn WEXITSTATUS(status: c_int) -> c_int {
1931 (status >> 8) & 0xff
1932 }
1933
1934 pub {const} fn WTERMSIG(status: c_int) -> c_int {
1935 status & 0o177
1936 }
1937
1938 pub {const} fn WSTOPSIG(status: c_int) -> c_int {
1939 (status >> 8) & 0xff
1940 }
1941
1942 pub {const} fn WCOREDUMP(status: c_int) -> bool {
1943 WIFSIGNALED(status) && (status & 0x80) != 0
1944 }
1945 }
1946
1947 const_fn! {
1948 {const} fn CMSG_ALIGN(len: usize) -> usize {
1949 len + core::mem::size_of::<usize>() - 1 & !(::core::mem::size_of::<usize>() - 1)
1950 }
1951 }
1952
1953 extern "C" {
1954 pub fn sigwait(set: *const sigset_t, sig: *mut c_int) -> c_int;
1955 pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int;
1956
1957 pub fn pthread_sigmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int;
1958 pub fn sigsuspend(mask: *const sigset_t) -> c_int;
1959 pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> c_int;
1960 pub fn pthread_kill(thread: pthread_t, sig: c_int) -> c_int;
1961
1962 pub fn sigtimedwait(
1963 set: *const sigset_t,
1964 info: *mut siginfo_t,
1965 timeout: *const timespec,
1966 ) -> c_int;
1967
1968 pub fn strftime(s: *mut c_char, max: size_t, format: *const c_char, tm: *const tm) -> size_t;
1969
1970 pub fn asctime_r(tm: *const tm, buf: *mut c_char) -> *mut c_char;
1971 pub fn ctime_r(timep: *const time_t, buf: *mut c_char) -> *mut c_char;
1972 pub fn strptime(s: *const c_char, format: *const c_char, tm: *mut tm) -> *mut c_char;
1973 pub fn clock_settime(clk_id: clockid_t, tp: *const timespec) -> c_int;
1974 pub fn clock_gettime(clk_id: clockid_t, tp: *mut timespec) -> c_int;
1975 pub fn clock_getres(clk_id: clockid_t, tp: *mut timespec) -> c_int;
1976
1977 pub fn timer_create(clockid: clockid_t, sevp: *mut sigevent, timerid: *mut timer_t) -> c_int;
1978
1979 pub fn timer_delete(timerid: timer_t) -> c_int;
1980
1981 pub fn timer_settime(
1982 timerid: timer_t,
1983 flags: c_int,
1984 new_value: *const itimerspec,
1985 old_value: *mut itimerspec,
1986 ) -> c_int;
1987
1988 pub fn timer_gettime(timerid: timer_t, curr_value: *mut itimerspec) -> c_int;
1989 pub fn timer_getoverrun(timerid: timer_t) -> c_int;
1990
1991 pub fn clock_nanosleep(
1992 clk_id: clockid_t,
1993 flags: c_int,
1994 rqtp: *const timespec,
1995 rmtp: *mut timespec,
1996 ) -> c_int;
1997
1998 pub fn clock_getcpuclockid(pid: pid_t, clk_id: *mut clockid_t) -> c_int;
1999
2000 pub fn futimes(fd: c_int, times: *const timeval) -> c_int;
2001 pub fn lutimes(file: *const c_char, times: *const timeval) -> c_int;
2002 pub fn settimeofday(tv: *const timeval, tz: *const timezone) -> c_int;
2003 pub fn getitimer(which: c_int, curr_value: *mut itimerval) -> c_int;
2004
2005 pub fn setitimer(which: c_int, new_value: *const itimerval, old_value: *mut itimerval)
2006 -> c_int;
2007
2008 pub fn gettimeofday(tp: *mut timeval, tz: *mut c_void) -> c_int;
2009 pub fn futimesat(fd: c_int, path: *const c_char, times: *const timeval) -> c_int;
2010
2011 pub fn getrlimit(resource: c_int, rlim: *mut rlimit) -> c_int;
2012 pub fn setrlimit(resource: c_int, rlim: *const rlimit) -> c_int;
2013 pub fn getpriority(which: c_int, who: id_t) -> c_int;
2014 pub fn setpriority(which: c_int, who: id_t, prio: c_int) -> c_int;
2015
2016 pub fn getpwnam_r(
2017 name: *const c_char,
2018 pwd: *mut passwd,
2019 buf: *mut c_char,
2020 buflen: size_t,
2021 result: *mut *mut passwd,
2022 ) -> c_int;
2023
2024 pub fn getpwuid_r(
2025 uid: uid_t,
2026 pwd: *mut passwd,
2027 buf: *mut c_char,
2028 buflen: size_t,
2029 result: *mut *mut passwd,
2030 ) -> c_int;
2031
2032 pub fn getpwent() -> *mut passwd;
2033 pub fn setpwent();
2034 pub fn endpwent();
2035
2036 pub fn if_nameindex() -> *mut if_nameindex;
2037 pub fn if_freenameindex(ptr: *mut if_nameindex);
2038
2039 pub fn readv(fd: c_int, iov: *const iovec, iovcnt: c_int) -> ssize_t;
2040 pub fn writev(fd: c_int, iov: *const iovec, iovcnt: c_int) -> ssize_t;
2041
2042 pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
2043
2044 pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
2045
2046 pub fn utimensat(
2047 dirfd: c_int,
2048 path: *const c_char,
2049 times: *const timespec,
2050 flag: c_int,
2051 ) -> c_int;
2052
2053 pub fn futimens(fd: c_int, times: *const timespec) -> c_int;
2054
2055 pub fn dlfork(val: c_int);
2056
2057 pub fn accept4(s: c_int, addr: *mut sockaddr, addrlen: *mut socklen_t, flags: c_int) -> c_int;
2058
2059 pub fn bind(socket: c_int, address: *const sockaddr, address_len: socklen_t) -> c_int;
2060
2061 pub fn recvfrom(
2062 socket: c_int,
2063 buf: *mut c_void,
2064 len: size_t,
2065 flags: c_int,
2066 addr: *mut sockaddr,
2067 addrlen: *mut socklen_t,
2068 ) -> ssize_t;
2069
2070 pub fn recvmsg(fd: c_int, msg: *mut msghdr, flags: c_int) -> ssize_t;
2071 pub fn sendmsg(fd: c_int, msg: *const msghdr, flags: c_int) -> ssize_t;
2072
2073 pub fn getnameinfo(
2074 sa: *const sockaddr,
2075 salen: socklen_t,
2076 host: *mut c_char,
2077 hostlen: socklen_t,
2078 serv: *mut c_char,
2079 sevlen: socklen_t,
2080 flags: c_int,
2081 ) -> c_int;
2082
2083 pub fn ppoll(
2084 fds: *mut pollfd,
2085 nfds: nfds_t,
2086 timeout: *const timespec,
2087 sigmask: *const sigset_t,
2088 ) -> c_int;
2089
2090 pub fn newlocale(mask: c_int, locale: *const c_char, base: locale_t) -> locale_t;
2091 pub fn freelocale(loc: locale_t);
2092 pub fn duplocale(base: locale_t) -> locale_t;
2093 pub fn uselocale(loc: locale_t) -> locale_t;
2094
2095 pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int;
2096 pub fn sem_destroy(sem: *mut sem_t) -> c_int;
2097 pub fn sem_open(name: *const c_char, oflag: c_int, ...) -> *mut sem_t;
2098 pub fn sem_close(sem: *mut sem_t) -> c_int;
2099 pub fn sem_unlink(name: *const c_char) -> c_int;
2100 pub fn sem_timedwait(sem: *mut sem_t, abstime: *const timespec) -> c_int;
2101 pub fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int;
2102
2103 pub fn clearenv() -> c_int;
2104 pub fn ptsname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
2105 pub fn getpt() -> c_int;
2106 pub fn memalign(align: size_t, size: size_t) -> *mut c_void;
2107 pub fn getloadavg(loadavg: *mut c_double, nelem: c_int) -> c_int;
2108
2109 pub fn abs(i: c_int) -> c_int;
2110 pub fn arc4random() -> u32;
2111 pub fn arc4random_uniform(l: u32) -> u32;
2112 pub fn arc4random_buf(buf: *mut c_void, size: size_t);
2113 pub fn labs(i: c_long) -> c_long;
2114 pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int;
2115 pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int;
2116 pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int;
2117 pub fn rand() -> c_int;
2118 pub fn reallocarray(ptr: *mut c_void, nmemb: size_t, size: size_t) -> *mut c_void;
2119 pub fn reallocf(ptr: *mut c_void, size: size_t) -> *mut c_void;
2120 pub fn srand(seed: c_uint);
2121 pub fn drand48() -> c_double;
2122 pub fn erand48(xseed: *mut c_ushort) -> c_double;
2123 pub fn jrand48(xseed: *mut c_ushort) -> c_long;
2124 pub fn lcong48(p: *mut c_ushort);
2125 pub fn lrand48() -> c_long;
2126 pub fn mrand48() -> c_long;
2127 pub fn nrand48(xseed: *mut c_ushort) -> c_long;
2128 pub fn seed48(xseed: *mut c_ushort) -> *mut c_ushort;
2129 pub fn srand48(seed: c_long);
2130
2131 pub fn qsort_r(
2132 base: *mut c_void,
2133 num: size_t,
2134 size: size_t,
2135 compar: Option<unsafe extern "C" fn(*const c_void, *const c_void, *mut c_void) -> c_int>,
2136 arg: *mut c_void,
2137 );
2138
2139 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
2140 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int;
2141 pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
2142 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
2143 pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
2144 pub fn shm_unlink(name: *const c_char) -> c_int;
2145
2146 pub fn explicit_bzero(s: *mut c_void, len: size_t);
2147 pub fn ffs(value: c_int) -> c_int;
2148 pub fn ffsl(value: c_long) -> c_int;
2149 pub fn ffsll(value: c_longlong) -> c_int;
2150 pub fn fls(value: c_int) -> c_int;
2151 pub fn flsl(value: c_long) -> c_int;
2152 pub fn flsll(value: c_longlong) -> c_int;
2153 pub fn strcasecmp_l(s1: *const c_char, s2: *const c_char, loc: locale_t) -> c_int;
2154
2155 pub fn strncasecmp_l(s1: *const c_char, s2: *const c_char, n: size_t, loc: locale_t) -> c_int;
2156
2157 pub fn timingsafe_bcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int;
2158 pub fn timingsafe_memcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int;
2159
2160 pub fn memccpy(dest: *mut c_void, src: *const c_void, c: c_int, count: size_t) -> *mut c_void;
2161
2162 pub fn memmem(
2163 haystack: *const c_void,
2164 haystacklen: size_t,
2165 needle: *const c_void,
2166 needlelen: size_t,
2167 ) -> *mut c_void;
2168
2169 pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
2170 #[link_name = "__xpg_strerror_r"]
2171 pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
2172 pub fn strsep(string: *mut *mut c_char, delim: *const c_char) -> *mut c_char;
2173
2174 #[link_name = "__gnu_basename"]
2175 pub fn basename(path: *const c_char) -> *mut c_char;
2176
2177 pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int;
2178 pub fn dup3(src: c_int, dst: c_int, flags: c_int) -> c_int;
2179 pub fn eaccess(pathname: *const c_char, mode: c_int) -> c_int;
2180 pub fn euidaccess(pathname: *const c_char, mode: c_int) -> c_int;
2181 // pub fn execlpe(path: *const c_char, arg0: *const c_char, ...) -> c_int;
2182
2183 pub fn execvpe(
2184 file: *const c_char,
2185 argv: *const *const c_char,
2186 envp: *const *const c_char,
2187 ) -> c_int;
2188
2189 pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int;
2190
2191 pub fn fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int;
2192
2193 pub fn fdatasync(fd: c_int) -> c_int;
2194 pub fn getdomainname(name: *mut c_char, len: size_t) -> c_int;
2195 pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int;
2196 pub fn gethostid() -> c_long;
2197 pub fn getpagesize() -> c_int;
2198 pub fn getpeereid(socket: c_int, euid: *mut uid_t, egid: *mut gid_t) -> c_int;
2199
2200 pub fn pthread_atfork(
2201 prepare: Option<unsafe extern "C" fn()>,
2202 parent: Option<unsafe extern "C" fn()>,
2203 child: Option<unsafe extern "C" fn()>,
2204 ) -> c_int;
2205
2206 pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int;
2207 pub fn sbrk(increment: intptr_t) -> *mut c_void;
2208 pub fn setgroups(ngroups: c_int, ptr: *const gid_t) -> c_int;
2209 pub fn sethostname(name: *const c_char, len: size_t) -> c_int;
2210 pub fn vhangup() -> c_int;
2211 pub fn getdtablesize() -> c_int;
2212 pub fn sync();
2213
2214 pub fn __errno() -> *mut c_int;
2215
2216 pub fn sched_setparam(pid: pid_t, param: *const sched_param) -> c_int;
2217 pub fn sched_getparam(pid: pid_t, param: *mut sched_param) -> c_int;
2218
2219 pub fn sched_setscheduler(pid: pid_t, policy: c_int, param: *const sched_param) -> c_int;
2220
2221 pub fn sched_getscheduler(pid: pid_t) -> c_int;
2222 pub fn sched_get_priority_max(policy: c_int) -> c_int;
2223 pub fn sched_get_priority_min(policy: c_int) -> c_int;
2224 pub fn sched_rr_get_interval(pid: pid_t, t: *mut timespec) -> c_int;
2225 pub fn sched_getcpu() -> c_int;
2226 pub fn sched_getaffinity(pid: pid_t, cpusetsize: size_t, mask: *mut cpu_set_t) -> c_int;
2227
2228 pub fn sched_setaffinity(pid: pid_t, cpusetsize: size_t, cpuset: *const cpu_set_t) -> c_int;
2229
2230 pub fn pthread_attr_getguardsize(attr: *const pthread_attr_t, guardsize: *mut size_t) -> c_int;
2231
2232 pub fn pthread_attr_getschedparam(
2233 attr: *const pthread_attr_t,
2234 param: *mut sched_param,
2235 ) -> c_int;
2236
2237 pub fn pthread_attr_setschedparam(
2238 attr: *mut pthread_attr_t,
2239 param: *const sched_param,
2240 ) -> c_int;
2241
2242 pub fn pthread_attr_getstack(
2243 attr: *const pthread_attr_t,
2244 stackaddr: *mut *mut c_void,
2245 stacksize: *mut size_t,
2246 ) -> c_int;
2247
2248 pub fn pthread_cancel(thread: pthread_t) -> c_int;
2249
2250 pub fn pthread_condattr_getclock(
2251 attr: *const pthread_condattr_t,
2252 clock_id: *mut clockid_t,
2253 ) -> c_int;
2254
2255 pub fn pthread_condattr_getpshared(
2256 attr: *const pthread_condattr_t,
2257 pshared: *mut c_int,
2258 ) -> c_int;
2259
2260 pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, clock_id: clockid_t) -> c_int;
2261
2262 pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: c_int) -> c_int;
2263 pub fn pthread_barrierattr_init(attr: *mut pthread_barrierattr_t) -> c_int;
2264
2265 pub fn pthread_barrierattr_setpshared(attr: *mut pthread_barrierattr_t, shared: c_int)
2266 -> c_int;
2267
2268 pub fn pthread_barrierattr_getpshared(
2269 attr: *const pthread_barrierattr_t,
2270 shared: *mut c_int,
2271 ) -> c_int;
2272
2273 pub fn pthread_barrierattr_destroy(attr: *mut pthread_barrierattr_t) -> c_int;
2274
2275 pub fn pthread_barrier_init(
2276 barrier: *mut pthread_barrier_t,
2277 attr: *const pthread_barrierattr_t,
2278 count: c_uint,
2279 ) -> c_int;
2280
2281 pub fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> c_int;
2282 pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> c_int;
2283
2284 pub fn pthread_create(
2285 native: *mut pthread_t,
2286 attr: *const pthread_attr_t,
2287 f: extern "C" fn(*mut c_void) -> *mut c_void,
2288 value: *mut c_void,
2289 ) -> c_int;
2290
2291 pub fn pthread_getcpuclockid(thread: pthread_t, clk_id: *mut clockid_t) -> c_int;
2292
2293 pub fn pthread_getschedparam(
2294 native: pthread_t,
2295 policy: *mut c_int,
2296 param: *mut sched_param,
2297 ) -> c_int;
2298
2299 pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t, abstime: *const timespec) -> c_int;
2300
2301 pub fn pthread_mutexattr_getprotocol(
2302 attr: *const pthread_mutexattr_t,
2303 protocol: *mut c_int,
2304 ) -> c_int;
2305
2306 pub fn pthread_mutexattr_getpshared(
2307 attr: *const pthread_mutexattr_t,
2308 pshared: *mut c_int,
2309 ) -> c_int;
2310
2311 pub fn pthread_mutexattr_setprotocol(attr: *mut pthread_mutexattr_t, protocol: c_int) -> c_int;
2312
2313 pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int;
2314
2315 pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> c_int;
2316 pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: c_int) -> c_int;
2317 pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> c_int;
2318 pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> c_int;
2319 pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> c_int;
2320
2321 pub fn pthread_rwlockattr_getpshared(
2322 attr: *const pthread_rwlockattr_t,
2323 val: *mut c_int,
2324 ) -> c_int;
2325
2326 pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: c_int) -> c_int;
2327
2328 pub fn pthread_setschedparam(
2329 native: pthread_t,
2330 policy: c_int,
2331 param: *const sched_param,
2332 ) -> c_int;
2333
2334 pub fn pthread_setschedprio(native: pthread_t, priority: c_int) -> c_int;
2335
2336 pub fn pthread_getaffinity_np(
2337 thread: pthread_t,
2338 cpusetsize: size_t,
2339 cpuset: *mut cpu_set_t,
2340 ) -> c_int;
2341
2342 pub fn pthread_getattr_np(native: pthread_t, attr: *mut pthread_attr_t) -> c_int;
2343 pub fn pthread_getname_np(thread: pthread_t, name: *mut c_char, len: size_t) -> c_int;
2344
2345 pub fn pthread_setaffinity_np(
2346 thread: pthread_t,
2347 cpusetsize: size_t,
2348 cpuset: *const cpu_set_t,
2349 ) -> c_int;
2350
2351 pub fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int;
2352 pub fn pthread_sigqueue(thread: *mut pthread_t, sig: c_int, value: sigval) -> c_int;
2353
2354 pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int;
2355
2356 pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
2357
2358 pub fn mount(src: *const c_char, target: *const c_char, flags: c_uint) -> c_int;
2359
2360 pub fn umount(target: *const c_char) -> c_int;
2361 pub fn cygwin_umount(target: *const c_char, flags: c_uint) -> c_int;
2362
2363 pub fn dirfd(dirp: *mut DIR) -> c_int;
2364 pub fn seekdir(dirp: *mut DIR, loc: c_long);
2365 pub fn telldir(dirp: *mut DIR) -> c_long;
2366
2367 pub fn uname(buf: *mut utsname) -> c_int;
2368
2369 pub fn posix_spawn(
2370 pid: *mut pid_t,
2371 path: *const c_char,
2372 file_actions: *const posix_spawn_file_actions_t,
2373 attrp: *const posix_spawnattr_t,
2374 argv: *const *mut c_char,
2375 envp: *const *mut c_char,
2376 ) -> c_int;
2377 pub fn posix_spawnp(
2378 pid: *mut pid_t,
2379 file: *const c_char,
2380 file_actions: *const posix_spawn_file_actions_t,
2381 attrp: *const posix_spawnattr_t,
2382 argv: *const *mut c_char,
2383 envp: *const *mut c_char,
2384 ) -> c_int;
2385 pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int;
2386 pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int;
2387 pub fn posix_spawnattr_getsigdefault(
2388 attr: *const posix_spawnattr_t,
2389 default: *mut sigset_t,
2390 ) -> c_int;
2391 pub fn posix_spawnattr_setsigdefault(
2392 attr: *mut posix_spawnattr_t,
2393 default: *const sigset_t,
2394 ) -> c_int;
2395 pub fn posix_spawnattr_getsigmask(
2396 attr: *const posix_spawnattr_t,
2397 default: *mut sigset_t,
2398 ) -> c_int;
2399 pub fn posix_spawnattr_setsigmask(
2400 attr: *mut posix_spawnattr_t,
2401 default: *const sigset_t,
2402 ) -> c_int;
2403 pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int;
2404 pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int;
2405 pub fn posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t, flags: *mut pid_t) -> c_int;
2406 pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: pid_t) -> c_int;
2407 pub fn posix_spawnattr_getschedpolicy(
2408 attr: *const posix_spawnattr_t,
2409 flags: *mut c_int,
2410 ) -> c_int;
2411 pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int;
2412 pub fn posix_spawnattr_getschedparam(
2413 attr: *const posix_spawnattr_t,
2414 param: *mut sched_param,
2415 ) -> c_int;
2416 pub fn posix_spawnattr_setschedparam(
2417 attr: *mut posix_spawnattr_t,
2418 param: *const sched_param,
2419 ) -> c_int;
2420
2421 pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int;
2422 pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int;
2423 pub fn posix_spawn_file_actions_addopen(
2424 actions: *mut posix_spawn_file_actions_t,
2425 fd: c_int,
2426 path: *const c_char,
2427 oflag: c_int,
2428 mode: mode_t,
2429 ) -> c_int;
2430 pub fn posix_spawn_file_actions_addclose(
2431 actions: *mut posix_spawn_file_actions_t,
2432 fd: c_int,
2433 ) -> c_int;
2434 pub fn posix_spawn_file_actions_adddup2(
2435 actions: *mut posix_spawn_file_actions_t,
2436 fd: c_int,
2437 newfd: c_int,
2438 ) -> c_int;
2439
2440 pub fn forkpty(
2441 amaster: *mut c_int,
2442 name: *mut c_char,
2443 termp: *const termios,
2444 winp: *const crate::winsize,
2445 ) -> crate::pid_t;
2446 pub fn openpty(
2447 amaster: *mut c_int,
2448 aslave: *mut c_int,
2449 name: *mut c_char,
2450 termp: *const termios,
2451 winp: *const crate::winsize,
2452 ) -> c_int;
2453
2454 pub fn getgrgid_r(
2455 gid: crate::gid_t,
2456 grp: *mut crate::group,
2457 buf: *mut c_char,
2458 buflen: size_t,
2459 result: *mut *mut crate::group,
2460 ) -> c_int;
2461 pub fn getgrouplist(
2462 user: *const c_char,
2463 group: crate::gid_t,
2464 groups: *mut crate::gid_t,
2465 ngroups: *mut c_int,
2466 ) -> c_int;
2467 pub fn getgrnam_r(
2468 name: *const c_char,
2469 grp: *mut crate::group,
2470 buf: *mut c_char,
2471 buflen: size_t,
2472 result: *mut *mut crate::group,
2473 ) -> c_int;
2474 pub fn initgroups(user: *const c_char, group: crate::gid_t) -> c_int;
2475 }