Debian Codegraph @

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