Debian Codegraph @

debian/rust-vendor/libc/src/unix/bsd/freebsdlike/mod.rs

raw
1 use crate::off_t;
2 use crate::prelude::*;
3
4 pub type mode_t = u16;
5 pub type pthread_attr_t = *mut c_void;
6 pub type rlim_t = i64;
7 pub type pthread_mutex_t = *mut c_void;
8 pub type pthread_mutexattr_t = *mut c_void;
9 pub type pthread_cond_t = *mut c_void;
10 pub type pthread_condattr_t = *mut c_void;
11 pub type pthread_rwlock_t = *mut c_void;
12 pub type pthread_rwlockattr_t = *mut c_void;
13 pub type pthread_key_t = c_int;
14 pub type tcflag_t = c_uint;
15 pub type speed_t = c_uint;
16 pub type nl_item = c_int;
17 pub type id_t = i64;
18 pub type vm_size_t = crate::uintptr_t;
19 pub type key_t = c_long;
20
21 // elf.h
22
23 pub type Elf32_Addr = u32;
24 pub type Elf32_Half = u16;
25 pub type Elf32_Off = u32;
26 pub type Elf32_Sword = i32;
27 pub type Elf32_Word = u32;
28
29 pub type Elf64_Addr = u64;
30 pub type Elf64_Half = u16;
31 pub type Elf64_Lword = u64;
32 pub type Elf64_Off = u64;
33 pub type Elf64_Sword = i32;
34 pub type Elf64_Sxword = i64;
35 pub type Elf64_Word = u32;
36 pub type Elf64_Xword = u64;
37
38 pub type iconv_t = *mut c_void;
39
40 // It's an alias over "struct __kvm_t". However, its fields aren't supposed to be used directly,
41 // making the type definition system dependent. Better not bind it exactly.
42 pub type kvm_t = c_void;
43
44 pub type posix_spawnattr_t = *mut c_void;
45 pub type posix_spawn_file_actions_t = *mut c_void;
46
47 cfg_if! {
48 if #[cfg(target_pointer_width = "64")] {
49 type Elf_Addr = Elf64_Addr;
50 type Elf_Half = Elf64_Half;
51 type Elf_Phdr = Elf64_Phdr;
52 } else if #[cfg(target_pointer_width = "32")] {
53 type Elf_Addr = Elf32_Addr;
54 type Elf_Half = Elf32_Half;
55 type Elf_Phdr = Elf32_Phdr;
56 }
57 }
58
59 // link.h
60
61 extern_ty! {
62 pub type timezone;
63 }
64
65 impl siginfo_t {
66 pub unsafe fn si_addr(&self) -> *mut c_void {
67 self.si_addr
68 }
69
70 pub unsafe fn si_value(&self) -> crate::sigval {
71 self.si_value
72 }
73
74 pub unsafe fn si_pid(&self) -> crate::pid_t {
75 self.si_pid
76 }
77
78 pub unsafe fn si_uid(&self) -> crate::uid_t {
79 self.si_uid
80 }
81
82 pub unsafe fn si_status(&self) -> c_int {
83 self.si_status
84 }
85 }
86
87 s! {
88 pub struct in_addr {
89 pub s_addr: crate::in_addr_t,
90 }
91
92 pub struct ip_mreq {
93 pub imr_multiaddr: in_addr,
94 pub imr_interface: in_addr,
95 }
96
97 pub struct ip_mreqn {
98 pub imr_multiaddr: in_addr,
99 pub imr_address: in_addr,
100 pub imr_ifindex: c_int,
101 }
102
103 pub struct glob_t {
104 pub gl_pathc: size_t,
105 pub gl_matchc: size_t,
106 pub gl_offs: size_t,
107 pub gl_flags: c_int,
108 pub gl_pathv: *mut *mut c_char,
109 __unused3: Padding<*mut c_void>,
110 __unused4: Padding<*mut c_void>,
111 __unused5: Padding<*mut c_void>,
112 __unused6: Padding<*mut c_void>,
113 __unused7: Padding<*mut c_void>,
114 __unused8: Padding<*mut c_void>,
115 }
116
117 pub struct tm {
118 pub tm_sec: c_int,
119 pub tm_min: c_int,
120 pub tm_hour: c_int,
121 pub tm_mday: c_int,
122 pub tm_mon: c_int,
123 pub tm_year: c_int,
124 pub tm_wday: c_int,
125 pub tm_yday: c_int,
126 pub tm_isdst: c_int,
127 pub tm_gmtoff: c_long,
128 pub tm_zone: *mut c_char,
129 }
130
131 pub struct addrinfo {
132 pub ai_flags: c_int,
133 pub ai_family: c_int,
134 pub ai_socktype: c_int,
135 pub ai_protocol: c_int,
136 pub ai_addrlen: crate::socklen_t,
137 pub ai_canonname: *mut c_char,
138 pub ai_addr: *mut crate::sockaddr,
139 pub ai_next: *mut addrinfo,
140 }
141
142 pub struct sigset_t {
143 bits: [u32; 4],
144 }
145
146 pub struct siginfo_t {
147 pub si_signo: c_int,
148 pub si_errno: c_int,
149 pub si_code: c_int,
150 pub si_pid: crate::pid_t,
151 pub si_uid: crate::uid_t,
152 pub si_status: c_int,
153 pub si_addr: *mut c_void,
154 pub si_value: crate::sigval,
155 _pad1: Padding<c_long>,
156 _pad2: Padding<[c_int; 7]>,
157 }
158
159 pub struct sigaction {
160 pub sa_sigaction: crate::sighandler_t,
161 pub sa_flags: c_int,
162 pub sa_mask: sigset_t,
163 }
164
165 pub struct sched_param {
166 pub sched_priority: c_int,
167 }
168
169 pub struct Dl_info {
170 pub dli_fname: *const c_char,
171 pub dli_fbase: *mut c_void,
172 pub dli_sname: *const c_char,
173 pub dli_saddr: *mut c_void,
174 }
175
176 pub struct sockaddr_in {
177 pub sin_len: u8,
178 pub sin_family: crate::sa_family_t,
179 pub sin_port: crate::in_port_t,
180 pub sin_addr: crate::in_addr,
181 pub sin_zero: [c_char; 8],
182 }
183
184 pub struct termios {
185 pub c_iflag: crate::tcflag_t,
186 pub c_oflag: crate::tcflag_t,
187 pub c_cflag: crate::tcflag_t,
188 pub c_lflag: crate::tcflag_t,
189 pub c_cc: [crate::cc_t; crate::NCCS],
190 pub c_ispeed: crate::speed_t,
191 pub c_ospeed: crate::speed_t,
192 }
193
194 pub struct flock {
195 pub l_start: off_t,
196 pub l_len: off_t,
197 pub l_pid: crate::pid_t,
198 pub l_type: c_short,
199 pub l_whence: c_short,
200 #[cfg(not(target_os = "dragonfly"))]
201 pub l_sysid: c_int,
202 }
203
204 pub struct sf_hdtr {
205 pub headers: *mut crate::iovec,
206 pub hdr_cnt: c_int,
207 pub trailers: *mut crate::iovec,
208 pub trl_cnt: c_int,
209 }
210
211 pub struct lconv {
212 pub decimal_point: *mut c_char,
213 pub thousands_sep: *mut c_char,
214 pub grouping: *mut c_char,
215 pub int_curr_symbol: *mut c_char,
216 pub currency_symbol: *mut c_char,
217 pub mon_decimal_point: *mut c_char,
218 pub mon_thousands_sep: *mut c_char,
219 pub mon_grouping: *mut c_char,
220 pub positive_sign: *mut c_char,
221 pub negative_sign: *mut c_char,
222 pub int_frac_digits: c_char,
223 pub frac_digits: c_char,
224 pub p_cs_precedes: c_char,
225 pub p_sep_by_space: c_char,
226 pub n_cs_precedes: c_char,
227 pub n_sep_by_space: c_char,
228 pub p_sign_posn: c_char,
229 pub n_sign_posn: c_char,
230 pub int_p_cs_precedes: c_char,
231 pub int_n_cs_precedes: c_char,
232 pub int_p_sep_by_space: c_char,
233 pub int_n_sep_by_space: c_char,
234 pub int_p_sign_posn: c_char,
235 pub int_n_sign_posn: c_char,
236 }
237
238 pub struct cmsgcred {
239 pub cmcred_pid: crate::pid_t,
240 pub cmcred_uid: crate::uid_t,
241 pub cmcred_euid: crate::uid_t,
242 pub cmcred_gid: crate::gid_t,
243 pub cmcred_ngroups: c_short,
244 pub cmcred_groups: [crate::gid_t; CMGROUP_MAX],
245 }
246
247 pub struct rtprio {
248 pub type_: c_ushort,
249 pub prio: c_ushort,
250 }
251
252 pub struct in6_pktinfo {
253 pub ipi6_addr: crate::in6_addr,
254 pub ipi6_ifindex: c_uint,
255 }
256
257 pub struct arphdr {
258 pub ar_hrd: u16,
259 pub ar_pro: u16,
260 pub ar_hln: u8,
261 pub ar_pln: u8,
262 pub ar_op: u16,
263 }
264
265 pub struct timex {
266 pub modes: c_uint,
267 pub offset: c_long,
268 pub freq: c_long,
269 pub maxerror: c_long,
270 pub esterror: c_long,
271 pub status: c_int,
272 pub constant: c_long,
273 pub precision: c_long,
274 pub tolerance: c_long,
275 pub ppsfreq: c_long,
276 pub jitter: c_long,
277 pub shift: c_int,
278 pub stabil: c_long,
279 pub jitcnt: c_long,
280 pub calcnt: c_long,
281 pub errcnt: c_long,
282 pub stbcnt: c_long,
283 }
284
285 pub struct ntptimeval {
286 pub time: crate::timespec,
287 pub maxerror: c_long,
288 pub esterror: c_long,
289 pub tai: c_long,
290 pub time_state: c_int,
291 }
292
293 pub struct accept_filter_arg {
294 pub af_name: [c_char; 16],
295 af_arg: [c_char; 256 - 16],
296 }
297
298 pub struct ptrace_io_desc {
299 pub piod_op: c_int,
300 pub piod_offs: *mut c_void,
301 pub piod_addr: *mut c_void,
302 pub piod_len: size_t,
303 }
304
305 // bpf.h
306
307 pub struct bpf_program {
308 pub bf_len: c_uint,
309 pub bf_insns: *mut bpf_insn,
310 }
311
312 pub struct bpf_stat {
313 pub bs_recv: c_uint,
314 pub bs_drop: c_uint,
315 }
316
317 pub struct bpf_version {
318 pub bv_major: c_ushort,
319 pub bv_minor: c_ushort,
320 }
321
322 pub struct bpf_hdr {
323 pub bh_tstamp: crate::timeval,
324 pub bh_caplen: u32,
325 pub bh_datalen: u32,
326 pub bh_hdrlen: c_ushort,
327 }
328
329 pub struct bpf_insn {
330 pub code: c_ushort,
331 pub jt: c_uchar,
332 pub jf: c_uchar,
333 pub k: u32,
334 }
335
336 pub struct bpf_dltlist {
337 bfl_len: c_uint,
338 bfl_list: *mut c_uint,
339 }
340
341 // elf.h
342
343 pub struct Elf32_Phdr {
344 pub p_type: Elf32_Word,
345 pub p_offset: Elf32_Off,
346 pub p_vaddr: Elf32_Addr,
347 pub p_paddr: Elf32_Addr,
348 pub p_filesz: Elf32_Word,
349 pub p_memsz: Elf32_Word,
350 pub p_flags: Elf32_Word,
351 pub p_align: Elf32_Word,
352 }
353
354 pub struct Elf64_Phdr {
355 pub p_type: Elf64_Word,
356 pub p_flags: Elf64_Word,
357 pub p_offset: Elf64_Off,
358 pub p_vaddr: Elf64_Addr,
359 pub p_paddr: Elf64_Addr,
360 pub p_filesz: Elf64_Xword,
361 pub p_memsz: Elf64_Xword,
362 pub p_align: Elf64_Xword,
363 }
364
365 // link.h
366
367 pub struct dl_phdr_info {
368 pub dlpi_addr: Elf_Addr,
369 pub dlpi_name: *const c_char,
370 pub dlpi_phdr: *const Elf_Phdr,
371 pub dlpi_phnum: Elf_Half,
372 pub dlpi_adds: c_ulonglong,
373 pub dlpi_subs: c_ulonglong,
374 pub dlpi_tls_modid: usize,
375 pub dlpi_tls_data: *mut c_void,
376 }
377
378 pub struct ipc_perm {
379 pub cuid: crate::uid_t,
380 pub cgid: crate::gid_t,
381 pub uid: crate::uid_t,
382 pub gid: crate::gid_t,
383 pub mode: mode_t,
384 pub seq: c_ushort,
385 pub key: crate::key_t,
386 }
387
388 pub struct eui64 {
389 pub octet: [u8; EUI64_LEN],
390 }
391
392 pub struct sockaddr_storage {
393 pub ss_len: u8,
394 pub ss_family: crate::sa_family_t,
395 __ss_pad1: Padding<[u8; 6]>,
396 __ss_align: i64,
397 __ss_pad2: Padding<[u8; 112]>,
398 }
399 }
400
401 // Non-public helper constant
402 const SIZEOF_LONG: usize = size_of::<c_long>();
403
404 pub const AIO_LISTIO_MAX: c_int = 16;
405 pub const AIO_CANCELED: c_int = 1;
406 pub const AIO_NOTCANCELED: c_int = 2;
407 pub const AIO_ALLDONE: c_int = 3;
408 pub const LIO_NOP: c_int = 0;
409 pub const LIO_WRITE: c_int = 1;
410 pub const LIO_READ: c_int = 2;
411 pub const LIO_WAIT: c_int = 1;
412 pub const LIO_NOWAIT: c_int = 0;
413
414 pub const SIGEV_NONE: c_int = 0;
415 pub const SIGEV_SIGNAL: c_int = 1;
416 pub const SIGEV_THREAD: c_int = 2;
417 pub const SIGEV_KEVENT: c_int = 3;
418
419 pub const CODESET: crate::nl_item = 0;
420 pub const D_T_FMT: crate::nl_item = 1;
421 pub const D_FMT: crate::nl_item = 2;
422 pub const T_FMT: crate::nl_item = 3;
423 pub const T_FMT_AMPM: crate::nl_item = 4;
424 pub const AM_STR: crate::nl_item = 5;
425 pub const PM_STR: crate::nl_item = 6;
426
427 pub const DAY_1: crate::nl_item = 7;
428 pub const DAY_2: crate::nl_item = 8;
429 pub const DAY_3: crate::nl_item = 9;
430 pub const DAY_4: crate::nl_item = 10;
431 pub const DAY_5: crate::nl_item = 11;
432 pub const DAY_6: crate::nl_item = 12;
433 pub const DAY_7: crate::nl_item = 13;
434
435 pub const ABDAY_1: crate::nl_item = 14;
436 pub const ABDAY_2: crate::nl_item = 15;
437 pub const ABDAY_3: crate::nl_item = 16;
438 pub const ABDAY_4: crate::nl_item = 17;
439 pub const ABDAY_5: crate::nl_item = 18;
440 pub const ABDAY_6: crate::nl_item = 19;
441 pub const ABDAY_7: crate::nl_item = 20;
442
443 pub const MON_1: crate::nl_item = 21;
444 pub const MON_2: crate::nl_item = 22;
445 pub const MON_3: crate::nl_item = 23;
446 pub const MON_4: crate::nl_item = 24;
447 pub const MON_5: crate::nl_item = 25;
448 pub const MON_6: crate::nl_item = 26;
449 pub const MON_7: crate::nl_item = 27;
450 pub const MON_8: crate::nl_item = 28;
451 pub const MON_9: crate::nl_item = 29;
452 pub const MON_10: crate::nl_item = 30;
453 pub const MON_11: crate::nl_item = 31;
454 pub const MON_12: crate::nl_item = 32;
455
456 pub const ABMON_1: crate::nl_item = 33;
457 pub const ABMON_2: crate::nl_item = 34;
458 pub const ABMON_3: crate::nl_item = 35;
459 pub const ABMON_4: crate::nl_item = 36;
460 pub const ABMON_5: crate::nl_item = 37;
461 pub const ABMON_6: crate::nl_item = 38;
462 pub const ABMON_7: crate::nl_item = 39;
463 pub const ABMON_8: crate::nl_item = 40;
464 pub const ABMON_9: crate::nl_item = 41;
465 pub const ABMON_10: crate::nl_item = 42;
466 pub const ABMON_11: crate::nl_item = 43;
467 pub const ABMON_12: crate::nl_item = 44;
468
469 pub const ERA: crate::nl_item = 45;
470 pub const ERA_D_FMT: crate::nl_item = 46;
471 pub const ERA_D_T_FMT: crate::nl_item = 47;
472 pub const ERA_T_FMT: crate::nl_item = 48;
473 pub const ALT_DIGITS: crate::nl_item = 49;
474
475 pub const RADIXCHAR: crate::nl_item = 50;
476 pub const THOUSEP: crate::nl_item = 51;
477
478 pub const YESEXPR: crate::nl_item = 52;
479 pub const NOEXPR: crate::nl_item = 53;
480
481 pub const YESSTR: crate::nl_item = 54;
482 pub const NOSTR: crate::nl_item = 55;
483
484 pub const CRNCYSTR: crate::nl_item = 56;
485
486 pub const D_MD_ORDER: crate::nl_item = 57;
487
488 pub const ALTMON_1: crate::nl_item = 58;
489 pub const ALTMON_2: crate::nl_item = 59;
490 pub const ALTMON_3: crate::nl_item = 60;
491 pub const ALTMON_4: crate::nl_item = 61;
492 pub const ALTMON_5: crate::nl_item = 62;
493 pub const ALTMON_6: crate::nl_item = 63;
494 pub const ALTMON_7: crate::nl_item = 64;
495 pub const ALTMON_8: crate::nl_item = 65;
496 pub const ALTMON_9: crate::nl_item = 66;
497 pub const ALTMON_10: crate::nl_item = 67;
498 pub const ALTMON_11: crate::nl_item = 68;
499 pub const ALTMON_12: crate::nl_item = 69;
500
501 pub const EXIT_FAILURE: c_int = 1;
502 pub const EXIT_SUCCESS: c_int = 0;
503 pub const EOF: c_int = -1;
504 pub const SEEK_SET: c_int = 0;
505 pub const SEEK_CUR: c_int = 1;
506 pub const SEEK_END: c_int = 2;
507 pub const SEEK_DATA: c_int = 3;
508 pub const SEEK_HOLE: c_int = 4;
509 pub const _IOFBF: c_int = 0;
510 pub const _IONBF: c_int = 2;
511 pub const _IOLBF: c_int = 1;
512 pub const BUFSIZ: c_uint = 1024;
513 pub const FOPEN_MAX: c_uint = 20;
514 pub const FILENAME_MAX: c_uint = 1024;
515 pub const L_tmpnam: c_uint = 1024;
516 pub const TMP_MAX: c_uint = 308915776;
517
518 pub const O_NOCTTY: c_int = 32768;
519 pub const O_DIRECT: c_int = 0x00010000;
520
521 pub const S_IFIFO: mode_t = 0o1_0000;
522 pub const S_IFCHR: mode_t = 0o2_0000;
523 pub const S_IFBLK: mode_t = 0o6_0000;
524 pub const S_IFDIR: mode_t = 0o4_0000;
525 pub const S_IFREG: mode_t = 0o10_0000;
526 pub const S_IFLNK: mode_t = 0o12_0000;
527 pub const S_IFSOCK: mode_t = 0o14_0000;
528 pub const S_IFMT: mode_t = 0o17_0000;
529 pub const S_IEXEC: mode_t = 0o0100;
530 pub const S_IWRITE: mode_t = 0o0200;
531 pub const S_IREAD: mode_t = 0o0400;
532 pub const S_IRWXU: mode_t = 0o0700;
533 pub const S_IXUSR: mode_t = 0o0100;
534 pub const S_IWUSR: mode_t = 0o0200;
535 pub const S_IRUSR: mode_t = 0o0400;
536 pub const S_IRWXG: mode_t = 0o0070;
537 pub const S_IXGRP: mode_t = 0o0010;
538 pub const S_IWGRP: mode_t = 0o0020;
539 pub const S_IRGRP: mode_t = 0o0040;
540 pub const S_IRWXO: mode_t = 0o0007;
541 pub const S_IXOTH: mode_t = 0o0001;
542 pub const S_IWOTH: mode_t = 0o0002;
543 pub const S_IROTH: mode_t = 0o0004;
544 pub const F_OK: c_int = 0;
545 pub const R_OK: c_int = 4;
546 pub const W_OK: c_int = 2;
547 pub const X_OK: c_int = 1;
548 pub const F_LOCK: c_int = 1;
549 pub const F_TEST: c_int = 3;
550 pub const F_TLOCK: c_int = 2;
551 pub const F_ULOCK: c_int = 0;
552 pub const F_DUPFD_CLOEXEC: c_int = 17;
553 pub const F_DUP2FD: c_int = 10;
554 pub const F_DUP2FD_CLOEXEC: c_int = 18;
555 pub const SIGHUP: c_int = 1;
556 pub const SIGINT: c_int = 2;
557 pub const SIGQUIT: c_int = 3;
558 pub const SIGILL: c_int = 4;
559 pub const SIGABRT: c_int = 6;
560 pub const SIGEMT: c_int = 7;
561 pub const SIGFPE: c_int = 8;
562 pub const SIGKILL: c_int = 9;
563 pub const SIGSEGV: c_int = 11;
564 pub const SIGPIPE: c_int = 13;
565 pub const SIGALRM: c_int = 14;
566 pub const SIGTERM: c_int = 15;
567
568 pub const PROT_NONE: c_int = 0;
569 pub const PROT_READ: c_int = 1;
570 pub const PROT_WRITE: c_int = 2;
571 pub const PROT_EXEC: c_int = 4;
572
573 pub const MAP_FILE: c_int = 0x0000;
574 pub const MAP_SHARED: c_int = 0x0001;
575 pub const MAP_PRIVATE: c_int = 0x0002;
576 pub const MAP_FIXED: c_int = 0x0010;
577 pub const MAP_ANON: c_int = 0x1000;
578 pub const MAP_ANONYMOUS: c_int = MAP_ANON;
579
580 pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
581
582 pub const MCL_CURRENT: c_int = 0x0001;
583 pub const MCL_FUTURE: c_int = 0x0002;
584
585 pub const MNT_EXPUBLIC: c_int = 0x20000000;
586 pub const MNT_NOATIME: c_int = 0x10000000;
587 pub const MNT_NOCLUSTERR: c_int = 0x40000000;
588 pub const MNT_NOCLUSTERW: c_int = u32_cast_int(0x80000000);
589 pub const MNT_NOSYMFOLLOW: c_int = 0x00400000;
590 pub const MNT_SOFTDEP: c_int = 0x00200000;
591 pub const MNT_SUIDDIR: c_int = 0x00100000;
592 pub const MNT_EXRDONLY: c_int = 0x00000080;
593 pub const MNT_DEFEXPORTED: c_int = 0x00000200;
594 pub const MNT_EXPORTANON: c_int = 0x00000400;
595 pub const MNT_EXKERB: c_int = 0x00000800;
596 pub const MNT_DELEXPORT: c_int = 0x00020000;
597
598 pub const MS_SYNC: c_int = 0x0000;
599 pub const MS_ASYNC: c_int = 0x0001;
600 pub const MS_INVALIDATE: c_int = 0x0002;
601
602 pub const EPERM: c_int = 1;
603 pub const ENOENT: c_int = 2;
604 pub const ESRCH: c_int = 3;
605 pub const EINTR: c_int = 4;
606 pub const EIO: c_int = 5;
607 pub const ENXIO: c_int = 6;
608 pub const E2BIG: c_int = 7;
609 pub const ENOEXEC: c_int = 8;
610 pub const EBADF: c_int = 9;
611 pub const ECHILD: c_int = 10;
612 pub const EDEADLK: c_int = 11;
613 pub const ENOMEM: c_int = 12;
614 pub const EACCES: c_int = 13;
615 pub const EFAULT: c_int = 14;
616 pub const ENOTBLK: c_int = 15;
617 pub const EBUSY: c_int = 16;
618 pub const EEXIST: c_int = 17;
619 pub const EXDEV: c_int = 18;
620 pub const ENODEV: c_int = 19;
621 pub const ENOTDIR: c_int = 20;
622 pub const EISDIR: c_int = 21;
623 pub const EINVAL: c_int = 22;
624 pub const ENFILE: c_int = 23;
625 pub const EMFILE: c_int = 24;
626 pub const ENOTTY: c_int = 25;
627 pub const ETXTBSY: c_int = 26;
628 pub const EFBIG: c_int = 27;
629 pub const ENOSPC: c_int = 28;
630 pub const ESPIPE: c_int = 29;
631 pub const EROFS: c_int = 30;
632 pub const EMLINK: c_int = 31;
633 pub const EPIPE: c_int = 32;
634 pub const EDOM: c_int = 33;
635 pub const ERANGE: c_int = 34;
636 pub const EAGAIN: c_int = 35;
637 pub const EWOULDBLOCK: c_int = 35;
638 pub const EINPROGRESS: c_int = 36;
639 pub const EALREADY: c_int = 37;
640 pub const ENOTSOCK: c_int = 38;
641 pub const EDESTADDRREQ: c_int = 39;
642 pub const EMSGSIZE: c_int = 40;
643 pub const EPROTOTYPE: c_int = 41;
644 pub const ENOPROTOOPT: c_int = 42;
645 pub const EPROTONOSUPPORT: c_int = 43;
646 pub const ESOCKTNOSUPPORT: c_int = 44;
647 pub const EOPNOTSUPP: c_int = 45;
648 pub const ENOTSUP: c_int = EOPNOTSUPP;
649 pub const EPFNOSUPPORT: c_int = 46;
650 pub const EAFNOSUPPORT: c_int = 47;
651 pub const EADDRINUSE: c_int = 48;
652 pub const EADDRNOTAVAIL: c_int = 49;
653 pub const ENETDOWN: c_int = 50;
654 pub const ENETUNREACH: c_int = 51;
655 pub const ENETRESET: c_int = 52;
656 pub const ECONNABORTED: c_int = 53;
657 pub const ECONNRESET: c_int = 54;
658 pub const ENOBUFS: c_int = 55;
659 pub const EISCONN: c_int = 56;
660 pub const ENOTCONN: c_int = 57;
661 pub const ESHUTDOWN: c_int = 58;
662 pub const ETOOMANYREFS: c_int = 59;
663 pub const ETIMEDOUT: c_int = 60;
664 pub const ECONNREFUSED: c_int = 61;
665 pub const ELOOP: c_int = 62;
666 pub const ENAMETOOLONG: c_int = 63;
667 pub const EHOSTDOWN: c_int = 64;
668 pub const EHOSTUNREACH: c_int = 65;
669 pub const ENOTEMPTY: c_int = 66;
670 pub const EPROCLIM: c_int = 67;
671 pub const EUSERS: c_int = 68;
672 pub const EDQUOT: c_int = 69;
673 pub const ESTALE: c_int = 70;
674 pub const EREMOTE: c_int = 71;
675 pub const EBADRPC: c_int = 72;
676 pub const ERPCMISMATCH: c_int = 73;
677 pub const EPROGUNAVAIL: c_int = 74;
678 pub const EPROGMISMATCH: c_int = 75;
679 pub const EPROCUNAVAIL: c_int = 76;
680 pub const ENOLCK: c_int = 77;
681 pub const ENOSYS: c_int = 78;
682 pub const EFTYPE: c_int = 79;
683 pub const EAUTH: c_int = 80;
684 pub const ENEEDAUTH: c_int = 81;
685 pub const EIDRM: c_int = 82;
686 pub const ENOMSG: c_int = 83;
687 pub const EOVERFLOW: c_int = 84;
688 pub const ECANCELED: c_int = 85;
689 pub const EILSEQ: c_int = 86;
690 pub const ENOATTR: c_int = 87;
691 pub const EDOOFUS: c_int = 88;
692 pub const EBADMSG: c_int = 89;
693 pub const EMULTIHOP: c_int = 90;
694 pub const ENOLINK: c_int = 91;
695 pub const EPROTO: c_int = 92;
696
697 pub const POLLSTANDARD: c_short = crate::POLLIN
698 | crate::POLLPRI
699 | crate::POLLOUT
700 | crate::POLLRDNORM
701 | crate::POLLRDBAND
702 | crate::POLLWRBAND
703 | crate::POLLERR
704 | crate::POLLHUP
705 | crate::POLLNVAL;
706
707 pub const AI_PASSIVE: c_int = 0x00000001;
708 pub const AI_CANONNAME: c_int = 0x00000002;
709 pub const AI_NUMERICHOST: c_int = 0x00000004;
710 pub const AI_NUMERICSERV: c_int = 0x00000008;
711 pub const AI_ALL: c_int = 0x00000100;
712 pub const AI_ADDRCONFIG: c_int = 0x00000400;
713 pub const AI_V4MAPPED: c_int = 0x00000800;
714
715 pub const EAI_AGAIN: c_int = 2;
716 pub const EAI_BADFLAGS: c_int = 3;
717 pub const EAI_FAIL: c_int = 4;
718 pub const EAI_FAMILY: c_int = 5;
719 pub const EAI_MEMORY: c_int = 6;
720 pub const EAI_NONAME: c_int = 8;
721 pub const EAI_SERVICE: c_int = 9;
722 pub const EAI_SOCKTYPE: c_int = 10;
723 pub const EAI_SYSTEM: c_int = 11;
724 pub const EAI_OVERFLOW: c_int = 14;
725
726 pub const F_DUPFD: c_int = 0;
727 pub const F_GETFD: c_int = 1;
728 pub const F_SETFD: c_int = 2;
729 pub const F_GETFL: c_int = 3;
730 pub const F_SETFL: c_int = 4;
731
732 pub const SIGTRAP: c_int = 5;
733
734 pub const GLOB_APPEND: c_int = 0x0001;
735 pub const GLOB_DOOFFS: c_int = 0x0002;
736 pub const GLOB_ERR: c_int = 0x0004;
737 pub const GLOB_MARK: c_int = 0x0008;
738 pub const GLOB_NOCHECK: c_int = 0x0010;
739 pub const GLOB_NOSORT: c_int = 0x0020;
740 pub const GLOB_NOESCAPE: c_int = 0x2000;
741
742 pub const GLOB_NOSPACE: c_int = -1;
743 pub const GLOB_ABORTED: c_int = -2;
744 pub const GLOB_NOMATCH: c_int = -3;
745
746 pub const POSIX_MADV_NORMAL: c_int = 0;
747 pub const POSIX_MADV_RANDOM: c_int = 1;
748 pub const POSIX_MADV_SEQUENTIAL: c_int = 2;
749 pub const POSIX_MADV_WILLNEED: c_int = 3;
750 pub const POSIX_MADV_DONTNEED: c_int = 4;
751
752 pub const PTHREAD_BARRIER_SERIAL_THREAD: c_int = -1;
753 pub const PTHREAD_PROCESS_PRIVATE: c_int = 0;
754 pub const PTHREAD_PROCESS_SHARED: c_int = 1;
755 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
756 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
757
758 pub const RLIMIT_CPU: c_int = 0;
759 pub const RLIMIT_FSIZE: c_int = 1;
760 pub const RLIMIT_DATA: c_int = 2;
761 pub const RLIMIT_STACK: c_int = 3;
762 pub const RLIMIT_CORE: c_int = 4;
763 pub const RLIMIT_RSS: c_int = 5;
764 pub const RLIMIT_MEMLOCK: c_int = 6;
765 pub const RLIMIT_NPROC: c_int = 7;
766 pub const RLIMIT_NOFILE: c_int = 8;
767 pub const RLIMIT_SBSIZE: c_int = 9;
768 pub const RLIMIT_VMEM: c_int = 10;
769 pub const RLIMIT_AS: c_int = RLIMIT_VMEM;
770 pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
771
772 pub const RUSAGE_SELF: c_int = 0;
773 pub const RUSAGE_CHILDREN: c_int = -1;
774
775 pub const CLOCK_REALTIME: crate::clockid_t = 0;
776 pub const CLOCK_VIRTUAL: crate::clockid_t = 1;
777 pub const CLOCK_PROF: crate::clockid_t = 2;
778 pub const CLOCK_MONOTONIC: crate::clockid_t = 4;
779 pub const CLOCK_UPTIME: crate::clockid_t = 5;
780 pub const CLOCK_UPTIME_PRECISE: crate::clockid_t = 7;
781 pub const CLOCK_UPTIME_FAST: crate::clockid_t = 8;
782 pub const CLOCK_REALTIME_PRECISE: crate::clockid_t = 9;
783 pub const CLOCK_REALTIME_FAST: crate::clockid_t = 10;
784 pub const CLOCK_MONOTONIC_PRECISE: crate::clockid_t = 11;
785 pub const CLOCK_MONOTONIC_FAST: crate::clockid_t = 12;
786 pub const CLOCK_SECOND: crate::clockid_t = 13;
787 pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 14;
788 pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 15;
789
790 pub const MADV_NORMAL: c_int = 0;
791 pub const MADV_RANDOM: c_int = 1;
792 pub const MADV_SEQUENTIAL: c_int = 2;
793 pub const MADV_WILLNEED: c_int = 3;
794 pub const MADV_DONTNEED: c_int = 4;
795 pub const MADV_FREE: c_int = 5;
796 pub const MADV_NOSYNC: c_int = 6;
797 pub const MADV_AUTOSYNC: c_int = 7;
798 pub const MADV_NOCORE: c_int = 8;
799 pub const MADV_CORE: c_int = 9;
800
801 pub const MINCORE_INCORE: c_int = 0x1;
802 pub const MINCORE_REFERENCED: c_int = 0x2;
803 pub const MINCORE_MODIFIED: c_int = 0x4;
804 pub const MINCORE_REFERENCED_OTHER: c_int = 0x8;
805 pub const MINCORE_MODIFIED_OTHER: c_int = 0x10;
806
807 pub const AF_UNSPEC: c_int = 0;
808 pub const AF_LOCAL: c_int = 1;
809 pub const AF_UNIX: c_int = AF_LOCAL;
810 pub const AF_INET: c_int = 2;
811 pub const AF_IMPLINK: c_int = 3;
812 pub const AF_PUP: c_int = 4;
813 pub const AF_CHAOS: c_int = 5;
814 pub const AF_NETBIOS: c_int = 6;
815 pub const AF_ISO: c_int = 7;
816 pub const AF_OSI: c_int = AF_ISO;
817 pub const AF_ECMA: c_int = 8;
818 pub const AF_DATAKIT: c_int = 9;
819 pub const AF_CCITT: c_int = 10;
820 pub const AF_SNA: c_int = 11;
821 pub const AF_DECnet: c_int = 12;
822 pub const AF_DLI: c_int = 13;
823 pub const AF_LAT: c_int = 14;
824 pub const AF_HYLINK: c_int = 15;
825 pub const AF_APPLETALK: c_int = 16;
826 pub const AF_ROUTE: c_int = 17;
827 pub const AF_LINK: c_int = 18;
828 pub const pseudo_AF_XTP: c_int = 19;
829 pub const AF_COIP: c_int = 20;
830 pub const AF_CNT: c_int = 21;
831 pub const pseudo_AF_RTIP: c_int = 22;
832 pub const AF_IPX: c_int = 23;
833 pub const AF_SIP: c_int = 24;
834 pub const pseudo_AF_PIP: c_int = 25;
835 pub const AF_ISDN: c_int = 26;
836 pub const AF_E164: c_int = AF_ISDN;
837 pub const pseudo_AF_KEY: c_int = 27;
838 pub const AF_INET6: c_int = 28;
839 pub const AF_NATM: c_int = 29;
840 pub const AF_ATM: c_int = 30;
841 pub const pseudo_AF_HDRCMPLT: c_int = 31;
842 pub const AF_NETGRAPH: c_int = 32;
843
844 pub const PF_UNSPEC: c_int = AF_UNSPEC;
845 pub const PF_LOCAL: c_int = AF_LOCAL;
846 pub const PF_UNIX: c_int = PF_LOCAL;
847 pub const PF_INET: c_int = AF_INET;
848 pub const PF_IMPLINK: c_int = AF_IMPLINK;
849 pub const PF_PUP: c_int = AF_PUP;
850 pub const PF_CHAOS: c_int = AF_CHAOS;
851 pub const PF_NETBIOS: c_int = AF_NETBIOS;
852 pub const PF_ISO: c_int = AF_ISO;
853 pub const PF_OSI: c_int = AF_ISO;
854 pub const PF_ECMA: c_int = AF_ECMA;
855 pub const PF_DATAKIT: c_int = AF_DATAKIT;
856 pub const PF_CCITT: c_int = AF_CCITT;
857 pub const PF_SNA: c_int = AF_SNA;
858 pub const PF_DECnet: c_int = AF_DECnet;
859 pub const PF_DLI: c_int = AF_DLI;
860 pub const PF_LAT: c_int = AF_LAT;
861 pub const PF_HYLINK: c_int = AF_HYLINK;
862 pub const PF_APPLETALK: c_int = AF_APPLETALK;
863 pub const PF_ROUTE: c_int = AF_ROUTE;
864 pub const PF_LINK: c_int = AF_LINK;
865 pub const PF_XTP: c_int = pseudo_AF_XTP;
866 pub const PF_COIP: c_int = AF_COIP;
867 pub const PF_CNT: c_int = AF_CNT;
868 pub const PF_SIP: c_int = AF_SIP;
869 pub const PF_IPX: c_int = AF_IPX;
870 pub const PF_RTIP: c_int = pseudo_AF_RTIP;
871 pub const PF_PIP: c_int = pseudo_AF_PIP;
872 pub const PF_ISDN: c_int = AF_ISDN;
873 pub const PF_KEY: c_int = pseudo_AF_KEY;
874 pub const PF_INET6: c_int = AF_INET6;
875 pub const PF_NATM: c_int = AF_NATM;
876 pub const PF_ATM: c_int = AF_ATM;
877 pub const PF_NETGRAPH: c_int = AF_NETGRAPH;
878
879 pub const PIOD_READ_D: c_int = 1;
880 pub const PIOD_WRITE_D: c_int = 2;
881 pub const PIOD_READ_I: c_int = 3;
882 pub const PIOD_WRITE_I: c_int = 4;
883
884 pub const PT_TRACE_ME: c_int = 0;
885 pub const PT_READ_I: c_int = 1;
886 pub const PT_READ_D: c_int = 2;
887 pub const PT_WRITE_I: c_int = 4;
888 pub const PT_WRITE_D: c_int = 5;
889 pub const PT_CONTINUE: c_int = 7;
890 pub const PT_KILL: c_int = 8;
891 pub const PT_STEP: c_int = 9;
892 pub const PT_ATTACH: c_int = 10;
893 pub const PT_DETACH: c_int = 11;
894 pub const PT_IO: c_int = 12;
895
896 pub const SOMAXCONN: c_int = 128;
897
898 pub const MSG_OOB: c_int = 0x00000001;
899 pub const MSG_PEEK: c_int = 0x00000002;
900 pub const MSG_DONTROUTE: c_int = 0x00000004;
901 pub const MSG_EOR: c_int = 0x00000008;
902 pub const MSG_TRUNC: c_int = 0x00000010;
903 pub const MSG_CTRUNC: c_int = 0x00000020;
904 pub const MSG_WAITALL: c_int = 0x00000040;
905 pub const MSG_DONTWAIT: c_int = 0x00000080;
906 pub const MSG_EOF: c_int = 0x00000100;
907
908 pub const SCM_TIMESTAMP: c_int = 0x02;
909 pub const SCM_CREDS: c_int = 0x03;
910
911 pub const SOCK_STREAM: c_int = 1;
912 pub const SOCK_DGRAM: c_int = 2;
913 pub const SOCK_RAW: c_int = 3;
914 pub const SOCK_RDM: c_int = 4;
915 pub const SOCK_SEQPACKET: c_int = 5;
916 pub const SOCK_CLOEXEC: c_int = 0x10000000;
917 pub const SOCK_NONBLOCK: c_int = 0x20000000;
918 pub const SOCK_MAXADDRLEN: c_int = 255;
919 pub const IP_TTL: c_int = 4;
920 pub const IP_HDRINCL: c_int = 2;
921 pub const IP_RECVDSTADDR: c_int = 7;
922 pub const IP_SENDSRCADDR: c_int = IP_RECVDSTADDR;
923 pub const IP_ADD_MEMBERSHIP: c_int = 12;
924 pub const IP_DROP_MEMBERSHIP: c_int = 13;
925 pub const IP_RECVIF: c_int = 20;
926 pub const IP_RECVTTL: c_int = 65;
927 pub const IP_MINTTL: c_int = 66;
928 pub const IPV6_RECVHOPLIMIT: c_int = 37;
929 pub const IPV6_JOIN_GROUP: c_int = 12;
930 pub const IPV6_LEAVE_GROUP: c_int = 13;
931 pub const IPV6_CHECKSUM: c_int = 26;
932 pub const IPV6_RECVPKTINFO: c_int = 36;
933 pub const IPV6_PKTINFO: c_int = 46;
934 pub const IPV6_HOPLIMIT: c_int = 47;
935 pub const IPV6_RECVTCLASS: c_int = 57;
936 pub const IPV6_TCLASS: c_int = 61;
937
938 pub const TCP_NOPUSH: c_int = 4;
939 pub const TCP_NOOPT: c_int = 8;
940 pub const TCP_KEEPIDLE: c_int = 256;
941 pub const TCP_KEEPINTVL: c_int = 512;
942 pub const TCP_KEEPCNT: c_int = 1024;
943
944 pub const SOL_SOCKET: c_int = 0xffff;
945 pub const SO_DEBUG: c_int = 0x01;
946 pub const SO_ACCEPTCONN: c_int = 0x0002;
947 pub const SO_REUSEADDR: c_int = 0x0004;
948 pub const SO_KEEPALIVE: c_int = 0x0008;
949 pub const SO_DONTROUTE: c_int = 0x0010;
950 pub const SO_BROADCAST: c_int = 0x0020;
951 pub const SO_USELOOPBACK: c_int = 0x0040;
952 pub const SO_LINGER: c_int = 0x0080;
953 pub const SO_OOBINLINE: c_int = 0x0100;
954 pub const SO_REUSEPORT: c_int = 0x0200;
955 pub const SO_TIMESTAMP: c_int = 0x0400;
956 pub const SO_NOSIGPIPE: c_int = 0x0800;
957 pub const SO_ACCEPTFILTER: c_int = 0x1000;
958 pub const SO_SNDBUF: c_int = 0x1001;
959 pub const SO_RCVBUF: c_int = 0x1002;
960 pub const SO_SNDLOWAT: c_int = 0x1003;
961 pub const SO_RCVLOWAT: c_int = 0x1004;
962 pub const SO_SNDTIMEO: c_int = 0x1005;
963 pub const SO_RCVTIMEO: c_int = 0x1006;
964 pub const SO_ERROR: c_int = 0x1007;
965 pub const SO_TYPE: c_int = 0x1008;
966
967 pub const LOCAL_PEERCRED: c_int = 1;
968
969 // net/route.h
970 pub const RTF_XRESOLVE: c_int = 0x200;
971 pub const RTF_LLINFO: c_int = 0x400;
972 pub const RTF_PROTO3: c_int = 0x40000;
973 pub const RTF_PINNED: c_int = 0x100000;
974 pub const RTF_LOCAL: c_int = 0x200000;
975 pub const RTF_BROADCAST: c_int = 0x400000;
976 pub const RTF_MULTICAST: c_int = 0x800000;
977
978 pub const RTM_LOCK: c_int = 0x8;
979 pub const RTM_RESOLVE: c_int = 0xb;
980 pub const RTM_NEWADDR: c_int = 0xc;
981 pub const RTM_DELADDR: c_int = 0xd;
982 pub const RTM_IFINFO: c_int = 0xe;
983 pub const RTM_NEWMADDR: c_int = 0xf;
984 pub const RTM_DELMADDR: c_int = 0x10;
985 pub const RTM_IFANNOUNCE: c_int = 0x11;
986 pub const RTM_IEEE80211: c_int = 0x12;
987
988 pub const SHUT_RD: c_int = 0;
989 pub const SHUT_WR: c_int = 1;
990 pub const SHUT_RDWR: c_int = 2;
991
992 pub const LOCK_SH: c_int = 1;
993 pub const LOCK_EX: c_int = 2;
994 pub const LOCK_NB: c_int = 4;
995 pub const LOCK_UN: c_int = 8;
996
997 pub const MAP_COPY: c_int = 0x0002;
998 #[doc(hidden)]
999 #[deprecated(
1000 since = "0.2.54",
1001 note = "Removed in FreeBSD 11, unused in DragonFlyBSD"
1002 )]
1003 pub const MAP_RENAME: c_int = 0x0020;
1004 #[doc(hidden)]
1005 #[deprecated(
1006 since = "0.2.54",
1007 note = "Removed in FreeBSD 11, unused in DragonFlyBSD"
1008 )]
1009 pub const MAP_NORESERVE: c_int = 0x0040;
1010 pub const MAP_HASSEMAPHORE: c_int = 0x0200;
1011 pub const MAP_STACK: c_int = 0x0400;
1012 pub const MAP_NOSYNC: c_int = 0x0800;
1013 pub const MAP_NOCORE: c_int = 0x020000;
1014
1015 pub const IPPROTO_RAW: c_int = 255;
1016
1017 pub const _PC_LINK_MAX: c_int = 1;
1018 pub const _PC_MAX_CANON: c_int = 2;
1019 pub const _PC_MAX_INPUT: c_int = 3;
1020 pub const _PC_NAME_MAX: c_int = 4;
1021 pub const _PC_PATH_MAX: c_int = 5;
1022 pub const _PC_PIPE_BUF: c_int = 6;
1023 pub const _PC_CHOWN_RESTRICTED: c_int = 7;
1024 pub const _PC_NO_TRUNC: c_int = 8;
1025 pub const _PC_VDISABLE: c_int = 9;
1026 pub const _PC_ALLOC_SIZE_MIN: c_int = 10;
1027 pub const _PC_FILESIZEBITS: c_int = 12;
1028 pub const _PC_REC_INCR_XFER_SIZE: c_int = 14;
1029 pub const _PC_REC_MAX_XFER_SIZE: c_int = 15;
1030 pub const _PC_REC_MIN_XFER_SIZE: c_int = 16;
1031 pub const _PC_REC_XFER_ALIGN: c_int = 17;
1032 pub const _PC_SYMLINK_MAX: c_int = 18;
1033 pub const _PC_MIN_HOLE_SIZE: c_int = 21;
1034 pub const _PC_ASYNC_IO: c_int = 53;
1035 pub const _PC_PRIO_IO: c_int = 54;
1036 pub const _PC_SYNC_IO: c_int = 55;
1037 pub const _PC_ACL_EXTENDED: c_int = 59;
1038 pub const _PC_ACL_PATH_MAX: c_int = 60;
1039 pub const _PC_CAP_PRESENT: c_int = 61;
1040 pub const _PC_INF_PRESENT: c_int = 62;
1041 pub const _PC_MAC_PRESENT: c_int = 63;
1042
1043 pub const _SC_ARG_MAX: c_int = 1;
1044 pub const _SC_CHILD_MAX: c_int = 2;
1045 pub const _SC_CLK_TCK: c_int = 3;
1046 pub const _SC_NGROUPS_MAX: c_int = 4;
1047 pub const _SC_OPEN_MAX: c_int = 5;
1048 pub const _SC_JOB_CONTROL: c_int = 6;
1049 pub const _SC_SAVED_IDS: c_int = 7;
1050 pub const _SC_VERSION: c_int = 8;
1051 pub const _SC_BC_BASE_MAX: c_int = 9;
1052 pub const _SC_BC_DIM_MAX: c_int = 10;
1053 pub const _SC_BC_SCALE_MAX: c_int = 11;
1054 pub const _SC_BC_STRING_MAX: c_int = 12;
1055 pub const _SC_COLL_WEIGHTS_MAX: c_int = 13;
1056 pub const _SC_EXPR_NEST_MAX: c_int = 14;
1057 pub const _SC_LINE_MAX: c_int = 15;
1058 pub const _SC_RE_DUP_MAX: c_int = 16;
1059 pub const _SC_2_VERSION: c_int = 17;
1060 pub const _SC_2_C_BIND: c_int = 18;
1061 pub const _SC_2_C_DEV: c_int = 19;
1062 pub const _SC_2_CHAR_TERM: c_int = 20;
1063 pub const _SC_2_FORT_DEV: c_int = 21;
1064 pub const _SC_2_FORT_RUN: c_int = 22;
1065 pub const _SC_2_LOCALEDEF: c_int = 23;
1066 pub const _SC_2_SW_DEV: c_int = 24;
1067 pub const _SC_2_UPE: c_int = 25;
1068 pub const _SC_STREAM_MAX: c_int = 26;
1069 pub const _SC_TZNAME_MAX: c_int = 27;
1070 pub const _SC_ASYNCHRONOUS_IO: c_int = 28;
1071 pub const _SC_MAPPED_FILES: c_int = 29;
1072 pub const _SC_MEMLOCK: c_int = 30;
1073 pub const _SC_MEMLOCK_RANGE: c_int = 31;
1074 pub const _SC_MEMORY_PROTECTION: c_int = 32;
1075 pub const _SC_MESSAGE_PASSING: c_int = 33;
1076 pub const _SC_PRIORITIZED_IO: c_int = 34;
1077 pub const _SC_PRIORITY_SCHEDULING: c_int = 35;
1078 pub const _SC_REALTIME_SIGNALS: c_int = 36;
1079 pub const _SC_SEMAPHORES: c_int = 37;
1080 pub const _SC_FSYNC: c_int = 38;
1081 pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 39;
1082 pub const _SC_SYNCHRONIZED_IO: c_int = 40;
1083 pub const _SC_TIMERS: c_int = 41;
1084 pub const _SC_AIO_LISTIO_MAX: c_int = 42;
1085 pub const _SC_AIO_MAX: c_int = 43;
1086 pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 44;
1087 pub const _SC_DELAYTIMER_MAX: c_int = 45;
1088 pub const _SC_MQ_OPEN_MAX: c_int = 46;
1089 pub const _SC_PAGESIZE: c_int = 47;
1090 pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
1091 pub const _SC_RTSIG_MAX: c_int = 48;
1092 pub const _SC_SEM_NSEMS_MAX: c_int = 49;
1093 pub const _SC_SEM_VALUE_MAX: c_int = 50;
1094 pub const _SC_SIGQUEUE_MAX: c_int = 51;
1095 pub const _SC_TIMER_MAX: c_int = 52;
1096 pub const _SC_IOV_MAX: c_int = 56;
1097 pub const _SC_NPROCESSORS_CONF: c_int = 57;
1098 pub const _SC_2_PBS: c_int = 59;
1099 pub const _SC_2_PBS_ACCOUNTING: c_int = 60;
1100 pub const _SC_2_PBS_CHECKPOINT: c_int = 61;
1101 pub const _SC_2_PBS_LOCATE: c_int = 62;
1102 pub const _SC_2_PBS_MESSAGE: c_int = 63;
1103 pub const _SC_2_PBS_TRACK: c_int = 64;
1104 pub const _SC_ADVISORY_INFO: c_int = 65;
1105 pub const _SC_BARRIERS: c_int = 66;
1106 pub const _SC_CLOCK_SELECTION: c_int = 67;
1107 pub const _SC_CPUTIME: c_int = 68;
1108 pub const _SC_FILE_LOCKING: c_int = 69;
1109 pub const _SC_NPROCESSORS_ONLN: c_int = 58;
1110 pub const _SC_GETGR_R_SIZE_MAX: c_int = 70;
1111 pub const _SC_GETPW_R_SIZE_MAX: c_int = 71;
1112 pub const _SC_HOST_NAME_MAX: c_int = 72;
1113 pub const _SC_LOGIN_NAME_MAX: c_int = 73;
1114 pub const _SC_MONOTONIC_CLOCK: c_int = 74;
1115 pub const _SC_MQ_PRIO_MAX: c_int = 75;
1116 pub const _SC_READER_WRITER_LOCKS: c_int = 76;
1117 pub const _SC_REGEXP: c_int = 77;
1118 pub const _SC_SHELL: c_int = 78;
1119 pub const _SC_SPAWN: c_int = 79;
1120 pub const _SC_SPIN_LOCKS: c_int = 80;
1121 pub const _SC_SPORADIC_SERVER: c_int = 81;
1122 pub const _SC_THREAD_ATTR_STACKADDR: c_int = 82;
1123 pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 83;
1124 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 85;
1125 pub const _SC_THREAD_KEYS_MAX: c_int = 86;
1126 pub const _SC_THREAD_PRIO_INHERIT: c_int = 87;
1127 pub const _SC_THREAD_PRIO_PROTECT: c_int = 88;
1128 pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 89;
1129 pub const _SC_THREAD_PROCESS_SHARED: c_int = 90;
1130 pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 91;
1131 pub const _SC_THREAD_SPORADIC_SERVER: c_int = 92;
1132 pub const _SC_THREAD_STACK_MIN: c_int = 93;
1133 pub const _SC_THREAD_THREADS_MAX: c_int = 94;
1134 pub const _SC_TIMEOUTS: c_int = 95;
1135 pub const _SC_THREADS: c_int = 96;
1136 pub const _SC_TRACE: c_int = 97;
1137 pub const _SC_TRACE_EVENT_FILTER: c_int = 98;
1138 pub const _SC_TRACE_INHERIT: c_int = 99;
1139 pub const _SC_TRACE_LOG: c_int = 100;
1140 pub const _SC_TTY_NAME_MAX: c_int = 101;
1141 pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 102;
1142 pub const _SC_V6_ILP32_OFF32: c_int = 103;
1143 pub const _SC_V6_ILP32_OFFBIG: c_int = 104;
1144 pub const _SC_V6_LP64_OFF64: c_int = 105;
1145 pub const _SC_V6_LPBIG_OFFBIG: c_int = 106;
1146 pub const _SC_ATEXIT_MAX: c_int = 107;
1147 pub const _SC_XOPEN_CRYPT: c_int = 108;
1148 pub const _SC_XOPEN_ENH_I18N: c_int = 109;
1149 pub const _SC_XOPEN_LEGACY: c_int = 110;
1150 pub const _SC_XOPEN_REALTIME: c_int = 111;
1151 pub const _SC_XOPEN_REALTIME_THREADS: c_int = 112;
1152 pub const _SC_XOPEN_SHM: c_int = 113;
1153 pub const _SC_XOPEN_STREAMS: c_int = 114;
1154 pub const _SC_XOPEN_UNIX: c_int = 115;
1155 pub const _SC_XOPEN_VERSION: c_int = 116;
1156 pub const _SC_XOPEN_XCU_VERSION: c_int = 117;
1157 pub const _SC_IPV6: c_int = 118;
1158 pub const _SC_RAW_SOCKETS: c_int = 119;
1159 pub const _SC_SYMLOOP_MAX: c_int = 120;
1160 pub const _SC_PHYS_PAGES: c_int = 121;
1161
1162 pub const _CS_PATH: c_int = 1;
1163
1164 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = ptr::null_mut();
1165 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = ptr::null_mut();
1166 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = ptr::null_mut();
1167 pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
1168 pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2;
1169 pub const PTHREAD_MUTEX_NORMAL: c_int = 3;
1170 pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_ERRORCHECK;
1171
1172 pub const SCHED_FIFO: c_int = 1;
1173 pub const SCHED_OTHER: c_int = 2;
1174 pub const SCHED_RR: c_int = 3;
1175
1176 pub const FD_SETSIZE: usize = 1024;
1177
1178 pub const ST_NOSUID: c_ulong = 2;
1179
1180 pub const NI_MAXHOST: size_t = 1025;
1181
1182 pub const XUCRED_VERSION: c_uint = 0;
1183
1184 pub const RTLD_LOCAL: c_int = 0;
1185 pub const RTLD_NODELETE: c_int = 0x1000;
1186 pub const RTLD_NOLOAD: c_int = 0x2000;
1187 pub const RTLD_GLOBAL: c_int = 0x100;
1188
1189 pub const LOG_NTP: c_int = 12 << 3;
1190 pub const LOG_SECURITY: c_int = 13 << 3;
1191 pub const LOG_CONSOLE: c_int = 14 << 3;
1192 pub const LOG_NFACILITIES: c_int = 24;
1193
1194 pub const TIOCEXCL: c_ulong = 0x2000740d;
1195 pub const TIOCNXCL: c_ulong = 0x2000740e;
1196 pub const TIOCFLUSH: c_ulong = 0x80047410;
1197 pub const TIOCGETA: c_ulong = 0x402c7413;
1198 pub const TIOCSETA: c_ulong = 0x802c7414;
1199 pub const TIOCSETAW: c_ulong = 0x802c7415;
1200 pub const TIOCSETAF: c_ulong = 0x802c7416;
1201 pub const TIOCGETD: c_ulong = 0x4004741a;
1202 pub const TIOCSETD: c_ulong = 0x8004741b;
1203 pub const TIOCGDRAINWAIT: c_ulong = 0x40047456;
1204 pub const TIOCSDRAINWAIT: c_ulong = 0x80047457;
1205 #[cfg_attr(
1206 not(target_os = "dragonfly"),
1207 deprecated = "unused since FreeBSD 8, removed in FreeBSD 15"
1208 )]
1209 pub const TIOCMGDTRWAIT: c_ulong = 0x4004745a;
1210 #[cfg_attr(
1211 not(target_os = "dragonfly"),
1212 deprecated = "unused since FreeBSD 8, removed in FreeBSD 15"
1213 )]
1214 pub const TIOCMSDTRWAIT: c_ulong = 0x8004745b;
1215 pub const TIOCDRAIN: c_ulong = 0x2000745e;
1216 pub const TIOCEXT: c_ulong = 0x80047460;
1217 pub const TIOCSCTTY: c_ulong = 0x20007461;
1218 pub const TIOCCONS: c_ulong = 0x80047462;
1219 pub const TIOCGSID: c_ulong = 0x40047463;
1220 pub const TIOCSTAT: c_ulong = 0x20007465;
1221 pub const TIOCUCNTL: c_ulong = 0x80047466;
1222 pub const TIOCSWINSZ: c_ulong = 0x80087467;
1223 pub const TIOCGWINSZ: c_ulong = 0x40087468;
1224 pub const TIOCMGET: c_ulong = 0x4004746a;
1225 pub const TIOCM_LE: c_int = 0x1;
1226 pub const TIOCM_DTR: c_int = 0x2;
1227 pub const TIOCM_RTS: c_int = 0x4;
1228 pub const TIOCM_ST: c_int = 0x8;
1229 pub const TIOCM_SR: c_int = 0x10;
1230 pub const TIOCM_CTS: c_int = 0x20;
1231 pub const TIOCM_RI: c_int = 0x80;
1232 pub const TIOCM_DSR: c_int = 0x100;
1233 pub const TIOCM_CD: c_int = 0x40;
1234 pub const TIOCM_CAR: c_int = 0x40;
1235 pub const TIOCM_RNG: c_int = 0x80;
1236 pub const TIOCMBIC: c_ulong = 0x8004746b;
1237 pub const TIOCMBIS: c_ulong = 0x8004746c;
1238 pub const TIOCMSET: c_ulong = 0x8004746d;
1239 pub const TIOCSTART: c_ulong = 0x2000746e;
1240 pub const TIOCSTOP: c_ulong = 0x2000746f;
1241 pub const TIOCPKT: c_ulong = 0x80047470;
1242 pub const TIOCPKT_DATA: c_int = 0x0;
1243 pub const TIOCPKT_FLUSHREAD: c_int = 0x1;
1244 pub const TIOCPKT_FLUSHWRITE: c_int = 0x2;
1245 pub const TIOCPKT_STOP: c_int = 0x4;
1246 pub const TIOCPKT_START: c_int = 0x8;
1247 pub const TIOCPKT_NOSTOP: c_int = 0x10;
1248 pub const TIOCPKT_DOSTOP: c_int = 0x20;
1249 pub const TIOCPKT_IOCTL: c_int = 0x40;
1250 pub const TIOCNOTTY: c_ulong = 0x20007471;
1251 pub const TIOCSTI: c_ulong = 0x80017472;
1252 pub const TIOCOUTQ: c_ulong = 0x40047473;
1253 pub const TIOCSPGRP: c_ulong = 0x80047476;
1254 pub const TIOCGPGRP: c_ulong = 0x40047477;
1255 pub const TIOCCDTR: c_ulong = 0x20007478;
1256 pub const TIOCSDTR: c_ulong = 0x20007479;
1257 pub const TTYDISC: c_int = 0x0;
1258 pub const SLIPDISC: c_int = 0x4;
1259 pub const PPPDISC: c_int = 0x5;
1260 pub const NETGRAPHDISC: c_int = 0x6;
1261
1262 pub const BIOCGRSIG: c_ulong = 0x40044272;
1263 pub const BIOCSRSIG: c_ulong = 0x80044273;
1264 pub const BIOCSDLT: c_ulong = 0x80044278;
1265 pub const BIOCGSEESENT: c_ulong = 0x40044276;
1266 pub const BIOCSSEESENT: c_ulong = 0x80044277;
1267 cfg_if! {
1268 if #[cfg(target_pointer_width = "64")] {
1269 pub const BIOCGDLTLIST: c_ulong = 0xc0104279;
1270 pub const BIOCSETF: c_ulong = 0x80104267;
1271 } else if #[cfg(target_pointer_width = "32")] {
1272 pub const BIOCGDLTLIST: c_ulong = 0xc0084279;
1273 pub const BIOCSETF: c_ulong = 0x80084267;
1274 }
1275 }
1276
1277 pub const FIODTYPE: c_ulong = 0x4004667a;
1278 pub const FIOGETLBA: c_ulong = 0x40046679;
1279
1280 pub const B0: speed_t = 0;
1281 pub const B50: speed_t = 50;
1282 pub const B75: speed_t = 75;
1283 pub const B110: speed_t = 110;
1284 pub const B134: speed_t = 134;
1285 pub const B150: speed_t = 150;
1286 pub const B200: speed_t = 200;
1287 pub const B300: speed_t = 300;
1288 pub const B600: speed_t = 600;
1289 pub const B1200: speed_t = 1200;
1290 pub const B1800: speed_t = 1800;
1291 pub const B2400: speed_t = 2400;
1292 pub const B4800: speed_t = 4800;
1293 pub const B9600: speed_t = 9600;
1294 pub const B19200: speed_t = 19200;
1295 pub const B38400: speed_t = 38400;
1296 pub const B7200: speed_t = 7200;
1297 pub const B14400: speed_t = 14400;
1298 pub const B28800: speed_t = 28800;
1299 pub const B57600: speed_t = 57600;
1300 pub const B76800: speed_t = 76800;
1301 pub const B115200: speed_t = 115200;
1302 pub const B230400: speed_t = 230400;
1303 pub const EXTA: speed_t = 19200;
1304 pub const EXTB: speed_t = 38400;
1305
1306 pub const SEM_FAILED: *mut sem_t = ptr::null_mut();
1307
1308 pub const CRTSCTS: crate::tcflag_t = 0x00030000;
1309 pub const CCTS_OFLOW: crate::tcflag_t = 0x00010000;
1310 pub const CRTS_IFLOW: crate::tcflag_t = 0x00020000;
1311 pub const CDTR_IFLOW: crate::tcflag_t = 0x00040000;
1312 pub const CDSR_OFLOW: crate::tcflag_t = 0x00080000;
1313 pub const CCAR_OFLOW: crate::tcflag_t = 0x00100000;
1314 pub const VERASE2: usize = 7;
1315 pub const OCRNL: crate::tcflag_t = 0x10;
1316 pub const ONOCR: crate::tcflag_t = 0x20;
1317 pub const ONLRET: crate::tcflag_t = 0x40;
1318
1319 pub const CMGROUP_MAX: usize = 16;
1320
1321 pub const EUI64_LEN: usize = 8;
1322
1323 // https://github.com/freebsd/freebsd/blob/HEAD/sys/net/bpf.h
1324 pub const BPF_ALIGNMENT: usize = SIZEOF_LONG;
1325
1326 // Values for rtprio struct (prio field) and syscall (function argument)
1327 pub const RTP_PRIO_MIN: c_ushort = 0;
1328 pub const RTP_PRIO_MAX: c_ushort = 31;
1329 pub const RTP_LOOKUP: c_int = 0;
1330 pub const RTP_SET: c_int = 1;
1331
1332 // Flags for chflags(2)
1333 pub const UF_SETTABLE: c_ulong = 0x0000ffff;
1334 pub const UF_NODUMP: c_ulong = 0x00000001;
1335 pub const UF_IMMUTABLE: c_ulong = 0x00000002;
1336 pub const UF_APPEND: c_ulong = 0x00000004;
1337 pub const UF_OPAQUE: c_ulong = 0x00000008;
1338 pub const UF_NOUNLINK: c_ulong = 0x00000010;
1339 pub const SF_SETTABLE: c_ulong = 0xffff0000;
1340 pub const SF_ARCHIVED: c_ulong = 0x00010000;
1341 pub const SF_IMMUTABLE: c_ulong = 0x00020000;
1342 pub const SF_APPEND: c_ulong = 0x00040000;
1343 pub const SF_NOUNLINK: c_ulong = 0x00100000;
1344
1345 pub const TIMER_ABSTIME: c_int = 1;
1346
1347 //<sys/timex.h>
1348 pub const NTP_API: c_int = 4;
1349 pub const MAXPHASE: c_long = 500000000;
1350 pub const MAXFREQ: c_long = 500000;
1351 pub const MINSEC: c_int = 256;
1352 pub const MAXSEC: c_int = 2048;
1353 pub const NANOSECOND: c_long = 1000000000;
1354 pub const SCALE_PPM: c_int = 65;
1355 pub const MAXTC: c_int = 10;
1356 pub const MOD_OFFSET: c_uint = 0x0001;
1357 pub const MOD_FREQUENCY: c_uint = 0x0002;
1358 pub const MOD_MAXERROR: c_uint = 0x0004;
1359 pub const MOD_ESTERROR: c_uint = 0x0008;
1360 pub const MOD_STATUS: c_uint = 0x0010;
1361 pub const MOD_TIMECONST: c_uint = 0x0020;
1362 pub const MOD_PPSMAX: c_uint = 0x0040;
1363 pub const MOD_TAI: c_uint = 0x0080;
1364 pub const MOD_MICRO: c_uint = 0x1000;
1365 pub const MOD_NANO: c_uint = 0x2000;
1366 pub const MOD_CLKB: c_uint = 0x4000;
1367 pub const MOD_CLKA: c_uint = 0x8000;
1368 pub const STA_PLL: c_int = 0x0001;
1369 pub const STA_PPSFREQ: c_int = 0x0002;
1370 pub const STA_PPSTIME: c_int = 0x0004;
1371 pub const STA_FLL: c_int = 0x0008;
1372 pub const STA_INS: c_int = 0x0010;
1373 pub const STA_DEL: c_int = 0x0020;
1374 pub const STA_UNSYNC: c_int = 0x0040;
1375 pub const STA_FREQHOLD: c_int = 0x0080;
1376 pub const STA_PPSSIGNAL: c_int = 0x0100;
1377 pub const STA_PPSJITTER: c_int = 0x0200;
1378 pub const STA_PPSWANDER: c_int = 0x0400;
1379 pub const STA_PPSERROR: c_int = 0x0800;
1380 pub const STA_CLOCKERR: c_int = 0x1000;
1381 pub const STA_NANO: c_int = 0x2000;
1382 pub const STA_MODE: c_int = 0x4000;
1383 pub const STA_CLK: c_int = 0x8000;
1384 pub const STA_RONLY: c_int = STA_PPSSIGNAL
1385 | STA_PPSJITTER
1386 | STA_PPSWANDER
1387 | STA_PPSERROR
1388 | STA_CLOCKERR
1389 | STA_NANO
1390 | STA_MODE
1391 | STA_CLK;
1392 pub const TIME_OK: c_int = 0;
1393 pub const TIME_INS: c_int = 1;
1394 pub const TIME_DEL: c_int = 2;
1395 pub const TIME_OOP: c_int = 3;
1396 pub const TIME_WAIT: c_int = 4;
1397 pub const TIME_ERROR: c_int = 5;
1398
1399 pub const REG_ENOSYS: c_int = -1;
1400
1401 pub const IPC_PRIVATE: crate::key_t = 0;
1402 pub const IPC_CREAT: c_int = 0o1000;
1403 pub const IPC_EXCL: c_int = 0o2000;
1404 pub const IPC_NOWAIT: c_int = 0o4000;
1405 pub const IPC_RMID: c_int = 0;
1406 pub const IPC_SET: c_int = 1;
1407 pub const IPC_STAT: c_int = 2;
1408 pub const IPC_R: c_int = 0o400;
1409 pub const IPC_W: c_int = 0o200;
1410 pub const IPC_M: c_int = 0o10000;
1411
1412 pub const SHM_RDONLY: c_int = 0o10000;
1413 pub const SHM_RND: c_int = 0o20000;
1414 pub const SHM_R: c_int = 0o400;
1415 pub const SHM_W: c_int = 0o200;
1416
1417 pub const KENV_GET: c_int = 0;
1418 pub const KENV_SET: c_int = 1;
1419 pub const KENV_UNSET: c_int = 2;
1420 pub const KENV_DUMP: c_int = 3;
1421 pub const KENV_MNAMELEN: c_int = 128;
1422 pub const KENV_MVALLEN: c_int = 128;
1423
1424 pub const RB_ASKNAME: c_int = 0x001;
1425 pub const RB_SINGLE: c_int = 0x002;
1426 pub const RB_NOSYNC: c_int = 0x004;
1427 pub const RB_HALT: c_int = 0x008;
1428 pub const RB_INITNAME: c_int = 0x010;
1429 pub const RB_DFLTROOT: c_int = 0x020;
1430 pub const RB_KDB: c_int = 0x040;
1431 pub const RB_RDONLY: c_int = 0x080;
1432 pub const RB_DUMP: c_int = 0x100;
1433 pub const RB_MINIROOT: c_int = 0x200;
1434 pub const RB_VERBOSE: c_int = 0x800;
1435 pub const RB_SERIAL: c_int = 0x1000;
1436 pub const RB_CDROM: c_int = 0x2000;
1437 pub const RB_POWEROFF: c_int = 0x4000;
1438 pub const RB_GDB: c_int = 0x8000;
1439 pub const RB_MUTE: c_int = 0x10000;
1440 pub const RB_SELFTEST: c_int = 0x20000;
1441
1442 // DIFF(main): changed to `c_short` in f62eb023ab
1443 pub const POSIX_SPAWN_RESETIDS: c_int = 0x01;
1444 pub const POSIX_SPAWN_SETPGROUP: c_int = 0x02;
1445 pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 0x04;
1446 pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x08;
1447 pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x10;
1448 pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x20;
1449
1450 safe_f! {
1451 pub const safe fn WIFCONTINUED(status: c_int) -> bool {
1452 status == 0x13
1453 }
1454
1455 pub const safe fn WSTOPSIG(status: c_int) -> c_int {
1456 status >> 8
1457 }
1458
1459 pub const safe fn WIFSTOPPED(status: c_int) -> bool {
1460 (status & 0o177) == 0o177
1461 }
1462 }
1463
1464 extern "C" {
1465 pub fn sem_destroy(sem: *mut sem_t) -> c_int;
1466 pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int;
1467
1468 pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int;
1469 pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut crate::timezone) -> c_int;
1470 pub fn accept4(
1471 s: c_int,
1472 addr: *mut crate::sockaddr,
1473 addrlen: *mut crate::socklen_t,
1474 flags: c_int,
1475 ) -> c_int;
1476 pub fn chflags(path: *const c_char, flags: c_ulong) -> c_int;
1477 pub fn chflagsat(fd: c_int, path: *const c_char, flags: c_ulong, atflag: c_int) -> c_int;
1478
1479 pub fn clock_nanosleep(
1480 clk_id: crate::clockid_t,
1481 flags: c_int,
1482 rqtp: *const crate::timespec,
1483 rmtp: *mut crate::timespec,
1484 ) -> c_int;
1485
1486 pub fn clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
1487 pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
1488 pub fn clock_settime(clk_id: crate::clockid_t, tp: *const crate::timespec) -> c_int;
1489 pub fn clock_getcpuclockid(pid: crate::pid_t, clk_id: *mut crate::clockid_t) -> c_int;
1490
1491 pub fn pthread_getcpuclockid(thread: crate::pthread_t, clk_id: *mut crate::clockid_t) -> c_int;
1492
1493 pub fn dirfd(dirp: *mut crate::DIR) -> c_int;
1494 pub fn duplocale(base: crate::locale_t) -> crate::locale_t;
1495 pub fn endutxent();
1496 pub fn fchflags(fd: c_int, flags: c_ulong) -> c_int;
1497
1498 // DIFF(main): changed to `*const *mut` in e77f551de9
1499 pub fn fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int;
1500
1501 pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
1502 pub fn getdomainname(name: *mut c_char, len: c_int) -> c_int;
1503 pub fn getgrent_r(
1504 grp: *mut crate::group,
1505 buf: *mut c_char,
1506 buflen: size_t,
1507 result: *mut *mut crate::group,
1508 ) -> c_int;
1509 pub fn getpwent_r(
1510 pwd: *mut crate::passwd,
1511 buf: *mut c_char,
1512 buflen: size_t,
1513 result: *mut *mut crate::passwd,
1514 ) -> c_int;
1515 pub fn getgrouplist(
1516 name: *const c_char,
1517 basegid: crate::gid_t,
1518 groups: *mut crate::gid_t,
1519 ngroups: *mut c_int,
1520 ) -> c_int;
1521 pub fn getnameinfo(
1522 sa: *const crate::sockaddr,
1523 salen: crate::socklen_t,
1524 host: *mut c_char,
1525 hostlen: size_t,
1526 serv: *mut c_char,
1527 servlen: size_t,
1528 flags: c_int,
1529 ) -> c_int;
1530 pub fn getpriority(which: c_int, who: c_int) -> c_int;
1531 pub fn getresgid(
1532 rgid: *mut crate::gid_t,
1533 egid: *mut crate::gid_t,
1534 sgid: *mut crate::gid_t,
1535 ) -> c_int;
1536 pub fn getresuid(
1537 ruid: *mut crate::uid_t,
1538 euid: *mut crate::uid_t,
1539 suid: *mut crate::uid_t,
1540 ) -> c_int;
1541 pub fn getutxent() -> *mut utmpx;
1542 pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
1543 pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
1544 pub fn initgroups(name: *const c_char, basegid: crate::gid_t) -> c_int;
1545 #[cfg_attr(
1546 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1547 link_name = "kevent@FBSD_1.0"
1548 )]
1549 pub fn kevent(
1550 kq: c_int,
1551 changelist: *const crate::kevent,
1552 nchanges: c_int,
1553 eventlist: *mut crate::kevent,
1554 nevents: c_int,
1555 timeout: *const crate::timespec,
1556 ) -> c_int;
1557 pub fn lchflags(path: *const c_char, flags: c_ulong) -> c_int;
1558 pub fn lutimes(file: *const c_char, times: *const crate::timeval) -> c_int;
1559 pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
1560 pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
1561 #[cfg_attr(
1562 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1563 link_name = "mknodat@FBSD_1.1"
1564 )]
1565 pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
1566 pub fn malloc_usable_size(ptr: *const c_void) -> size_t;
1567 pub fn mincore(addr: *const c_void, len: size_t, vec: *mut c_char) -> c_int;
1568 pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t;
1569 pub fn nl_langinfo_l(item: crate::nl_item, locale: crate::locale_t) -> *mut c_char;
1570 pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int;
1571 pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
1572 pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int;
1573 pub fn ppoll(
1574 fds: *mut crate::pollfd,
1575 nfds: crate::nfds_t,
1576 timeout: *const crate::timespec,
1577 sigmask: *const sigset_t,
1578 ) -> c_int;
1579 pub fn preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
1580 pub fn pthread_attr_get_np(tid: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
1581 pub fn pthread_attr_getguardsize(
1582 attr: *const crate::pthread_attr_t,
1583 guardsize: *mut size_t,
1584 ) -> c_int;
1585 pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int;
1586 pub fn pthread_attr_getstack(
1587 attr: *const crate::pthread_attr_t,
1588 stackaddr: *mut *mut c_void,
1589 stacksize: *mut size_t,
1590 ) -> c_int;
1591 pub fn pthread_condattr_getclock(
1592 attr: *const pthread_condattr_t,
1593 clock_id: *mut clockid_t,
1594 ) -> c_int;
1595 pub fn pthread_condattr_getpshared(
1596 attr: *const pthread_condattr_t,
1597 pshared: *mut c_int,
1598 ) -> c_int;
1599 pub fn pthread_condattr_setclock(
1600 attr: *mut pthread_condattr_t,
1601 clock_id: crate::clockid_t,
1602 ) -> c_int;
1603 pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: c_int) -> c_int;
1604 pub fn pthread_main_np() -> c_int;
1605 pub fn pthread_mutex_timedlock(
1606 lock: *mut pthread_mutex_t,
1607 abstime: *const crate::timespec,
1608 ) -> c_int;
1609 pub fn pthread_mutexattr_getpshared(
1610 attr: *const pthread_mutexattr_t,
1611 pshared: *mut c_int,
1612 ) -> c_int;
1613 pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int;
1614 pub fn pthread_rwlockattr_getpshared(
1615 attr: *const pthread_rwlockattr_t,
1616 val: *mut c_int,
1617 ) -> c_int;
1618 pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: c_int) -> c_int;
1619 pub fn pthread_barrierattr_init(attr: *mut crate::pthread_barrierattr_t) -> c_int;
1620 pub fn pthread_barrierattr_destroy(attr: *mut crate::pthread_barrierattr_t) -> c_int;
1621 pub fn pthread_barrierattr_getpshared(
1622 attr: *const crate::pthread_barrierattr_t,
1623 shared: *mut c_int,
1624 ) -> c_int;
1625 pub fn pthread_barrierattr_setpshared(
1626 attr: *mut crate::pthread_barrierattr_t,
1627 shared: c_int,
1628 ) -> c_int;
1629 pub fn pthread_barrier_init(
1630 barrier: *mut pthread_barrier_t,
1631 attr: *const crate::pthread_barrierattr_t,
1632 count: c_uint,
1633 ) -> c_int;
1634 pub fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> c_int;
1635 pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> c_int;
1636 pub fn pthread_get_name_np(tid: crate::pthread_t, name: *mut c_char, len: size_t);
1637 pub fn pthread_set_name_np(tid: crate::pthread_t, name: *const c_char);
1638 pub fn pthread_getname_np(
1639 thread: crate::pthread_t,
1640 buffer: *mut c_char,
1641 length: size_t,
1642 ) -> c_int;
1643 pub fn pthread_setname_np(thread: crate::pthread_t, name: *const c_char) -> c_int;
1644 pub fn pthread_setschedparam(
1645 native: crate::pthread_t,
1646 policy: c_int,
1647 param: *const sched_param,
1648 ) -> c_int;
1649 pub fn pthread_getschedparam(
1650 native: crate::pthread_t,
1651 policy: *mut c_int,
1652 param: *mut sched_param,
1653 ) -> c_int;
1654 pub fn ptrace(request: c_int, pid: crate::pid_t, addr: *mut c_char, data: c_int) -> c_int;
1655 pub fn utrace(addr: *const c_void, len: size_t) -> c_int;
1656 pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
1657 pub fn pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off_t) -> ssize_t;
1658 pub fn querylocale(mask: c_int, loc: crate::locale_t) -> *const c_char;
1659 pub fn rtprio(function: c_int, pid: crate::pid_t, rtp: *mut rtprio) -> c_int;
1660 pub fn sched_rr_get_interval(pid: crate::pid_t, t: *mut crate::timespec) -> c_int;
1661 pub fn sched_getparam(pid: crate::pid_t, param: *mut sched_param) -> c_int;
1662 pub fn sched_setparam(pid: crate::pid_t, param: *const sched_param) -> c_int;
1663 pub fn sched_getscheduler(pid: crate::pid_t) -> c_int;
1664 pub fn sched_setscheduler(
1665 pid: crate::pid_t,
1666 policy: c_int,
1667 param: *const crate::sched_param,
1668 ) -> c_int;
1669 pub fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int;
1670 pub fn sem_timedwait(sem: *mut sem_t, abstime: *const crate::timespec) -> c_int;
1671 pub fn sendfile(
1672 fd: c_int,
1673 s: c_int,
1674 offset: off_t,
1675 nbytes: size_t,
1676 hdtr: *mut crate::sf_hdtr,
1677 sbytes: *mut off_t,
1678 flags: c_int,
1679 ) -> c_int;
1680 pub fn setdomainname(name: *const c_char, len: c_int) -> c_int;
1681 pub fn sethostname(name: *const c_char, len: c_int) -> c_int;
1682 pub fn setpriority(which: c_int, who: c_int, prio: c_int) -> c_int;
1683 pub fn setresgid(rgid: crate::gid_t, egid: crate::gid_t, sgid: crate::gid_t) -> c_int;
1684 pub fn setresuid(ruid: crate::uid_t, euid: crate::uid_t, suid: crate::uid_t) -> c_int;
1685 pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int;
1686 pub fn setutxent();
1687 pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
1688 pub fn sigtimedwait(
1689 set: *const sigset_t,
1690 info: *mut siginfo_t,
1691 timeout: *const crate::timespec,
1692 ) -> c_int;
1693 pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> c_int;
1694 pub fn sysctl(
1695 name: *const c_int,
1696 namelen: c_uint,
1697 oldp: *mut c_void,
1698 oldlenp: *mut size_t,
1699 newp: *const c_void,
1700 newlen: size_t,
1701 ) -> c_int;
1702 pub fn sysctlbyname(
1703 name: *const c_char,
1704 oldp: *mut c_void,
1705 oldlenp: *mut size_t,
1706 newp: *const c_void,
1707 newlen: size_t,
1708 ) -> c_int;
1709 pub fn sysctlnametomib(name: *const c_char, mibp: *mut c_int, sizep: *mut size_t) -> c_int;
1710 pub fn uselocale(loc: crate::locale_t) -> crate::locale_t;
1711 pub fn utimensat(
1712 dirfd: c_int,
1713 path: *const c_char,
1714 times: *const crate::timespec,
1715 flag: c_int,
1716 ) -> c_int;
1717
1718 pub fn ntp_adjtime(buf: *mut timex) -> c_int;
1719 pub fn ntp_gettime(buf: *mut ntptimeval) -> c_int;
1720
1721 // #include <link.h>
1722 pub fn dl_iterate_phdr(
1723 callback: Option<
1724 unsafe extern "C" fn(info: *mut dl_phdr_info, size: usize, data: *mut c_void) -> c_int,
1725 >,
1726 data: *mut c_void,
1727 ) -> c_int;
1728
1729 pub fn iconv_open(tocode: *const c_char, fromcode: *const c_char) -> iconv_t;
1730 pub fn iconv(
1731 cd: iconv_t,
1732 inbuf: *mut *mut c_char,
1733 inbytesleft: *mut size_t,
1734 outbuf: *mut *mut c_char,
1735 outbytesleft: *mut size_t,
1736 ) -> size_t;
1737 pub fn iconv_close(cd: iconv_t) -> c_int;
1738
1739 // Added in `FreeBSD` 11.0
1740 // Added in `DragonFly BSD` 5.4
1741 pub fn explicit_bzero(s: *mut c_void, len: size_t);
1742 // ISO/IEC 9899:2011 ("ISO C11") K.3.7.4.1
1743 pub fn memset_s(s: *mut c_void, smax: size_t, c: c_int, n: size_t) -> c_int;
1744 pub fn gethostid() -> c_long;
1745 pub fn sethostid(hostid: c_long);
1746
1747 pub fn eui64_aton(a: *const c_char, e: *mut eui64) -> c_int;
1748 pub fn eui64_ntoa(id: *const eui64, a: *mut c_char, len: size_t) -> c_int;
1749 pub fn eui64_ntohost(hostname: *mut c_char, len: size_t, id: *const eui64) -> c_int;
1750 pub fn eui64_hostton(hostname: *const c_char, id: *mut eui64) -> c_int;
1751
1752 pub fn eaccess(path: *const c_char, mode: c_int) -> c_int;
1753
1754 pub fn kenv(action: c_int, name: *const c_char, value: *mut c_char, len: c_int) -> c_int;
1755 pub fn reboot(howto: c_int) -> c_int;
1756
1757 pub fn exect(path: *const c_char, argv: *const *mut c_char, envp: *const *mut c_char) -> c_int;
1758 pub fn execvP(
1759 file: *const c_char,
1760 search_path: *const c_char,
1761 argv: *const *mut c_char,
1762 ) -> c_int;
1763
1764 pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int;
1765 pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int;
1766
1767 pub fn posix_spawn(
1768 pid: *mut crate::pid_t,
1769 path: *const c_char,
1770 file_actions: *const crate::posix_spawn_file_actions_t,
1771 attrp: *const crate::posix_spawnattr_t,
1772 argv: *const *mut c_char,
1773 envp: *const *mut c_char,
1774 ) -> c_int;
1775 pub fn posix_spawnp(
1776 pid: *mut crate::pid_t,
1777 file: *const c_char,
1778 file_actions: *const crate::posix_spawn_file_actions_t,
1779 attrp: *const crate::posix_spawnattr_t,
1780 argv: *const *mut c_char,
1781 envp: *const *mut c_char,
1782 ) -> c_int;
1783 pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int;
1784 pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int;
1785 pub fn posix_spawnattr_getsigdefault(
1786 attr: *const posix_spawnattr_t,
1787 default: *mut crate::sigset_t,
1788 ) -> c_int;
1789 pub fn posix_spawnattr_setsigdefault(
1790 attr: *mut posix_spawnattr_t,
1791 default: *const crate::sigset_t,
1792 ) -> c_int;
1793 pub fn posix_spawnattr_getsigmask(
1794 attr: *const posix_spawnattr_t,
1795 default: *mut crate::sigset_t,
1796 ) -> c_int;
1797 pub fn posix_spawnattr_setsigmask(
1798 attr: *mut posix_spawnattr_t,
1799 default: *const crate::sigset_t,
1800 ) -> c_int;
1801 pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int;
1802 pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int;
1803 pub fn posix_spawnattr_getpgroup(
1804 attr: *const posix_spawnattr_t,
1805 flags: *mut crate::pid_t,
1806 ) -> c_int;
1807 pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::pid_t) -> c_int;
1808 pub fn posix_spawnattr_getschedpolicy(
1809 attr: *const posix_spawnattr_t,
1810 flags: *mut c_int,
1811 ) -> c_int;
1812 pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int;
1813 pub fn posix_spawnattr_getschedparam(
1814 attr: *const posix_spawnattr_t,
1815 param: *mut crate::sched_param,
1816 ) -> c_int;
1817 pub fn posix_spawnattr_setschedparam(
1818 attr: *mut posix_spawnattr_t,
1819 param: *const crate::sched_param,
1820 ) -> c_int;
1821
1822 pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int;
1823 pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int;
1824 pub fn posix_spawn_file_actions_addopen(
1825 actions: *mut posix_spawn_file_actions_t,
1826 fd: c_int,
1827 path: *const c_char,
1828 oflag: c_int,
1829 mode: mode_t,
1830 ) -> c_int;
1831 pub fn posix_spawn_file_actions_addclose(
1832 actions: *mut posix_spawn_file_actions_t,
1833 fd: c_int,
1834 ) -> c_int;
1835 pub fn posix_spawn_file_actions_adddup2(
1836 actions: *mut posix_spawn_file_actions_t,
1837 fd: c_int,
1838 newfd: c_int,
1839 ) -> c_int;
1840 }
1841
1842 #[link(name = "rt")]
1843 extern "C" {
1844 pub fn mq_close(mqd: crate::mqd_t) -> c_int;
1845 pub fn mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int;
1846 pub fn mq_notify(mqd: crate::mqd_t, notification: *const crate::sigevent) -> c_int;
1847 pub fn mq_open(name: *const c_char, oflag: c_int, ...) -> crate::mqd_t;
1848 pub fn mq_receive(
1849 mqd: crate::mqd_t,
1850 msg_ptr: *mut c_char,
1851 msg_len: size_t,
1852 msg_prio: *mut c_uint,
1853 ) -> ssize_t;
1854 pub fn mq_send(
1855 mqd: crate::mqd_t,
1856 msg_ptr: *const c_char,
1857 msg_len: size_t,
1858 msg_prio: c_uint,
1859 ) -> c_int;
1860 pub fn mq_setattr(
1861 mqd: crate::mqd_t,
1862 newattr: *const crate::mq_attr,
1863 oldattr: *mut crate::mq_attr,
1864 ) -> c_int;
1865 pub fn mq_timedreceive(
1866 mqd: crate::mqd_t,
1867 msg_ptr: *mut c_char,
1868 msg_len: size_t,
1869 msg_prio: *mut c_uint,
1870 abs_timeout: *const crate::timespec,
1871 ) -> ssize_t;
1872 pub fn mq_timedsend(
1873 mqd: crate::mqd_t,
1874 msg_ptr: *const c_char,
1875 msg_len: size_t,
1876 msg_prio: c_uint,
1877 abs_timeout: *const crate::timespec,
1878 ) -> c_int;
1879 pub fn mq_unlink(name: *const c_char) -> c_int;
1880
1881 pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
1882 pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int;
1883 }
1884
1885 #[link(name = "util")]
1886 extern "C" {
1887 pub fn openpty(
1888 amaster: *mut c_int,
1889 aslave: *mut c_int,
1890 name: *mut c_char,
1891 termp: *mut termios,
1892 winp: *mut crate::winsize,
1893 ) -> c_int;
1894 pub fn forkpty(
1895 amaster: *mut c_int,
1896 name: *mut c_char,
1897 termp: *mut termios,
1898 winp: *mut crate::winsize,
1899 ) -> crate::pid_t;
1900 pub fn login_tty(fd: c_int) -> c_int;
1901 pub fn fparseln(
1902 stream: *mut crate::FILE,
1903 len: *mut size_t,
1904 lineno: *mut size_t,
1905 delim: *const c_char,
1906 flags: c_int,
1907 ) -> *mut c_char;
1908 }
1909
1910 #[link(name = "execinfo")]
1911 extern "C" {
1912 pub fn backtrace(addrlist: *mut *mut c_void, len: size_t) -> size_t;
1913 pub fn backtrace_symbols(addrlist: *const *mut c_void, len: size_t) -> *mut *mut c_char;
1914 pub fn backtrace_symbols_fd(addrlist: *const *mut c_void, len: size_t, fd: c_int) -> c_int;
1915 }
1916
1917 #[link(name = "kvm")]
1918 extern "C" {
1919 pub fn kvm_open(
1920 execfile: *const c_char,
1921 corefile: *const c_char,
1922 swapfile: *const c_char,
1923 flags: c_int,
1924 errstr: *const c_char,
1925 ) -> *mut crate::kvm_t;
1926 pub fn kvm_close(kd: *mut crate::kvm_t) -> c_int;
1927 pub fn kvm_getprocs(
1928 kd: *mut crate::kvm_t,
1929 op: c_int,
1930 arg: c_int,
1931 cnt: *mut c_int,
1932 ) -> *mut crate::kinfo_proc;
1933 pub fn kvm_getloadavg(kd: *mut kvm_t, loadavg: *mut c_double, nelem: c_int) -> c_int;
1934 pub fn kvm_openfiles(
1935 execfile: *const c_char,
1936 corefile: *const c_char,
1937 swapfile: *const c_char,
1938 flags: c_int,
1939 errbuf: *mut c_char,
1940 ) -> *mut crate::kvm_t;
1941 pub fn kvm_read(
1942 kd: *mut crate::kvm_t,
1943 addr: c_ulong,
1944 buf: *mut c_void,
1945 nbytes: size_t,
1946 ) -> ssize_t;
1947 pub fn kvm_write(
1948 kd: *mut crate::kvm_t,
1949 addr: c_ulong,
1950 buf: *const c_void,
1951 nbytes: size_t,
1952 ) -> ssize_t;
1953 }
1954
1955 cfg_if! {
1956 if #[cfg(target_os = "freebsd")] {
1957 mod freebsd;
1958 pub use self::freebsd::*;
1959 } else if #[cfg(target_os = "dragonfly")] {
1960 mod dragonfly;
1961 pub use self::dragonfly::*;
1962 } else {
1963 // ...
1964 }
1965 }