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