interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / libc / src / unix / cygwin / mod.rs

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