1 use crate::prelude::*;
2 
3 pub type wchar_t = i32;
4 pub type useconds_t = u32;
5 pub type dev_t = u32;
6 pub type socklen_t = u32;
7 pub type pthread_t = c_ulong;
8 pub type mode_t = u32;
9 pub type shmatt_t = c_ulong;
10 pub type mqd_t = c_int;
11 pub type msgqnum_t = c_ulong;
12 pub type msglen_t = c_ulong;
13 pub type nfds_t = c_ulong;
14 pub type nl_item = c_int;
15 pub type idtype_t = c_uint;
16 pub type loff_t = i64;
17 pub type pthread_key_t = c_uint;
18 
19 pub type clock_t = c_long;
20 pub type time_t = i64;
21 pub type suseconds_t = c_long;
22 pub type ino_t = u64;
23 pub type off_t = i64;
24 pub type blkcnt_t = i32;
25 
26 pub type blksize_t = c_long;
27 pub type fsblkcnt_t = u32;
28 pub type fsfilcnt_t = u32;
29 pub type rlim_t = u64;
30 pub type nlink_t = u32;
31 
32 pub type ino64_t = crate::ino_t;
33 pub type off64_t = off_t;
34 pub type blkcnt64_t = crate::blkcnt_t;
35 pub type rlim64_t = crate::rlim_t;
36 
37 pub type rlimit64 = crate::rlimit;
38 pub type flock64 = crate::flock;
39 pub type stat64 = crate::stat;
40 pub type statfs64 = crate::statfs;
41 pub type statvfs64 = crate::statvfs;
42 pub type dirent64 = crate::dirent;
43 
44 #[cfg_attr(feature = "extra_traits", derive(Debug))]
45 pub enum fpos64_t {} // FIXME(emscripten): fill this out with a struct
46 impl Copy for fpos64_t {}
47 impl Clone for fpos64_t {
clone(&self) -> fpos64_t48     fn clone(&self) -> fpos64_t {
49         *self
50     }
51 }
52 
53 s! {
54     pub struct glob_t {
55         pub gl_pathc: size_t,
56         pub gl_pathv: *mut *mut c_char,
57         pub gl_offs: size_t,
58         pub gl_flags: c_int,
59 
60         __unused1: *mut c_void,
61         __unused2: *mut c_void,
62         __unused3: *mut c_void,
63         __unused4: *mut c_void,
64         __unused5: *mut c_void,
65     }
66 
67     pub struct passwd {
68         pub pw_name: *mut c_char,
69         pub pw_passwd: *mut c_char,
70         pub pw_uid: crate::uid_t,
71         pub pw_gid: crate::gid_t,
72         pub pw_gecos: *mut c_char,
73         pub pw_dir: *mut c_char,
74         pub pw_shell: *mut c_char,
75     }
76 
77     pub struct spwd {
78         pub sp_namp: *mut c_char,
79         pub sp_pwdp: *mut c_char,
80         pub sp_lstchg: c_long,
81         pub sp_min: c_long,
82         pub sp_max: c_long,
83         pub sp_warn: c_long,
84         pub sp_inact: c_long,
85         pub sp_expire: c_long,
86         pub sp_flag: c_ulong,
87     }
88 
89     pub struct statvfs {
90         pub f_bsize: c_ulong,
91         pub f_frsize: c_ulong,
92         pub f_blocks: crate::fsblkcnt_t,
93         pub f_bfree: crate::fsblkcnt_t,
94         pub f_bavail: crate::fsblkcnt_t,
95         pub f_files: crate::fsfilcnt_t,
96         pub f_ffree: crate::fsfilcnt_t,
97         pub f_favail: crate::fsfilcnt_t,
98         pub f_fsid: c_ulong,
99         __f_unused: c_int,
100         pub f_flag: c_ulong,
101         pub f_namemax: c_ulong,
102         __f_spare: [c_int; 6],
103     }
104 
105     pub struct signalfd_siginfo {
106         pub ssi_signo: u32,
107         pub ssi_errno: i32,
108         pub ssi_code: i32,
109         pub ssi_pid: u32,
110         pub ssi_uid: u32,
111         pub ssi_fd: i32,
112         pub ssi_tid: u32,
113         pub ssi_band: u32,
114         pub ssi_overrun: u32,
115         pub ssi_trapno: u32,
116         pub ssi_status: i32,
117         pub ssi_int: i32,
118         pub ssi_ptr: u64,
119         pub ssi_utime: u64,
120         pub ssi_stime: u64,
121         pub ssi_addr: u64,
122         pub ssi_addr_lsb: u16,
123         _pad2: u16,
124         pub ssi_syscall: i32,
125         pub ssi_call_addr: u64,
126         pub ssi_arch: u32,
127         _pad: [u8; 28],
128     }
129 
130     pub struct fsid_t {
131         __val: [c_int; 2],
132     }
133 
134     pub struct cpu_set_t {
135         bits: [u32; 32],
136     }
137 
138     pub struct if_nameindex {
139         pub if_index: c_uint,
140         pub if_name: *mut c_char,
141     }
142 
143     // System V IPC
144     pub struct msginfo {
145         pub msgpool: c_int,
146         pub msgmap: c_int,
147         pub msgmax: c_int,
148         pub msgmnb: c_int,
149         pub msgmni: c_int,
150         pub msgssz: c_int,
151         pub msgtql: c_int,
152         pub msgseg: c_ushort,
153     }
154 
155     pub struct sembuf {
156         pub sem_num: c_ushort,
157         pub sem_op: c_short,
158         pub sem_flg: c_short,
159     }
160 
161     // FIXME(1.0): This should not implement `PartialEq`
162     #[allow(unpredictable_function_pointer_comparisons)]
163     pub struct sigaction {
164         pub sa_sigaction: crate::sighandler_t,
165         pub sa_mask: crate::sigset_t,
166         pub sa_flags: c_int,
167         pub sa_restorer: Option<extern "C" fn()>,
168     }
169 
170     pub struct ipc_perm {
171         pub __ipc_perm_key: crate::key_t,
172         pub uid: crate::uid_t,
173         pub gid: crate::gid_t,
174         pub cuid: crate::uid_t,
175         pub cgid: crate::gid_t,
176         pub mode: mode_t,
177         pub __seq: c_int,
178         __unused1: c_long,
179         __unused2: c_long,
180     }
181 
182     pub struct termios {
183         pub c_iflag: crate::tcflag_t,
184         pub c_oflag: crate::tcflag_t,
185         pub c_cflag: crate::tcflag_t,
186         pub c_lflag: crate::tcflag_t,
187         pub c_line: crate::cc_t,
188         pub c_cc: [crate::cc_t; crate::NCCS],
189         pub __c_ispeed: crate::speed_t,
190         pub __c_ospeed: crate::speed_t,
191     }
192 
193     pub struct flock {
194         pub l_type: c_short,
195         pub l_whence: c_short,
196         pub l_start: off_t,
197         pub l_len: off_t,
198         pub l_pid: crate::pid_t,
199     }
200 
201     pub struct pthread_attr_t {
202         __size: [u32; 11],
203     }
204 
205     pub struct sigset_t {
206         __val: [c_ulong; 32],
207     }
208 
209     pub struct msghdr {
210         pub msg_name: *mut c_void,
211         pub msg_namelen: crate::socklen_t,
212         pub msg_iov: *mut crate::iovec,
213         pub msg_iovlen: c_int,
214         pub msg_control: *mut c_void,
215         pub msg_controllen: crate::socklen_t,
216         pub msg_flags: c_int,
217     }
218 
219     pub struct cmsghdr {
220         pub cmsg_len: crate::socklen_t,
221         pub cmsg_level: c_int,
222         pub cmsg_type: c_int,
223     }
224 
225     pub struct sem_t {
226         __val: [c_int; 4],
227     }
228     pub struct stat {
229         pub st_dev: crate::dev_t,
230         #[cfg(emscripten_old_stat_abi)]
231         __st_dev_padding: c_int,
232         #[cfg(emscripten_old_stat_abi)]
233         __st_ino_truncated: c_long,
234         pub st_mode: mode_t,
235         pub st_nlink: crate::nlink_t,
236         pub st_uid: crate::uid_t,
237         pub st_gid: crate::gid_t,
238         pub st_rdev: crate::dev_t,
239         #[cfg(emscripten_old_stat_abi)]
240         __st_rdev_padding: c_int,
241         pub st_size: off_t,
242         pub st_blksize: crate::blksize_t,
243         pub st_blocks: crate::blkcnt_t,
244         pub st_atime: crate::time_t,
245         pub st_atime_nsec: c_long,
246         pub st_mtime: crate::time_t,
247         pub st_mtime_nsec: c_long,
248         pub st_ctime: crate::time_t,
249         pub st_ctime_nsec: c_long,
250         pub st_ino: crate::ino_t,
251     }
252 
253     pub struct stack_t {
254         pub ss_sp: *mut c_void,
255         pub ss_flags: c_int,
256         pub ss_size: size_t,
257     }
258 
259     pub struct shmid_ds {
260         pub shm_perm: crate::ipc_perm,
261         pub shm_segsz: size_t,
262         pub shm_atime: crate::time_t,
263         pub shm_dtime: crate::time_t,
264         pub shm_ctime: crate::time_t,
265         pub shm_cpid: crate::pid_t,
266         pub shm_lpid: crate::pid_t,
267         pub shm_nattch: c_ulong,
268         __pad1: c_ulong,
269         __pad2: c_ulong,
270     }
271 
272     pub struct msqid_ds {
273         pub msg_perm: crate::ipc_perm,
274         pub msg_stime: crate::time_t,
275         pub msg_rtime: crate::time_t,
276         pub msg_ctime: crate::time_t,
277         pub __msg_cbytes: c_ulong,
278         pub msg_qnum: crate::msgqnum_t,
279         pub msg_qbytes: crate::msglen_t,
280         pub msg_lspid: crate::pid_t,
281         pub msg_lrpid: crate::pid_t,
282         __pad1: c_ulong,
283         __pad2: c_ulong,
284     }
285 
286     pub struct statfs {
287         pub f_type: c_ulong,
288         pub f_bsize: c_ulong,
289         pub f_blocks: crate::fsblkcnt_t,
290         pub f_bfree: crate::fsblkcnt_t,
291         pub f_bavail: crate::fsblkcnt_t,
292         pub f_files: crate::fsfilcnt_t,
293         pub f_ffree: crate::fsfilcnt_t,
294         pub f_fsid: crate::fsid_t,
295         pub f_namelen: c_ulong,
296         pub f_frsize: c_ulong,
297         pub f_flags: c_ulong,
298         pub f_spare: [c_ulong; 4],
299     }
300 
301     pub struct siginfo_t {
302         pub si_signo: c_int,
303         pub si_errno: c_int,
304         pub si_code: c_int,
305         pub _pad: [c_int; 29],
306         _align: [usize; 0],
307     }
308 
309     pub struct arpd_request {
310         pub req: c_ushort,
311         pub ip: u32,
312         pub dev: c_ulong,
313         pub stamp: c_ulong,
314         pub updated: c_ulong,
315         pub ha: [c_uchar; crate::MAX_ADDR_LEN],
316     }
317 
318     #[allow(missing_debug_implementations)]
319     #[repr(align(4))]
320     pub struct pthread_mutex_t {
321         size: [u8; crate::__SIZEOF_PTHREAD_MUTEX_T],
322     }
323 
324     #[repr(align(4))]
325     pub struct pthread_rwlock_t {
326         size: [u8; crate::__SIZEOF_PTHREAD_RWLOCK_T],
327     }
328 
329     #[repr(align(4))]
330     pub struct pthread_mutexattr_t {
331         size: [u8; crate::__SIZEOF_PTHREAD_MUTEXATTR_T],
332     }
333 
334     #[repr(align(4))]
335     pub struct pthread_rwlockattr_t {
336         size: [u8; crate::__SIZEOF_PTHREAD_RWLOCKATTR_T],
337     }
338 
339     #[repr(align(4))]
340     pub struct pthread_condattr_t {
341         size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T],
342     }
343 }
344 
345 s_no_extra_traits! {
346     pub struct dirent {
347         pub d_ino: crate::ino_t,
348         pub d_off: off_t,
349         pub d_reclen: c_ushort,
350         pub d_type: c_uchar,
351         pub d_name: [c_char; 256],
352     }
353 
354     pub struct sysinfo {
355         pub uptime: c_ulong,
356         pub loads: [c_ulong; 3],
357         pub totalram: c_ulong,
358         pub freeram: c_ulong,
359         pub sharedram: c_ulong,
360         pub bufferram: c_ulong,
361         pub totalswap: c_ulong,
362         pub freeswap: c_ulong,
363         pub procs: c_ushort,
364         pub pad: c_ushort,
365         pub totalhigh: c_ulong,
366         pub freehigh: c_ulong,
367         pub mem_unit: c_uint,
368         pub __reserved: [c_char; 256],
369     }
370 
371     pub struct mq_attr {
372         pub mq_flags: c_long,
373         pub mq_maxmsg: c_long,
374         pub mq_msgsize: c_long,
375         pub mq_curmsgs: c_long,
376         pad: [c_long; 4],
377     }
378 
379     #[cfg_attr(target_pointer_width = "32", repr(align(4)))]
380     #[cfg_attr(target_pointer_width = "64", repr(align(8)))]
381     pub struct pthread_cond_t {
382         size: [u8; crate::__SIZEOF_PTHREAD_COND_T],
383     }
384 
385     #[allow(missing_debug_implementations)]
386     #[repr(align(8))]
387     pub struct max_align_t {
388         priv_: [f64; 3],
389     }
390 }
391 
392 cfg_if! {
393     if #[cfg(feature = "extra_traits")] {
394         impl PartialEq for dirent {
395             fn eq(&self, other: &dirent) -> bool {
396                 self.d_ino == other.d_ino
397                     && self.d_off == other.d_off
398                     && self.d_reclen == other.d_reclen
399                     && self.d_type == other.d_type
400                     && self
401                         .d_name
402                         .iter()
403                         .zip(other.d_name.iter())
404                         .all(|(a, b)| a == b)
405             }
406         }
407         impl Eq for dirent {}
408         impl hash::Hash for dirent {
409             fn hash<H: hash::Hasher>(&self, state: &mut H) {
410                 self.d_ino.hash(state);
411                 self.d_off.hash(state);
412                 self.d_reclen.hash(state);
413                 self.d_type.hash(state);
414                 self.d_name.hash(state);
415             }
416         }
417 
418         impl PartialEq for sysinfo {
419             fn eq(&self, other: &sysinfo) -> bool {
420                 self.uptime == other.uptime
421                     && self.loads == other.loads
422                     && self.totalram == other.totalram
423                     && self.freeram == other.freeram
424                     && self.sharedram == other.sharedram
425                     && self.bufferram == other.bufferram
426                     && self.totalswap == other.totalswap
427                     && self.freeswap == other.freeswap
428                     && self.procs == other.procs
429                     && self.pad == other.pad
430                     && self.totalhigh == other.totalhigh
431                     && self.freehigh == other.freehigh
432                     && self.mem_unit == other.mem_unit
433                     && self
434                         .__reserved
435                         .iter()
436                         .zip(other.__reserved.iter())
437                         .all(|(a, b)| a == b)
438             }
439         }
440         impl Eq for sysinfo {}
441         impl hash::Hash for sysinfo {
442             fn hash<H: hash::Hasher>(&self, state: &mut H) {
443                 self.uptime.hash(state);
444                 self.loads.hash(state);
445                 self.totalram.hash(state);
446                 self.freeram.hash(state);
447                 self.sharedram.hash(state);
448                 self.bufferram.hash(state);
449                 self.totalswap.hash(state);
450                 self.freeswap.hash(state);
451                 self.procs.hash(state);
452                 self.pad.hash(state);
453                 self.totalhigh.hash(state);
454                 self.freehigh.hash(state);
455                 self.mem_unit.hash(state);
456                 self.__reserved.hash(state);
457             }
458         }
459 
460         impl PartialEq for mq_attr {
461             fn eq(&self, other: &mq_attr) -> bool {
462                 self.mq_flags == other.mq_flags
463                     && self.mq_maxmsg == other.mq_maxmsg
464                     && self.mq_msgsize == other.mq_msgsize
465                     && self.mq_curmsgs == other.mq_curmsgs
466             }
467         }
468         impl Eq for mq_attr {}
469         impl hash::Hash for mq_attr {
470             fn hash<H: hash::Hasher>(&self, state: &mut H) {
471                 self.mq_flags.hash(state);
472                 self.mq_maxmsg.hash(state);
473                 self.mq_msgsize.hash(state);
474                 self.mq_curmsgs.hash(state);
475             }
476         }
477 
478         impl PartialEq for pthread_cond_t {
479             fn eq(&self, other: &pthread_cond_t) -> bool {
480                 self.size.iter().zip(other.size.iter()).all(|(a, b)| a == b)
481             }
482         }
483         impl Eq for pthread_cond_t {}
484         impl hash::Hash for pthread_cond_t {
485             fn hash<H: hash::Hasher>(&self, state: &mut H) {
486                 self.size.hash(state);
487             }
488         }
489     }
490 }
491 
492 pub const MADV_SOFT_OFFLINE: c_int = 101;
493 pub const MS_NOUSER: c_ulong = 0x80000000;
494 pub const MS_RMT_MASK: c_ulong = 0x02800051;
495 
496 pub const ABDAY_1: crate::nl_item = 0x20000;
497 pub const ABDAY_2: crate::nl_item = 0x20001;
498 pub const ABDAY_3: crate::nl_item = 0x20002;
499 pub const ABDAY_4: crate::nl_item = 0x20003;
500 pub const ABDAY_5: crate::nl_item = 0x20004;
501 pub const ABDAY_6: crate::nl_item = 0x20005;
502 pub const ABDAY_7: crate::nl_item = 0x20006;
503 
504 pub const DAY_1: crate::nl_item = 0x20007;
505 pub const DAY_2: crate::nl_item = 0x20008;
506 pub const DAY_3: crate::nl_item = 0x20009;
507 pub const DAY_4: crate::nl_item = 0x2000A;
508 pub const DAY_5: crate::nl_item = 0x2000B;
509 pub const DAY_6: crate::nl_item = 0x2000C;
510 pub const DAY_7: crate::nl_item = 0x2000D;
511 
512 pub const ABMON_1: crate::nl_item = 0x2000E;
513 pub const ABMON_2: crate::nl_item = 0x2000F;
514 pub const ABMON_3: crate::nl_item = 0x20010;
515 pub const ABMON_4: crate::nl_item = 0x20011;
516 pub const ABMON_5: crate::nl_item = 0x20012;
517 pub const ABMON_6: crate::nl_item = 0x20013;
518 pub const ABMON_7: crate::nl_item = 0x20014;
519 pub const ABMON_8: crate::nl_item = 0x20015;
520 pub const ABMON_9: crate::nl_item = 0x20016;
521 pub const ABMON_10: crate::nl_item = 0x20017;
522 pub const ABMON_11: crate::nl_item = 0x20018;
523 pub const ABMON_12: crate::nl_item = 0x20019;
524 
525 pub const MON_1: crate::nl_item = 0x2001A;
526 pub const MON_2: crate::nl_item = 0x2001B;
527 pub const MON_3: crate::nl_item = 0x2001C;
528 pub const MON_4: crate::nl_item = 0x2001D;
529 pub const MON_5: crate::nl_item = 0x2001E;
530 pub const MON_6: crate::nl_item = 0x2001F;
531 pub const MON_7: crate::nl_item = 0x20020;
532 pub const MON_8: crate::nl_item = 0x20021;
533 pub const MON_9: crate::nl_item = 0x20022;
534 pub const MON_10: crate::nl_item = 0x20023;
535 pub const MON_11: crate::nl_item = 0x20024;
536 pub const MON_12: crate::nl_item = 0x20025;
537 
538 pub const AM_STR: crate::nl_item = 0x20026;
539 pub const PM_STR: crate::nl_item = 0x20027;
540 
541 pub const D_T_FMT: crate::nl_item = 0x20028;
542 pub const D_FMT: crate::nl_item = 0x20029;
543 pub const T_FMT: crate::nl_item = 0x2002A;
544 pub const T_FMT_AMPM: crate::nl_item = 0x2002B;
545 
546 pub const ERA: crate::nl_item = 0x2002C;
547 pub const ERA_D_FMT: crate::nl_item = 0x2002E;
548 pub const ALT_DIGITS: crate::nl_item = 0x2002F;
549 pub const ERA_D_T_FMT: crate::nl_item = 0x20030;
550 pub const ERA_T_FMT: crate::nl_item = 0x20031;
551 
552 pub const CODESET: crate::nl_item = 14;
553 
554 pub const CRNCYSTR: crate::nl_item = 0x4000F;
555 
556 pub const RUSAGE_THREAD: c_int = 1;
557 pub const RUSAGE_CHILDREN: c_int = -1;
558 
559 pub const RADIXCHAR: crate::nl_item = 0x10000;
560 pub const THOUSEP: crate::nl_item = 0x10001;
561 
562 pub const YESEXPR: crate::nl_item = 0x50000;
563 pub const NOEXPR: crate::nl_item = 0x50001;
564 pub const YESSTR: crate::nl_item = 0x50002;
565 pub const NOSTR: crate::nl_item = 0x50003;
566 
567 pub const FILENAME_MAX: c_uint = 4096;
568 pub const L_tmpnam: c_uint = 20;
569 pub const _PC_LINK_MAX: c_int = 0;
570 pub const _PC_MAX_CANON: c_int = 1;
571 pub const _PC_MAX_INPUT: c_int = 2;
572 pub const _PC_NAME_MAX: c_int = 3;
573 pub const _PC_PATH_MAX: c_int = 4;
574 pub const _PC_PIPE_BUF: c_int = 5;
575 pub const _PC_CHOWN_RESTRICTED: c_int = 6;
576 pub const _PC_NO_TRUNC: c_int = 7;
577 pub const _PC_VDISABLE: c_int = 8;
578 pub const _PC_SYNC_IO: c_int = 9;
579 pub const _PC_ASYNC_IO: c_int = 10;
580 pub const _PC_PRIO_IO: c_int = 11;
581 pub const _PC_SOCK_MAXBUF: c_int = 12;
582 pub const _PC_FILESIZEBITS: c_int = 13;
583 pub const _PC_REC_INCR_XFER_SIZE: c_int = 14;
584 pub const _PC_REC_MAX_XFER_SIZE: c_int = 15;
585 pub const _PC_REC_MIN_XFER_SIZE: c_int = 16;
586 pub const _PC_REC_XFER_ALIGN: c_int = 17;
587 pub const _PC_ALLOC_SIZE_MIN: c_int = 18;
588 pub const _PC_SYMLINK_MAX: c_int = 19;
589 pub const _PC_2_SYMLINKS: c_int = 20;
590 
591 pub const _SC_ARG_MAX: c_int = 0;
592 pub const _SC_CHILD_MAX: c_int = 1;
593 pub const _SC_CLK_TCK: c_int = 2;
594 pub const _SC_NGROUPS_MAX: c_int = 3;
595 pub const _SC_OPEN_MAX: c_int = 4;
596 pub const _SC_STREAM_MAX: c_int = 5;
597 pub const _SC_TZNAME_MAX: c_int = 6;
598 pub const _SC_JOB_CONTROL: c_int = 7;
599 pub const _SC_SAVED_IDS: c_int = 8;
600 pub const _SC_REALTIME_SIGNALS: c_int = 9;
601 pub const _SC_PRIORITY_SCHEDULING: c_int = 10;
602 pub const _SC_TIMERS: c_int = 11;
603 pub const _SC_ASYNCHRONOUS_IO: c_int = 12;
604 pub const _SC_PRIORITIZED_IO: c_int = 13;
605 pub const _SC_SYNCHRONIZED_IO: c_int = 14;
606 pub const _SC_FSYNC: c_int = 15;
607 pub const _SC_MAPPED_FILES: c_int = 16;
608 pub const _SC_MEMLOCK: c_int = 17;
609 pub const _SC_MEMLOCK_RANGE: c_int = 18;
610 pub const _SC_MEMORY_PROTECTION: c_int = 19;
611 pub const _SC_MESSAGE_PASSING: c_int = 20;
612 pub const _SC_SEMAPHORES: c_int = 21;
613 pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 22;
614 pub const _SC_AIO_LISTIO_MAX: c_int = 23;
615 pub const _SC_AIO_MAX: c_int = 24;
616 pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 25;
617 pub const _SC_DELAYTIMER_MAX: c_int = 26;
618 pub const _SC_MQ_OPEN_MAX: c_int = 27;
619 pub const _SC_MQ_PRIO_MAX: c_int = 28;
620 pub const _SC_VERSION: c_int = 29;
621 pub const _SC_PAGESIZE: c_int = 30;
622 pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
623 pub const _SC_RTSIG_MAX: c_int = 31;
624 pub const _SC_SEM_NSEMS_MAX: c_int = 32;
625 pub const _SC_SEM_VALUE_MAX: c_int = 33;
626 pub const _SC_SIGQUEUE_MAX: c_int = 34;
627 pub const _SC_TIMER_MAX: c_int = 35;
628 pub const _SC_BC_BASE_MAX: c_int = 36;
629 pub const _SC_BC_DIM_MAX: c_int = 37;
630 pub const _SC_BC_SCALE_MAX: c_int = 38;
631 pub const _SC_BC_STRING_MAX: c_int = 39;
632 pub const _SC_COLL_WEIGHTS_MAX: c_int = 40;
633 pub const _SC_EXPR_NEST_MAX: c_int = 42;
634 pub const _SC_LINE_MAX: c_int = 43;
635 pub const _SC_RE_DUP_MAX: c_int = 44;
636 pub const _SC_2_VERSION: c_int = 46;
637 pub const _SC_2_C_BIND: c_int = 47;
638 pub const _SC_2_C_DEV: c_int = 48;
639 pub const _SC_2_FORT_DEV: c_int = 49;
640 pub const _SC_2_FORT_RUN: c_int = 50;
641 pub const _SC_2_SW_DEV: c_int = 51;
642 pub const _SC_2_LOCALEDEF: c_int = 52;
643 pub const _SC_UIO_MAXIOV: c_int = 60;
644 pub const _SC_IOV_MAX: c_int = 60;
645 pub const _SC_THREADS: c_int = 67;
646 pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 68;
647 pub const _SC_GETGR_R_SIZE_MAX: c_int = 69;
648 pub const _SC_GETPW_R_SIZE_MAX: c_int = 70;
649 pub const _SC_LOGIN_NAME_MAX: c_int = 71;
650 pub const _SC_TTY_NAME_MAX: c_int = 72;
651 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 73;
652 pub const _SC_THREAD_KEYS_MAX: c_int = 74;
653 pub const _SC_THREAD_STACK_MIN: c_int = 75;
654 pub const _SC_THREAD_THREADS_MAX: c_int = 76;
655 pub const _SC_THREAD_ATTR_STACKADDR: c_int = 77;
656 pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 78;
657 pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 79;
658 pub const _SC_THREAD_PRIO_INHERIT: c_int = 80;
659 pub const _SC_THREAD_PRIO_PROTECT: c_int = 81;
660 pub const _SC_THREAD_PROCESS_SHARED: c_int = 82;
661 pub const _SC_NPROCESSORS_CONF: c_int = 83;
662 pub const _SC_NPROCESSORS_ONLN: c_int = 84;
663 pub const _SC_PHYS_PAGES: c_int = 85;
664 pub const _SC_AVPHYS_PAGES: c_int = 86;
665 pub const _SC_ATEXIT_MAX: c_int = 87;
666 pub const _SC_PASS_MAX: c_int = 88;
667 pub const _SC_XOPEN_VERSION: c_int = 89;
668 pub const _SC_XOPEN_XCU_VERSION: c_int = 90;
669 pub const _SC_XOPEN_UNIX: c_int = 91;
670 pub const _SC_XOPEN_CRYPT: c_int = 92;
671 pub const _SC_XOPEN_ENH_I18N: c_int = 93;
672 pub const _SC_XOPEN_SHM: c_int = 94;
673 pub const _SC_2_CHAR_TERM: c_int = 95;
674 pub const _SC_2_UPE: c_int = 97;
675 pub const _SC_XOPEN_XPG2: c_int = 98;
676 pub const _SC_XOPEN_XPG3: c_int = 99;
677 pub const _SC_XOPEN_XPG4: c_int = 100;
678 pub const _SC_NZERO: c_int = 109;
679 pub const _SC_XBS5_ILP32_OFF32: c_int = 125;
680 pub const _SC_XBS5_ILP32_OFFBIG: c_int = 126;
681 pub const _SC_XBS5_LP64_OFF64: c_int = 127;
682 pub const _SC_XBS5_LPBIG_OFFBIG: c_int = 128;
683 pub const _SC_XOPEN_LEGACY: c_int = 129;
684 pub const _SC_XOPEN_REALTIME: c_int = 130;
685 pub const _SC_XOPEN_REALTIME_THREADS: c_int = 131;
686 pub const _SC_ADVISORY_INFO: c_int = 132;
687 pub const _SC_BARRIERS: c_int = 133;
688 pub const _SC_CLOCK_SELECTION: c_int = 137;
689 pub const _SC_CPUTIME: c_int = 138;
690 pub const _SC_THREAD_CPUTIME: c_int = 139;
691 pub const _SC_MONOTONIC_CLOCK: c_int = 149;
692 pub const _SC_READER_WRITER_LOCKS: c_int = 153;
693 pub const _SC_SPIN_LOCKS: c_int = 154;
694 pub const _SC_REGEXP: c_int = 155;
695 pub const _SC_SHELL: c_int = 157;
696 pub const _SC_SPAWN: c_int = 159;
697 pub const _SC_SPORADIC_SERVER: c_int = 160;
698 pub const _SC_THREAD_SPORADIC_SERVER: c_int = 161;
699 pub const _SC_TIMEOUTS: c_int = 164;
700 pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 165;
701 pub const _SC_2_PBS: c_int = 168;
702 pub const _SC_2_PBS_ACCOUNTING: c_int = 169;
703 pub const _SC_2_PBS_LOCATE: c_int = 170;
704 pub const _SC_2_PBS_MESSAGE: c_int = 171;
705 pub const _SC_2_PBS_TRACK: c_int = 172;
706 pub const _SC_SYMLOOP_MAX: c_int = 173;
707 pub const _SC_STREAMS: c_int = 174;
708 pub const _SC_2_PBS_CHECKPOINT: c_int = 175;
709 pub const _SC_V6_ILP32_OFF32: c_int = 176;
710 pub const _SC_V6_ILP32_OFFBIG: c_int = 177;
711 pub const _SC_V6_LP64_OFF64: c_int = 178;
712 pub const _SC_V6_LPBIG_OFFBIG: c_int = 179;
713 pub const _SC_HOST_NAME_MAX: c_int = 180;
714 pub const _SC_TRACE: c_int = 181;
715 pub const _SC_TRACE_EVENT_FILTER: c_int = 182;
716 pub const _SC_TRACE_INHERIT: c_int = 183;
717 pub const _SC_TRACE_LOG: c_int = 184;
718 pub const _SC_IPV6: c_int = 235;
719 pub const _SC_RAW_SOCKETS: c_int = 236;
720 pub const _SC_V7_ILP32_OFF32: c_int = 237;
721 pub const _SC_V7_ILP32_OFFBIG: c_int = 238;
722 pub const _SC_V7_LP64_OFF64: c_int = 239;
723 pub const _SC_V7_LPBIG_OFFBIG: c_int = 240;
724 pub const _SC_SS_REPL_MAX: c_int = 241;
725 pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 242;
726 pub const _SC_TRACE_NAME_MAX: c_int = 243;
727 pub const _SC_TRACE_SYS_MAX: c_int = 244;
728 pub const _SC_TRACE_USER_EVENT_MAX: c_int = 245;
729 pub const _SC_XOPEN_STREAMS: c_int = 246;
730 pub const _SC_THREAD_ROBUST_PRIO_INHERIT: c_int = 247;
731 pub const _SC_THREAD_ROBUST_PRIO_PROTECT: c_int = 248;
732 
733 pub const RLIM_SAVED_MAX: crate::rlim_t = RLIM_INFINITY;
734 pub const RLIM_SAVED_CUR: crate::rlim_t = RLIM_INFINITY;
735 
736 pub const GLOB_ERR: c_int = 1 << 0;
737 pub const GLOB_MARK: c_int = 1 << 1;
738 pub const GLOB_NOSORT: c_int = 1 << 2;
739 pub const GLOB_DOOFFS: c_int = 1 << 3;
740 pub const GLOB_NOCHECK: c_int = 1 << 4;
741 pub const GLOB_APPEND: c_int = 1 << 5;
742 pub const GLOB_NOESCAPE: c_int = 1 << 6;
743 
744 pub const GLOB_NOSPACE: c_int = 1;
745 pub const GLOB_ABORTED: c_int = 2;
746 pub const GLOB_NOMATCH: c_int = 3;
747 
748 pub const POSIX_MADV_NORMAL: c_int = 0;
749 pub const POSIX_MADV_RANDOM: c_int = 1;
750 pub const POSIX_MADV_SEQUENTIAL: c_int = 2;
751 pub const POSIX_MADV_WILLNEED: c_int = 3;
752 
753 pub const AT_EACCESS: c_int = 0x200;
754 
755 pub const S_IEXEC: mode_t = 0o0100;
756 pub const S_IWRITE: mode_t = 0o0200;
757 pub const S_IREAD: mode_t = 0o0400;
758 
759 pub const F_LOCK: c_int = 1;
760 pub const F_TEST: c_int = 3;
761 pub const F_TLOCK: c_int = 2;
762 pub const F_ULOCK: c_int = 0;
763 
764 pub const ST_RDONLY: c_ulong = 1;
765 pub const ST_NOSUID: c_ulong = 2;
766 pub const ST_NODEV: c_ulong = 4;
767 pub const ST_NOEXEC: c_ulong = 8;
768 pub const ST_SYNCHRONOUS: c_ulong = 16;
769 pub const ST_MANDLOCK: c_ulong = 64;
770 pub const ST_WRITE: c_ulong = 128;
771 pub const ST_APPEND: c_ulong = 256;
772 pub const ST_IMMUTABLE: c_ulong = 512;
773 pub const ST_NOATIME: c_ulong = 1024;
774 pub const ST_NODIRATIME: c_ulong = 2048;
775 
776 pub const RTLD_NEXT: *mut c_void = -1i64 as *mut c_void;
777 pub const RTLD_DEFAULT: *mut c_void = 0i64 as *mut c_void;
778 pub const RTLD_NODELETE: c_int = 0x1000;
779 pub const RTLD_NOW: c_int = 0x2;
780 
781 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
782     size: [0; __SIZEOF_PTHREAD_MUTEX_T],
783 };
784 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
785     size: [0; __SIZEOF_PTHREAD_COND_T],
786 };
787 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
788     size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
789 };
790 
791 pub const PTHREAD_MUTEX_NORMAL: c_int = 0;
792 pub const PTHREAD_MUTEX_RECURSIVE: c_int = 1;
793 pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2;
794 pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL;
795 pub const PTHREAD_PROCESS_PRIVATE: c_int = 0;
796 pub const PTHREAD_PROCESS_SHARED: c_int = 1;
797 pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
798 
799 pub const SCHED_OTHER: c_int = 0;
800 pub const SCHED_FIFO: c_int = 1;
801 pub const SCHED_RR: c_int = 2;
802 pub const SCHED_BATCH: c_int = 3;
803 pub const SCHED_IDLE: c_int = 5;
804 
805 pub const AF_IB: c_int = 27;
806 pub const AF_MPLS: c_int = 28;
807 pub const AF_NFC: c_int = 39;
808 pub const AF_VSOCK: c_int = 40;
809 pub const PF_IB: c_int = AF_IB;
810 pub const PF_MPLS: c_int = AF_MPLS;
811 pub const PF_NFC: c_int = AF_NFC;
812 pub const PF_VSOCK: c_int = AF_VSOCK;
813 
814 // System V IPC
815 pub const IPC_PRIVATE: crate::key_t = 0;
816 
817 pub const IPC_CREAT: c_int = 0o1000;
818 pub const IPC_EXCL: c_int = 0o2000;
819 pub const IPC_NOWAIT: c_int = 0o4000;
820 
821 pub const IPC_RMID: c_int = 0;
822 pub const IPC_SET: c_int = 1;
823 pub const IPC_STAT: c_int = 2;
824 pub const IPC_INFO: c_int = 3;
825 pub const MSG_STAT: c_int = 11;
826 pub const MSG_INFO: c_int = 12;
827 
828 pub const MSG_NOERROR: c_int = 0o10000;
829 pub const MSG_EXCEPT: c_int = 0o20000;
830 
831 pub const SHM_R: c_int = 0o400;
832 pub const SHM_W: c_int = 0o200;
833 
834 pub const SHM_RDONLY: c_int = 0o10000;
835 pub const SHM_RND: c_int = 0o20000;
836 pub const SHM_REMAP: c_int = 0o40000;
837 pub const SHM_EXEC: c_int = 0o100000;
838 
839 pub const SHM_LOCK: c_int = 11;
840 pub const SHM_UNLOCK: c_int = 12;
841 
842 pub const SHM_HUGETLB: c_int = 0o4000;
843 pub const SHM_NORESERVE: c_int = 0o10000;
844 
845 pub const LOG_NFACILITIES: c_int = 24;
846 
847 pub const SEM_FAILED: *mut crate::sem_t = 0 as *mut sem_t;
848 
849 pub const AI_PASSIVE: c_int = 0x0001;
850 pub const AI_CANONNAME: c_int = 0x0002;
851 pub const AI_NUMERICHOST: c_int = 0x0004;
852 pub const AI_V4MAPPED: c_int = 0x0008;
853 pub const AI_ALL: c_int = 0x0010;
854 pub const AI_ADDRCONFIG: c_int = 0x0020;
855 
856 pub const AI_NUMERICSERV: c_int = 0x0400;
857 
858 pub const EAI_BADFLAGS: c_int = -1;
859 pub const EAI_NONAME: c_int = -2;
860 pub const EAI_AGAIN: c_int = -3;
861 pub const EAI_FAIL: c_int = -4;
862 pub const EAI_FAMILY: c_int = -6;
863 pub const EAI_SOCKTYPE: c_int = -7;
864 pub const EAI_SERVICE: c_int = -8;
865 pub const EAI_MEMORY: c_int = -10;
866 pub const EAI_OVERFLOW: c_int = -12;
867 
868 pub const NI_NUMERICHOST: c_int = 1;
869 pub const NI_NUMERICSERV: c_int = 2;
870 pub const NI_NOFQDN: c_int = 4;
871 pub const NI_NAMEREQD: c_int = 8;
872 pub const NI_DGRAM: c_int = 16;
873 
874 pub const SYNC_FILE_RANGE_WAIT_BEFORE: c_uint = 1;
875 pub const SYNC_FILE_RANGE_WRITE: c_uint = 2;
876 pub const SYNC_FILE_RANGE_WAIT_AFTER: c_uint = 4;
877 
878 pub const EAI_SYSTEM: c_int = -11;
879 
880 pub const MREMAP_MAYMOVE: c_int = 1;
881 pub const MREMAP_FIXED: c_int = 2;
882 
883 pub const ITIMER_REAL: c_int = 0;
884 pub const ITIMER_VIRTUAL: c_int = 1;
885 pub const ITIMER_PROF: c_int = 2;
886 
887 pub const _POSIX_VDISABLE: crate::cc_t = 0;
888 
889 pub const FALLOC_FL_KEEP_SIZE: c_int = 0x01;
890 pub const FALLOC_FL_PUNCH_HOLE: c_int = 0x02;
891 
892 pub const NCCS: usize = 32;
893 
894 pub const O_TRUNC: c_int = 512;
895 pub const O_NOATIME: c_int = 0o1000000;
896 pub const O_CLOEXEC: c_int = 0x80000;
897 
898 // Defined as wasi value.
899 pub const EPERM: c_int = 63;
900 pub const ENOENT: c_int = 44;
901 pub const ESRCH: c_int = 71;
902 pub const EINTR: c_int = 27;
903 pub const EIO: c_int = 29;
904 pub const ENXIO: c_int = 60;
905 pub const E2BIG: c_int = 1;
906 pub const ENOEXEC: c_int = 45;
907 pub const EBADF: c_int = 8;
908 pub const ECHILD: c_int = 12;
909 pub const EAGAIN: c_int = 6;
910 pub const ENOMEM: c_int = 48;
911 pub const EACCES: c_int = 2;
912 pub const EFAULT: c_int = 21;
913 pub const ENOTBLK: c_int = 105;
914 pub const EBUSY: c_int = 10;
915 pub const EEXIST: c_int = 20;
916 pub const EXDEV: c_int = 75;
917 pub const ENODEV: c_int = 43;
918 pub const ENOTDIR: c_int = 54;
919 pub const EISDIR: c_int = 31;
920 pub const EINVAL: c_int = 28;
921 pub const ENFILE: c_int = 41;
922 pub const EMFILE: c_int = 33;
923 pub const ENOTTY: c_int = 59;
924 pub const ETXTBSY: c_int = 74;
925 pub const EFBIG: c_int = 22;
926 pub const ENOSPC: c_int = 51;
927 pub const ESPIPE: c_int = 70;
928 pub const EROFS: c_int = 69;
929 pub const EMLINK: c_int = 34;
930 pub const EPIPE: c_int = 64;
931 pub const EDOM: c_int = 18;
932 pub const ERANGE: c_int = 68;
933 pub const EWOULDBLOCK: c_int = EAGAIN;
934 pub const ENOLINK: c_int = 47;
935 pub const EPROTO: c_int = 65;
936 pub const EDEADLK: c_int = 16;
937 pub const EDEADLOCK: c_int = EDEADLK;
938 pub const ENAMETOOLONG: c_int = 37;
939 pub const ENOLCK: c_int = 46;
940 pub const ENOSYS: c_int = 52;
941 pub const ENOTEMPTY: c_int = 55;
942 pub const ELOOP: c_int = 32;
943 pub const ENOMSG: c_int = 49;
944 pub const EIDRM: c_int = 24;
945 pub const EMULTIHOP: c_int = 36;
946 pub const EBADMSG: c_int = 9;
947 pub const EOVERFLOW: c_int = 61;
948 pub const EILSEQ: c_int = 25;
949 pub const ENOTSOCK: c_int = 57;
950 pub const EDESTADDRREQ: c_int = 17;
951 pub const EMSGSIZE: c_int = 35;
952 pub const EPROTOTYPE: c_int = 67;
953 pub const ENOPROTOOPT: c_int = 50;
954 pub const EPROTONOSUPPORT: c_int = 66;
955 pub const EAFNOSUPPORT: c_int = 5;
956 pub const EADDRINUSE: c_int = 3;
957 pub const EADDRNOTAVAIL: c_int = 4;
958 pub const ENETDOWN: c_int = 38;
959 pub const ENETUNREACH: c_int = 40;
960 pub const ENETRESET: c_int = 39;
961 pub const ECONNABORTED: c_int = 13;
962 pub const ECONNRESET: c_int = 15;
963 pub const ENOBUFS: c_int = 42;
964 pub const EISCONN: c_int = 30;
965 pub const ENOTCONN: c_int = 53;
966 pub const ETIMEDOUT: c_int = 73;
967 pub const ECONNREFUSED: c_int = 14;
968 pub const EHOSTUNREACH: c_int = 23;
969 pub const EALREADY: c_int = 7;
970 pub const EINPROGRESS: c_int = 26;
971 pub const ESTALE: c_int = 72;
972 pub const EDQUOT: c_int = 19;
973 pub const ECANCELED: c_int = 11;
974 pub const EOWNERDEAD: c_int = 62;
975 pub const ENOTRECOVERABLE: c_int = 56;
976 
977 pub const ENOSTR: c_int = 100;
978 pub const EBFONT: c_int = 101;
979 pub const EBADSLT: c_int = 102;
980 pub const EBADRQC: c_int = 103;
981 pub const ENOANO: c_int = 104;
982 pub const ECHRNG: c_int = 106;
983 pub const EL3HLT: c_int = 107;
984 pub const EL3RST: c_int = 108;
985 pub const ELNRNG: c_int = 109;
986 pub const EUNATCH: c_int = 110;
987 pub const ENOCSI: c_int = 111;
988 pub const EL2HLT: c_int = 112;
989 pub const EBADE: c_int = 113;
990 pub const EBADR: c_int = 114;
991 pub const EXFULL: c_int = 115;
992 pub const ENODATA: c_int = 116;
993 pub const ETIME: c_int = 117;
994 pub const ENOSR: c_int = 118;
995 pub const ENONET: c_int = 119;
996 pub const ENOPKG: c_int = 120;
997 pub const EREMOTE: c_int = 121;
998 pub const EADV: c_int = 122;
999 pub const ESRMNT: c_int = 123;
1000 pub const ECOMM: c_int = 124;
1001 pub const EDOTDOT: c_int = 125;
1002 pub const ENOTUNIQ: c_int = 126;
1003 pub const EBADFD: c_int = 127;
1004 pub const EREMCHG: c_int = 128;
1005 pub const ELIBACC: c_int = 129;
1006 pub const ELIBBAD: c_int = 130;
1007 pub const ELIBSCN: c_int = 131;
1008 pub const ELIBMAX: c_int = 132;
1009 pub const ELIBEXEC: c_int = 133;
1010 pub const ERESTART: c_int = 134;
1011 pub const ESTRPIPE: c_int = 135;
1012 pub const EUSERS: c_int = 136;
1013 pub const ESOCKTNOSUPPORT: c_int = 137;
1014 pub const EOPNOTSUPP: c_int = 138;
1015 pub const ENOTSUP: c_int = EOPNOTSUPP;
1016 pub const EPFNOSUPPORT: c_int = 139;
1017 pub const ESHUTDOWN: c_int = 140;
1018 pub const ETOOMANYREFS: c_int = 141;
1019 pub const EHOSTDOWN: c_int = 142;
1020 pub const EUCLEAN: c_int = 143;
1021 pub const ENOTNAM: c_int = 144;
1022 pub const ENAVAIL: c_int = 145;
1023 pub const EISNAM: c_int = 146;
1024 pub const EREMOTEIO: c_int = 147;
1025 pub const ENOMEDIUM: c_int = 148;
1026 pub const EMEDIUMTYPE: c_int = 149;
1027 pub const ENOKEY: c_int = 150;
1028 pub const EKEYEXPIRED: c_int = 151;
1029 pub const EKEYREVOKED: c_int = 152;
1030 pub const EKEYREJECTED: c_int = 153;
1031 pub const ERFKILL: c_int = 154;
1032 pub const EHWPOISON: c_int = 155;
1033 pub const EL2NSYNC: c_int = 156;
1034 
1035 pub const SA_NODEFER: c_int = 0x40000000;
1036 pub const SA_RESETHAND: c_int = 0x80000000;
1037 pub const SA_RESTART: c_int = 0x10000000;
1038 pub const SA_NOCLDSTOP: c_int = 0x00000001;
1039 
1040 pub const BUFSIZ: c_uint = 1024;
1041 pub const TMP_MAX: c_uint = 10000;
1042 pub const FOPEN_MAX: c_uint = 1000;
1043 pub const O_PATH: c_int = 0o10000000;
1044 pub const O_EXEC: c_int = 0o10000000;
1045 pub const O_SEARCH: c_int = 0o10000000;
1046 pub const O_ACCMODE: c_int = 0o10000003;
1047 pub const O_NDELAY: c_int = O_NONBLOCK;
1048 pub const NI_MAXHOST: crate::socklen_t = 255;
1049 pub const PTHREAD_STACK_MIN: size_t = 2048;
1050 pub const POSIX_FADV_DONTNEED: c_int = 4;
1051 pub const POSIX_FADV_NOREUSE: c_int = 5;
1052 
1053 pub const POSIX_MADV_DONTNEED: c_int = 4;
1054 
1055 pub const RLIM_INFINITY: crate::rlim_t = !0;
1056 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
1057 pub const RLIMIT_NLIMITS: c_int = 16;
1058 #[allow(deprecated)]
1059 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
1060 pub const RLIM_NLIMITS: c_int = RLIMIT_NLIMITS;
1061 
1062 pub const MAP_ANONYMOUS: c_int = MAP_ANON;
1063 
1064 #[doc(hidden)]
1065 #[deprecated(since = "0.2.55", note = "Use SIGSYS instead")]
1066 pub const SIGUNUSED: c_int = crate::SIGSYS;
1067 
1068 pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
1069 pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
1070 pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
1071 
1072 pub const CPU_SETSIZE: c_int = 1024;
1073 
1074 pub const TCSANOW: c_int = 0;
1075 pub const TCSADRAIN: c_int = 1;
1076 pub const TCSAFLUSH: c_int = 2;
1077 
1078 pub const TIOCINQ: c_int = crate::FIONREAD;
1079 
1080 pub const RTLD_GLOBAL: c_int = 0x100;
1081 pub const RTLD_NOLOAD: c_int = 0x4;
1082 
1083 pub const CLOCK_SGI_CYCLE: crate::clockid_t = 10;
1084 
1085 pub const MCL_CURRENT: c_int = 0x0001;
1086 pub const MCL_FUTURE: c_int = 0x0002;
1087 
1088 pub const SIGSTKSZ: size_t = 8192;
1089 pub const MINSIGSTKSZ: size_t = 2048;
1090 pub const CBAUD: crate::tcflag_t = 0o0010017;
1091 pub const TAB1: c_int = 0x00000800;
1092 pub const TAB2: c_int = 0x00001000;
1093 pub const TAB3: c_int = 0x00001800;
1094 pub const CR1: c_int = 0x00000200;
1095 pub const CR2: c_int = 0x00000400;
1096 pub const CR3: c_int = 0x00000600;
1097 pub const FF1: c_int = 0x00008000;
1098 pub const BS1: c_int = 0x00002000;
1099 pub const VT1: c_int = 0x00004000;
1100 pub const VWERASE: usize = 14;
1101 pub const VREPRINT: usize = 12;
1102 pub const VSUSP: usize = 10;
1103 pub const VSTART: usize = 8;
1104 pub const VSTOP: usize = 9;
1105 pub const VDISCARD: usize = 13;
1106 pub const VTIME: usize = 5;
1107 pub const IXON: crate::tcflag_t = 0x00000400;
1108 pub const IXOFF: crate::tcflag_t = 0x00001000;
1109 pub const ONLCR: crate::tcflag_t = 0x4;
1110 pub const CSIZE: crate::tcflag_t = 0x00000030;
1111 pub const CS6: crate::tcflag_t = 0x00000010;
1112 pub const CS7: crate::tcflag_t = 0x00000020;
1113 pub const CS8: crate::tcflag_t = 0x00000030;
1114 pub const CSTOPB: crate::tcflag_t = 0x00000040;
1115 pub const CREAD: crate::tcflag_t = 0x00000080;
1116 pub const PARENB: crate::tcflag_t = 0x00000100;
1117 pub const PARODD: crate::tcflag_t = 0x00000200;
1118 pub const HUPCL: crate::tcflag_t = 0x00000400;
1119 pub const CLOCAL: crate::tcflag_t = 0x00000800;
1120 pub const ECHOKE: crate::tcflag_t = 0x00000800;
1121 pub const ECHOE: crate::tcflag_t = 0x00000010;
1122 pub const ECHOK: crate::tcflag_t = 0x00000020;
1123 pub const ECHONL: crate::tcflag_t = 0x00000040;
1124 pub const ECHOPRT: crate::tcflag_t = 0x00000400;
1125 pub const ECHOCTL: crate::tcflag_t = 0x00000200;
1126 pub const ISIG: crate::tcflag_t = 0x00000001;
1127 pub const ICANON: crate::tcflag_t = 0x00000002;
1128 pub const PENDIN: crate::tcflag_t = 0x00004000;
1129 pub const NOFLSH: crate::tcflag_t = 0x00000080;
1130 pub const CBAUDEX: crate::tcflag_t = 0o010000;
1131 pub const VSWTC: usize = 7;
1132 pub const OLCUC: crate::tcflag_t = 0o000002;
1133 pub const NLDLY: crate::tcflag_t = 0o000400;
1134 pub const CRDLY: crate::tcflag_t = 0o003000;
1135 pub const TABDLY: crate::tcflag_t = 0o014000;
1136 pub const BSDLY: crate::tcflag_t = 0o020000;
1137 pub const FFDLY: crate::tcflag_t = 0o100000;
1138 pub const VTDLY: crate::tcflag_t = 0o040000;
1139 pub const XTABS: crate::tcflag_t = 0o014000;
1140 
1141 pub const B0: crate::speed_t = 0o000000;
1142 pub const B50: crate::speed_t = 0o000001;
1143 pub const B75: crate::speed_t = 0o000002;
1144 pub const B110: crate::speed_t = 0o000003;
1145 pub const B134: crate::speed_t = 0o000004;
1146 pub const B150: crate::speed_t = 0o000005;
1147 pub const B200: crate::speed_t = 0o000006;
1148 pub const B300: crate::speed_t = 0o000007;
1149 pub const B600: crate::speed_t = 0o000010;
1150 pub const B1200: crate::speed_t = 0o000011;
1151 pub const B1800: crate::speed_t = 0o000012;
1152 pub const B2400: crate::speed_t = 0o000013;
1153 pub const B4800: crate::speed_t = 0o000014;
1154 pub const B9600: crate::speed_t = 0o000015;
1155 pub const B19200: crate::speed_t = 0o000016;
1156 pub const B38400: crate::speed_t = 0o000017;
1157 pub const B57600: crate::speed_t = 0o010001;
1158 pub const B115200: crate::speed_t = 0o010002;
1159 pub const B230400: crate::speed_t = 0o010003;
1160 pub const B460800: crate::speed_t = 0o010004;
1161 pub const B500000: crate::speed_t = 0o010005;
1162 pub const B576000: crate::speed_t = 0o010006;
1163 pub const B921600: crate::speed_t = 0o010007;
1164 pub const B1000000: crate::speed_t = 0o010010;
1165 pub const B1152000: crate::speed_t = 0o010011;
1166 pub const B1500000: crate::speed_t = 0o010012;
1167 pub const B2000000: crate::speed_t = 0o010013;
1168 pub const B2500000: crate::speed_t = 0o010014;
1169 pub const B3000000: crate::speed_t = 0o010015;
1170 pub const B3500000: crate::speed_t = 0o010016;
1171 pub const B4000000: crate::speed_t = 0o010017;
1172 
1173 pub const SO_BINDTODEVICE: c_int = 25;
1174 pub const SO_TIMESTAMP: c_int = 63;
1175 pub const SO_MARK: c_int = 36;
1176 pub const SO_RXQ_OVFL: c_int = 40;
1177 pub const SO_PEEK_OFF: c_int = 42;
1178 pub const SO_BUSY_POLL: c_int = 46;
1179 
1180 pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
1181 pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
1182 
1183 pub const O_DIRECT: c_int = 0x4000;
1184 pub const O_DIRECTORY: c_int = 0x10000;
1185 pub const O_NOFOLLOW: c_int = 0x20000;
1186 pub const O_ASYNC: c_int = 0x2000;
1187 
1188 pub const FIOCLEX: c_int = 0x5451;
1189 pub const FIONBIO: c_int = 0x5421;
1190 
1191 pub const RLIMIT_RSS: c_int = 5;
1192 pub const RLIMIT_NOFILE: c_int = 7;
1193 pub const RLIMIT_AS: c_int = 9;
1194 pub const RLIMIT_NPROC: c_int = 6;
1195 pub const RLIMIT_MEMLOCK: c_int = 8;
1196 pub const RLIMIT_CPU: c_int = 0;
1197 pub const RLIMIT_FSIZE: c_int = 1;
1198 pub const RLIMIT_DATA: c_int = 2;
1199 pub const RLIMIT_STACK: c_int = 3;
1200 pub const RLIMIT_CORE: c_int = 4;
1201 pub const RLIMIT_LOCKS: c_int = 10;
1202 pub const RLIMIT_SIGPENDING: c_int = 11;
1203 pub const RLIMIT_MSGQUEUE: c_int = 12;
1204 pub const RLIMIT_NICE: c_int = 13;
1205 pub const RLIMIT_RTPRIO: c_int = 14;
1206 
1207 pub const O_APPEND: c_int = 1024;
1208 pub const O_CREAT: c_int = 64;
1209 pub const O_EXCL: c_int = 128;
1210 pub const O_NOCTTY: c_int = 256;
1211 pub const O_NONBLOCK: c_int = 2048;
1212 pub const O_SYNC: c_int = 1052672;
1213 pub const O_RSYNC: c_int = 1052672;
1214 pub const O_DSYNC: c_int = 4096;
1215 
1216 pub const SOCK_NONBLOCK: c_int = 2048;
1217 
1218 pub const MAP_ANON: c_int = 0x0020;
1219 pub const MAP_GROWSDOWN: c_int = 0x0100;
1220 pub const MAP_DENYWRITE: c_int = 0x0800;
1221 pub const MAP_EXECUTABLE: c_int = 0x01000;
1222 pub const MAP_LOCKED: c_int = 0x02000;
1223 pub const MAP_NORESERVE: c_int = 0x04000;
1224 pub const MAP_POPULATE: c_int = 0x08000;
1225 pub const MAP_NONBLOCK: c_int = 0x010000;
1226 pub const MAP_STACK: c_int = 0x020000;
1227 
1228 pub const SOCK_STREAM: c_int = 1;
1229 pub const SOCK_DGRAM: c_int = 2;
1230 pub const SOCK_SEQPACKET: c_int = 5;
1231 
1232 pub const IPPROTO_MAX: c_int = 263;
1233 
1234 pub const SOL_SOCKET: c_int = 1;
1235 
1236 pub const SO_REUSEADDR: c_int = 2;
1237 pub const SO_TYPE: c_int = 3;
1238 pub const SO_ERROR: c_int = 4;
1239 pub const SO_DONTROUTE: c_int = 5;
1240 pub const SO_BROADCAST: c_int = 6;
1241 pub const SO_SNDBUF: c_int = 7;
1242 pub const SO_RCVBUF: c_int = 8;
1243 pub const SO_KEEPALIVE: c_int = 9;
1244 pub const SO_OOBINLINE: c_int = 10;
1245 pub const SO_LINGER: c_int = 13;
1246 pub const SO_REUSEPORT: c_int = 15;
1247 pub const SO_RCVLOWAT: c_int = 18;
1248 pub const SO_SNDLOWAT: c_int = 19;
1249 pub const SO_RCVTIMEO: c_int = 66;
1250 pub const SO_SNDTIMEO: c_int = 67;
1251 pub const SO_ACCEPTCONN: c_int = 30;
1252 
1253 pub const IPV6_RTHDR_LOOSE: c_int = 0;
1254 pub const IPV6_RTHDR_STRICT: c_int = 1;
1255 
1256 pub const SA_ONSTACK: c_int = 0x08000000;
1257 pub const SA_SIGINFO: c_int = 0x00000004;
1258 pub const SA_NOCLDWAIT: c_int = 0x00000002;
1259 
1260 pub const SIGCHLD: c_int = 17;
1261 pub const SIGBUS: c_int = 7;
1262 pub const SIGTTIN: c_int = 21;
1263 pub const SIGTTOU: c_int = 22;
1264 pub const SIGXCPU: c_int = 24;
1265 pub const SIGXFSZ: c_int = 25;
1266 pub const SIGVTALRM: c_int = 26;
1267 pub const SIGPROF: c_int = 27;
1268 pub const SIGWINCH: c_int = 28;
1269 pub const SIGUSR1: c_int = 10;
1270 pub const SIGUSR2: c_int = 12;
1271 pub const SIGCONT: c_int = 18;
1272 pub const SIGSTOP: c_int = 19;
1273 pub const SIGTSTP: c_int = 20;
1274 pub const SIGURG: c_int = 23;
1275 pub const SIGIO: c_int = 29;
1276 pub const SIGSYS: c_int = 31;
1277 pub const SIGSTKFLT: c_int = 16;
1278 pub const SIGPOLL: c_int = 29;
1279 pub const SIGPWR: c_int = 30;
1280 pub const SIG_SETMASK: c_int = 2;
1281 pub const SIG_BLOCK: c_int = 0x000000;
1282 pub const SIG_UNBLOCK: c_int = 0x01;
1283 
1284 pub const EXTPROC: crate::tcflag_t = 0x00010000;
1285 
1286 pub const MAP_HUGETLB: c_int = 0x040000;
1287 
1288 pub const F_GETLK: c_int = 12;
1289 pub const F_GETOWN: c_int = 9;
1290 pub const F_SETLK: c_int = 13;
1291 pub const F_SETLKW: c_int = 14;
1292 pub const F_SETOWN: c_int = 8;
1293 pub const F_OFD_GETLK: c_int = 36;
1294 pub const F_OFD_SETLK: c_int = 37;
1295 pub const F_OFD_SETLKW: c_int = 38;
1296 
1297 pub const VEOF: usize = 4;
1298 pub const VEOL: usize = 11;
1299 pub const VEOL2: usize = 16;
1300 pub const VMIN: usize = 6;
1301 pub const IEXTEN: crate::tcflag_t = 0x00008000;
1302 pub const TOSTOP: crate::tcflag_t = 0x00000100;
1303 pub const FLUSHO: crate::tcflag_t = 0x00001000;
1304 
1305 pub const TCGETS: c_int = 0x5401;
1306 pub const TCSETS: c_int = 0x5402;
1307 pub const TCSETSW: c_int = 0x5403;
1308 pub const TCSETSF: c_int = 0x5404;
1309 pub const TCGETA: c_int = 0x5405;
1310 pub const TCSETA: c_int = 0x5406;
1311 pub const TCSETAW: c_int = 0x5407;
1312 pub const TCSETAF: c_int = 0x5408;
1313 pub const TCSBRK: c_int = 0x5409;
1314 pub const TCXONC: c_int = 0x540A;
1315 pub const TCFLSH: c_int = 0x540B;
1316 pub const TIOCGSOFTCAR: c_int = 0x5419;
1317 pub const TIOCSSOFTCAR: c_int = 0x541A;
1318 pub const TIOCLINUX: c_int = 0x541C;
1319 pub const TIOCGSERIAL: c_int = 0x541E;
1320 pub const TIOCEXCL: c_int = 0x540C;
1321 pub const TIOCNXCL: c_int = 0x540D;
1322 pub const TIOCSCTTY: c_int = 0x540E;
1323 pub const TIOCGPGRP: c_int = 0x540F;
1324 pub const TIOCSPGRP: c_int = 0x5410;
1325 pub const TIOCOUTQ: c_int = 0x5411;
1326 pub const TIOCSTI: c_int = 0x5412;
1327 pub const TIOCGWINSZ: c_int = 0x5413;
1328 pub const TIOCSWINSZ: c_int = 0x5414;
1329 pub const TIOCMGET: c_int = 0x5415;
1330 pub const TIOCMBIS: c_int = 0x5416;
1331 pub const TIOCMBIC: c_int = 0x5417;
1332 pub const TIOCMSET: c_int = 0x5418;
1333 pub const FIONREAD: c_int = 0x541B;
1334 pub const TIOCCONS: c_int = 0x541D;
1335 
1336 pub const SYS_gettid: c_long = 224; // Valid for arm (32-bit) and x86 (32-bit)
1337 
1338 pub const POLLWRNORM: c_short = 0x100;
1339 pub const POLLWRBAND: c_short = 0x200;
1340 
1341 pub const TIOCM_LE: c_int = 0x001;
1342 pub const TIOCM_DTR: c_int = 0x002;
1343 pub const TIOCM_RTS: c_int = 0x004;
1344 pub const TIOCM_ST: c_int = 0x008;
1345 pub const TIOCM_SR: c_int = 0x010;
1346 pub const TIOCM_CTS: c_int = 0x020;
1347 pub const TIOCM_CAR: c_int = 0x040;
1348 pub const TIOCM_RNG: c_int = 0x080;
1349 pub const TIOCM_DSR: c_int = 0x100;
1350 pub const TIOCM_CD: c_int = TIOCM_CAR;
1351 pub const TIOCM_RI: c_int = TIOCM_RNG;
1352 pub const O_TMPFILE: c_int = 0x410000;
1353 
1354 pub const MAX_ADDR_LEN: usize = 7;
1355 pub const ARPD_UPDATE: c_ushort = 0x01;
1356 pub const ARPD_LOOKUP: c_ushort = 0x02;
1357 pub const ARPD_FLUSH: c_ushort = 0x03;
1358 pub const ATF_MAGIC: c_int = 0x80;
1359 
1360 pub const PRIO_PROCESS: c_int = 0;
1361 pub const PRIO_PGRP: c_int = 1;
1362 pub const PRIO_USER: c_int = 2;
1363 
1364 pub const SOMAXCONN: c_int = 128;
1365 
1366 f! {
1367     pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
1368         if ((*cmsg).cmsg_len as usize) < mem::size_of::<cmsghdr>() {
1369             return core::ptr::null_mut::<cmsghdr>();
1370         }
1371         let next = (cmsg as usize + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr;
1372         let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
1373         if (next.offset(1)) as usize > max {
1374             core::ptr::null_mut::<cmsghdr>()
1375         } else {
1376             next as *mut cmsghdr
1377         }
1378     }
1379 
1380     pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
1381         for slot in cpuset.bits.iter_mut() {
1382             *slot = 0;
1383         }
1384     }
1385 
1386     pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1387         let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
1388         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1389         cpuset.bits[idx] |= 1 << offset;
1390         ()
1391     }
1392 
1393     pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
1394         let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
1395         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1396         cpuset.bits[idx] &= !(1 << offset);
1397         ()
1398     }
1399 
1400     pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
1401         let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]);
1402         let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1403         0 != (cpuset.bits[idx] & (1 << offset))
1404     }
1405 
1406     pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
1407         set1.bits == set2.bits
1408     }
1409 }
1410 
1411 safe_f! {
1412     pub {const} fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t {
1413         let major = major as crate::dev_t;
1414         let minor = minor as crate::dev_t;
1415         let mut dev = 0;
1416         dev |= (major & 0xfffff000) << 31 << 1;
1417         dev |= (major & 0x00000fff) << 8;
1418         dev |= (minor & 0xffffff00) << 12;
1419         dev |= minor & 0x000000ff;
1420         dev
1421     }
1422 
1423     pub {const} fn major(dev: crate::dev_t) -> c_uint {
1424         // see
1425         // https://github.com/emscripten-core/emscripten/blob/
1426         // main/system/lib/libc/musl/include/sys/sysmacros.h
1427         let mut major = 0;
1428         major |= (dev >> 31 >> 1) & 0xfffff000;
1429         major |= (dev >> 8) & 0x00000fff;
1430         major as c_uint
1431     }
1432 
1433     pub {const} fn minor(dev: crate::dev_t) -> c_uint {
1434         // see
1435         // https://github.com/emscripten-core/emscripten/blob/
1436         // main/system/lib/libc/musl/include/sys/sysmacros.h
1437         let mut minor = 0;
1438         minor |= (dev >> 12) & 0xffffff00;
1439         minor |= dev & 0x000000ff;
1440         minor as c_uint
1441     }
1442 }
1443 
1444 extern "C" {
getrlimit(resource: c_int, rlim: *mut crate::rlimit) -> c_int1445     pub fn getrlimit(resource: c_int, rlim: *mut crate::rlimit) -> c_int;
setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int1446     pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int;
strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int1447     pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
1448 
abs(i: c_int) -> c_int1449     pub fn abs(i: c_int) -> c_int;
labs(i: c_long) -> c_long1450     pub fn labs(i: c_long) -> c_long;
rand() -> c_int1451     pub fn rand() -> c_int;
srand(seed: c_uint)1452     pub fn srand(seed: c_uint);
1453 
gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int1454     pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int;
1455 
setpwent()1456     pub fn setpwent();
endpwent()1457     pub fn endpwent();
getpwent() -> *mut passwd1458     pub fn getpwent() -> *mut passwd;
1459 
shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int1460     pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
1461 
mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int1462     pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
__errno_location() -> *mut c_int1463     pub fn __errno_location() -> *mut c_int;
1464 
posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int1465     pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t1466     pub fn pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t1467     pub fn preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
dup3(oldfd: c_int, newfd: c_int, flags: c_int) -> c_int1468     pub fn dup3(oldfd: c_int, newfd: c_int, flags: c_int) -> c_int;
nl_langinfo_l(item: crate::nl_item, locale: crate::locale_t) -> *mut c_char1469     pub fn nl_langinfo_l(item: crate::nl_item, locale: crate::locale_t) -> *mut c_char;
accept4( fd: c_int, addr: *mut crate::sockaddr, len: *mut crate::socklen_t, flg: c_int, ) -> c_int1470     pub fn accept4(
1471         fd: c_int,
1472         addr: *mut crate::sockaddr,
1473         len: *mut crate::socklen_t,
1474         flg: c_int,
1475     ) -> c_int;
getnameinfo( sa: *const crate::sockaddr, salen: crate::socklen_t, host: *mut c_char, hostlen: crate::socklen_t, serv: *mut c_char, servlen: crate::socklen_t, flags: c_int, ) -> c_int1476     pub fn getnameinfo(
1477         sa: *const crate::sockaddr,
1478         salen: crate::socklen_t,
1479         host: *mut c_char,
1480         hostlen: crate::socklen_t,
1481         serv: *mut c_char,
1482         servlen: crate::socklen_t,
1483         flags: c_int,
1484     ) -> c_int;
getloadavg(loadavg: *mut c_double, nelem: c_int) -> c_int1485     pub fn getloadavg(loadavg: *mut c_double, nelem: c_int) -> c_int;
1486 
mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int1487     pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
if_nameindex() -> *mut if_nameindex1488     pub fn if_nameindex() -> *mut if_nameindex;
if_freenameindex(ptr: *mut if_nameindex)1489     pub fn if_freenameindex(ptr: *mut if_nameindex);
1490 
mremap( addr: *mut c_void, len: size_t, new_len: size_t, flags: c_int, ... ) -> *mut c_void1491     pub fn mremap(
1492         addr: *mut c_void,
1493         len: size_t,
1494         new_len: size_t,
1495         flags: c_int,
1496         ...
1497     ) -> *mut c_void;
1498 
glob( pattern: *const c_char, flags: c_int, errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>, pglob: *mut crate::glob_t, ) -> c_int1499     pub fn glob(
1500         pattern: *const c_char,
1501         flags: c_int,
1502         errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>,
1503         pglob: *mut crate::glob_t,
1504     ) -> c_int;
globfree(pglob: *mut crate::glob_t)1505     pub fn globfree(pglob: *mut crate::glob_t);
1506 
posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int1507     pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
1508 
shm_unlink(name: *const c_char) -> c_int1509     pub fn shm_unlink(name: *const c_char) -> c_int;
1510 
seekdir(dirp: *mut crate::DIR, loc: c_long)1511     pub fn seekdir(dirp: *mut crate::DIR, loc: c_long);
1512 
telldir(dirp: *mut crate::DIR) -> c_long1513     pub fn telldir(dirp: *mut crate::DIR) -> c_long;
madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int1514     pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
1515 
msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int1516     pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int;
1517 
recvfrom( socket: c_int, buf: *mut c_void, len: size_t, flags: c_int, addr: *mut crate::sockaddr, addrlen: *mut crate::socklen_t, ) -> ssize_t1518     pub fn recvfrom(
1519         socket: c_int,
1520         buf: *mut c_void,
1521         len: size_t,
1522         flags: c_int,
1523         addr: *mut crate::sockaddr,
1524         addrlen: *mut crate::socklen_t,
1525     ) -> ssize_t;
mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int1526     pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int;
nl_langinfo(item: crate::nl_item) -> *mut c_char1527     pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char;
1528 
sendmmsg( sockfd: c_int, msgvec: *mut crate::mmsghdr, vlen: c_uint, flags: c_uint, ) -> c_int1529     pub fn sendmmsg(
1530         sockfd: c_int,
1531         msgvec: *mut crate::mmsghdr,
1532         vlen: c_uint,
1533         flags: c_uint,
1534     ) -> c_int;
recvmmsg( sockfd: c_int, msgvec: *mut crate::mmsghdr, vlen: c_uint, flags: c_uint, timeout: *mut crate::timespec, ) -> c_int1535     pub fn recvmmsg(
1536         sockfd: c_int,
1537         msgvec: *mut crate::mmsghdr,
1538         vlen: c_uint,
1539         flags: c_uint,
1540         timeout: *mut crate::timespec,
1541     ) -> c_int;
sync()1542     pub fn sync();
ioctl(fd: c_int, request: c_int, ...) -> c_int1543     pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int;
getpriority(which: c_int, who: crate::id_t) -> c_int1544     pub fn getpriority(which: c_int, who: crate::id_t) -> c_int;
setpriority(which: c_int, who: crate::id_t, prio: c_int) -> c_int1545     pub fn setpriority(which: c_int, who: crate::id_t, prio: c_int) -> c_int;
pthread_create( native: *mut crate::pthread_t, attr: *const crate::pthread_attr_t, f: extern "C" fn(*mut c_void) -> *mut c_void, value: *mut c_void, ) -> c_int1546     pub fn pthread_create(
1547         native: *mut crate::pthread_t,
1548         attr: *const crate::pthread_attr_t,
1549         f: extern "C" fn(*mut c_void) -> *mut c_void,
1550         value: *mut c_void,
1551     ) -> c_int;
1552 
getentropy(buf: *mut c_void, buflen: size_t) -> c_int1553     pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int;
1554 
getpwnam_r( name: *const c_char, pwd: *mut passwd, buf: *mut c_char, buflen: size_t, result: *mut *mut passwd, ) -> c_int1555     pub fn getpwnam_r(
1556         name: *const c_char,
1557         pwd: *mut passwd,
1558         buf: *mut c_char,
1559         buflen: size_t,
1560         result: *mut *mut passwd,
1561     ) -> c_int;
getpwuid_r( uid: crate::uid_t, pwd: *mut passwd, buf: *mut c_char, buflen: size_t, result: *mut *mut passwd, ) -> c_int1562     pub fn getpwuid_r(
1563         uid: crate::uid_t,
1564         pwd: *mut passwd,
1565         buf: *mut c_char,
1566         buflen: size_t,
1567         result: *mut *mut passwd,
1568     ) -> c_int;
1569 
1570     // grp.h
getgrgid(gid: crate::gid_t) -> *mut crate::group1571     pub fn getgrgid(gid: crate::gid_t) -> *mut crate::group;
getgrnam(name: *const c_char) -> *mut crate::group1572     pub fn getgrnam(name: *const c_char) -> *mut crate::group;
getgrnam_r( name: *const c_char, grp: *mut crate::group, buf: *mut c_char, buflen: size_t, result: *mut *mut crate::group, ) -> c_int1573     pub fn getgrnam_r(
1574         name: *const c_char,
1575         grp: *mut crate::group,
1576         buf: *mut c_char,
1577         buflen: size_t,
1578         result: *mut *mut crate::group,
1579     ) -> c_int;
getgrgid_r( gid: crate::gid_t, grp: *mut crate::group, buf: *mut c_char, buflen: size_t, result: *mut *mut crate::group, ) -> c_int1580     pub fn getgrgid_r(
1581         gid: crate::gid_t,
1582         grp: *mut crate::group,
1583         buf: *mut c_char,
1584         buflen: size_t,
1585         result: *mut *mut crate::group,
1586     ) -> c_int;
1587 }
1588 
1589 // Alias <foo> to <foo>64 to mimic glibc's LFS64 support
1590 mod lfs64;
1591 pub use self::lfs64::*;
1592