Debian Codegraph @

debian/missing-sources/libc/src/unix/nto/mod.rs

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