Debian Codegraph @

debian/missing-sources/libc/src/unix/linux_like/emscripten/mod.rs

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