interplane.Get Omega
Read in your language

aienux

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

Brought by drakestapleton

branch main Branches Tags History

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

3021 lines · 99630 bytes Raw Blame History
1//! Definitions for QNX Software Development Platform
2//!
3//! This module applies to:
4//!
5//! * `aarch64-unknown-nto-qnx700`
6//! * `aarch64-unknown-nto-qnx710`
7//! * `aarch64-unknown-nto-qnx710_iosock`
8//! * `aarch64-unknown-qnx`
9//! * `i686-pc-nto-qnx700`
10//! * `x86_64-pc-nto-qnx710`
11//! * `x86_64-pc-nto-qnx710_iosock`
12//! * `x86_64-pc-qnx`
13//!
14//! There are sub-modules for the target architecture, and sub-modules for the
15//! kind of networking library used. QNX SDP 7.0 uses `io-pkt`, QNX SDP 8.0
16//! uses `io-sock`, and QNX SDP 7.1 comes with both (so you can pick).
17
18use crate::prelude::*;
19
20// QNX definitions of common UNIX things
21
22pub type clock_t = u32;
23
24pub type sa_family_t = u8;
25pub type speed_t = c_uint;
26pub type tcflag_t = c_uint;
27pub type clockid_t = c_int;
28pub type timer_t = c_int;
29pub type key_t = c_uint;
30pub type id_t = c_int;
31
32pub type useconds_t = u32;
33pub type dev_t = u32;
34pub type socklen_t = u32;
35pub type mode_t = u32;
36pub type rlim64_t = u64;
37pub type mqd_t = c_int;
38pub type nfds_t = c_uint;
39pub type idtype_t = c_uint;
40pub type errno_t = c_int;
41pub type rsize_t = c_ulong;
42
43pub type Elf32_Half = u16;
44pub type Elf32_Word = u32;
45pub type Elf32_Off = u32;
46pub type Elf32_Addr = u32;
47pub type Elf32_Lword = u64;
48pub type Elf32_Sword = i32;
49
50pub type Elf64_Half = u16;
51pub type Elf64_Word = u32;
52pub type Elf64_Off = u64;
53pub type Elf64_Addr = u64;
54pub type Elf64_Xword = u64;
55pub type Elf64_Sxword = i64;
56pub type Elf64_Lword = u64;
57pub type Elf64_Sword = i32;
58
59pub type Elf32_Section = u16;
60pub type Elf64_Section = u16;
61
62pub type _Time32t = u32;
63
64pub type pthread_t = c_int;
65pub type regoff_t = ssize_t;
66
67pub type nlink_t = u32;
68pub type blksize_t = u32;
69pub type suseconds_t = i32;
70
71pub type ino_t = u64;
72pub type off_t = i64;
73pub type blkcnt_t = u64;
74pub type msgqnum_t = u64;
75pub type msglen_t = u64;
76pub type fsblkcnt_t = u64;
77pub type fsfilcnt_t = u64;
78pub type rlim_t = u64;
79pub type posix_spawn_file_actions_t = *mut c_void;
80pub type posix_spawnattr_t = crate::uintptr_t;
81
82pub type pthread_mutex_t = crate::sync_t;
83pub type pthread_mutexattr_t = crate::_sync_attr;
84pub type pthread_cond_t = crate::sync_t;
85pub type pthread_condattr_t = crate::_sync_attr;
86pub type pthread_rwlockattr_t = crate::_sync_attr;
87pub type pthread_key_t = c_int;
88pub type pthread_spinlock_t = sync_t;
89pub type pthread_barrierattr_t = _sync_attr;
90pub type sem_t = sync_t;
91
92pub type nl_item = c_int;
93
94extern_ty! {
95 pub type timezone;
96}
97
98s! {
99 pub struct dirent_extra {
100 pub d_datalen: u16,
101 pub d_type: u16,
102 d_reserved: Padding<u32>,
103 }
104
105 pub struct stat {
106 pub st_ino: crate::ino_t,
107 pub st_size: off_t,
108 pub st_dev: crate::dev_t,
109 pub st_rdev: crate::dev_t,
110 pub st_uid: crate::uid_t,
111 pub st_gid: crate::gid_t,
112 pub __old_st_mtime: crate::_Time32t,
113 pub __old_st_atime: crate::_Time32t,
114 pub __old_st_ctime: crate::_Time32t,
115 pub st_mode: mode_t,
116 pub st_nlink: crate::nlink_t,
117 pub st_blocksize: crate::blksize_t,
118 pub st_nblocks: i32,
119 pub st_blksize: crate::blksize_t,
120 pub st_blocks: crate::blkcnt_t,
121 pub st_mtim: crate::timespec,
122 pub st_atim: crate::timespec,
123 pub st_ctim: crate::timespec,
124 }
125
126 pub struct ip_mreq {
127 pub imr_multiaddr: in_addr,
128 pub imr_interface: in_addr,
129 }
130
131 pub struct sockaddr {
132 pub sa_len: u8,
133 pub sa_family: sa_family_t,
134 pub sa_data: [c_char; 14],
135 }
136
137 pub struct sockaddr_in6 {
138 pub sin6_len: u8,
139 pub sin6_family: sa_family_t,
140 pub sin6_port: crate::in_port_t,
141 pub sin6_flowinfo: u32,
142 pub sin6_addr: crate::in6_addr,
143 pub sin6_scope_id: u32,
144 }
145
146 // The order of the `ai_addr` field in this struct is crucial
147 // for converting between the Rust and C types.
148 pub struct addrinfo {
149 pub ai_flags: c_int,
150 pub ai_family: c_int,
151 pub ai_socktype: c_int,
152 pub ai_protocol: c_int,
153 pub ai_addrlen: socklen_t,
154 pub ai_canonname: *mut c_char,
155 pub ai_addr: *mut crate::sockaddr,
156 pub ai_next: *mut addrinfo,
157 }
158
159 pub struct fd_set {
160 fds_bits: [c_uint; 2 * FD_SETSIZE as usize / ULONG_SIZE],
161 }
162
163 pub struct tm {
164 pub tm_sec: c_int,
165 pub tm_min: c_int,
166 pub tm_hour: c_int,
167 pub tm_mday: c_int,
168 pub tm_mon: c_int,
169 pub tm_year: c_int,
170 pub tm_wday: c_int,
171 pub tm_yday: c_int,
172 pub tm_isdst: c_int,
173 pub tm_gmtoff: c_long,
174 pub tm_zone: *const c_char,
175 }
176
177 #[repr(align(8))]
178 pub struct sched_param {
179 pub sched_priority: c_int,
180 pub sched_curpriority: c_int,
181 reserved: Padding<[c_int; 10]>,
182 }
183
184 #[repr(align(8))]
185 pub struct __sched_param {
186 pub __sched_priority: c_int,
187 pub __sched_curpriority: c_int,
188 reserved: Padding<[c_int; 10]>,
189 }
190
191 pub struct Dl_info {
192 pub dli_fname: *const c_char,
193 pub dli_fbase: *mut c_void,
194 pub dli_sname: *const c_char,
195 pub dli_saddr: *mut c_void,
196 }
197
198 pub struct lconv {
199 pub currency_symbol: *mut c_char,
200 pub int_curr_symbol: *mut c_char,
201 pub mon_decimal_point: *mut c_char,
202 pub mon_grouping: *mut c_char,
203 pub mon_thousands_sep: *mut c_char,
204 pub negative_sign: *mut c_char,
205 pub positive_sign: *mut c_char,
206 pub frac_digits: c_char,
207 pub int_frac_digits: c_char,
208 pub n_cs_precedes: c_char,
209 pub n_sep_by_space: c_char,
210 pub n_sign_posn: c_char,
211 pub p_cs_precedes: c_char,
212 pub p_sep_by_space: c_char,
213 pub p_sign_posn: c_char,
214
215 pub int_n_cs_precedes: c_char,
216 pub int_n_sep_by_space: c_char,
217 pub int_n_sign_posn: c_char,
218 pub int_p_cs_precedes: c_char,
219 pub int_p_sep_by_space: c_char,
220 pub int_p_sign_posn: c_char,
221
222 pub decimal_point: *mut c_char,
223 pub grouping: *mut c_char,
224 pub thousands_sep: *mut c_char,
225
226 pub _Frac_grouping: *mut c_char,
227 pub _Frac_sep: *mut c_char,
228 pub _False: *mut c_char,
229 pub _True: *mut c_char,
230
231 pub _No: *mut c_char,
232 pub _Yes: *mut c_char,
233 pub _Nostr: *mut c_char,
234 pub _Yesstr: *mut c_char,
235 _Reserved: Padding<[*mut c_char; 8]>,
236 }
237
238 pub struct ifaddrs {
239 pub ifa_next: *mut ifaddrs,
240 pub ifa_name: *mut c_char,
241 pub ifa_flags: c_uint,
242 pub ifa_addr: *mut crate::sockaddr,
243 pub ifa_netmask: *mut crate::sockaddr,
244 pub ifa_dstaddr: *mut crate::sockaddr,
245 pub ifa_data: *mut c_void,
246 }
247
248 pub struct arpreq {
249 pub arp_pa: crate::sockaddr,
250 pub arp_ha: crate::sockaddr,
251 pub arp_flags: c_int,
252 }
253
254 #[repr(align(8))]
255 pub struct siginfo_t {
256 pub si_signo: c_int,
257 pub si_code: c_int,
258 pub si_errno: c_int,
259 __data: [u8; 36], // union
260 }
261
262 pub struct sigaction {
263 pub sa_sigaction: crate::sighandler_t,
264 pub sa_flags: c_int,
265 pub sa_mask: crate::sigset_t,
266 }
267
268 pub struct _sync {
269 _union: c_uint,
270 __owner: c_uint,
271 }
272 pub struct rlimit64 {
273 pub rlim_cur: rlim64_t,
274 pub rlim_max: rlim64_t,
275 }
276
277 // FIXME(1.0): This should not implement `PartialEq`
278 #[allow(unpredictable_function_pointer_comparisons)]
279 pub struct glob_t {
280 pub gl_pathc: size_t,
281 pub gl_matchc: c_int,
282 pub gl_pathv: *mut *mut c_char,
283 pub gl_offs: size_t,
284 pub gl_flags: c_int,
285 pub gl_errfunc: extern "C" fn(*const c_char, c_int) -> c_int,
286
287 __unused1: Padding<*mut c_void>,
288 __unused2: Padding<*mut c_void>,
289 __unused3: Padding<*mut c_void>,
290 __unused4: Padding<*mut c_void>,
291 __unused5: Padding<*mut c_void>,
292 }
293
294 pub struct passwd {
295 pub pw_name: *mut c_char,
296 pub pw_passwd: *mut c_char,
297 pub pw_uid: crate::uid_t,
298 pub pw_gid: crate::gid_t,
299 pub pw_age: *mut c_char,
300 pub pw_comment: *mut c_char,
301 pub pw_gecos: *mut c_char,
302 pub pw_dir: *mut c_char,
303 pub pw_shell: *mut c_char,
304 }
305
306 pub struct if_nameindex {
307 pub if_index: c_uint,
308 pub if_name: *mut c_char,
309 }
310
311 pub struct sembuf {
312 pub sem_num: c_ushort,
313 pub sem_op: c_short,
314 pub sem_flg: c_short,
315 }
316
317 pub struct Elf32_Ehdr {
318 pub e_ident: [c_uchar; 16],
319 pub e_type: Elf32_Half,
320 pub e_machine: Elf32_Half,
321 pub e_version: Elf32_Word,
322 pub e_entry: Elf32_Addr,
323 pub e_phoff: Elf32_Off,
324 pub e_shoff: Elf32_Off,
325 pub e_flags: Elf32_Word,
326 pub e_ehsize: Elf32_Half,
327 pub e_phentsize: Elf32_Half,
328 pub e_phnum: Elf32_Half,
329 pub e_shentsize: Elf32_Half,
330 pub e_shnum: Elf32_Half,
331 pub e_shstrndx: Elf32_Half,
332 }
333
334 pub struct Elf64_Ehdr {
335 pub e_ident: [c_uchar; 16],
336 pub e_type: Elf64_Half,
337 pub e_machine: Elf64_Half,
338 pub e_version: Elf64_Word,
339 pub e_entry: Elf64_Addr,
340 pub e_phoff: Elf64_Off,
341 pub e_shoff: Elf64_Off,
342 pub e_flags: Elf64_Word,
343 pub e_ehsize: Elf64_Half,
344 pub e_phentsize: Elf64_Half,
345 pub e_phnum: Elf64_Half,
346 pub e_shentsize: Elf64_Half,
347 pub e_shnum: Elf64_Half,
348 pub e_shstrndx: Elf64_Half,
349 }
350
351 pub struct Elf32_Sym {
352 pub st_name: Elf32_Word,
353 pub st_value: Elf32_Addr,
354 pub st_size: Elf32_Word,
355 pub st_info: c_uchar,
356 pub st_other: c_uchar,
357 pub st_shndx: Elf32_Section,
358 }
359
360 pub struct Elf64_Sym {
361 pub st_name: Elf64_Word,
362 pub st_info: c_uchar,
363 pub st_other: c_uchar,
364 pub st_shndx: Elf64_Section,
365 pub st_value: Elf64_Addr,
366 pub st_size: Elf64_Xword,
367 }
368
369 pub struct Elf32_Phdr {
370 pub p_type: Elf32_Word,
371 pub p_offset: Elf32_Off,
372 pub p_vaddr: Elf32_Addr,
373 pub p_paddr: Elf32_Addr,
374 pub p_filesz: Elf32_Word,
375 pub p_memsz: Elf32_Word,
376 pub p_flags: Elf32_Word,
377 pub p_align: Elf32_Word,
378 }
379
380 pub struct Elf64_Phdr {
381 pub p_type: Elf64_Word,
382 pub p_flags: Elf64_Word,
383 pub p_offset: Elf64_Off,
384 pub p_vaddr: Elf64_Addr,
385 pub p_paddr: Elf64_Addr,
386 pub p_filesz: Elf64_Xword,
387 pub p_memsz: Elf64_Xword,
388 pub p_align: Elf64_Xword,
389 }
390
391 pub struct Elf32_Shdr {
392 pub sh_name: Elf32_Word,
393 pub sh_type: Elf32_Word,
394 pub sh_flags: Elf32_Word,
395 pub sh_addr: Elf32_Addr,
396 pub sh_offset: Elf32_Off,
397 pub sh_size: Elf32_Word,
398 pub sh_link: Elf32_Word,
399 pub sh_info: Elf32_Word,
400 pub sh_addralign: Elf32_Word,
401 pub sh_entsize: Elf32_Word,
402 }
403
404 pub struct Elf64_Shdr {
405 pub sh_name: Elf64_Word,
406 pub sh_type: Elf64_Word,
407 pub sh_flags: Elf64_Xword,
408 pub sh_addr: Elf64_Addr,
409 pub sh_offset: Elf64_Off,
410 pub sh_size: Elf64_Xword,
411 pub sh_link: Elf64_Word,
412 pub sh_info: Elf64_Word,
413 pub sh_addralign: Elf64_Xword,
414 pub sh_entsize: Elf64_Xword,
415 }
416
417 pub struct in6_pktinfo {
418 pub ipi6_addr: crate::in6_addr,
419 pub ipi6_ifindex: c_uint,
420 }
421
422 pub struct inotify_event {
423 pub wd: c_int,
424 pub mask: u32,
425 pub cookie: u32,
426 pub len: u32,
427 }
428
429 pub struct regmatch_t {
430 pub rm_so: regoff_t,
431 pub rm_eo: regoff_t,
432 }
433
434 pub struct msghdr {
435 pub msg_name: *mut c_void,
436 pub msg_namelen: crate::socklen_t,
437 pub msg_iov: *mut crate::iovec,
438 pub msg_iovlen: c_int,
439 pub msg_control: *mut c_void,
440 pub msg_controllen: crate::socklen_t,
441 pub msg_flags: c_int,
442 }
443
444 pub struct cmsghdr {
445 pub cmsg_len: crate::socklen_t,
446 pub cmsg_level: c_int,
447 pub cmsg_type: c_int,
448 }
449
450 pub struct termios {
451 pub c_iflag: crate::tcflag_t,
452 pub c_oflag: crate::tcflag_t,
453 pub c_cflag: crate::tcflag_t,
454 pub c_lflag: crate::tcflag_t,
455 pub c_cc: [crate::cc_t; crate::NCCS],
456 __reserved: Padding<[c_uint; 3]>,
457 pub c_ispeed: crate::speed_t,
458 pub c_ospeed: crate::speed_t,
459 }
460
461 pub struct mallinfo {
462 pub arena: c_int,
463 pub ordblks: c_int,
464 pub smblks: c_int,
465 pub hblks: c_int,
466 pub hblkhd: c_int,
467 pub usmblks: c_int,
468 pub fsmblks: c_int,
469 pub uordblks: c_int,
470 pub fordblks: c_int,
471 pub keepcost: c_int,
472 }
473
474 pub struct flock {
475 pub l_type: i16,
476 pub l_whence: i16,
477 pub l_zero1: i32,
478 pub l_start: off_t,
479 pub l_len: off_t,
480 pub l_pid: crate::pid_t,
481 pub l_sysid: u32,
482 }
483
484 pub struct statvfs {
485 pub f_bsize: c_ulong,
486 pub f_frsize: c_ulong,
487 pub f_blocks: crate::fsblkcnt_t,
488 pub f_bfree: crate::fsblkcnt_t,
489 pub f_bavail: crate::fsblkcnt_t,
490 pub f_files: crate::fsfilcnt_t,
491 pub f_ffree: crate::fsfilcnt_t,
492 pub f_favail: crate::fsfilcnt_t,
493 pub f_fsid: c_ulong,
494 pub f_basetype: [c_char; 16],
495 pub f_flag: c_ulong,
496 pub f_namemax: c_ulong,
497 f_filler: [c_uint; 21],
498 }
499
500 pub struct aiocb {
501 pub aio_fildes: c_int,
502 pub aio_reqprio: c_int,
503 pub aio_offset: off_t,
504 pub aio_buf: *mut c_void,
505 pub aio_nbytes: size_t,
506 pub aio_sigevent: crate::sigevent,
507 pub aio_lio_opcode: c_int,
508 pub _aio_lio_state: *mut c_void,
509 _aio_pad: Padding<[c_int; 3]>,
510 pub _aio_next: *mut crate::aiocb,
511 pub _aio_flag: c_uint,
512 pub _aio_iotype: c_uint,
513 pub _aio_result: ssize_t,
514 pub _aio_error: c_uint,
515 pub _aio_suspend: *mut c_void,
516 pub _aio_plist: *mut c_void,
517 pub _aio_policy: c_int,
518 pub _aio_param: crate::__sched_param,
519 }
520
521 pub struct pthread_attr_t {
522 __data1: c_long,
523 __data2: [u8; 96],
524 }
525
526 pub struct ipc_perm {
527 pub uid: crate::uid_t,
528 pub gid: crate::gid_t,
529 pub cuid: crate::uid_t,
530 pub cgid: crate::gid_t,
531 pub mode: mode_t,
532 pub seq: c_uint,
533 pub key: crate::key_t,
534 _reserved: Padding<[c_int; 4]>,
535 }
536
537 pub struct regex_t {
538 re_magic: c_int,
539 re_nsub: size_t,
540 re_endp: *const c_char,
541 re_g: *mut c_void,
542 }
543
544 // FIXME(1.0): This should not implement `PartialEq`
545 #[allow(unpredictable_function_pointer_comparisons)]
546 pub struct _thread_attr {
547 pub __flags: c_int,
548 pub __stacksize: size_t,
549 pub __stackaddr: *mut c_void,
550 pub __exitfunc: Option<unsafe extern "C" fn(_fake: *mut c_void)>,
551 pub __policy: c_int,
552 pub __param: crate::__sched_param,
553 pub __guardsize: c_uint,
554 pub __prealloc: c_uint,
555 __spare: [c_int; 2],
556 }
557
558 pub struct _sync_attr {
559 pub __protocol: c_int,
560 pub __flags: c_int,
561 pub __prioceiling: c_int,
562 pub __clockid: c_int,
563 pub __count: c_int,
564 __reserved: Padding<[c_int; 3]>,
565 }
566
567 pub struct sockcred {
568 pub sc_uid: crate::uid_t,
569 pub sc_euid: crate::uid_t,
570 pub sc_gid: crate::gid_t,
571 pub sc_egid: crate::gid_t,
572 pub sc_ngroups: c_int,
573 pub sc_groups: [crate::gid_t; 1],
574 }
575
576 pub struct bpf_program {
577 pub bf_len: c_uint,
578 pub bf_insns: *mut crate::bpf_insn,
579 }
580
581 pub struct bpf_version {
582 pub bv_major: c_ushort,
583 pub bv_minor: c_ushort,
584 }
585
586 pub struct bpf_hdr {
587 pub bh_tstamp: crate::timeval,
588 pub bh_caplen: u32,
589 pub bh_datalen: u32,
590 pub bh_hdrlen: u16,
591 }
592
593 pub struct bpf_insn {
594 pub code: u16,
595 pub jt: c_uchar,
596 pub jf: c_uchar,
597 pub k: u32,
598 }
599
600 pub struct bpf_dltlist {
601 pub bfl_len: c_uint,
602 pub bfl_list: *mut c_uint,
603 }
604
605 pub struct dl_phdr_info {
606 pub dlpi_addr: crate::Elf64_Addr,
607 pub dlpi_name: *const c_char,
608 pub dlpi_phdr: *const crate::Elf64_Phdr,
609 pub dlpi_phnum: crate::Elf64_Half,
610 }
611
612 #[repr(align(8))]
613 pub struct ucontext_t {
614 pub uc_link: *mut ucontext_t,
615 pub uc_sigmask: crate::sigset_t,
616 pub uc_stack: stack_t,
617 pub uc_mcontext: mcontext_t,
618 }
619 pub struct sockaddr_un {
620 pub sun_len: u8,
621 pub sun_family: sa_family_t,
622 pub sun_path: [c_char; 104],
623 }
624
625 pub struct sockaddr_storage {
626 pub ss_len: u8,
627 pub ss_family: sa_family_t,
628 __ss_pad1: Padding<[c_char; 6]>,
629 __ss_align: i64,
630 __ss_pad2: Padding<[c_char; 112]>,
631 }
632
633 pub struct utsname {
634 pub sysname: [c_char; _SYSNAME_SIZE],
635 pub nodename: [c_char; _SYSNAME_SIZE],
636 pub release: [c_char; _SYSNAME_SIZE],
637 pub version: [c_char; _SYSNAME_SIZE],
638 pub machine: [c_char; _SYSNAME_SIZE],
639 }
640
641 pub struct sigevent {
642 pub sigev_notify: c_int,
643 __padding1: Padding<c_int>,
644 pub sigev_signo: c_int, // union
645 __padding2: Padding<c_int>,
646 pub sigev_value: crate::sigval,
647 __sigev_un2: usize, // union
648 }
649 pub struct dirent {
650 pub d_ino: crate::ino_t,
651 pub d_offset: off_t,
652 pub d_reclen: c_short,
653 pub d_namelen: c_short,
654 pub d_name: [c_char; 1], // flex array
655 }
656
657 pub struct sigset_t {
658 __val: [u32; 2],
659 }
660
661 pub struct mq_attr {
662 pub mq_maxmsg: c_long,
663 pub mq_msgsize: c_long,
664 pub mq_flags: c_long,
665 pub mq_curmsgs: c_long,
666 pub mq_sendwait: c_long,
667 pub mq_recvwait: c_long,
668 }
669}
670
671s_no_extra_traits! {
672 pub struct msg {
673 pub msg_next: *mut crate::msg,
674 pub msg_type: c_long,
675 pub msg_ts: c_ushort,
676 pub msg_spot: c_short,
677 _pad: Padding<[u8; 4]>,
678 }
679
680 pub struct msqid_ds {
681 pub msg_perm: crate::ipc_perm,
682 pub msg_first: *mut crate::msg,
683 pub msg_last: *mut crate::msg,
684 pub msg_cbytes: crate::msglen_t,
685 pub msg_qnum: crate::msgqnum_t,
686 pub msg_qbytes: crate::msglen_t,
687 pub msg_lspid: crate::pid_t,
688 pub msg_lrpid: crate::pid_t,
689 pub msg_stime: crate::time_t,
690 msg_pad1: Padding<c_long>,
691 pub msg_rtime: crate::time_t,
692 msg_pad2: Padding<c_long>,
693 pub msg_ctime: crate::time_t,
694 msg_pad3: Padding<c_long>,
695 msg_pad4: Padding<[c_long; 4]>,
696 }
697
698 pub struct sync_t {
699 __u: c_uint, // union
700 pub __owner: c_uint,
701 }
702
703 #[repr(align(4))]
704 pub struct pthread_barrier_t {
705 // union
706 __pad: Padding<[u8; 28]>, // union
707 }
708
709 pub struct pthread_rwlock_t {
710 pub __active: c_int,
711 pub __blockedwriters: c_int,
712 pub __blockedreaders: c_int,
713 pub __heavy: c_int,
714 pub __lock: crate::pthread_mutex_t, // union
715 pub __rcond: crate::pthread_cond_t, // union
716 pub __wcond: crate::pthread_cond_t, // union
717 pub __owner: c_uint,
718 pub __spare: c_uint,
719 }
720
721 // There is no canonical definition of c_longdouble in Rust. For both AArch64 and x86_64,
722 // however, the size and alignment properties are that of the gcc __int128 which corresponds (at
723 // least on rustc 1.78+ with LLVM 18, see
724 // https://blog.rust-lang.org/2024/03/30/i128-layout-update/) to i128. Use this instead until we
725 // get native f128 support.
726 //
727 // The definition was taken from the definition of the _Maxalignt struct in the QNX SDK.
728 // However, on QNX SDP 7, there is a different definition of std::max_align_t (the C++ version of
729 // this type). In practice, this doesn't make a difference for the _alignment_ properties of the
730 // type - however, it changes the size, so using in in any other form than the zero-sized array
731 // form would be bogus and it would potentially change the size of the data type. On QNX SDP 8, this
732 // got fixed and both C and C++ are using the same definition.
733 pub struct max_align_t {
734 _ll: crate::c_longlong,
735 _ld: i128,
736 }
737}
738
739pub const _SYSNAME_SIZE: usize = 256 + 1;
740pub const RLIM_INFINITY: crate::rlim_t = 0xfffffffffffffffd;
741pub const O_LARGEFILE: c_int = 0o0100000;
742
743// intentionally not public, only used for fd_set
744cfg_if! {
745 if #[cfg(target_pointer_width = "32")] {
746 const ULONG_SIZE: usize = 32;
747 } else if #[cfg(target_pointer_width = "64")] {
748 const ULONG_SIZE: usize = 64;
749 } else {
750 // Unknown target_pointer_width
751 }
752}
753
754pub const EXIT_FAILURE: c_int = 1;
755pub const EXIT_SUCCESS: c_int = 0;
756pub const RAND_MAX: c_int = 32767;
757pub const EOF: c_int = -1;
758pub const SEEK_SET: c_int = 0;
759pub const SEEK_CUR: c_int = 1;
760pub const SEEK_END: c_int = 2;
761pub const _IOFBF: c_int = 0;
762pub const _IONBF: c_int = 2;
763pub const _IOLBF: c_int = 1;
764
765pub const F_DUPFD: c_int = 0;
766pub const F_GETFD: c_int = 1;
767pub const F_SETFD: c_int = 2;
768pub const F_GETFL: c_int = 3;
769pub const F_SETFL: c_int = 4;
770
771pub const F_DUPFD_CLOEXEC: c_int = 5;
772
773pub const SIGTRAP: c_int = 5;
774
775pub const CLOCK_REALTIME: crate::clockid_t = 0;
776pub const CLOCK_MONOTONIC: crate::clockid_t = 2;
777pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 3;
778pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 4;
779pub const TIMER_ABSTIME: c_uint = 0x80000000;
780
781pub const RUSAGE_SELF: c_int = 0;
782
783pub const F_OK: c_int = 0;
784pub const X_OK: c_int = 1;
785pub const W_OK: c_int = 2;
786pub const R_OK: c_int = 4;
787
788pub const SIGHUP: c_int = 1;
789pub const SIGINT: c_int = 2;
790pub const SIGQUIT: c_int = 3;
791pub const SIGILL: c_int = 4;
792pub const SIGABRT: c_int = 6;
793pub const SIGFPE: c_int = 8;
794pub const SIGKILL: c_int = 9;
795pub const SIGSEGV: c_int = 11;
796pub const SIGPIPE: c_int = 13;
797pub const SIGALRM: c_int = 14;
798pub const SIGTERM: c_int = 15;
799
800pub const PROT_NONE: c_int = 0x00000000;
801pub const PROT_READ: c_int = 0x00000100;
802pub const PROT_WRITE: c_int = 0x00000200;
803pub const PROT_EXEC: c_int = 0x00000400;
804
805pub const MAP_FILE: c_int = 0;
806pub const MAP_SHARED: c_int = 1;
807pub const MAP_PRIVATE: c_int = 2;
808pub const MAP_FIXED: c_int = 0x10;
809
810pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
811
812pub const MS_ASYNC: c_int = 1;
813pub const MS_INVALIDATE: c_int = 4;
814pub const MS_SYNC: c_int = 2;
815
816pub const SCM_RIGHTS: c_int = 0x01;
817pub const SCM_TIMESTAMP: c_int = 0x02;
818
819pub const MAP_TYPE: c_int = 0x3;
820
821pub const IFF_UP: c_int = 0x00000001;
822pub const IFF_BROADCAST: c_int = 0x00000002;
823pub const IFF_DEBUG: c_int = 0x00000004;
824pub const IFF_LOOPBACK: c_int = 0x00000008;
825pub const IFF_POINTOPOINT: c_int = 0x00000010;
826pub const IFF_RUNNING: c_int = 0x00000040;
827pub const IFF_NOARP: c_int = 0x00000080;
828pub const IFF_PROMISC: c_int = 0x00000100;
829pub const IFF_ALLMULTI: c_int = 0x00000200;
830pub const IFF_MULTICAST: c_int = 0x00008000;
831
832pub const AF_UNSPEC: c_int = 0;
833pub const AF_UNIX: c_int = AF_LOCAL;
834pub const AF_LOCAL: c_int = 1;
835pub const AF_INET: c_int = 2;
836pub const AF_IPX: c_int = 23;
837pub const AF_APPLETALK: c_int = 16;
838pub const AF_ROUTE: c_int = 17;
839pub const AF_SNA: c_int = 11;
840
841pub const AF_ISDN: c_int = 26;
842
843pub const PF_UNSPEC: c_int = AF_UNSPEC;
844pub const PF_UNIX: c_int = PF_LOCAL;
845pub const PF_LOCAL: c_int = AF_LOCAL;
846pub const PF_INET: c_int = AF_INET;
847pub const PF_IPX: c_int = AF_IPX;
848pub const PF_APPLETALK: c_int = AF_APPLETALK;
849pub const PF_INET6: c_int = AF_INET6;
850pub const PF_KEY: c_int = pseudo_AF_KEY;
851pub const PF_ROUTE: c_int = AF_ROUTE;
852pub const PF_SNA: c_int = AF_SNA;
853
854pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH;
855pub const PF_ISDN: c_int = AF_ISDN;
856
857pub const SOMAXCONN: c_int = 128;
858
859pub const MSG_OOB: c_int = 0x0001;
860pub const MSG_PEEK: c_int = 0x0002;
861pub const MSG_DONTROUTE: c_int = 0x0004;
862pub const MSG_CTRUNC: c_int = 0x0020;
863pub const MSG_TRUNC: c_int = 0x0010;
864pub const MSG_DONTWAIT: c_int = 0x0080;
865pub const MSG_EOR: c_int = 0x0008;
866pub const MSG_WAITALL: c_int = 0x0040;
867
868pub const IP_TOS: c_int = 3;
869pub const IP_TTL: c_int = 4;
870pub const IP_HDRINCL: c_int = 2;
871pub const IP_OPTIONS: c_int = 1;
872pub const IP_RECVOPTS: c_int = 5;
873pub const IP_RETOPTS: c_int = 8;
874pub const IP_MULTICAST_IF: c_int = 9;
875pub const IP_MULTICAST_TTL: c_int = 10;
876pub const IP_MULTICAST_LOOP: c_int = 11;
877pub const IP_ADD_MEMBERSHIP: c_int = 12;
878pub const IP_DROP_MEMBERSHIP: c_int = 13;
879pub const IP_DEFAULT_MULTICAST_TTL: c_int = 1;
880pub const IP_DEFAULT_MULTICAST_LOOP: c_int = 1;
881
882pub const IPPROTO_HOPOPTS: c_int = 0;
883pub const IPPROTO_IGMP: c_int = 2;
884pub const IPPROTO_IPIP: c_int = 4;
885pub const IPPROTO_EGP: c_int = 8;
886pub const IPPROTO_PUP: c_int = 12;
887pub const IPPROTO_IDP: c_int = 22;
888pub const IPPROTO_TP: c_int = 29;
889pub const IPPROTO_ROUTING: c_int = 43;
890pub const IPPROTO_FRAGMENT: c_int = 44;
891pub const IPPROTO_RSVP: c_int = 46;
892pub const IPPROTO_GRE: c_int = 47;
893pub const IPPROTO_ESP: c_int = 50;
894pub const IPPROTO_AH: c_int = 51;
895pub const IPPROTO_NONE: c_int = 59;
896pub const IPPROTO_DSTOPTS: c_int = 60;
897pub const IPPROTO_ENCAP: c_int = 98;
898pub const IPPROTO_PIM: c_int = 103;
899pub const IPPROTO_SCTP: c_int = 132;
900pub const IPPROTO_RAW: c_int = 255;
901pub const IPPROTO_MAX: c_int = 256;
902pub const IPPROTO_CARP: c_int = 112;
903pub const IPPROTO_DONE: c_int = 257;
904pub const IPPROTO_EON: c_int = 80;
905pub const IPPROTO_ETHERIP: c_int = 97;
906pub const IPPROTO_GGP: c_int = 3;
907pub const IPPROTO_IPCOMP: c_int = 108;
908pub const IPPROTO_MOBILE: c_int = 55;
909
910pub const IPV6_RTHDR_LOOSE: c_int = 0;
911pub const IPV6_RTHDR_STRICT: c_int = 1;
912pub const IPV6_UNICAST_HOPS: c_int = 4;
913pub const IPV6_MULTICAST_IF: c_int = 9;
914pub const IPV6_MULTICAST_HOPS: c_int = 10;
915pub const IPV6_MULTICAST_LOOP: c_int = 11;
916pub const IPV6_JOIN_GROUP: c_int = 12;
917pub const IPV6_LEAVE_GROUP: c_int = 13;
918pub const IPV6_CHECKSUM: c_int = 26;
919pub const IPV6_V6ONLY: c_int = 27;
920pub const IPV6_RTHDRDSTOPTS: c_int = 35;
921pub const IPV6_RECVPKTINFO: c_int = 36;
922pub const IPV6_RECVHOPLIMIT: c_int = 37;
923pub const IPV6_RECVRTHDR: c_int = 38;
924pub const IPV6_RECVHOPOPTS: c_int = 39;
925pub const IPV6_RECVDSTOPTS: c_int = 40;
926pub const IPV6_RECVPATHMTU: c_int = 43;
927pub const IPV6_PATHMTU: c_int = 44;
928pub const IPV6_PKTINFO: c_int = 46;
929pub const IPV6_HOPLIMIT: c_int = 47;
930pub const IPV6_NEXTHOP: c_int = 48;
931pub const IPV6_HOPOPTS: c_int = 49;
932pub const IPV6_DSTOPTS: c_int = 50;
933pub const IPV6_RECVTCLASS: c_int = 57;
934pub const IPV6_TCLASS: c_int = 61;
935pub const IPV6_DONTFRAG: c_int = 62;
936
937pub const TCP_NODELAY: c_int = 0x01;
938pub const TCP_MAXSEG: c_int = 0x02;
939pub const TCP_MD5SIG: c_int = 0x10;
940
941pub const SHUT_RD: c_int = 0;
942pub const SHUT_WR: c_int = 1;
943pub const SHUT_RDWR: c_int = 2;
944
945pub const LOCK_SH: c_int = 0x1;
946pub const LOCK_EX: c_int = 0x2;
947pub const LOCK_NB: c_int = 0x4;
948pub const LOCK_UN: c_int = 0x8;
949
950pub const SS_ONSTACK: c_int = 1;
951pub const SS_DISABLE: c_int = 2;
952
953/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
954/// for details.
955pub const PATH_MAX: c_int = 1024;
956
957pub const UIO_MAXIOV: c_int = 1024;
958
959pub const FD_SETSIZE: usize = 256;
960
961pub const TCIOFF: c_int = 0x0002;
962pub const TCION: c_int = 0x0003;
963pub const TCOOFF: c_int = 0x0000;
964pub const TCOON: c_int = 0x0001;
965pub const TCIFLUSH: c_int = 0;
966pub const TCOFLUSH: c_int = 1;
967pub const TCIOFLUSH: c_int = 2;
968pub const NL0: crate::tcflag_t = 0x000;
969pub const NL1: crate::tcflag_t = 0x100;
970pub const TAB0: crate::tcflag_t = 0x0000;
971pub const CR0: crate::tcflag_t = 0x000;
972pub const FF0: crate::tcflag_t = 0x0000;
973pub const BS0: crate::tcflag_t = 0x0000;
974pub const VT0: crate::tcflag_t = 0x0000;
975pub const VERASE: usize = 2;
976pub const VKILL: usize = 3;
977pub const VINTR: usize = 0;
978pub const VQUIT: usize = 1;
979pub const VLNEXT: usize = 15;
980pub const IGNBRK: crate::tcflag_t = 0x00000001;
981pub const BRKINT: crate::tcflag_t = 0x00000002;
982pub const IGNPAR: crate::tcflag_t = 0x00000004;
983pub const PARMRK: crate::tcflag_t = 0x00000008;
984pub const INPCK: crate::tcflag_t = 0x00000010;
985pub const ISTRIP: crate::tcflag_t = 0x00000020;
986pub const INLCR: crate::tcflag_t = 0x00000040;
987pub const IGNCR: crate::tcflag_t = 0x00000080;
988pub const ICRNL: crate::tcflag_t = 0x00000100;
989pub const IXANY: crate::tcflag_t = 0x00000800;
990pub const IMAXBEL: crate::tcflag_t = 0x00002000;
991pub const OPOST: crate::tcflag_t = 0x00000001;
992pub const CS5: crate::tcflag_t = 0x00;
993pub const ECHO: crate::tcflag_t = 0x00000008;
994pub const OCRNL: crate::tcflag_t = 0x00000008;
995pub const ONOCR: crate::tcflag_t = 0x00000010;
996pub const ONLRET: crate::tcflag_t = 0x00000020;
997pub const OFILL: crate::tcflag_t = 0x00000040;
998pub const OFDEL: crate::tcflag_t = 0x00000080;
999
1000pub const WNOHANG: c_int = 0x0040;
1001pub const WUNTRACED: c_int = 0x0004;
1002pub const WSTOPPED: c_int = WUNTRACED;
1003pub const WEXITED: c_int = 0x0001;
1004pub const WCONTINUED: c_int = 0x0008;
1005pub const WNOWAIT: c_int = 0x0080;
1006pub const WTRAPPED: c_int = 0x0002;
1007
1008pub const RTLD_LOCAL: c_int = 0x0200;
1009pub const RTLD_LAZY: c_int = 0x0001;
1010
1011pub const POSIX_FADV_NORMAL: c_int = 0;
1012pub const POSIX_FADV_RANDOM: c_int = 2;
1013pub const POSIX_FADV_SEQUENTIAL: c_int = 1;
1014pub const POSIX_FADV_WILLNEED: c_int = 3;
1015
1016pub const AT_FDCWD: c_int = -100;
1017pub const AT_EACCESS: c_int = 0x0001;
1018pub const AT_SYMLINK_NOFOLLOW: c_int = 0x0002;
1019pub const AT_SYMLINK_FOLLOW: c_int = 0x0004;
1020pub const AT_REMOVEDIR: c_int = 0x0008;
1021
1022pub const LOG_CRON: c_int = 9 << 3;
1023pub const LOG_AUTHPRIV: c_int = 10 << 3;
1024pub const LOG_FTP: c_int = 11 << 3;
1025pub const LOG_PERROR: c_int = 0x20;
1026
1027pub const PIPE_BUF: usize = 5120;
1028
1029pub const CLD_EXITED: c_int = 1;
1030pub const CLD_KILLED: c_int = 2;
1031pub const CLD_DUMPED: c_int = 3;
1032pub const CLD_TRAPPED: c_int = 4;
1033pub const CLD_STOPPED: c_int = 5;
1034pub const CLD_CONTINUED: c_int = 6;
1035
1036pub const UTIME_OMIT: c_long = 0x40000002;
1037pub const UTIME_NOW: c_long = 0x40000001;
1038
1039pub const POLLIN: c_short = POLLRDNORM | POLLRDBAND;
1040pub const POLLPRI: c_short = 0x0008;
1041pub const POLLOUT: c_short = 0x0002;
1042pub const POLLERR: c_short = 0x0020;
1043pub const POLLHUP: c_short = 0x0040;
1044pub const POLLNVAL: c_short = 0x1000;
1045pub const POLLRDNORM: c_short = 0x0001;
1046pub const POLLRDBAND: c_short = 0x0004;
1047
1048pub const IPTOS_LOWDELAY: u8 = 0x10;
1049pub const IPTOS_THROUGHPUT: u8 = 0x08;
1050pub const IPTOS_RELIABILITY: u8 = 0x04;
1051pub const IPTOS_MINCOST: u8 = 0x02;
1052
1053pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0;
1054pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0;
1055pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0;
1056pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80;
1057pub const IPTOS_PREC_FLASH: u8 = 0x60;
1058pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40;
1059pub const IPTOS_PREC_PRIORITY: u8 = 0x20;
1060pub const IPTOS_PREC_ROUTINE: u8 = 0x00;
1061
1062pub const IPTOS_ECN_MASK: u8 = 0x03;
1063pub const IPTOS_ECN_ECT1: u8 = 0x01;
1064pub const IPTOS_ECN_ECT0: u8 = 0x02;
1065pub const IPTOS_ECN_CE: u8 = 0x03;
1066
1067pub const IPOPT_CONTROL: u8 = 0x00;
1068pub const IPOPT_RESERVED1: u8 = 0x20;
1069pub const IPOPT_RESERVED2: u8 = 0x60;
1070pub const IPOPT_LSRR: u8 = 131;
1071pub const IPOPT_RR: u8 = 7;
1072pub const IPOPT_SSRR: u8 = 137;
1073pub const IPDEFTTL: u8 = 64;
1074pub const IPOPT_OPTVAL: u8 = 0;
1075pub const IPOPT_OLEN: u8 = 1;
1076pub const IPOPT_OFFSET: u8 = 2;
1077pub const IPOPT_MINOFF: u8 = 4;
1078pub const IPOPT_NOP: u8 = 1;
1079pub const IPOPT_EOL: u8 = 0;
1080pub const IPOPT_TS: u8 = 68;
1081pub const IPOPT_TS_TSONLY: u8 = 0;
1082pub const IPOPT_TS_TSANDADDR: u8 = 1;
1083pub const IPOPT_TS_PRESPEC: u8 = 3;
1084
1085pub const MAX_IPOPTLEN: u8 = 40;
1086pub const IPVERSION: u8 = 4;
1087pub const MAXTTL: u8 = 255;
1088
1089pub const ARPHRD_ETHER: u16 = 1;
1090pub const ARPHRD_IEEE802: u16 = 6;
1091pub const ARPHRD_IEEE1394: u16 = 24;
1092
1093pub const SOL_SOCKET: c_int = 0xffff;
1094
1095pub const SO_DEBUG: c_int = 0x0001;
1096pub const SO_REUSEADDR: c_int = 0x0004;
1097pub const SO_TYPE: c_int = 0x1008;
1098pub const SO_ERROR: c_int = 0x1007;
1099pub const SO_DONTROUTE: c_int = 0x0010;
1100pub const SO_BROADCAST: c_int = 0x0020;
1101pub const SO_SNDBUF: c_int = 0x1001;
1102pub const SO_RCVBUF: c_int = 0x1002;
1103pub const SO_KEEPALIVE: c_int = 0x0008;
1104pub const SO_OOBINLINE: c_int = 0x0100;
1105pub const SO_LINGER: c_int = 0x0080;
1106pub const SO_REUSEPORT: c_int = 0x0200;
1107pub const SO_RCVLOWAT: c_int = 0x1004;
1108pub const SO_SNDLOWAT: c_int = 0x1003;
1109pub const SO_RCVTIMEO: c_int = 0x1006;
1110pub const SO_SNDTIMEO: c_int = 0x1005;
1111pub const SO_TIMESTAMP: c_int = 0x0400;
1112pub const SO_ACCEPTCONN: c_int = 0x0002;
1113
1114pub const TIOCM_LE: c_int = 0x0100;
1115pub const TIOCM_DTR: c_int = 0x0001;
1116pub const TIOCM_RTS: c_int = 0x0002;
1117pub const TIOCM_ST: c_int = 0x0200;
1118pub const TIOCM_SR: c_int = 0x0400;
1119pub const TIOCM_CTS: c_int = 0x1000;
1120pub const TIOCM_CAR: c_int = TIOCM_CD;
1121pub const TIOCM_CD: c_int = 0x8000;
1122pub const TIOCM_RNG: c_int = TIOCM_RI;
1123pub const TIOCM_RI: c_int = 0x4000;
1124pub const TIOCM_DSR: c_int = 0x2000;
1125
1126pub const SCHED_OTHER: c_int = 3;
1127pub const SCHED_FIFO: c_int = 1;
1128pub const SCHED_RR: c_int = 2;
1129
1130pub const IPC_PRIVATE: crate::key_t = 0;
1131
1132pub const IPC_CREAT: c_int = 0o001000;
1133pub const IPC_EXCL: c_int = 0o002000;
1134pub const IPC_NOWAIT: c_int = 0o004000;
1135
1136pub const IPC_RMID: c_int = 0;
1137pub const IPC_SET: c_int = 1;
1138pub const IPC_STAT: c_int = 2;
1139
1140pub const MSG_NOERROR: c_int = 0o010000;
1141
1142pub const LOG_NFACILITIES: c_int = 24;
1143
1144pub const SEM_FAILED: *mut crate::sem_t = 0xFFFFFFFFFFFFFFFF as *mut sem_t;
1145
1146pub const AI_PASSIVE: c_int = 0x00000001;
1147pub const AI_CANONNAME: c_int = 0x00000002;
1148pub const AI_NUMERICHOST: c_int = 0x00000004;
1149
1150pub const AI_NUMERICSERV: c_int = 0x00000008;
1151
1152pub const EAI_BADFLAGS: c_int = 3;
1153pub const EAI_NONAME: c_int = 8;
1154pub const EAI_AGAIN: c_int = 2;
1155pub const EAI_FAIL: c_int = 4;
1156pub const EAI_FAMILY: c_int = 5;
1157pub const EAI_SOCKTYPE: c_int = 10;
1158pub const EAI_SERVICE: c_int = 9;
1159pub const EAI_MEMORY: c_int = 6;
1160pub const EAI_SYSTEM: c_int = 11;
1161pub const EAI_OVERFLOW: c_int = 14;
1162
1163pub const NI_NUMERICHOST: c_int = 0x00000002;
1164pub const NI_NUMERICSERV: c_int = 0x00000008;
1165pub const NI_NOFQDN: c_int = 0x00000001;
1166pub const NI_NAMEREQD: c_int = 0x00000004;
1167pub const NI_DGRAM: c_int = 0x00000010;
1168
1169pub const AIO_CANCELED: c_int = 0;
1170pub const AIO_NOTCANCELED: c_int = 2;
1171pub const AIO_ALLDONE: c_int = 1;
1172pub const LIO_READ: c_int = 1;
1173pub const LIO_WRITE: c_int = 2;
1174pub const LIO_NOP: c_int = 0;
1175pub const LIO_WAIT: c_int = 1;
1176pub const LIO_NOWAIT: c_int = 0;
1177
1178pub const ITIMER_REAL: c_int = 0;
1179pub const ITIMER_VIRTUAL: c_int = 1;
1180pub const ITIMER_PROF: c_int = 2;
1181
1182// DIFF(main): changed to `c_short` in f62eb023ab
1183pub const POSIX_SPAWN_RESETIDS: c_int = 0x00000010;
1184pub const POSIX_SPAWN_SETPGROUP: c_int = 0x00000001;
1185pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x00000004;
1186pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x00000002;
1187pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 0x00000400;
1188pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x00000040;
1189
1190pub const RTF_UP: c_ushort = 0x0001;
1191pub const RTF_GATEWAY: c_ushort = 0x0002;
1192
1193pub const RTF_HOST: c_ushort = 0x0004;
1194pub const RTF_DYNAMIC: c_ushort = 0x0010;
1195pub const RTF_MODIFIED: c_ushort = 0x0020;
1196pub const RTF_REJECT: c_ushort = 0x0008;
1197pub const RTF_STATIC: c_ushort = 0x0800;
1198pub const RTF_XRESOLVE: c_ushort = 0x0200;
1199pub const RTM_NEWADDR: u16 = 0xc;
1200pub const RTM_DELADDR: u16 = 0xd;
1201pub const RTA_DST: c_ushort = 0x1;
1202pub const RTA_GATEWAY: c_ushort = 0x2;
1203
1204pub const IN_ACCESS: u32 = 0x00000001;
1205pub const IN_MODIFY: u32 = 0x00000002;
1206pub const IN_ATTRIB: u32 = 0x00000004;
1207pub const IN_CLOSE_WRITE: u32 = 0x00000008;
1208pub const IN_CLOSE_NOWRITE: u32 = 0x00000010;
1209pub const IN_CLOSE: u32 = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE;
1210pub const IN_OPEN: u32 = 0x00000020;
1211pub const IN_MOVED_FROM: u32 = 0x00000040;
1212pub const IN_MOVED_TO: u32 = 0x00000080;
1213pub const IN_MOVE: u32 = IN_MOVED_FROM | IN_MOVED_TO;
1214pub const IN_CREATE: u32 = 0x00000100;
1215pub const IN_DELETE: u32 = 0x00000200;
1216pub const IN_DELETE_SELF: u32 = 0x00000400;
1217pub const IN_MOVE_SELF: u32 = 0x00000800;
1218pub const IN_UNMOUNT: u32 = 0x00002000;
1219pub const IN_Q_OVERFLOW: u32 = 0x00004000;
1220pub const IN_IGNORED: u32 = 0x00008000;
1221pub const IN_ONLYDIR: u32 = 0x01000000;
1222pub const IN_DONT_FOLLOW: u32 = 0x02000000;
1223
1224pub const IN_ISDIR: u32 = 0x40000000;
1225pub const IN_ONESHOT: u32 = 0x80000000;
1226
1227pub const REG_EXTENDED: c_int = 0o0001;
1228pub const REG_ICASE: c_int = 0o0002;
1229pub const REG_NEWLINE: c_int = 0o0010;
1230pub const REG_NOSUB: c_int = 0o0004;
1231
1232pub const REG_NOTBOL: c_int = 0o00001;
1233pub const REG_NOTEOL: c_int = 0o00002;
1234
1235pub const REG_ENOSYS: c_int = 17;
1236pub const REG_NOMATCH: c_int = 1;
1237pub const REG_BADPAT: c_int = 2;
1238pub const REG_ECOLLATE: c_int = 3;
1239pub const REG_ECTYPE: c_int = 4;
1240pub const REG_EESCAPE: c_int = 5;
1241pub const REG_ESUBREG: c_int = 6;
1242pub const REG_EBRACK: c_int = 7;
1243pub const REG_EPAREN: c_int = 8;
1244pub const REG_EBRACE: c_int = 9;
1245pub const REG_BADBR: c_int = 10;
1246pub const REG_ERANGE: c_int = 11;
1247pub const REG_ESPACE: c_int = 12;
1248pub const REG_BADRPT: c_int = 13;
1249
1250// errno.h
1251pub const EOK: c_int = 0;
1252pub const EWOULDBLOCK: c_int = EAGAIN;
1253pub const EPERM: c_int = 1;
1254pub const ENOENT: c_int = 2;
1255pub const ESRCH: c_int = 3;
1256pub const EINTR: c_int = 4;
1257pub const EIO: c_int = 5;
1258pub const ENXIO: c_int = 6;
1259pub const E2BIG: c_int = 7;
1260pub const ENOEXEC: c_int = 8;
1261pub const EBADF: c_int = 9;
1262pub const ECHILD: c_int = 10;
1263pub const EAGAIN: c_int = 11;
1264pub const ENOMEM: c_int = 12;
1265pub const EACCES: c_int = 13;
1266pub const EFAULT: c_int = 14;
1267pub const ENOTBLK: c_int = 15;
1268pub const EBUSY: c_int = 16;
1269pub const EEXIST: c_int = 17;
1270pub const EXDEV: c_int = 18;
1271pub const ENODEV: c_int = 19;
1272pub const ENOTDIR: c_int = 20;
1273pub const EISDIR: c_int = 21;
1274pub const EINVAL: c_int = 22;
1275pub const ENFILE: c_int = 23;
1276pub const EMFILE: c_int = 24;
1277pub const ENOTTY: c_int = 25;
1278pub const ETXTBSY: c_int = 26;
1279pub const EFBIG: c_int = 27;
1280pub const ENOSPC: c_int = 28;
1281pub const ESPIPE: c_int = 29;
1282pub const EROFS: c_int = 30;
1283pub const EMLINK: c_int = 31;
1284pub const EPIPE: c_int = 32;
1285pub const EDOM: c_int = 33;
1286pub const ERANGE: c_int = 34;
1287pub const ENOMSG: c_int = 35;
1288pub const EIDRM: c_int = 36;
1289pub const ECHRNG: c_int = 37;
1290pub const EL2NSYNC: c_int = 38;
1291pub const EL3HLT: c_int = 39;
1292pub const EL3RST: c_int = 40;
1293pub const ELNRNG: c_int = 41;
1294pub const EUNATCH: c_int = 42;
1295pub const ENOCSI: c_int = 43;
1296pub const EL2HLT: c_int = 44;
1297pub const EDEADLK: c_int = 45;
1298pub const ENOLCK: c_int = 46;
1299pub const ECANCELED: c_int = 47;
1300pub const EDQUOT: c_int = 49;
1301pub const EBADE: c_int = 50;
1302pub const EBADR: c_int = 51;
1303pub const EXFULL: c_int = 52;
1304pub const ENOANO: c_int = 53;
1305pub const EBADRQC: c_int = 54;
1306pub const EBADSLT: c_int = 55;
1307pub const EDEADLOCK: c_int = 56;
1308pub const EBFONT: c_int = 57;
1309pub const EOWNERDEAD: c_int = 58;
1310pub const ENOSTR: c_int = 60;
1311pub const ENODATA: c_int = 61;
1312pub const ETIME: c_int = 62;
1313pub const ENOSR: c_int = 63;
1314pub const ENONET: c_int = 64;
1315pub const ENOPKG: c_int = 65;
1316pub const EREMOTE: c_int = 66;
1317pub const ENOLINK: c_int = 67;
1318pub const EADV: c_int = 68;
1319pub const ESRMNT: c_int = 69;
1320pub const ECOMM: c_int = 70;
1321pub const EPROTO: c_int = 71;
1322pub const EMULTIHOP: c_int = 74;
1323pub const EBADMSG: c_int = 77;
1324pub const ENAMETOOLONG: c_int = 78;
1325pub const EOVERFLOW: c_int = 79;
1326pub const ENOTUNIQ: c_int = 80;
1327pub const EBADFD: c_int = 81;
1328pub const EREMCHG: c_int = 82;
1329pub const ELIBACC: c_int = 83;
1330pub const ELIBBAD: c_int = 84;
1331pub const ELIBSCN: c_int = 85;
1332pub const ELIBMAX: c_int = 86;
1333pub const ELIBEXEC: c_int = 87;
1334pub const EILSEQ: c_int = 88;
1335pub const ENOSYS: c_int = 89;
1336pub const ELOOP: c_int = 90;
1337pub const ERESTART: c_int = 91;
1338pub const ESTRPIPE: c_int = 92;
1339pub const ENOTEMPTY: c_int = 93;
1340pub const EUSERS: c_int = 94;
1341pub const ENOTRECOVERABLE: c_int = 95;
1342pub const EOPNOTSUPP: c_int = 103;
1343pub const EFPOS: c_int = 110;
1344pub const ESTALE: c_int = 122;
1345pub const EINPROGRESS: c_int = 236;
1346pub const EALREADY: c_int = 237;
1347pub const ENOTSOCK: c_int = 238;
1348pub const EDESTADDRREQ: c_int = 239;
1349pub const EMSGSIZE: c_int = 240;
1350pub const EPROTOTYPE: c_int = 241;
1351pub const ENOPROTOOPT: c_int = 242;
1352pub const EPROTONOSUPPORT: c_int = 243;
1353pub const ESOCKTNOSUPPORT: c_int = 244;
1354pub const EPFNOSUPPORT: c_int = 246;
1355pub const EAFNOSUPPORT: c_int = 247;
1356pub const EADDRINUSE: c_int = 248;
1357pub const EADDRNOTAVAIL: c_int = 249;
1358pub const ENETDOWN: c_int = 250;
1359pub const ENETUNREACH: c_int = 251;
1360pub const ENETRESET: c_int = 252;
1361pub const ECONNABORTED: c_int = 253;
1362pub const ECONNRESET: c_int = 254;
1363pub const ENOBUFS: c_int = 255;
1364pub const EISCONN: c_int = 256;
1365pub const ENOTCONN: c_int = 257;
1366pub const ESHUTDOWN: c_int = 258;
1367pub const ETOOMANYREFS: c_int = 259;
1368pub const ETIMEDOUT: c_int = 260;
1369pub const ECONNREFUSED: c_int = 261;
1370pub const EHOSTDOWN: c_int = 264;
1371pub const EHOSTUNREACH: c_int = 265;
1372pub const EBADRPC: c_int = 272;
1373pub const ERPCMISMATCH: c_int = 273;
1374pub const EPROGUNAVAIL: c_int = 274;
1375pub const EPROGMISMATCH: c_int = 275;
1376pub const EPROCUNAVAIL: c_int = 276;
1377pub const ENOREMOTE: c_int = 300;
1378pub const ENONDP: c_int = 301;
1379pub const EBADFSYS: c_int = 302;
1380pub const EMORE: c_int = 309;
1381pub const ECTRLTERM: c_int = 310;
1382pub const ENOLIC: c_int = 311;
1383pub const ESRVRFAULT: c_int = 312;
1384pub const EENDIAN: c_int = 313;
1385pub const ESECTYPEINVAL: c_int = 314;
1386
1387pub const RUSAGE_CHILDREN: c_int = -1;
1388pub const L_tmpnam: c_uint = 255;
1389
1390pub const _PC_LINK_MAX: c_int = 1;
1391pub const _PC_MAX_CANON: c_int = 2;
1392pub const _PC_MAX_INPUT: c_int = 3;
1393pub const _PC_NAME_MAX: c_int = 4;
1394pub const _PC_PATH_MAX: c_int = 5;
1395pub const _PC_PIPE_BUF: c_int = 6;
1396pub const _PC_CHOWN_RESTRICTED: c_int = 9;
1397pub const _PC_NO_TRUNC: c_int = 7;
1398pub const _PC_VDISABLE: c_int = 8;
1399pub const _PC_SYNC_IO: c_int = 14;
1400pub const _PC_ASYNC_IO: c_int = 12;
1401pub const _PC_PRIO_IO: c_int = 13;
1402pub const _PC_SOCK_MAXBUF: c_int = 15;
1403pub const _PC_FILESIZEBITS: c_int = 16;
1404pub const _PC_REC_INCR_XFER_SIZE: c_int = 22;
1405pub const _PC_REC_MAX_XFER_SIZE: c_int = 23;
1406pub const _PC_REC_MIN_XFER_SIZE: c_int = 24;
1407pub const _PC_REC_XFER_ALIGN: c_int = 25;
1408pub const _PC_ALLOC_SIZE_MIN: c_int = 21;
1409pub const _PC_SYMLINK_MAX: c_int = 17;
1410pub const _PC_2_SYMLINKS: c_int = 20;
1411
1412pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
1413pub const _SC_ARG_MAX: c_int = 1;
1414pub const _SC_CHILD_MAX: c_int = 2;
1415pub const _SC_CLK_TCK: c_int = 3;
1416pub const _SC_NGROUPS_MAX: c_int = 4;
1417pub const _SC_OPEN_MAX: c_int = 5;
1418pub const _SC_JOB_CONTROL: c_int = 6;
1419pub const _SC_SAVED_IDS: c_int = 7;
1420pub const _SC_VERSION: c_int = 8;
1421pub const _SC_PASS_MAX: c_int = 9;
1422pub const _SC_PAGESIZE: c_int = 11;
1423pub const _SC_XOPEN_VERSION: c_int = 12;
1424pub const _SC_STREAM_MAX: c_int = 13;
1425pub const _SC_TZNAME_MAX: c_int = 14;
1426pub const _SC_AIO_LISTIO_MAX: c_int = 15;
1427pub const _SC_AIO_MAX: c_int = 16;
1428pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 17;
1429pub const _SC_DELAYTIMER_MAX: c_int = 18;
1430pub const _SC_MQ_OPEN_MAX: c_int = 19;
1431pub const _SC_MQ_PRIO_MAX: c_int = 20;
1432pub const _SC_RTSIG_MAX: c_int = 21;
1433pub const _SC_SEM_NSEMS_MAX: c_int = 22;
1434pub const _SC_SEM_VALUE_MAX: c_int = 23;
1435pub const _SC_SIGQUEUE_MAX: c_int = 24;
1436pub const _SC_TIMER_MAX: c_int = 25;
1437pub const _SC_ASYNCHRONOUS_IO: c_int = 26;
1438pub const _SC_FSYNC: c_int = 27;
1439pub const _SC_MAPPED_FILES: c_int = 28;
1440pub const _SC_MEMLOCK: c_int = 29;
1441pub const _SC_MEMLOCK_RANGE: c_int = 30;
1442pub const _SC_MEMORY_PROTECTION: c_int = 31;
1443pub const _SC_MESSAGE_PASSING: c_int = 32;
1444pub const _SC_PRIORITIZED_IO: c_int = 33;
1445pub const _SC_PRIORITY_SCHEDULING: c_int = 34;
1446pub const _SC_REALTIME_SIGNALS: c_int = 35;
1447pub const _SC_SEMAPHORES: c_int = 36;
1448pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 37;
1449pub const _SC_SYNCHRONIZED_IO: c_int = 38;
1450pub const _SC_TIMERS: c_int = 39;
1451pub const _SC_GETGR_R_SIZE_MAX: c_int = 40;
1452pub const _SC_GETPW_R_SIZE_MAX: c_int = 41;
1453pub const _SC_LOGIN_NAME_MAX: c_int = 42;
1454pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 43;
1455pub const _SC_THREAD_KEYS_MAX: c_int = 44;
1456pub const _SC_THREAD_STACK_MIN: c_int = 45;
1457pub const _SC_THREAD_THREADS_MAX: c_int = 46;
1458pub const _SC_TTY_NAME_MAX: c_int = 47;
1459pub const _SC_THREADS: c_int = 48;
1460pub const _SC_THREAD_ATTR_STACKADDR: c_int = 49;
1461pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 50;
1462pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 51;
1463pub const _SC_THREAD_PRIO_INHERIT: c_int = 52;
1464pub const _SC_THREAD_PRIO_PROTECT: c_int = 53;
1465pub const _SC_THREAD_PROCESS_SHARED: c_int = 54;
1466pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 55;
1467pub const _SC_2_CHAR_TERM: c_int = 56;
1468pub const _SC_2_C_BIND: c_int = 57;
1469pub const _SC_2_C_DEV: c_int = 58;
1470pub const _SC_2_C_VERSION: c_int = 59;
1471pub const _SC_2_FORT_DEV: c_int = 60;
1472pub const _SC_2_FORT_RUN: c_int = 61;
1473pub const _SC_2_LOCALEDEF: c_int = 62;
1474pub const _SC_2_SW_DEV: c_int = 63;
1475pub const _SC_2_UPE: c_int = 64;
1476pub const _SC_2_VERSION: c_int = 65;
1477pub const _SC_ATEXIT_MAX: c_int = 66;
1478pub const _SC_AVPHYS_PAGES: c_int = 67;
1479pub const _SC_BC_BASE_MAX: c_int = 68;
1480pub const _SC_BC_DIM_MAX: c_int = 69;
1481pub const _SC_BC_SCALE_MAX: c_int = 70;
1482pub const _SC_BC_STRING_MAX: c_int = 71;
1483pub const _SC_CHARCLASS_NAME_MAX: c_int = 72;
1484pub const _SC_CHAR_BIT: c_int = 73;
1485pub const _SC_CHAR_MAX: c_int = 74;
1486pub const _SC_CHAR_MIN: c_int = 75;
1487pub const _SC_COLL_WEIGHTS_MAX: c_int = 76;
1488pub const _SC_EQUIV_CLASS_MAX: c_int = 77;
1489pub const _SC_EXPR_NEST_MAX: c_int = 78;
1490pub const _SC_INT_MAX: c_int = 79;
1491pub const _SC_INT_MIN: c_int = 80;
1492pub const _SC_LINE_MAX: c_int = 81;
1493pub const _SC_LONG_BIT: c_int = 82;
1494pub const _SC_MB_LEN_MAX: c_int = 83;
1495pub const _SC_NL_ARGMAX: c_int = 84;
1496pub const _SC_NL_LANGMAX: c_int = 85;
1497pub const _SC_NL_MSGMAX: c_int = 86;
1498pub const _SC_NL_NMAX: c_int = 87;
1499pub const _SC_NL_SETMAX: c_int = 88;
1500pub const _SC_NL_TEXTMAX: c_int = 89;
1501pub const _SC_NPROCESSORS_CONF: c_int = 90;
1502pub const _SC_NPROCESSORS_ONLN: c_int = 91;
1503pub const _SC_NZERO: c_int = 92;
1504pub const _SC_PHYS_PAGES: c_int = 93;
1505pub const _SC_PII: c_int = 94;
1506pub const _SC_PII_INTERNET: c_int = 95;
1507pub const _SC_PII_INTERNET_DGRAM: c_int = 96;
1508pub const _SC_PII_INTERNET_STREAM: c_int = 97;
1509pub const _SC_PII_OSI: c_int = 98;
1510pub const _SC_PII_OSI_CLTS: c_int = 99;
1511pub const _SC_PII_OSI_COTS: c_int = 100;
1512pub const _SC_PII_OSI_M: c_int = 101;
1513pub const _SC_PII_SOCKET: c_int = 102;
1514pub const _SC_PII_XTI: c_int = 103;
1515pub const _SC_POLL: c_int = 104;
1516pub const _SC_RE_DUP_MAX: c_int = 105;
1517pub const _SC_SCHAR_MAX: c_int = 106;
1518pub const _SC_SCHAR_MIN: c_int = 107;
1519pub const _SC_SELECT: c_int = 108;
1520pub const _SC_SHRT_MAX: c_int = 109;
1521pub const _SC_SHRT_MIN: c_int = 110;
1522pub const _SC_SSIZE_MAX: c_int = 111;
1523pub const _SC_T_IOV_MAX: c_int = 112;
1524pub const _SC_UCHAR_MAX: c_int = 113;
1525pub const _SC_UINT_MAX: c_int = 114;
1526pub const _SC_UIO_MAXIOV: c_int = 115;
1527pub const _SC_ULONG_MAX: c_int = 116;
1528pub const _SC_USHRT_MAX: c_int = 117;
1529pub const _SC_WORD_BIT: c_int = 118;
1530pub const _SC_XOPEN_CRYPT: c_int = 119;
1531pub const _SC_XOPEN_ENH_I18N: c_int = 120;
1532pub const _SC_XOPEN_SHM: c_int = 121;
1533pub const _SC_XOPEN_UNIX: c_int = 122;
1534pub const _SC_XOPEN_XCU_VERSION: c_int = 123;
1535pub const _SC_XOPEN_XPG2: c_int = 124;
1536pub const _SC_XOPEN_XPG3: c_int = 125;
1537pub const _SC_XOPEN_XPG4: c_int = 126;
1538pub const _SC_XBS5_ILP32_OFF32: c_int = 127;
1539pub const _SC_XBS5_ILP32_OFFBIG: c_int = 128;
1540pub const _SC_XBS5_LP64_OFF64: c_int = 129;
1541pub const _SC_XBS5_LPBIG_OFFBIG: c_int = 130;
1542pub const _SC_ADVISORY_INFO: c_int = 131;
1543pub const _SC_CPUTIME: c_int = 132;
1544pub const _SC_SPAWN: c_int = 133;
1545pub const _SC_SPORADIC_SERVER: c_int = 134;
1546pub const _SC_THREAD_CPUTIME: c_int = 135;
1547pub const _SC_THREAD_SPORADIC_SERVER: c_int = 136;
1548pub const _SC_TIMEOUTS: c_int = 137;
1549pub const _SC_BARRIERS: c_int = 138;
1550pub const _SC_CLOCK_SELECTION: c_int = 139;
1551pub const _SC_MONOTONIC_CLOCK: c_int = 140;
1552pub const _SC_READER_WRITER_LOCKS: c_int = 141;
1553pub const _SC_SPIN_LOCKS: c_int = 142;
1554pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 143;
1555pub const _SC_TRACE_EVENT_FILTER: c_int = 144;
1556pub const _SC_TRACE: c_int = 145;
1557pub const _SC_TRACE_INHERIT: c_int = 146;
1558pub const _SC_TRACE_LOG: c_int = 147;
1559pub const _SC_2_PBS: c_int = 148;
1560pub const _SC_2_PBS_ACCOUNTING: c_int = 149;
1561pub const _SC_2_PBS_CHECKPOINT: c_int = 150;
1562pub const _SC_2_PBS_LOCATE: c_int = 151;
1563pub const _SC_2_PBS_MESSAGE: c_int = 152;
1564pub const _SC_2_PBS_TRACK: c_int = 153;
1565pub const _SC_HOST_NAME_MAX: c_int = 154;
1566pub const _SC_IOV_MAX: c_int = 155;
1567pub const _SC_IPV6: c_int = 156;
1568pub const _SC_RAW_SOCKETS: c_int = 157;
1569pub const _SC_REGEXP: c_int = 158;
1570pub const _SC_SHELL: c_int = 159;
1571pub const _SC_SS_REPL_MAX: c_int = 160;
1572pub const _SC_SYMLOOP_MAX: c_int = 161;
1573pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 162;
1574pub const _SC_TRACE_NAME_MAX: c_int = 163;
1575pub const _SC_TRACE_SYS_MAX: c_int = 164;
1576pub const _SC_TRACE_USER_EVENT_MAX: c_int = 165;
1577pub const _SC_V6_ILP32_OFF32: c_int = 166;
1578pub const _SC_V6_ILP32_OFFBIG: c_int = 167;
1579pub const _SC_V6_LP64_OFF64: c_int = 168;
1580pub const _SC_V6_LPBIG_OFFBIG: c_int = 169;
1581pub const _SC_XOPEN_REALTIME: c_int = 170;
1582pub const _SC_XOPEN_REALTIME_THREADS: c_int = 171;
1583pub const _SC_XOPEN_LEGACY: c_int = 172;
1584pub const _SC_XOPEN_STREAMS: c_int = 173;
1585pub const _SC_V7_ILP32_OFF32: c_int = 176;
1586pub const _SC_V7_ILP32_OFFBIG: c_int = 177;
1587pub const _SC_V7_LP64_OFF64: c_int = 178;
1588pub const _SC_V7_LPBIG_OFFBIG: c_int = 179;
1589
1590pub const GLOB_ERR: c_int = 0x0001;
1591pub const GLOB_MARK: c_int = 0x0002;
1592pub const GLOB_NOSORT: c_int = 0x0004;
1593pub const GLOB_DOOFFS: c_int = 0x0008;
1594pub const GLOB_NOCHECK: c_int = 0x0010;
1595pub const GLOB_APPEND: c_int = 0x0020;
1596pub const GLOB_NOESCAPE: c_int = 0x0040;
1597
1598pub const GLOB_NOSPACE: c_int = 1;
1599pub const GLOB_ABORTED: c_int = 2;
1600pub const GLOB_NOMATCH: c_int = 3;
1601
1602pub const S_IEXEC: mode_t = crate::S_IXUSR;
1603pub const S_IWRITE: mode_t = crate::S_IWUSR;
1604pub const S_IREAD: mode_t = crate::S_IRUSR;
1605
1606pub const S_IFIFO: mode_t = 0o1_0000;
1607pub const S_IFCHR: mode_t = 0o2_0000;
1608pub const S_IFDIR: mode_t = 0o4_0000;
1609pub const S_IFBLK: mode_t = 0o6_0000;
1610pub const S_IFREG: mode_t = 0o10_0000;
1611pub const S_IFLNK: mode_t = 0o12_0000;
1612pub const S_IFSOCK: mode_t = 0o14_0000;
1613pub const S_IFMT: mode_t = 0o17_0000;
1614
1615pub const S_IXOTH: mode_t = 0o0001;
1616pub const S_IWOTH: mode_t = 0o0002;
1617pub const S_IROTH: mode_t = 0o0004;
1618pub const S_IRWXO: mode_t = 0o0007;
1619pub const S_IXGRP: mode_t = 0o0010;
1620pub const S_IWGRP: mode_t = 0o0020;
1621pub const S_IRGRP: mode_t = 0o0040;
1622pub const S_IRWXG: mode_t = 0o0070;
1623pub const S_IXUSR: mode_t = 0o0100;
1624pub const S_IWUSR: mode_t = 0o0200;
1625pub const S_IRUSR: mode_t = 0o0400;
1626pub const S_IRWXU: mode_t = 0o0700;
1627
1628pub const F_LOCK: c_int = 1;
1629pub const F_TEST: c_int = 3;
1630pub const F_TLOCK: c_int = 2;
1631pub const F_ULOCK: c_int = 0;
1632
1633pub const ST_RDONLY: c_ulong = 0x01;
1634pub const ST_NOSUID: c_ulong = 0x04;
1635pub const ST_NOEXEC: c_ulong = 0x02;
1636pub const ST_NOATIME: c_ulong = 0x20;
1637
1638pub const RTLD_NEXT: *mut c_void = -3i64 as *mut c_void;
1639pub const RTLD_DEFAULT: *mut c_void = -2i64 as *mut c_void;
1640pub const RTLD_NODELETE: c_int = 0x1000;
1641pub const RTLD_NOW: c_int = 0x0002;
1642
1643pub const EMPTY: c_short = 0;
1644pub const RUN_LVL: c_short = 1;
1645pub const BOOT_TIME: c_short = 2;
1646pub const NEW_TIME: c_short = 4;
1647pub const OLD_TIME: c_short = 3;
1648pub const INIT_PROCESS: c_short = 5;
1649pub const LOGIN_PROCESS: c_short = 6;
1650pub const USER_PROCESS: c_short = 7;
1651pub const DEAD_PROCESS: c_short = 8;
1652pub const ACCOUNTING: c_short = 9;
1653
1654pub const ENOTSUP: c_int = 48;
1655
1656pub const BUFSIZ: c_uint = 1024;
1657pub const TMP_MAX: c_uint = 26 * 26 * 26;
1658pub const FOPEN_MAX: c_uint = 16;
1659pub const FILENAME_MAX: c_uint = 255;
1660
1661pub const NI_MAXHOST: crate::socklen_t = 1025;
1662pub const M_KEEP: c_int = 4;
1663pub const REG_STARTEND: c_int = 0o00004;
1664pub const VEOF: usize = 4;
1665
1666pub const RTLD_GLOBAL: c_int = 0x0100;
1667pub const RTLD_NOLOAD: c_int = 0x0004;
1668
1669pub const O_RDONLY: c_int = 0o000000;
1670pub const O_WRONLY: c_int = 0o000001;
1671pub const O_RDWR: c_int = 0o000002;
1672
1673pub const O_EXEC: c_int = 0o00003;
1674pub const O_ASYNC: c_int = 0o0200000;
1675pub const O_NDELAY: c_int = O_NONBLOCK;
1676pub const O_TRUNC: c_int = 0o001000;
1677pub const O_CLOEXEC: c_int = 0o020000;
1678pub const O_DIRECTORY: c_int = 0o4000000;
1679pub const O_ACCMODE: c_int = 0o000007;
1680pub const O_APPEND: c_int = 0o000010;
1681pub const O_CREAT: c_int = 0o000400;
1682pub const O_EXCL: c_int = 0o002000;
1683pub const O_NOCTTY: c_int = 0o004000;
1684pub const O_NONBLOCK: c_int = 0o000200;
1685pub const O_SYNC: c_int = 0o000040;
1686pub const O_RSYNC: c_int = 0o000100;
1687pub const O_DSYNC: c_int = 0o000020;
1688pub const O_NOFOLLOW: c_int = 0o010000;
1689
1690pub const POSIX_FADV_DONTNEED: c_int = 4;
1691pub const POSIX_FADV_NOREUSE: c_int = 5;
1692
1693pub const SOCK_SEQPACKET: c_int = 5;
1694pub const SOCK_STREAM: c_int = 1;
1695pub const SOCK_DGRAM: c_int = 2;
1696pub const SOCK_RAW: c_int = 3;
1697pub const SOCK_RDM: c_int = 4;
1698pub const SOCK_CLOEXEC: c_int = 0x10000000;
1699
1700pub const SA_SIGINFO: c_int = 0x0002;
1701pub const SA_NOCLDWAIT: c_int = 0x0020;
1702pub const SA_NODEFER: c_int = 0x0010;
1703pub const SA_RESETHAND: c_int = 0x0004;
1704pub const SA_NOCLDSTOP: c_int = 0x0001;
1705
1706pub const SIGTTIN: c_int = 26;
1707pub const SIGTTOU: c_int = 27;
1708pub const SIGXCPU: c_int = 30;
1709pub const SIGXFSZ: c_int = 31;
1710pub const SIGVTALRM: c_int = 28;
1711pub const SIGPROF: c_int = 29;
1712pub const SIGWINCH: c_int = 20;
1713pub const SIGCHLD: c_int = 18;
1714pub const SIGBUS: c_int = 10;
1715pub const SIGUSR1: c_int = 16;
1716pub const SIGUSR2: c_int = 17;
1717pub const SIGCONT: c_int = 25;
1718pub const SIGSTOP: c_int = 23;
1719pub const SIGTSTP: c_int = 24;
1720pub const SIGURG: c_int = 21;
1721pub const SIGIO: c_int = SIGPOLL;
1722pub const SIGSYS: c_int = 12;
1723pub const SIGPOLL: c_int = 22;
1724pub const SIGPWR: c_int = 19;
1725pub const SIG_SETMASK: c_int = 2;
1726pub const SIG_BLOCK: c_int = 0;
1727pub const SIG_UNBLOCK: c_int = 1;
1728
1729pub const POLLWRNORM: c_short = crate::POLLOUT;
1730pub const POLLWRBAND: c_short = 0x0010;
1731
1732pub const F_SETLK: c_int = 106;
1733pub const F_SETLKW: c_int = 107;
1734pub const F_ALLOCSP: c_int = 110;
1735pub const F_FREESP: c_int = 111;
1736pub const F_GETLK: c_int = 114;
1737
1738pub const F_RDLCK: c_int = 1;
1739pub const F_WRLCK: c_int = 2;
1740pub const F_UNLCK: c_int = 3;
1741
1742pub const NCCS: usize = 40;
1743
1744pub const MAP_ANON: c_int = MAP_ANONYMOUS;
1745pub const MAP_ANONYMOUS: c_int = 0x00080000;
1746
1747pub const MCL_CURRENT: c_int = 0x000000001;
1748pub const MCL_FUTURE: c_int = 0x000000002;
1749
1750pub const _TIO_CBAUD: crate::tcflag_t = 15;
1751pub const CBAUD: crate::tcflag_t = _TIO_CBAUD;
1752pub const TAB1: crate::tcflag_t = 0x0800;
1753pub const TAB2: crate::tcflag_t = 0x1000;
1754pub const TAB3: crate::tcflag_t = 0x1800;
1755pub const CR1: crate::tcflag_t = 0x200;
1756pub const CR2: crate::tcflag_t = 0x400;
1757pub const CR3: crate::tcflag_t = 0x600;
1758pub const FF1: crate::tcflag_t = 0x8000;
1759pub const BS1: crate::tcflag_t = 0x2000;
1760pub const VT1: crate::tcflag_t = 0x4000;
1761pub const VWERASE: usize = 14;
1762pub const VREPRINT: usize = 12;
1763pub const VSUSP: usize = 10;
1764pub const VSTART: usize = 8;
1765pub const VSTOP: usize = 9;
1766pub const VDISCARD: usize = 13;
1767pub const VTIME: usize = 17;
1768pub const IXON: crate::tcflag_t = 0x00000400;
1769pub const IXOFF: crate::tcflag_t = 0x00001000;
1770pub const ONLCR: crate::tcflag_t = 0x00000004;
1771pub const CSIZE: crate::tcflag_t = 0x00000030;
1772pub const CS6: crate::tcflag_t = 0x10;
1773pub const CS7: crate::tcflag_t = 0x20;
1774pub const CS8: crate::tcflag_t = 0x30;
1775pub const CSTOPB: crate::tcflag_t = 0x00000040;
1776pub const CREAD: crate::tcflag_t = 0x00000080;
1777pub const PARENB: crate::tcflag_t = 0x00000100;
1778pub const PARODD: crate::tcflag_t = 0x00000200;
1779pub const HUPCL: crate::tcflag_t = 0x00000400;
1780pub const CLOCAL: crate::tcflag_t = 0x00000800;
1781pub const ECHOKE: crate::tcflag_t = 0x00000800;
1782pub const ECHOE: crate::tcflag_t = 0x00000010;
1783pub const ECHOK: crate::tcflag_t = 0x00000020;
1784pub const ECHONL: crate::tcflag_t = 0x00000040;
1785pub const ECHOCTL: crate::tcflag_t = 0x00000200;
1786pub const ISIG: crate::tcflag_t = 0x00000001;
1787pub const ICANON: crate::tcflag_t = 0x00000002;
1788pub const NOFLSH: crate::tcflag_t = 0x00000080;
1789pub const OLCUC: crate::tcflag_t = 0x00000002;
1790pub const NLDLY: crate::tcflag_t = 0x00000100;
1791pub const CRDLY: crate::tcflag_t = 0x00000600;
1792pub const TABDLY: crate::tcflag_t = 0x00001800;
1793pub const BSDLY: crate::tcflag_t = 0x00002000;
1794pub const FFDLY: crate::tcflag_t = 0x00008000;
1795pub const VTDLY: crate::tcflag_t = 0x00004000;
1796pub const XTABS: crate::tcflag_t = 0x1800;
1797
1798pub const B0: crate::speed_t = 0;
1799pub const B50: crate::speed_t = 1;
1800pub const B75: crate::speed_t = 2;
1801pub const B110: crate::speed_t = 3;
1802pub const B134: crate::speed_t = 4;
1803pub const B150: crate::speed_t = 5;
1804pub const B200: crate::speed_t = 6;
1805pub const B300: crate::speed_t = 7;
1806pub const B600: crate::speed_t = 8;
1807pub const B1200: crate::speed_t = 9;
1808pub const B1800: crate::speed_t = 10;
1809pub const B2400: crate::speed_t = 11;
1810pub const B4800: crate::speed_t = 12;
1811pub const B9600: crate::speed_t = 13;
1812pub const B19200: crate::speed_t = 14;
1813pub const B38400: crate::speed_t = 15;
1814pub const EXTA: crate::speed_t = 14;
1815pub const EXTB: crate::speed_t = 15;
1816pub const B57600: crate::speed_t = 57600;
1817pub const B115200: crate::speed_t = 115200;
1818
1819pub const VEOL: usize = 5;
1820pub const VEOL2: usize = 6;
1821pub const VMIN: usize = 16;
1822pub const IEXTEN: crate::tcflag_t = 0x00008000;
1823pub const TOSTOP: crate::tcflag_t = 0x00000100;
1824
1825pub const TCSANOW: c_int = 0x0001;
1826pub const TCSADRAIN: c_int = 0x0002;
1827pub const TCSAFLUSH: c_int = 0x0004;
1828
1829pub const HW_MACHINE: c_int = 1;
1830pub const HW_MODEL: c_int = 2;
1831pub const HW_NCPU: c_int = 3;
1832pub const HW_BYTEORDER: c_int = 4;
1833pub const HW_PHYSMEM: c_int = 5;
1834pub const HW_USERMEM: c_int = 6;
1835pub const HW_PAGESIZE: c_int = 7;
1836pub const HW_DISKNAMES: c_int = 8;
1837pub const CTL_KERN: c_int = 1;
1838pub const CTL_VM: c_int = 2;
1839pub const CTL_VFS: c_int = 3;
1840pub const CTL_NET: c_int = 4;
1841pub const CTL_DEBUG: c_int = 5;
1842pub const CTL_HW: c_int = 6;
1843pub const CTL_MACHDEP: c_int = 7;
1844pub const CTL_USER: c_int = 8;
1845
1846pub const DAY_1: crate::nl_item = 8;
1847pub const DAY_2: crate::nl_item = 9;
1848pub const DAY_3: crate::nl_item = 10;
1849pub const DAY_4: crate::nl_item = 11;
1850pub const DAY_5: crate::nl_item = 12;
1851pub const DAY_6: crate::nl_item = 13;
1852pub const DAY_7: crate::nl_item = 14;
1853
1854pub const MON_1: crate::nl_item = 22;
1855pub const MON_2: crate::nl_item = 23;
1856pub const MON_3: crate::nl_item = 24;
1857pub const MON_4: crate::nl_item = 25;
1858pub const MON_5: crate::nl_item = 26;
1859pub const MON_6: crate::nl_item = 27;
1860pub const MON_7: crate::nl_item = 28;
1861pub const MON_8: crate::nl_item = 29;
1862pub const MON_9: crate::nl_item = 30;
1863pub const MON_10: crate::nl_item = 31;
1864pub const MON_11: crate::nl_item = 32;
1865pub const MON_12: crate::nl_item = 33;
1866
1867pub const ABDAY_1: crate::nl_item = 15;
1868pub const ABDAY_2: crate::nl_item = 16;
1869pub const ABDAY_3: crate::nl_item = 17;
1870pub const ABDAY_4: crate::nl_item = 18;
1871pub const ABDAY_5: crate::nl_item = 19;
1872pub const ABDAY_6: crate::nl_item = 20;
1873pub const ABDAY_7: crate::nl_item = 21;
1874
1875pub const ABMON_1: crate::nl_item = 34;
1876pub const ABMON_2: crate::nl_item = 35;
1877pub const ABMON_3: crate::nl_item = 36;
1878pub const ABMON_4: crate::nl_item = 37;
1879pub const ABMON_5: crate::nl_item = 38;
1880pub const ABMON_6: crate::nl_item = 39;
1881pub const ABMON_7: crate::nl_item = 40;
1882pub const ABMON_8: crate::nl_item = 41;
1883pub const ABMON_9: crate::nl_item = 42;
1884pub const ABMON_10: crate::nl_item = 43;
1885pub const ABMON_11: crate::nl_item = 44;
1886pub const ABMON_12: crate::nl_item = 45;
1887
1888pub const AF_CCITT: c_int = 10;
1889pub const AF_CHAOS: c_int = 5;
1890pub const AF_CNT: c_int = 21;
1891pub const AF_COIP: c_int = 20;
1892pub const AF_DATAKIT: c_int = 9;
1893pub const AF_DECnet: c_int = 12;
1894pub const AF_DLI: c_int = 13;
1895pub const AF_E164: c_int = 26;
1896pub const AF_ECMA: c_int = 8;
1897pub const AF_HYLINK: c_int = 15;
1898pub const AF_IMPLINK: c_int = 3;
1899pub const AF_ISO: c_int = 7;
1900pub const AF_LAT: c_int = 14;
1901pub const AF_LINK: c_int = 18;
1902pub const AF_OSI: c_int = 7;
1903pub const AF_PUP: c_int = 4;
1904pub const ALT_DIGITS: crate::nl_item = 50;
1905pub const AM_STR: crate::nl_item = 6;
1906pub const B76800: crate::speed_t = 76800;
1907
1908pub const BIOCFLUSH: c_int = 17000;
1909pub const BIOCGBLEN: c_int = 1074020966;
1910pub const BIOCGDLT: c_int = 1074020970;
1911pub const BIOCGHDRCMPLT: c_int = 1074020980;
1912pub const BIOCGRTIMEOUT: c_int = 1074807406;
1913pub const BIOCIMMEDIATE: c_int = -2147204496;
1914pub const BIOCPROMISC: c_int = 17001;
1915pub const BIOCSBLEN: c_int = -1073462682;
1916pub const BIOCSETF: c_int = -2146418073;
1917pub const BIOCSHDRCMPLT: c_int = -2147204491;
1918pub const BIOCSRTIMEOUT: c_int = -2146418067;
1919pub const BIOCVERSION: c_int = 1074020977;
1920
1921pub const BPF_ALIGNMENT: usize = size_of::<c_long>();
1922pub const CHAR_BIT: usize = 8;
1923pub const CODESET: crate::nl_item = 1;
1924pub const CRNCYSTR: crate::nl_item = 55;
1925
1926pub const D_FLAG_FILTER: c_int = 0x00000001;
1927pub const D_FLAG_STAT: c_int = 0x00000002;
1928pub const D_FLAG_STAT_FORM_MASK: c_int = 0x000000f0;
1929pub const D_FLAG_STAT_FORM_T32_2001: c_int = 0x00000010;
1930pub const D_FLAG_STAT_FORM_T32_2008: c_int = 0x00000020;
1931pub const D_FLAG_STAT_FORM_T64_2008: c_int = 0x00000030;
1932pub const D_FLAG_STAT_FORM_UNSET: c_int = 0x00000000;
1933
1934pub const D_FMT: crate::nl_item = 3;
1935pub const D_GETFLAG: c_int = 1;
1936pub const D_SETFLAG: c_int = 2;
1937pub const D_T_FMT: crate::nl_item = 2;
1938pub const ERA: crate::nl_item = 46;
1939pub const ERA_D_FMT: crate::nl_item = 47;
1940pub const ERA_D_T_FMT: crate::nl_item = 48;
1941pub const ERA_T_FMT: crate::nl_item = 49;
1942pub const RADIXCHAR: crate::nl_item = 51;
1943pub const THOUSEP: crate::nl_item = 52;
1944pub const YESEXPR: crate::nl_item = 53;
1945pub const NOEXPR: crate::nl_item = 54;
1946pub const F_GETOWN: c_int = 35;
1947
1948pub const FIONBIO: c_int = -2147195266;
1949pub const FIOASYNC: c_int = -2147195267;
1950pub const FIOCLEX: c_int = 26113;
1951pub const FIOGETOWN: c_int = 1074030203;
1952pub const FIONCLEX: c_int = 26114;
1953pub const FIONREAD: c_int = 1074030207;
1954pub const FIOSETOWN: c_int = -2147195268;
1955
1956pub const F_SETOWN: c_int = 36;
1957pub const IFF_LINK0: c_int = 0x00001000;
1958pub const IFF_LINK1: c_int = 0x00002000;
1959pub const IFF_LINK2: c_int = 0x00004000;
1960pub const IFF_OACTIVE: c_int = 0x00000400;
1961pub const IFF_SIMPLEX: c_int = 0x00000800;
1962pub const IHFLOW: tcflag_t = 0x00000001;
1963pub const IIDLE: tcflag_t = 0x00000008;
1964pub const IP_RECVDSTADDR: c_int = 7;
1965pub const IP_RECVIF: c_int = 20;
1966pub const IPTOS_ECN_NOTECT: u8 = 0x00;
1967pub const IUCLC: tcflag_t = 0x00000200;
1968pub const IUTF8: tcflag_t = 0x0004000;
1969
1970pub const KERN_ARGMAX: c_int = 8;
1971pub const KERN_BOOTTIME: c_int = 21;
1972pub const KERN_CLOCKRATE: c_int = 12;
1973pub const KERN_FILE: c_int = 15;
1974pub const KERN_HOSTID: c_int = 11;
1975pub const KERN_HOSTNAME: c_int = 10;
1976pub const KERN_JOB_CONTROL: c_int = 19;
1977pub const KERN_MAXFILES: c_int = 7;
1978pub const KERN_MAXPROC: c_int = 6;
1979pub const KERN_MAXVNODES: c_int = 5;
1980pub const KERN_NGROUPS: c_int = 18;
1981pub const KERN_OSRELEASE: c_int = 2;
1982pub const KERN_OSREV: c_int = 3;
1983pub const KERN_OSTYPE: c_int = 1;
1984pub const KERN_POSIX1: c_int = 17;
1985pub const KERN_PROC: c_int = 14;
1986pub const KERN_PROC_ALL: c_int = 0;
1987pub const KERN_PROC_PGRP: c_int = 2;
1988pub const KERN_PROC_PID: c_int = 1;
1989pub const KERN_PROC_RUID: c_int = 6;
1990pub const KERN_PROC_SESSION: c_int = 3;
1991pub const KERN_PROC_TTY: c_int = 4;
1992pub const KERN_PROC_UID: c_int = 5;
1993pub const KERN_PROF: c_int = 16;
1994pub const KERN_SAVED_IDS: c_int = 20;
1995pub const KERN_SECURELVL: c_int = 9;
1996pub const KERN_VERSION: c_int = 4;
1997pub const KERN_VNODE: c_int = 13;
1998
1999pub const LC_ALL: c_int = 63;
2000pub const LC_COLLATE: c_int = 1;
2001pub const LC_CTYPE: c_int = 2;
2002pub const LC_MESSAGES: c_int = 32;
2003pub const LC_MONETARY: c_int = 4;
2004pub const LC_NUMERIC: c_int = 8;
2005pub const LC_TIME: c_int = 16;
2006
2007pub const MAP_STACK: c_int = 0x00001000;
2008pub const MNT_NOEXEC: c_int = 0x02;
2009pub const MNT_NOSUID: c_int = 0x04;
2010pub const MNT_RDONLY: c_int = 0x01;
2011
2012pub const NET_RT_DUMP: c_int = 1;
2013pub const NET_RT_FLAGS: c_int = 2;
2014pub const OHFLOW: tcflag_t = 0x00000002;
2015pub const P_ALL: idtype_t = 0;
2016pub const PARSTK: tcflag_t = 0x00000004;
2017pub const PF_CCITT: c_int = 10;
2018pub const PF_CHAOS: c_int = 5;
2019pub const PF_CNT: c_int = 21;
2020pub const PF_COIP: c_int = 20;
2021pub const PF_DATAKIT: c_int = 9;
2022pub const PF_DECnet: c_int = 12;
2023pub const PF_DLI: c_int = 13;
2024pub const PF_ECMA: c_int = 8;
2025pub const PF_HYLINK: c_int = 15;
2026pub const PF_IMPLINK: c_int = 3;
2027pub const PF_ISO: c_int = 7;
2028pub const PF_LAT: c_int = 14;
2029pub const PF_LINK: c_int = 18;
2030pub const PF_OSI: c_int = 7;
2031pub const PF_PIP: c_int = 25;
2032pub const PF_PUP: c_int = 4;
2033pub const PF_RTIP: c_int = 22;
2034pub const PF_XTP: c_int = 19;
2035pub const PM_STR: crate::nl_item = 7;
2036pub const POSIX_MADV_DONTNEED: c_int = 4;
2037pub const POSIX_MADV_NORMAL: c_int = 0;
2038pub const POSIX_MADV_RANDOM: c_int = 2;
2039pub const POSIX_MADV_SEQUENTIAL: c_int = 1;
2040pub const POSIX_MADV_WILLNEED: c_int = 3;
2041pub const _POSIX_VDISABLE: c_int = 0;
2042pub const P_PGID: idtype_t = 2;
2043pub const P_PID: idtype_t = 1;
2044pub const PRIO_PGRP: c_int = 1;
2045pub const PRIO_PROCESS: c_int = 0;
2046pub const PRIO_USER: c_int = 2;
2047pub const pseudo_AF_PIP: c_int = 25;
2048pub const pseudo_AF_RTIP: c_int = 22;
2049pub const pseudo_AF_XTP: c_int = 19;
2050pub const REG_ASSERT: c_int = 15;
2051pub const REG_ATOI: c_int = 255;
2052pub const REG_BACKR: c_int = 0x400;
2053pub const REG_BASIC: c_int = 0x00;
2054pub const REG_DUMP: c_int = 0x80;
2055pub const REG_EMPTY: c_int = 14;
2056pub const REG_INVARG: c_int = 16;
2057pub const REG_ITOA: c_int = 0o400;
2058pub const REG_LARGE: c_int = 0x200;
2059pub const REG_NOSPEC: c_int = 0x10;
2060pub const REG_OK: c_int = 0;
2061pub const REG_PEND: c_int = 0x20;
2062pub const REG_TRACE: c_int = 0x100;
2063
2064pub const RLIMIT_AS: c_int = 6;
2065pub const RLIMIT_CORE: c_int = 4;
2066pub const RLIMIT_CPU: c_int = 0;
2067pub const RLIMIT_DATA: c_int = 2;
2068pub const RLIMIT_FSIZE: c_int = 1;
2069pub const RLIMIT_MEMLOCK: c_int = 7;
2070pub const RLIMIT_NOFILE: c_int = 5;
2071pub const RLIMIT_NPROC: c_int = 8;
2072pub const RLIMIT_RSS: c_int = 6;
2073pub const RLIMIT_STACK: c_int = 3;
2074pub const RLIMIT_VMEM: c_int = 6;
2075#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
2076pub const RLIM_NLIMITS: c_int = 14;
2077
2078pub const SCHED_ADJTOHEAD: c_int = 5;
2079pub const SCHED_ADJTOTAIL: c_int = 6;
2080pub const SCHED_MAXPOLICY: c_int = 7;
2081pub const SCHED_SETPRIO: c_int = 7;
2082pub const SCHED_SPORADIC: c_int = 4;
2083
2084pub const SHM_ANON: *mut c_char = -1isize as *mut c_char;
2085pub const SIGCLD: c_int = SIGCHLD;
2086pub const SIGDEADLK: c_int = 7;
2087pub const SIGEMT: c_int = 7;
2088pub const SIGEV_NONE: c_int = 0;
2089pub const SIGEV_SIGNAL: c_int = 129;
2090pub const SIGEV_THREAD: c_int = 135;
2091pub const SO_USELOOPBACK: c_int = 0x0040;
2092pub const _SS_ALIGNSIZE: usize = size_of::<i64>();
2093pub const _SS_MAXSIZE: usize = 128;
2094pub const _SS_PAD1SIZE: usize = _SS_ALIGNSIZE - 2;
2095pub const _SS_PAD2SIZE: usize = _SS_MAXSIZE - 2 - _SS_PAD1SIZE - _SS_ALIGNSIZE;
2096pub const TC_CPOSIX: tcflag_t = CLOCAL | CREAD | CSIZE | CSTOPB | HUPCL | PARENB | PARODD;
2097pub const TCGETS: c_int = 0x404c540d;
2098pub const TC_IPOSIX: tcflag_t =
2099 BRKINT | ICRNL | IGNBRK | IGNPAR | INLCR | INPCK | ISTRIP | IXOFF | IXON | PARMRK;
2100pub const TC_LPOSIX: tcflag_t =
2101 ECHO | ECHOE | ECHOK | ECHONL | ICANON | IEXTEN | ISIG | NOFLSH | TOSTOP;
2102pub const TC_OPOSIX: tcflag_t = OPOST;
2103pub const T_FMT_AMPM: crate::nl_item = 5;
2104
2105pub const TIOCCBRK: c_int = 29818;
2106pub const TIOCCDTR: c_int = 29816;
2107pub const TIOCDRAIN: c_int = 29790;
2108pub const TIOCEXCL: c_int = 29709;
2109pub const TIOCFLUSH: c_int = -2147191792;
2110pub const TIOCGETA: c_int = 1078752275;
2111pub const TIOCGPGRP: c_int = 1074033783;
2112pub const TIOCGWINSZ: c_int = 1074295912;
2113pub const TIOCMBIC: c_int = -2147191701;
2114pub const TIOCMBIS: c_int = -2147191700;
2115pub const TIOCMGET: c_int = 1074033770;
2116pub const TIOCMSET: c_int = -2147191699;
2117pub const TIOCNOTTY: c_int = 29809;
2118pub const TIOCNXCL: c_int = 29710;
2119pub const TIOCOUTQ: c_int = 1074033779;
2120pub const TIOCPKT: c_int = -2147191696;
2121pub const TIOCPKT_DATA: c_int = 0x00;
2122pub const TIOCPKT_DOSTOP: c_int = 0x20;
2123pub const TIOCPKT_FLUSHREAD: c_int = 0x01;
2124pub const TIOCPKT_FLUSHWRITE: c_int = 0x02;
2125pub const TIOCPKT_IOCTL: c_int = 0x40;
2126pub const TIOCPKT_NOSTOP: c_int = 0x10;
2127pub const TIOCPKT_START: c_int = 0x08;
2128pub const TIOCPKT_STOP: c_int = 0x04;
2129pub const TIOCSBRK: c_int = 29819;
2130pub const TIOCSCTTY: c_int = 29793;
2131pub const TIOCSDTR: c_int = 29817;
2132pub const TIOCSETA: c_int = -2142473196;
2133pub const TIOCSETAF: c_int = -2142473194;
2134pub const TIOCSETAW: c_int = -2142473195;
2135pub const TIOCSPGRP: c_int = -2147191690;
2136pub const TIOCSTART: c_int = 29806;
2137pub const TIOCSTI: c_int = -2147388302;
2138pub const TIOCSTOP: c_int = 29807;
2139pub const TIOCSWINSZ: c_int = -2146929561;
2140
2141pub const USER_CS_PATH: c_int = 1;
2142
2143/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2144/// for details.
2145pub const USER_BC_BASE_MAX: c_int = 2;
2146
2147/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2148/// for details.
2149pub const USER_BC_DIM_MAX: c_int = 3;
2150
2151/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2152/// for details.
2153pub const USER_BC_SCALE_MAX: c_int = 4;
2154
2155/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2156/// for details.
2157pub const USER_BC_STRING_MAX: c_int = 5;
2158
2159/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2160/// for details.
2161pub const USER_COLL_WEIGHTS_MAX: c_int = 6;
2162
2163/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2164/// for details.
2165pub const USER_EXPR_NEST_MAX: c_int = 7;
2166
2167/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2168/// for details.
2169pub const USER_LINE_MAX: c_int = 8;
2170
2171/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
2172/// for details.
2173pub const USER_RE_DUP_MAX: c_int = 9;
2174
2175pub const USER_POSIX2_VERSION: c_int = 10;
2176pub const USER_POSIX2_C_BIND: c_int = 11;
2177pub const USER_POSIX2_C_DEV: c_int = 12;
2178pub const USER_POSIX2_CHAR_TERM: c_int = 13;
2179pub const USER_POSIX2_FORT_DEV: c_int = 14;
2180pub const USER_POSIX2_FORT_RUN: c_int = 15;
2181pub const USER_POSIX2_LOCALEDEF: c_int = 16;
2182pub const USER_POSIX2_SW_DEV: c_int = 17;
2183pub const USER_POSIX2_UPE: c_int = 18;
2184pub const USER_STREAM_MAX: c_int = 19;
2185pub const USER_TZNAME_MAX: c_int = 20;
2186
2187pub const VDOWN: usize = 31;
2188pub const VINS: usize = 32;
2189pub const VDEL: usize = 33;
2190pub const VRUB: usize = 34;
2191pub const VCAN: usize = 35;
2192pub const VHOME: usize = 36;
2193pub const VEND: usize = 37;
2194pub const VSPARE3: usize = 38;
2195pub const VSPARE4: usize = 39;
2196pub const VSWTCH: usize = 7;
2197pub const VDSUSP: usize = 11;
2198pub const VFWD: usize = 18;
2199pub const VLOGIN: usize = 19;
2200pub const VPREFIX: usize = 20;
2201pub const VSUFFIX: usize = 24;
2202pub const VLEFT: usize = 28;
2203pub const VRIGHT: usize = 29;
2204pub const VUP: usize = 30;
2205pub const XCASE: tcflag_t = 0x00000004;
2206
2207pub const PTHREAD_BARRIER_SERIAL_THREAD: c_int = -1;
2208pub const PTHREAD_CREATE_JOINABLE: c_int = 0x00;
2209pub const PTHREAD_CREATE_DETACHED: c_int = 0x01;
2210
2211pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
2212pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2;
2213pub const PTHREAD_MUTEX_NORMAL: c_int = 3;
2214pub const PTHREAD_STACK_MIN: size_t = 256;
2215pub const PTHREAD_MUTEX_DEFAULT: c_int = 0;
2216pub const PTHREAD_MUTEX_STALLED: c_int = 0x00;
2217pub const PTHREAD_MUTEX_ROBUST: c_int = 0x10;
2218pub const PTHREAD_PROCESS_PRIVATE: c_int = 0x00;
2219pub const PTHREAD_PROCESS_SHARED: c_int = 0x01;
2220
2221pub const PTHREAD_KEYS_MAX: usize = 128;
2222
2223#[cfg(not(any(target_env = "nto71", target_env = "nto71_iosock", target_os = "qnx")))]
2224pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
2225 __u: 0x80000000,
2226 __owner: 0xffffffff,
2227};
2228#[cfg(any(target_env = "nto71", target_env = "nto71_iosock"))]
2229pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
2230 __u: 0x82000000,
2231 __owner: 0,
2232};
2233#[cfg(target_os = "qnx")]
2234pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
2235 __u: 0x80000000,
2236 __owner: 0,
2237};
2238pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
2239 __u: CLOCK_REALTIME as u32,
2240 __owner: 0xfffffffb,
2241};
2242pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
2243 __active: 0,
2244 __blockedwriters: 0,
2245 __blockedreaders: 0,
2246 __heavy: 0,
2247 __lock: PTHREAD_MUTEX_INITIALIZER,
2248 __rcond: PTHREAD_COND_INITIALIZER,
2249 __wcond: PTHREAD_COND_INITIALIZER,
2250 __owner: -2i32 as c_uint,
2251 __spare: 0,
2252};
2253
2254const fn _CMSG_ALIGN(len: usize) -> usize {
2255 len + size_of::<usize>() - 1 & !(size_of::<usize>() - 1)
2256}
2257
2258const fn _ALIGN(p: usize, b: usize) -> usize {
2259 (p + b - 1) & !(b - 1)
2260}
2261
2262f! {
2263 pub unsafe fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
2264 if (*mhdr).msg_controllen as usize >= size_of::<cmsghdr>() {
2265 (*mhdr).msg_control.cast()
2266 } else {
2267 ptr::null_mut()
2268 }
2269 }
2270
2271 pub unsafe fn CMSG_NXTHDR(mhdr: *const crate::msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
2272 let msg = _CMSG_ALIGN((*cmsg).cmsg_len as usize);
2273 let next = cmsg as usize + msg + _CMSG_ALIGN(size_of::<cmsghdr>());
2274 if next > (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize {
2275 ptr::null_mut()
2276 } else {
2277 (cmsg as usize + msg) as *mut cmsghdr
2278 }
2279 }
2280
2281 pub unsafe fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
2282 (cmsg as *mut c_uchar).offset(_CMSG_ALIGN(size_of::<cmsghdr>()) as isize)
2283 }
2284
2285 pub const unsafe fn CMSG_LEN(length: c_uint) -> c_uint {
2286 _CMSG_ALIGN(size_of::<cmsghdr>()) as c_uint + length
2287 }
2288
2289 pub const unsafe fn CMSG_SPACE(length: c_uint) -> c_uint {
2290 (_CMSG_ALIGN(size_of::<cmsghdr>()) + _CMSG_ALIGN(length as usize)) as c_uint
2291 }
2292
2293 pub unsafe fn FD_CLR(fd: c_int, set: *mut fd_set) -> () {
2294 let fd = fd as usize;
2295 let size = size_of_val(&(*set).fds_bits[0]) * 8;
2296 (*set).fds_bits[fd / size] &= !(1 << (fd % size));
2297 return;
2298 }
2299
2300 pub unsafe fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool {
2301 let fd = fd as usize;
2302 let size = size_of_val(&(*set).fds_bits[0]) * 8;
2303 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0;
2304 }
2305
2306 pub unsafe fn FD_SET(fd: c_int, set: *mut fd_set) -> () {
2307 let fd = fd as usize;
2308 let size = size_of_val(&(*set).fds_bits[0]) * 8;
2309 (*set).fds_bits[fd / size] |= 1 << (fd % size);
2310 return;
2311 }
2312
2313 pub unsafe fn FD_ZERO(set: *mut fd_set) -> () {
2314 (*set).fds_bits.fill(0);
2315 }
2316
2317 pub unsafe fn _DEXTRA_FIRST(_d: *const dirent) -> *mut crate::dirent_extra {
2318 let _f = &((*(_d)).d_name) as *const _;
2319 let _s = _d as usize;
2320
2321 _ALIGN(_s + _f as usize - _s + (*_d).d_namelen as usize + 1, 8) as *mut crate::dirent_extra
2322 }
2323
2324 pub unsafe fn _DEXTRA_VALID(_x: *const crate::dirent_extra, _d: *const dirent) -> bool {
2325 let sz = _x as usize - _d as usize + size_of::<crate::dirent_extra>();
2326 let rsz = (*_d).d_reclen as usize;
2327
2328 if sz > rsz || sz + (*_x).d_datalen as usize > rsz {
2329 false
2330 } else {
2331 true
2332 }
2333 }
2334
2335 pub unsafe fn _DEXTRA_NEXT(_x: *const crate::dirent_extra) -> *mut crate::dirent_extra {
2336 _ALIGN(
2337 _x as usize + size_of::<crate::dirent_extra>() + (*_x).d_datalen as usize,
2338 8,
2339 ) as *mut crate::dirent_extra
2340 }
2341
2342 pub unsafe fn SOCKCREDSIZE(ngrps: usize) -> usize {
2343 let ngrps = if ngrps > 0 { ngrps - 1 } else { 0 };
2344 size_of::<sockcred>() + size_of::<crate::gid_t>() * ngrps
2345 }
2346}
2347
2348safe_f! {
2349 pub const safe fn WIFSTOPPED(status: c_int) -> bool {
2350 (status & 0xff) == 0x7f
2351 }
2352
2353 pub const safe fn WSTOPSIG(status: c_int) -> c_int {
2354 (status >> 8) & 0xff
2355 }
2356
2357 pub const safe fn WIFCONTINUED(status: c_int) -> bool {
2358 status == 0xffff
2359 }
2360
2361 pub const safe fn WIFSIGNALED(status: c_int) -> bool {
2362 ((status & 0x7f) + 1) as i8 >= 2
2363 }
2364
2365 pub const safe fn WTERMSIG(status: c_int) -> c_int {
2366 status & 0x7f
2367 }
2368
2369 pub const safe fn WIFEXITED(status: c_int) -> bool {
2370 (status & 0x7f) == 0
2371 }
2372
2373 pub const safe fn WEXITSTATUS(status: c_int) -> c_int {
2374 (status >> 8) & 0xff
2375 }
2376
2377 pub const safe fn WCOREDUMP(status: c_int) -> bool {
2378 (status & 0x80) != 0
2379 }
2380
2381 pub const safe fn IPTOS_ECN(x: u8) -> u8 {
2382 x & crate::IPTOS_ECN_MASK
2383 }
2384
2385 pub const safe fn makedev(major: c_uint, minor: c_uint) -> crate::dev_t {
2386 ((major << 10) | (minor)) as crate::dev_t
2387 }
2388
2389 pub const safe fn major(dev: crate::dev_t) -> c_uint {
2390 ((dev as c_uint) >> 10) & 0x3f
2391 }
2392
2393 pub const safe fn minor(dev: crate::dev_t) -> c_uint {
2394 (dev as c_uint) & 0x3ff
2395 }
2396}
2397
2398// Network related functions are provided by libsocket and regex
2399// functions are provided by libregex.
2400// In QNX <=7.0, libregex functions were included in libc itself.
2401#[link(name = "socket")]
2402#[cfg_attr(not(target_env = "nto70"), link(name = "regex"))]
2403extern "C" {
2404 pub fn sem_destroy(sem: *mut sem_t) -> c_int;
2405 pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int;
2406 pub fn fdatasync(fd: c_int) -> c_int;
2407 pub fn getpriority(which: c_int, who: crate::id_t) -> c_int;
2408 pub fn setpriority(which: c_int, who: crate::id_t, prio: c_int) -> c_int;
2409 pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
2410 pub fn mknodat(__fd: c_int, pathname: *const c_char, mode: mode_t, dev: crate::dev_t) -> c_int;
2411
2412 pub fn clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
2413 pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
2414 pub fn clock_settime(clk_id: crate::clockid_t, tp: *const crate::timespec) -> c_int;
2415 pub fn clock_getcpuclockid(pid: crate::pid_t, clk_id: *mut crate::clockid_t) -> c_int;
2416
2417 pub fn pthread_attr_getstack(
2418 attr: *const crate::pthread_attr_t,
2419 stackaddr: *mut *mut c_void,
2420 stacksize: *mut size_t,
2421 ) -> c_int;
2422 pub fn memalign(align: size_t, size: size_t) -> *mut c_void;
2423 pub fn setgroups(ngroups: c_int, ptr: *const crate::gid_t) -> c_int;
2424
2425 pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int;
2426 pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
2427 pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char;
2428
2429 pub fn utimensat(
2430 dirfd: c_int,
2431 path: *const c_char,
2432 times: *const crate::timespec,
2433 flag: c_int,
2434 ) -> c_int;
2435
2436 pub fn pthread_condattr_getclock(
2437 attr: *const pthread_condattr_t,
2438 clock_id: *mut clockid_t,
2439 ) -> c_int;
2440 pub fn pthread_condattr_setclock(
2441 attr: *mut pthread_condattr_t,
2442 clock_id: crate::clockid_t,
2443 ) -> c_int;
2444 pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: c_int) -> c_int;
2445 pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int;
2446 pub fn pthread_rwlockattr_getpshared(
2447 attr: *const pthread_rwlockattr_t,
2448 val: *mut c_int,
2449 ) -> c_int;
2450 pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: c_int) -> c_int;
2451 pub fn ptsname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> *mut c_char;
2452 pub fn clearenv() -> c_int;
2453 pub fn waitid(
2454 idtype: idtype_t,
2455 id: id_t,
2456 infop: *mut crate::siginfo_t,
2457 options: c_int,
2458 ) -> c_int;
2459 pub fn wait4(
2460 pid: crate::pid_t,
2461 status: *mut c_int,
2462 options: c_int,
2463 rusage: *mut crate::rusage,
2464 ) -> crate::pid_t;
2465
2466 // DIFF(main): changed to `*const *mut` in e77f551de9
2467 pub fn execvpe(
2468 file: *const c_char,
2469 argv: *const *const c_char,
2470 envp: *const *const c_char,
2471 ) -> c_int;
2472
2473 pub fn getifaddrs(ifap: *mut *mut crate::ifaddrs) -> c_int;
2474 pub fn freeifaddrs(ifa: *mut crate::ifaddrs);
2475 pub fn bind(
2476 socket: c_int,
2477 address: *const crate::sockaddr,
2478 address_len: crate::socklen_t,
2479 ) -> c_int;
2480
2481 pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
2482 pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
2483
2484 pub fn sendmsg(fd: c_int, msg: *const crate::msghdr, flags: c_int) -> ssize_t;
2485 pub fn recvmsg(fd: c_int, msg: *mut crate::msghdr, flags: c_int) -> ssize_t;
2486 pub fn openpty(
2487 amaster: *mut c_int,
2488 aslave: *mut c_int,
2489 name: *mut c_char,
2490 termp: *mut termios,
2491 winp: *mut crate::winsize,
2492 ) -> c_int;
2493 pub fn forkpty(
2494 amaster: *mut c_int,
2495 name: *mut c_char,
2496 termp: *mut termios,
2497 winp: *mut crate::winsize,
2498 ) -> crate::pid_t;
2499 pub fn login_tty(fd: c_int) -> c_int;
2500
2501 pub fn uname(buf: *mut crate::utsname) -> c_int;
2502
2503 pub fn getpeereid(socket: c_int, euid: *mut crate::uid_t, egid: *mut crate::gid_t) -> c_int;
2504
2505 pub fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
2506
2507 pub fn abs(i: c_int) -> c_int;
2508 pub fn labs(i: c_long) -> c_long;
2509 pub fn rand() -> c_int;
2510 pub fn srand(seed: c_uint);
2511
2512 pub fn setpwent();
2513 pub fn endpwent();
2514 pub fn getpwent() -> *mut passwd;
2515 pub fn setgrent();
2516 pub fn endgrent();
2517 pub fn getgrent() -> *mut crate::group;
2518 pub fn setspent();
2519 pub fn endspent();
2520
2521 pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
2522
2523 pub fn ftok(pathname: *const c_char, proj_id: c_int) -> crate::key_t;
2524 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
2525
2526 pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
2527 pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int;
2528 pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int;
2529 pub fn sigtimedwait(
2530 set: *const sigset_t,
2531 info: *mut siginfo_t,
2532 timeout: *const crate::timespec,
2533 ) -> c_int;
2534 pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int;
2535 pub fn pthread_setschedprio(native: crate::pthread_t, priority: c_int) -> c_int;
2536
2537 pub fn if_nameindex() -> *mut if_nameindex;
2538 pub fn if_freenameindex(ptr: *mut if_nameindex);
2539
2540 pub fn glob(
2541 pattern: *const c_char,
2542 flags: c_int,
2543 errfunc: Option<extern "C" fn(epath: *const c_char, errno: c_int) -> c_int>,
2544 pglob: *mut crate::glob_t,
2545 ) -> c_int;
2546 pub fn globfree(pglob: *mut crate::glob_t);
2547
2548 pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
2549
2550 pub fn shm_unlink(name: *const c_char) -> c_int;
2551
2552 pub fn seekdir(dirp: *mut crate::DIR, loc: c_long);
2553
2554 pub fn telldir(dirp: *mut crate::DIR) -> c_long;
2555
2556 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int;
2557
2558 pub fn recvfrom(
2559 socket: c_int,
2560 buf: *mut c_void,
2561 len: size_t,
2562 flags: c_int,
2563 addr: *mut crate::sockaddr,
2564 addrlen: *mut crate::socklen_t,
2565 ) -> ssize_t;
2566 pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int;
2567
2568 pub fn getdomainname(name: *mut c_char, len: size_t) -> c_int;
2569 pub fn setdomainname(name: *const c_char, len: size_t) -> c_int;
2570 pub fn sync();
2571 pub fn pthread_getschedparam(
2572 native: crate::pthread_t,
2573 policy: *mut c_int,
2574 param: *mut crate::sched_param,
2575 ) -> c_int;
2576 pub fn umount(target: *const c_char, flags: c_int) -> c_int;
2577 pub fn sched_get_priority_max(policy: c_int) -> c_int;
2578 pub fn settimeofday(tv: *const crate::timeval, tz: *const c_void) -> c_int;
2579 pub fn sched_rr_get_interval(pid: crate::pid_t, tp: *mut crate::timespec) -> c_int;
2580 pub fn sem_timedwait(sem: *mut sem_t, abstime: *const crate::timespec) -> c_int;
2581 pub fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int;
2582 pub fn sched_setparam(pid: crate::pid_t, param: *const crate::sched_param) -> c_int;
2583 pub fn mount(
2584 special_device: *const c_char,
2585 mount_directory: *const c_char,
2586 flags: c_int,
2587 mount_type: *const c_char,
2588 mount_data: *const c_void,
2589 mount_datalen: c_int,
2590 ) -> c_int;
2591 pub fn sched_getparam(pid: crate::pid_t, param: *mut crate::sched_param) -> c_int;
2592 pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> c_int;
2593 pub fn pthread_mutex_timedlock(
2594 lock: *mut pthread_mutex_t,
2595 abstime: *const crate::timespec,
2596 ) -> c_int;
2597 pub fn pthread_spin_init(lock: *mut crate::pthread_spinlock_t, pshared: c_int) -> c_int;
2598 pub fn pthread_spin_destroy(lock: *mut crate::pthread_spinlock_t) -> c_int;
2599 pub fn pthread_spin_lock(lock: *mut crate::pthread_spinlock_t) -> c_int;
2600 pub fn pthread_spin_trylock(lock: *mut crate::pthread_spinlock_t) -> c_int;
2601 pub fn pthread_spin_unlock(lock: *mut crate::pthread_spinlock_t) -> c_int;
2602 pub fn pthread_barrierattr_init(__attr: *mut crate::pthread_barrierattr_t) -> c_int;
2603 pub fn pthread_barrierattr_destroy(__attr: *mut crate::pthread_barrierattr_t) -> c_int;
2604 pub fn pthread_barrierattr_getpshared(
2605 __attr: *const crate::pthread_barrierattr_t,
2606 __pshared: *mut c_int,
2607 ) -> c_int;
2608 pub fn pthread_barrierattr_setpshared(
2609 __attr: *mut crate::pthread_barrierattr_t,
2610 __pshared: c_int,
2611 ) -> c_int;
2612 pub fn pthread_barrier_init(
2613 __barrier: *mut crate::pthread_barrier_t,
2614 __attr: *const crate::pthread_barrierattr_t,
2615 __count: c_uint,
2616 ) -> c_int;
2617 pub fn pthread_barrier_destroy(__barrier: *mut crate::pthread_barrier_t) -> c_int;
2618 pub fn pthread_barrier_wait(__barrier: *mut crate::pthread_barrier_t) -> c_int;
2619
2620 pub fn sched_getscheduler(pid: crate::pid_t) -> c_int;
2621 pub fn clock_nanosleep(
2622 clk_id: crate::clockid_t,
2623 flags: c_int,
2624 rqtp: *const crate::timespec,
2625 rmtp: *mut crate::timespec,
2626 ) -> c_int;
2627 pub fn pthread_attr_getguardsize(
2628 attr: *const crate::pthread_attr_t,
2629 guardsize: *mut size_t,
2630 ) -> c_int;
2631 pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int;
2632 pub fn sethostname(name: *const c_char, len: size_t) -> c_int;
2633 pub fn sched_get_priority_min(policy: c_int) -> c_int;
2634 pub fn pthread_condattr_getpshared(
2635 attr: *const pthread_condattr_t,
2636 pshared: *mut c_int,
2637 ) -> c_int;
2638 pub fn pthread_setschedparam(
2639 native: crate::pthread_t,
2640 policy: c_int,
2641 param: *const crate::sched_param,
2642 ) -> c_int;
2643 pub fn sched_setscheduler(
2644 pid: crate::pid_t,
2645 policy: c_int,
2646 param: *const crate::sched_param,
2647 ) -> c_int;
2648 pub fn sigsuspend(mask: *const crate::sigset_t) -> c_int;
2649 pub fn getgrgid_r(
2650 gid: crate::gid_t,
2651 grp: *mut crate::group,
2652 buf: *mut c_char,
2653 buflen: size_t,
2654 result: *mut *mut crate::group,
2655 ) -> c_int;
2656 pub fn sem_close(sem: *mut sem_t) -> c_int;
2657 pub fn getdtablesize() -> c_int;
2658 pub fn getgrnam_r(
2659 name: *const c_char,
2660 grp: *mut crate::group,
2661 buf: *mut c_char,
2662 buflen: size_t,
2663 result: *mut *mut crate::group,
2664 ) -> c_int;
2665 pub fn initgroups(user: *const c_char, group: crate::gid_t) -> c_int;
2666 pub fn pthread_sigmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int;
2667 pub fn sem_open(name: *const c_char, oflag: c_int, ...) -> *mut sem_t;
2668 pub fn getgrnam(name: *const c_char) -> *mut crate::group;
2669 pub fn pthread_cancel(thread: crate::pthread_t) -> c_int;
2670 pub fn pthread_kill(thread: crate::pthread_t, sig: c_int) -> c_int;
2671 pub fn sem_unlink(name: *const c_char) -> c_int;
2672 pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int;
2673 pub fn getpwnam_r(
2674 name: *const c_char,
2675 pwd: *mut passwd,
2676 buf: *mut c_char,
2677 buflen: size_t,
2678 result: *mut *mut passwd,
2679 ) -> c_int;
2680 pub fn getpwuid_r(
2681 uid: crate::uid_t,
2682 pwd: *mut passwd,
2683 buf: *mut c_char,
2684 buflen: size_t,
2685 result: *mut *mut passwd,
2686 ) -> c_int;
2687 pub fn sigwait(set: *const sigset_t, sig: *mut c_int) -> c_int;
2688 pub fn pthread_atfork(
2689 prepare: Option<unsafe extern "C" fn()>,
2690 parent: Option<unsafe extern "C" fn()>,
2691 child: Option<unsafe extern "C" fn()>,
2692 ) -> c_int;
2693 pub fn getgrgid(gid: crate::gid_t) -> *mut crate::group;
2694 pub fn getgrouplist(
2695 user: *const c_char,
2696 group: crate::gid_t,
2697 groups: *mut crate::gid_t,
2698 ngroups: *mut c_int,
2699 ) -> c_int;
2700 pub fn pthread_mutexattr_getpshared(
2701 attr: *const pthread_mutexattr_t,
2702 pshared: *mut c_int,
2703 ) -> c_int;
2704 pub fn pthread_mutexattr_getrobust(
2705 attr: *const pthread_mutexattr_t,
2706 robustness: *mut c_int,
2707 ) -> c_int;
2708 pub fn pthread_mutexattr_setrobust(attr: *mut pthread_mutexattr_t, robustness: c_int) -> c_int;
2709 pub fn pthread_create(
2710 native: *mut crate::pthread_t,
2711 attr: *const crate::pthread_attr_t,
2712 f: extern "C" fn(*mut c_void) -> *mut c_void,
2713 value: *mut c_void,
2714 ) -> c_int;
2715 pub fn getitimer(which: c_int, curr_value: *mut crate::itimerval) -> c_int;
2716 pub fn setitimer(
2717 which: c_int,
2718 value: *const crate::itimerval,
2719 ovalue: *mut crate::itimerval,
2720 ) -> c_int;
2721 pub fn posix_spawn(
2722 pid: *mut crate::pid_t,
2723 path: *const c_char,
2724 file_actions: *const crate::posix_spawn_file_actions_t,
2725 attrp: *const crate::posix_spawnattr_t,
2726 argv: *const *mut c_char,
2727 envp: *const *mut c_char,
2728 ) -> c_int;
2729 pub fn posix_spawnp(
2730 pid: *mut crate::pid_t,
2731 file: *const c_char,
2732 file_actions: *const crate::posix_spawn_file_actions_t,
2733 attrp: *const crate::posix_spawnattr_t,
2734 argv: *const *mut c_char,
2735 envp: *const *mut c_char,
2736 ) -> c_int;
2737 pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int;
2738 pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int;
2739 pub fn posix_spawnattr_getsigdefault(
2740 attr: *const posix_spawnattr_t,
2741 default: *mut crate::sigset_t,
2742 ) -> c_int;
2743 pub fn posix_spawnattr_setsigdefault(
2744 attr: *mut posix_spawnattr_t,
2745 default: *const crate::sigset_t,
2746 ) -> c_int;
2747 pub fn posix_spawnattr_getsigmask(
2748 attr: *const posix_spawnattr_t,
2749 default: *mut crate::sigset_t,
2750 ) -> c_int;
2751 pub fn posix_spawnattr_setsigmask(
2752 attr: *mut posix_spawnattr_t,
2753 default: *const crate::sigset_t,
2754 ) -> c_int;
2755 pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int;
2756 pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int;
2757 pub fn posix_spawnattr_getpgroup(
2758 attr: *const posix_spawnattr_t,
2759 flags: *mut crate::pid_t,
2760 ) -> c_int;
2761 pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::pid_t) -> c_int;
2762 pub fn posix_spawnattr_getschedpolicy(
2763 attr: *const posix_spawnattr_t,
2764 flags: *mut c_int,
2765 ) -> c_int;
2766 pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int;
2767 pub fn posix_spawnattr_getschedparam(
2768 attr: *const posix_spawnattr_t,
2769 param: *mut crate::sched_param,
2770 ) -> c_int;
2771 pub fn posix_spawnattr_setschedparam(
2772 attr: *mut posix_spawnattr_t,
2773 param: *const crate::sched_param,
2774 ) -> c_int;
2775
2776 pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int;
2777 pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int;
2778 pub fn posix_spawn_file_actions_addopen(
2779 actions: *mut posix_spawn_file_actions_t,
2780 fd: c_int,
2781 path: *const c_char,
2782 oflag: c_int,
2783 mode: mode_t,
2784 ) -> c_int;
2785 pub fn posix_spawn_file_actions_addclose(
2786 actions: *mut posix_spawn_file_actions_t,
2787 fd: c_int,
2788 ) -> c_int;
2789 pub fn posix_spawn_file_actions_adddup2(
2790 actions: *mut posix_spawn_file_actions_t,
2791 fd: c_int,
2792 newfd: c_int,
2793 ) -> c_int;
2794 pub fn popen(command: *const c_char, mode: *const c_char) -> *mut crate::FILE;
2795 pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int;
2796 pub fn inotify_rm_watch(fd: c_int, wd: c_int) -> c_int;
2797 pub fn inotify_init() -> c_int;
2798 pub fn inotify_add_watch(fd: c_int, path: *const c_char, mask: u32) -> c_int;
2799
2800 pub fn gettid() -> crate::pid_t;
2801
2802 pub fn pthread_getcpuclockid(thread: crate::pthread_t, clk_id: *mut crate::clockid_t) -> c_int;
2803
2804 pub fn getnameinfo(
2805 sa: *const crate::sockaddr,
2806 salen: crate::socklen_t,
2807 host: *mut c_char,
2808 hostlen: crate::socklen_t,
2809 serv: *mut c_char,
2810 servlen: crate::socklen_t,
2811 flags: c_int,
2812 ) -> c_int;
2813
2814 pub fn mallopt(param: c_int, value: i64) -> c_int;
2815 pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int;
2816
2817 pub fn ctermid(s: *mut c_char) -> *mut c_char;
2818 pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int;
2819
2820 pub fn mallinfo() -> crate::mallinfo;
2821 pub fn getpwent_r(
2822 pwd: *mut crate::passwd,
2823 buf: *mut c_char,
2824 __bufsize: c_int,
2825 __result: *mut *mut crate::passwd,
2826 ) -> c_int;
2827 pub fn pthread_getname_np(thread: crate::pthread_t, name: *mut c_char, len: c_int) -> c_int;
2828 pub fn pthread_setname_np(thread: crate::pthread_t, name: *const c_char) -> c_int;
2829
2830 pub fn sysctl(
2831 _: *const c_int,
2832 _: c_uint,
2833 _: *mut c_void,
2834 _: *mut size_t,
2835 _: *const c_void,
2836 _: size_t,
2837 ) -> c_int;
2838
2839 pub fn getrlimit(resource: c_int, rlim: *mut crate::rlimit) -> c_int;
2840 pub fn setrlimit(resource: c_int, rlp: *const crate::rlimit) -> c_int;
2841
2842 pub fn lio_listio(
2843 __mode: c_int,
2844 __list: *const *mut aiocb,
2845 __nent: c_int,
2846 __sig: *mut sigevent,
2847 ) -> c_int;
2848
2849 pub fn dl_iterate_phdr(
2850 callback: Option<
2851 unsafe extern "C" fn(
2852 // The original .h file declares this as *const, but for consistency with other platforms,
2853 // changing this to *mut to make it easier to use.
2854 // Maybe in v0.3 all platforms should use this as a *const.
2855 info: *mut dl_phdr_info,
2856 size: size_t,
2857 data: *mut c_void,
2858 ) -> c_int,
2859 >,
2860 data: *mut c_void,
2861 ) -> c_int;
2862
2863 pub fn memset_s(s: *mut c_void, smax: size_t, c: c_int, n: size_t) -> c_int;
2864
2865 pub fn regcomp(__preg: *mut crate::regex_t, __pattern: *const c_char, __cflags: c_int)
2866 -> c_int;
2867 pub fn regexec(
2868 __preg: *const crate::regex_t,
2869 __str: *const c_char,
2870 __nmatch: size_t,
2871 __pmatch: *mut crate::regmatch_t,
2872 __eflags: c_int,
2873 ) -> c_int;
2874 pub fn regerror(
2875 __errcode: c_int,
2876 __preg: *const crate::regex_t,
2877 __errbuf: *mut c_char,
2878 __errbuf_size: size_t,
2879 ) -> size_t;
2880 pub fn regfree(__preg: *mut crate::regex_t);
2881 pub fn dirfd(__dirp: *mut crate::DIR) -> c_int;
2882 pub fn dircntl(dir: *mut crate::DIR, cmd: c_int, ...) -> c_int;
2883
2884 pub fn aio_cancel(__fd: c_int, __aiocbp: *mut crate::aiocb) -> c_int;
2885 pub fn aio_error(__aiocbp: *const crate::aiocb) -> c_int;
2886 pub fn aio_fsync(__operation: c_int, __aiocbp: *mut crate::aiocb) -> c_int;
2887 pub fn aio_read(__aiocbp: *mut crate::aiocb) -> c_int;
2888 pub fn aio_return(__aiocpb: *mut crate::aiocb) -> ssize_t;
2889 pub fn aio_suspend(
2890 __list: *const *const crate::aiocb,
2891 __nent: c_int,
2892 __timeout: *const crate::timespec,
2893 ) -> c_int;
2894 pub fn aio_write(__aiocpb: *mut crate::aiocb) -> c_int;
2895
2896 pub fn mq_close(__mqdes: crate::mqd_t) -> c_int;
2897 pub fn mq_getattr(__mqdes: crate::mqd_t, __mqstat: *mut crate::mq_attr) -> c_int;
2898 pub fn mq_notify(__mqdes: crate::mqd_t, __notification: *const crate::sigevent) -> c_int;
2899 pub fn mq_open(__name: *const c_char, __oflag: c_int, ...) -> crate::mqd_t;
2900 pub fn mq_receive(
2901 __mqdes: crate::mqd_t,
2902 __msg_ptr: *mut c_char,
2903 __msg_len: size_t,
2904 __msg_prio: *mut c_uint,
2905 ) -> ssize_t;
2906 pub fn mq_send(
2907 __mqdes: crate::mqd_t,
2908 __msg_ptr: *const c_char,
2909 __msg_len: size_t,
2910 __msg_prio: c_uint,
2911 ) -> c_int;
2912 pub fn mq_setattr(
2913 __mqdes: crate::mqd_t,
2914 __mqstat: *const mq_attr,
2915 __omqstat: *mut mq_attr,
2916 ) -> c_int;
2917 pub fn mq_timedreceive(
2918 __mqdes: crate::mqd_t,
2919 __msg_ptr: *mut c_char,
2920 __msg_len: size_t,
2921 __msg_prio: *mut c_uint,
2922 __abs_timeout: *const crate::timespec,
2923 ) -> ssize_t;
2924 pub fn mq_timedsend(
2925 __mqdes: crate::mqd_t,
2926 __msg_ptr: *const c_char,
2927 __msg_len: size_t,
2928 __msg_prio: c_uint,
2929 __abs_timeout: *const crate::timespec,
2930 ) -> c_int;
2931 pub fn mq_unlink(__name: *const c_char) -> c_int;
2932 pub fn __get_errno_ptr() -> *mut c_int;
2933
2934 // System page, see https://www.qnx.com/developers/docs/7.1#com.qnx.doc.neutrino.building/topic/syspage/syspage_about.html
2935 pub static mut _syspage_ptr: *mut syspage_entry;
2936
2937 // Function on the stack after a call to pthread_create(). This is used
2938 // as a sentinel to work around an infitnite loop in the unwinding code.
2939 pub fn __my_thread_exit(value_ptr: *mut *const c_void);
2940}
2941
2942// Models the implementation in stdlib.h. Ctest will fail if trying to use the
2943// default symbol from libc
2944pub unsafe fn atexit(cb: extern "C" fn()) -> c_int {
2945 extern "C" {
2946 static __dso_handle: *mut c_void;
2947 pub fn __cxa_atexit(cb: extern "C" fn(), __arg: *mut c_void, __dso: *mut c_void) -> c_int;
2948 }
2949 __cxa_atexit(cb, ptr::null_mut(), __dso_handle)
2950}
2951
2952impl siginfo_t {
2953 pub unsafe fn si_addr(&self) -> *mut c_void {
2954 #[repr(C)]
2955 struct siginfo_si_addr {
2956 _pad: Padding<[u8; 32]>,
2957 si_addr: *mut c_void,
2958 }
2959 (*(self as *const siginfo_t).cast::<siginfo_si_addr>()).si_addr
2960 }
2961
2962 pub unsafe fn si_value(&self) -> crate::sigval {
2963 #[repr(C)]
2964 struct siginfo_si_value {
2965 _pad: Padding<[u8; 32]>,
2966 si_value: crate::sigval,
2967 }
2968 (*(self as *const siginfo_t).cast::<siginfo_si_value>()).si_value
2969 }
2970
2971 pub unsafe fn si_pid(&self) -> crate::pid_t {
2972 #[repr(C)]
2973 struct siginfo_si_pid {
2974 _pad: Padding<[u8; 16]>,
2975 si_pid: crate::pid_t,
2976 }
2977 (*(self as *const siginfo_t).cast::<siginfo_si_pid>()).si_pid
2978 }
2979
2980 pub unsafe fn si_uid(&self) -> crate::uid_t {
2981 #[repr(C)]
2982 struct siginfo_si_uid {
2983 _pad: Padding<[u8; 24]>,
2984 si_uid: crate::uid_t,
2985 }
2986 (*(self as *const siginfo_t).cast::<siginfo_si_uid>()).si_uid
2987 }
2988
2989 pub unsafe fn si_status(&self) -> c_int {
2990 #[repr(C)]
2991 struct siginfo_si_status {
2992 _pad: Padding<[u8; 28]>,
2993 si_status: c_int,
2994 }
2995 (*(self as *const siginfo_t).cast::<siginfo_si_status>()).si_status
2996 }
2997}
2998
2999// Things that are QNX specific
3000
3001mod neutrino;
3002pub use self::neutrino::*;
3003
3004// Things that are architecture specific
3005
3006mod arch;
3007pub use self::arch::*;
3008
3009// Things that are network-stack specific
3010
3011cfg_if! {
3012 if #[cfg(any(target_env = "nto70", target_env = "nto71"))] {
3013 mod io_pkt;
3014 pub use self::io_pkt::*;
3015 } else if #[cfg(any(target_env = "nto71_iosock", target_os = "qnx"))] {
3016 mod io_sock;
3017 pub use self::io_sock::*;
3018 } else {
3019 panic!("Unsupported arch");
3020 }
3021}