blob: 7d23e67106f3eb18c4fe43e7a320b19aeb20cc3c [file] [log] [blame]
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001//! Definitions found commonly among almost all Unix derivatives
2//!
3//! More functions and definitions can be found in the more specific modules
4//! according to the platform in question.
5
Taylor Cramerb4cfe882017-11-15 11:29:01 -08006// PUB_TYPE
7
gnzlbg5c1a6b82018-11-21 20:34:50 +01008pub type c_schar = i8;
9pub type c_uchar = u8;
10pub type c_short = i16;
11pub type c_ushort = u16;
12pub type c_int = i32;
13pub type c_uint = u32;
14pub type c_float = f32;
15pub type c_double = f64;
16pub type c_longlong = i64;
17pub type c_ulonglong = u64;
18pub type intmax_t = i64;
19pub type uintmax_t = u64;
20
gnzlbg5e2b0d82019-05-24 13:49:11 +020021pub type locale_t = *mut ::c_void;
22
gnzlbg5c1a6b82018-11-21 20:34:50 +010023pub type size_t = usize;
24pub type ptrdiff_t = isize;
25pub type intptr_t = isize;
26pub type uintptr_t = usize;
27pub type ssize_t = isize;
28
Taylor Cramerf7f9be32017-11-15 10:22:26 -080029pub type pid_t = i32;
30pub type uid_t = u32;
31pub type gid_t = u32;
32pub type in_addr_t = u32;
33pub type in_port_t = u16;
34pub type sighandler_t = ::size_t;
35pub type cc_t = ::c_uchar;
Taylor Cramerb4cfe882017-11-15 11:29:01 -080036pub type sa_family_t = u16;
37pub type pthread_key_t = ::c_uint;
38pub type speed_t = ::c_uint;
39pub type tcflag_t = ::c_uint;
40pub type clockid_t = ::c_int;
41pub type key_t = ::c_int;
42pub type id_t = ::c_uint;
43pub type useconds_t = u32;
44pub type dev_t = u64;
45pub type socklen_t = u32;
46pub type pthread_t = c_ulong;
47pub type mode_t = u32;
48pub type ino64_t = u64;
49pub type off64_t = i64;
50pub type blkcnt64_t = i64;
51pub type rlim64_t = u64;
52pub type mqd_t = ::c_int;
53pub type nfds_t = ::c_ulong;
54pub type nl_item = ::c_int;
55pub type idtype_t = ::c_uint;
56pub type loff_t = ::c_longlong;
Taylor Cramerf7f9be32017-11-15 10:22:26 -080057
Taylor Cramerb4cfe882017-11-15 11:29:01 -080058pub type __u8 = ::c_uchar;
59pub type __u16 = ::c_ushort;
60pub type __s16 = ::c_short;
61pub type __u32 = ::c_uint;
62pub type __s32 = ::c_int;
63
64pub type Elf32_Half = u16;
65pub type Elf32_Word = u32;
66pub type Elf32_Off = u32;
67pub type Elf32_Addr = u32;
68
69pub type Elf64_Half = u16;
70pub type Elf64_Word = u32;
71pub type Elf64_Off = u64;
72pub type Elf64_Addr = u64;
73pub type Elf64_Xword = u64;
74
75pub type clock_t = c_long;
76pub type time_t = c_long;
77pub type suseconds_t = c_long;
78pub type ino_t = u64;
79pub type off_t = i64;
80pub type blkcnt_t = i64;
81
82pub type shmatt_t = ::c_ulong;
83pub type msgqnum_t = ::c_ulong;
84pub type msglen_t = ::c_ulong;
85pub type fsblkcnt_t = ::c_ulonglong;
86pub type fsfilcnt_t = ::c_ulonglong;
87pub type rlim_t = ::c_ulonglong;
88
89pub type c_long = i64;
90pub type c_ulong = u64;
91
92// FIXME: why are these uninhabited types? that seems... wrong?
93// Presumably these should be `()` or an `extern type` (when that stabilizes).
Bryant Mairsfa9cb782019-01-23 07:18:32 -080094#[cfg_attr(feature = "extra_traits", derive(Debug))]
Taylor Cramerb4cfe882017-11-15 11:29:01 -080095pub enum timezone {}
gnzlbg7ac0fe52019-02-13 10:38:54 +010096impl ::Copy for timezone {}
97impl ::Clone for timezone {
Matthew Maurere9a2a712020-01-02 15:36:15 -080098 fn clone(&self) -> timezone {
99 *self
100 }
Bryant Mairsf3684582019-01-23 07:23:09 -0800101}
Bryant Mairsfa9cb782019-01-23 07:18:32 -0800102#[cfg_attr(feature = "extra_traits", derive(Debug))]
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800103pub enum DIR {}
gnzlbg7ac0fe52019-02-13 10:38:54 +0100104impl ::Copy for DIR {}
105impl ::Clone for DIR {
Matthew Maurere9a2a712020-01-02 15:36:15 -0800106 fn clone(&self) -> DIR {
107 *self
108 }
Bryant Mairsf3684582019-01-23 07:23:09 -0800109}
gnzlbg5e2b0d82019-05-24 13:49:11 +0200110
Bryant Mairsfa9cb782019-01-23 07:18:32 -0800111#[cfg_attr(feature = "extra_traits", derive(Debug))]
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800112pub enum fpos64_t {} // TODO: fill this out with a struct
gnzlbg7ac0fe52019-02-13 10:38:54 +0100113impl ::Copy for fpos64_t {}
114impl ::Clone for fpos64_t {
Matthew Maurere9a2a712020-01-02 15:36:15 -0800115 fn clone(&self) -> fpos64_t {
116 *self
117 }
Bryant Mairsf3684582019-01-23 07:23:09 -0800118}
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800119
120// PUB_STRUCT
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800121
122s! {
123 pub struct group {
124 pub gr_name: *mut ::c_char,
125 pub gr_passwd: *mut ::c_char,
126 pub gr_gid: ::gid_t,
127 pub gr_mem: *mut *mut ::c_char,
128 }
129
130 pub struct utimbuf {
131 pub actime: time_t,
132 pub modtime: time_t,
133 }
134
135 pub struct timeval {
136 pub tv_sec: time_t,
137 pub tv_usec: suseconds_t,
138 }
139
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800140 pub struct timespec {
141 pub tv_sec: time_t,
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800142 pub tv_nsec: ::c_long,
143 }
144
Taylor Cramer2f593702018-08-22 12:29:48 -0700145 // FIXME: the rlimit and rusage related functions and types don't exist
146 // within zircon. Are there reasons for keeping them around?
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800147 pub struct rlimit {
148 pub rlim_cur: rlim_t,
149 pub rlim_max: rlim_t,
150 }
151
152 pub struct rusage {
153 pub ru_utime: timeval,
154 pub ru_stime: timeval,
155 pub ru_maxrss: c_long,
156 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
157 __pad1: u32,
158 pub ru_ixrss: c_long,
159 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
160 __pad2: u32,
161 pub ru_idrss: c_long,
162 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
163 __pad3: u32,
164 pub ru_isrss: c_long,
165 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
166 __pad4: u32,
167 pub ru_minflt: c_long,
168 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
169 __pad5: u32,
170 pub ru_majflt: c_long,
171 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
172 __pad6: u32,
173 pub ru_nswap: c_long,
174 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
175 __pad7: u32,
176 pub ru_inblock: c_long,
177 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
178 __pad8: u32,
179 pub ru_oublock: c_long,
180 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
181 __pad9: u32,
182 pub ru_msgsnd: c_long,
183 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
184 __pad10: u32,
185 pub ru_msgrcv: c_long,
186 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
187 __pad11: u32,
188 pub ru_nsignals: c_long,
189 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
190 __pad12: u32,
191 pub ru_nvcsw: c_long,
192 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
193 __pad13: u32,
194 pub ru_nivcsw: c_long,
195 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
196 __pad14: u32,
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800197 }
198
199 pub struct in_addr {
200 pub s_addr: in_addr_t,
201 }
202
203 pub struct in6_addr {
Taylor Cramera0a4f8c2018-08-24 11:41:02 -0700204 pub s6_addr: [u8; 16],
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800205 }
206
207 pub struct ip_mreq {
208 pub imr_multiaddr: in_addr,
209 pub imr_interface: in_addr,
210 }
211
212 pub struct ipv6_mreq {
213 pub ipv6mr_multiaddr: in6_addr,
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800214 pub ipv6mr_interface: ::c_uint,
215 }
216
217 pub struct hostent {
218 pub h_name: *mut ::c_char,
219 pub h_aliases: *mut *mut ::c_char,
220 pub h_addrtype: ::c_int,
221 pub h_length: ::c_int,
222 pub h_addr_list: *mut *mut ::c_char,
223 }
224
225 pub struct iovec {
226 pub iov_base: *mut ::c_void,
227 pub iov_len: ::size_t,
228 }
229
230 pub struct pollfd {
231 pub fd: ::c_int,
232 pub events: ::c_short,
233 pub revents: ::c_short,
234 }
235
236 pub struct winsize {
237 pub ws_row: ::c_ushort,
238 pub ws_col: ::c_ushort,
239 pub ws_xpixel: ::c_ushort,
240 pub ws_ypixel: ::c_ushort,
241 }
242
243 pub struct linger {
244 pub l_onoff: ::c_int,
245 pub l_linger: ::c_int,
246 }
247
248 pub struct sigval {
249 // Actually a union of an int and a void*
250 pub sival_ptr: *mut ::c_void
251 }
252
253 // <sys/time.h>
254 pub struct itimerval {
255 pub it_interval: ::timeval,
256 pub it_value: ::timeval,
257 }
258
259 // <sys/times.h>
260 pub struct tms {
261 pub tms_utime: ::clock_t,
262 pub tms_stime: ::clock_t,
263 pub tms_cutime: ::clock_t,
264 pub tms_cstime: ::clock_t,
265 }
266
267 pub struct servent {
268 pub s_name: *mut ::c_char,
269 pub s_aliases: *mut *mut ::c_char,
270 pub s_port: ::c_int,
271 pub s_proto: *mut ::c_char,
272 }
273
274 pub struct protoent {
275 pub p_name: *mut ::c_char,
276 pub p_aliases: *mut *mut ::c_char,
277 pub p_proto: ::c_int,
278 }
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800279
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800280 pub struct aiocb {
281 pub aio_fildes: ::c_int,
282 pub aio_lio_opcode: ::c_int,
283 pub aio_reqprio: ::c_int,
284 pub aio_buf: *mut ::c_void,
285 pub aio_nbytes: ::size_t,
286 pub aio_sigevent: ::sigevent,
287 __td: *mut ::c_void,
288 __lock: [::c_int; 2],
289 __err: ::c_int,
290 __ret: ::ssize_t,
291 pub aio_offset: off_t,
292 __next: *mut ::c_void,
293 __prev: *mut ::c_void,
294 #[cfg(target_pointer_width = "32")]
295 __dummy4: [::c_char; 24],
296 #[cfg(target_pointer_width = "64")]
297 __dummy4: [::c_char; 16],
298 }
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800299
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800300 pub struct sigaction {
301 pub sa_sigaction: ::sighandler_t,
302 pub sa_mask: ::sigset_t,
303 pub sa_flags: ::c_int,
gnzlbg7ac0fe52019-02-13 10:38:54 +0100304 pub sa_restorer: ::Option<extern fn()>,
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800305 }
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800306
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800307 pub struct termios {
308 pub c_iflag: ::tcflag_t,
309 pub c_oflag: ::tcflag_t,
310 pub c_cflag: ::tcflag_t,
311 pub c_lflag: ::tcflag_t,
312 pub c_line: ::cc_t,
313 pub c_cc: [::cc_t; ::NCCS],
314 pub __c_ispeed: ::speed_t,
315 pub __c_ospeed: ::speed_t,
316 }
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800317
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800318 pub struct flock {
319 pub l_type: ::c_short,
320 pub l_whence: ::c_short,
321 pub l_start: ::off_t,
322 pub l_len: ::off_t,
323 pub l_pid: ::pid_t,
324 }
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800325
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800326 pub struct ucred {
327 pub pid: ::pid_t,
328 pub uid: ::uid_t,
329 pub gid: ::gid_t,
330 }
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800331
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800332 pub struct sockaddr {
333 pub sa_family: sa_family_t,
334 pub sa_data: [::c_char; 14],
335 }
336
337 pub struct sockaddr_in {
338 pub sin_family: sa_family_t,
339 pub sin_port: ::in_port_t,
340 pub sin_addr: ::in_addr,
341 pub sin_zero: [u8; 8],
342 }
343
344 pub struct sockaddr_in6 {
345 pub sin6_family: sa_family_t,
346 pub sin6_port: ::in_port_t,
347 pub sin6_flowinfo: u32,
348 pub sin6_addr: ::in6_addr,
349 pub sin6_scope_id: u32,
350 }
351
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800352 pub struct addrinfo {
353 pub ai_flags: ::c_int,
354 pub ai_family: ::c_int,
355 pub ai_socktype: ::c_int,
356 pub ai_protocol: ::c_int,
357 pub ai_addrlen: socklen_t,
358
359 pub ai_addr: *mut ::sockaddr,
360
361 pub ai_canonname: *mut c_char,
362
363 pub ai_next: *mut addrinfo,
364 }
365
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800366 pub struct sockaddr_ll {
367 pub sll_family: ::c_ushort,
368 pub sll_protocol: ::c_ushort,
369 pub sll_ifindex: ::c_int,
370 pub sll_hatype: ::c_ushort,
371 pub sll_pkttype: ::c_uchar,
372 pub sll_halen: ::c_uchar,
373 pub sll_addr: [::c_uchar; 8]
374 }
375
376 pub struct fd_set {
377 fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
378 }
379
380 pub struct tm {
381 pub tm_sec: ::c_int,
382 pub tm_min: ::c_int,
383 pub tm_hour: ::c_int,
384 pub tm_mday: ::c_int,
385 pub tm_mon: ::c_int,
386 pub tm_year: ::c_int,
387 pub tm_wday: ::c_int,
388 pub tm_yday: ::c_int,
389 pub tm_isdst: ::c_int,
390 pub tm_gmtoff: ::c_long,
391 pub tm_zone: *const ::c_char,
392 }
393
394 pub struct sched_param {
395 pub sched_priority: ::c_int,
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800396 pub sched_ss_low_priority: ::c_int,
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800397 pub sched_ss_repl_period: ::timespec,
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800398 pub sched_ss_init_budget: ::timespec,
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800399 pub sched_ss_max_repl: ::c_int,
400 }
401
402 pub struct Dl_info {
403 pub dli_fname: *const ::c_char,
404 pub dli_fbase: *mut ::c_void,
405 pub dli_sname: *const ::c_char,
406 pub dli_saddr: *mut ::c_void,
407 }
408
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800409 pub struct epoll_event {
gnzlbga0865262019-05-29 13:17:17 +0200410 pub events: u32,
411 pub u64: u64,
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800412 }
413
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800414 pub struct lconv {
415 pub decimal_point: *mut ::c_char,
416 pub thousands_sep: *mut ::c_char,
417 pub grouping: *mut ::c_char,
418 pub int_curr_symbol: *mut ::c_char,
419 pub currency_symbol: *mut ::c_char,
420 pub mon_decimal_point: *mut ::c_char,
421 pub mon_thousands_sep: *mut ::c_char,
422 pub mon_grouping: *mut ::c_char,
423 pub positive_sign: *mut ::c_char,
424 pub negative_sign: *mut ::c_char,
425 pub int_frac_digits: ::c_char,
426 pub frac_digits: ::c_char,
427 pub p_cs_precedes: ::c_char,
428 pub p_sep_by_space: ::c_char,
429 pub n_cs_precedes: ::c_char,
430 pub n_sep_by_space: ::c_char,
431 pub p_sign_posn: ::c_char,
432 pub n_sign_posn: ::c_char,
433 pub int_p_cs_precedes: ::c_char,
434 pub int_p_sep_by_space: ::c_char,
435 pub int_n_cs_precedes: ::c_char,
436 pub int_n_sep_by_space: ::c_char,
437 pub int_p_sign_posn: ::c_char,
438 pub int_n_sign_posn: ::c_char,
439 }
440
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800441 pub struct rlimit64 {
442 pub rlim_cur: rlim64_t,
443 pub rlim_max: rlim64_t,
444 }
445
446 pub struct glob_t {
447 pub gl_pathc: ::size_t,
448 pub gl_pathv: *mut *mut c_char,
449 pub gl_offs: ::size_t,
450 pub gl_flags: ::c_int,
451
452 __unused1: *mut ::c_void,
453 __unused2: *mut ::c_void,
454 __unused3: *mut ::c_void,
455 __unused4: *mut ::c_void,
456 __unused5: *mut ::c_void,
457 }
458
459 pub struct ifaddrs {
460 pub ifa_next: *mut ifaddrs,
461 pub ifa_name: *mut c_char,
462 pub ifa_flags: ::c_uint,
463 pub ifa_addr: *mut ::sockaddr,
464 pub ifa_netmask: *mut ::sockaddr,
465 pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
466 pub ifa_data: *mut ::c_void
467 }
468
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800469 pub struct passwd {
470 pub pw_name: *mut ::c_char,
471 pub pw_passwd: *mut ::c_char,
472 pub pw_uid: ::uid_t,
473 pub pw_gid: ::gid_t,
474 pub pw_gecos: *mut ::c_char,
475 pub pw_dir: *mut ::c_char,
476 pub pw_shell: *mut ::c_char,
477 }
478
479 pub struct spwd {
480 pub sp_namp: *mut ::c_char,
481 pub sp_pwdp: *mut ::c_char,
482 pub sp_lstchg: ::c_long,
483 pub sp_min: ::c_long,
484 pub sp_max: ::c_long,
485 pub sp_warn: ::c_long,
486 pub sp_inact: ::c_long,
487 pub sp_expire: ::c_long,
488 pub sp_flag: ::c_ulong,
489 }
490
491 pub struct statvfs {
492 pub f_bsize: ::c_ulong,
493 pub f_frsize: ::c_ulong,
494 pub f_blocks: ::fsblkcnt_t,
495 pub f_bfree: ::fsblkcnt_t,
496 pub f_bavail: ::fsblkcnt_t,
497 pub f_files: ::fsfilcnt_t,
498 pub f_ffree: ::fsfilcnt_t,
499 pub f_favail: ::fsfilcnt_t,
500 #[cfg(target_endian = "little")]
501 pub f_fsid: ::c_ulong,
502 #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))]
503 __f_unused: ::c_int,
504 #[cfg(target_endian = "big")]
505 pub f_fsid: ::c_ulong,
506 pub f_flag: ::c_ulong,
507 pub f_namemax: ::c_ulong,
508 __f_spare: [::c_int; 6],
509 }
510
511 pub struct dqblk {
gnzlbga0865262019-05-29 13:17:17 +0200512 pub dqb_bhardlimit: u64,
513 pub dqb_bsoftlimit: u64,
514 pub dqb_curspace: u64,
515 pub dqb_ihardlimit: u64,
516 pub dqb_isoftlimit: u64,
517 pub dqb_curinodes: u64,
518 pub dqb_btime: u64,
519 pub dqb_itime: u64,
520 pub dqb_valid: u32,
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800521 }
522
523 pub struct signalfd_siginfo {
gnzlbga0865262019-05-29 13:17:17 +0200524 pub ssi_signo: u32,
525 pub ssi_errno: i32,
526 pub ssi_code: i32,
527 pub ssi_pid: u32,
528 pub ssi_uid: u32,
529 pub ssi_fd: i32,
530 pub ssi_tid: u32,
531 pub ssi_band: u32,
532 pub ssi_overrun: u32,
533 pub ssi_trapno: u32,
534 pub ssi_status: i32,
535 pub ssi_int: i32,
536 pub ssi_ptr: u64,
537 pub ssi_utime: u64,
538 pub ssi_stime: u64,
539 pub ssi_addr: u64,
540 pub ssi_addr_lsb: u16,
541 _pad2: u16,
542 pub ssi_syscall: i32,
543 pub ssi_call_addr: u64,
544 pub ssi_arch: u32,
545 _pad: [u8; 28],
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800546 }
547
548 pub struct itimerspec {
549 pub it_interval: ::timespec,
550 pub it_value: ::timespec,
551 }
552
553 pub struct fsid_t {
554 __val: [::c_int; 2],
555 }
556
Taylor Cramerb4cfe882017-11-15 11:29:01 -0800557 pub struct cpu_set_t {
558 #[cfg(all(target_pointer_width = "32",
559 not(target_arch = "x86_64")))]
560 bits: [u32; 32],
561 #[cfg(not(all(target_pointer_width = "32",
562 not(target_arch = "x86_64"))))]
563 bits: [u64; 16],
564 }
565
566 pub struct if_nameindex {
567 pub if_index: ::c_uint,
568 pub if_name: *mut ::c_char,
569 }
570
571 // System V IPC
572 pub struct msginfo {
573 pub msgpool: ::c_int,
574 pub msgmap: ::c_int,
575 pub msgmax: ::c_int,
576 pub msgmnb: ::c_int,
577 pub msgmni: ::c_int,
578 pub msgssz: ::c_int,
579 pub msgtql: ::c_int,
580 pub msgseg: ::c_ushort,
581 }
582
583 pub struct mmsghdr {
584 pub msg_hdr: ::msghdr,
585 pub msg_len: ::c_uint,
586 }
587
588 pub struct sembuf {
589 pub sem_num: ::c_ushort,
590 pub sem_op: ::c_short,
591 pub sem_flg: ::c_short,
592 }
593
594 pub struct input_event {
595 pub time: ::timeval,
596 pub type_: ::__u16,
597 pub code: ::__u16,
598 pub value: ::__s32,
599 }
600
601 pub struct input_id {
602 pub bustype: ::__u16,
603 pub vendor: ::__u16,
604 pub product: ::__u16,
605 pub version: ::__u16,
606 }
607
608 pub struct input_absinfo {
609 pub value: ::__s32,
610 pub minimum: ::__s32,
611 pub maximum: ::__s32,
612 pub fuzz: ::__s32,
613 pub flat: ::__s32,
614 pub resolution: ::__s32,
615 }
616
617 pub struct input_keymap_entry {
618 pub flags: ::__u8,
619 pub len: ::__u8,
620 pub index: ::__u16,
621 pub keycode: ::__u32,
622 pub scancode: [::__u8; 32],
623 }
624
625 pub struct input_mask {
626 pub type_: ::__u32,
627 pub codes_size: ::__u32,
628 pub codes_ptr: ::__u64,
629 }
630
631 pub struct ff_replay {
632 pub length: ::__u16,
633 pub delay: ::__u16,
634 }
635
636 pub struct ff_trigger {
637 pub button: ::__u16,
638 pub interval: ::__u16,
639 }
640
641 pub struct ff_envelope {
642 pub attack_length: ::__u16,
643 pub attack_level: ::__u16,
644 pub fade_length: ::__u16,
645 pub fade_level: ::__u16,
646 }
647
648 pub struct ff_constant_effect {
649 pub level: ::__s16,
650 pub envelope: ff_envelope,
651 }
652
653 pub struct ff_ramp_effect {
654 pub start_level: ::__s16,
655 pub end_level: ::__s16,
656 pub envelope: ff_envelope,
657 }
658
659 pub struct ff_condition_effect {
660 pub right_saturation: ::__u16,
661 pub left_saturation: ::__u16,
662
663 pub right_coeff: ::__s16,
664 pub left_coeff: ::__s16,
665
666 pub deadband: ::__u16,
667 pub center: ::__s16,
668 }
669
670 pub struct ff_periodic_effect {
671 pub waveform: ::__u16,
672 pub period: ::__u16,
673 pub magnitude: ::__s16,
674 pub offset: ::__s16,
675 pub phase: ::__u16,
676
677 pub envelope: ff_envelope,
678
679 pub custom_len: ::__u32,
680 pub custom_data: *mut ::__s16,
681 }
682
683 pub struct ff_rumble_effect {
684 pub strong_magnitude: ::__u16,
685 pub weak_magnitude: ::__u16,
686 }
687
688 pub struct ff_effect {
689 pub type_: ::__u16,
690 pub id: ::__s16,
691 pub direction: ::__u16,
692 pub trigger: ff_trigger,
693 pub replay: ff_replay,
694 // FIXME this is actually a union
695 #[cfg(target_pointer_width = "64")]
696 pub u: [u64; 4],
697 #[cfg(target_pointer_width = "32")]
698 pub u: [u32; 7],
699 }
700
701 pub struct dl_phdr_info {
702 #[cfg(target_pointer_width = "64")]
703 pub dlpi_addr: Elf64_Addr,
704 #[cfg(target_pointer_width = "32")]
705 pub dlpi_addr: Elf32_Addr,
706
707 pub dlpi_name: *const ::c_char,
708
709 #[cfg(target_pointer_width = "64")]
710 pub dlpi_phdr: *const Elf64_Phdr,
711 #[cfg(target_pointer_width = "32")]
712 pub dlpi_phdr: *const Elf32_Phdr,
713
714 #[cfg(target_pointer_width = "64")]
715 pub dlpi_phnum: Elf64_Half,
716 #[cfg(target_pointer_width = "32")]
717 pub dlpi_phnum: Elf32_Half,
718
719 pub dlpi_adds: ::c_ulonglong,
720 pub dlpi_subs: ::c_ulonglong,
721 pub dlpi_tls_modid: ::size_t,
722 pub dlpi_tls_data: *mut ::c_void,
723 }
724
725 pub struct Elf32_Phdr {
726 pub p_type: Elf32_Word,
727 pub p_offset: Elf32_Off,
728 pub p_vaddr: Elf32_Addr,
729 pub p_paddr: Elf32_Addr,
730 pub p_filesz: Elf32_Word,
731 pub p_memsz: Elf32_Word,
732 pub p_flags: Elf32_Word,
733 pub p_align: Elf32_Word,
734 }
735
736 pub struct Elf64_Phdr {
737 pub p_type: Elf64_Word,
738 pub p_flags: Elf64_Word,
739 pub p_offset: Elf64_Off,
740 pub p_vaddr: Elf64_Addr,
741 pub p_paddr: Elf64_Addr,
742 pub p_filesz: Elf64_Xword,
743 pub p_memsz: Elf64_Xword,
744 pub p_align: Elf64_Xword,
745 }
746
747 pub struct statfs64 {
748 pub f_type: ::c_ulong,
749 pub f_bsize: ::c_ulong,
750 pub f_blocks: ::fsblkcnt_t,
751 pub f_bfree: ::fsblkcnt_t,
752 pub f_bavail: ::fsblkcnt_t,
753 pub f_files: ::fsfilcnt_t,
754 pub f_ffree: ::fsfilcnt_t,
755 pub f_fsid: ::fsid_t,
756 pub f_namelen: ::c_ulong,
757 pub f_frsize: ::c_ulong,
758 pub f_flags: ::c_ulong,
759 pub f_spare: [::c_ulong; 4],
760 }
761
762 pub struct statvfs64 {
763 pub f_bsize: ::c_ulong,
764 pub f_frsize: ::c_ulong,
765 pub f_blocks: u64,
766 pub f_bfree: u64,
767 pub f_bavail: u64,
768 pub f_files: u64,
769 pub f_ffree: u64,
770 pub f_favail: u64,
771 pub f_fsid: ::c_ulong,
772 pub f_flag: ::c_ulong,
773 pub f_namemax: ::c_ulong,
774 __f_spare: [::c_int; 6],
775 }
776
777 pub struct stack_t {
778 pub ss_sp: *mut ::c_void,
779 pub ss_flags: ::c_int,
780 pub ss_size: ::size_t
781 }
782
783 pub struct pthread_attr_t {
784 __size: [u64; 7]
785 }
786
787 pub struct sigset_t {
788 __val: [::c_ulong; 16],
789 }
790
791 pub struct shmid_ds {
792 pub shm_perm: ::ipc_perm,
793 pub shm_segsz: ::size_t,
794 pub shm_atime: ::time_t,
795 pub shm_dtime: ::time_t,
796 pub shm_ctime: ::time_t,
797 pub shm_cpid: ::pid_t,
798 pub shm_lpid: ::pid_t,
799 pub shm_nattch: ::c_ulong,
800 __pad1: ::c_ulong,
801 __pad2: ::c_ulong,
802 }
803
804 pub struct msqid_ds {
805 pub msg_perm: ::ipc_perm,
806 pub msg_stime: ::time_t,
807 pub msg_rtime: ::time_t,
808 pub msg_ctime: ::time_t,
809 __msg_cbytes: ::c_ulong,
810 pub msg_qnum: ::msgqnum_t,
811 pub msg_qbytes: ::msglen_t,
812 pub msg_lspid: ::pid_t,
813 pub msg_lrpid: ::pid_t,
814 __pad1: ::c_ulong,
815 __pad2: ::c_ulong,
816 }
817
818 pub struct statfs {
819 pub f_type: ::c_ulong,
820 pub f_bsize: ::c_ulong,
821 pub f_blocks: ::fsblkcnt_t,
822 pub f_bfree: ::fsblkcnt_t,
823 pub f_bavail: ::fsblkcnt_t,
824 pub f_files: ::fsfilcnt_t,
825 pub f_ffree: ::fsfilcnt_t,
826 pub f_fsid: ::fsid_t,
827 pub f_namelen: ::c_ulong,
828 pub f_frsize: ::c_ulong,
829 pub f_flags: ::c_ulong,
830 pub f_spare: [::c_ulong; 4],
831 }
832
833 pub struct msghdr {
834 pub msg_name: *mut ::c_void,
835 pub msg_namelen: ::socklen_t,
836 pub msg_iov: *mut ::iovec,
837 pub msg_iovlen: ::c_int,
838 __pad1: ::c_int,
839 pub msg_control: *mut ::c_void,
840 pub msg_controllen: ::socklen_t,
841 __pad2: ::socklen_t,
842 pub msg_flags: ::c_int,
843 }
844
845 pub struct cmsghdr {
846 pub cmsg_len: ::socklen_t,
847 pub __pad1: ::c_int,
848 pub cmsg_level: ::c_int,
849 pub cmsg_type: ::c_int,
850 }
851
852 pub struct sem_t {
853 __val: [::c_int; 8],
854 }
855
856 pub struct siginfo_t {
857 pub si_signo: ::c_int,
858 pub si_errno: ::c_int,
859 pub si_code: ::c_int,
860 pub _pad: [::c_int; 29],
861 _align: [usize; 0],
862 }
863
864 pub struct termios2 {
865 pub c_iflag: ::tcflag_t,
866 pub c_oflag: ::tcflag_t,
867 pub c_cflag: ::tcflag_t,
868 pub c_lflag: ::tcflag_t,
869 pub c_line: ::cc_t,
870 pub c_cc: [::cc_t; 19],
871 pub c_ispeed: ::speed_t,
872 pub c_ospeed: ::speed_t,
Taylor Cramerf7f9be32017-11-15 10:22:26 -0800873 }
874}
875
gnzlbga17a91c2019-02-07 11:37:21 +0100876s_no_extra_traits! {
gnzlbga17a91c2019-02-07 11:37:21 +0100877 pub struct sysinfo {
878 pub uptime: ::c_ulong,
879 pub loads: [::c_ulong; 3],
880 pub totalram: ::c_ulong,
881 pub freeram: ::c_ulong,
882 pub sharedram: ::c_ulong,
883 pub bufferram: ::c_ulong,
884 pub totalswap: ::c_ulong,
885 pub freeswap: ::c_ulong,
886 pub procs: ::c_ushort,
887 pub pad: ::c_ushort,
888 pub totalhigh: ::c_ulong,
889 pub freehigh: ::c_ulong,
890 pub mem_unit: ::c_uint,
891 pub __reserved: [::c_char; 256],
892 }
893
gnzlbga17a91c2019-02-07 11:37:21 +0100894 pub struct sockaddr_un {
895 pub sun_family: sa_family_t,
896 pub sun_path: [::c_char; 108]
897 }
898
gnzlbga17a91c2019-02-07 11:37:21 +0100899 pub struct sockaddr_storage {
900 pub ss_family: sa_family_t,
901 __ss_align: ::size_t,
902 __ss_pad2: [u8; 128 - 2 * 8],
903 }
904
gnzlbga17a91c2019-02-07 11:37:21 +0100905 pub struct utsname {
906 pub sysname: [::c_char; 65],
907 pub nodename: [::c_char; 65],
908 pub release: [::c_char; 65],
909 pub version: [::c_char; 65],
910 pub machine: [::c_char; 65],
911 pub domainname: [::c_char; 65]
912 }
913
gnzlbga17a91c2019-02-07 11:37:21 +0100914 pub struct dirent {
915 pub d_ino: ::ino_t,
916 pub d_off: ::off_t,
917 pub d_reclen: ::c_ushort,
918 pub d_type: ::c_uchar,
919 pub d_name: [::c_char; 256],
920 }
921
gnzlbga17a91c2019-02-07 11:37:21 +0100922 pub struct dirent64 {
923 pub d_ino: ::ino64_t,
924 pub d_off: ::off64_t,
925 pub d_reclen: ::c_ushort,
926 pub d_type: ::c_uchar,
927 pub d_name: [::c_char; 256],
928 }
Bryant Mairs7d235af2019-05-27 08:37:42 -0700929
930 // x32 compatibility
931 // See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
932 pub struct mq_attr {
933 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
934 pub mq_flags: i64,
935 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
936 pub mq_maxmsg: i64,
937 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
938 pub mq_msgsize: i64,
939 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
940 pub mq_curmsgs: i64,
941 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
942 pad: [i64; 4],
943
944 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
945 pub mq_flags: ::c_long,
946 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
947 pub mq_maxmsg: ::c_long,
948 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
949 pub mq_msgsize: ::c_long,
950 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
951 pub mq_curmsgs: ::c_long,
952 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
953 pad: [::c_long; 4],
954 }
Bryant Mairs0b345012019-05-27 08:45:28 -0700955
956 pub struct sockaddr_nl {
957 pub nl_family: ::sa_family_t,
958 nl_pad: ::c_ushort,
959 pub nl_pid: u32,
960 pub nl_groups: u32
961 }
Matthew Maurere9a2a712020-01-02 15:36:15 -0800962
963 pub struct sigevent {
964 pub sigev_value: ::sigval,
965 pub sigev_signo: ::c_int,
966 pub sigev_notify: ::c_int,
967 pub sigev_notify_function: fn(::sigval),
968 pub sigev_notify_attributes: *mut pthread_attr_t,
969 pub __pad: [::c_char; 56 - 3 * 8 /* 8 == sizeof(long) */],
970 }
gnzlbga17a91c2019-02-07 11:37:21 +0100971}
972
Bryant Mairs35280a02019-02-22 07:30:45 -0800973cfg_if! {
974 if #[cfg(feature = "extra_traits")] {
975 impl PartialEq for sysinfo {
976 fn eq(&self, other: &sysinfo) -> bool {
977 self.uptime == other.uptime
978 && self.loads == other.loads
979 && self.totalram == other.totalram
980 && self.freeram == other.freeram
981 && self.sharedram == other.sharedram
982 && self.bufferram == other.bufferram
983 && self.totalswap == other.totalswap
984 && self.freeswap == other.freeswap
985 && self.procs == other.procs
986 && self.pad == other.pad
987 && self.totalhigh == other.totalhigh
988 && self.freehigh == other.freehigh
989 && self.mem_unit == other.mem_unit
990 && self
991 .__reserved
992 .iter()
993 .zip(other.__reserved.iter())
994 .all(|(a,b)| a == b)
995 }
996 }
997 impl Eq for sysinfo {}
998 impl ::fmt::Debug for sysinfo {
999 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1000 f.debug_struct("sysinfo")
1001 .field("uptime", &self.uptime)
1002 .field("loads", &self.loads)
1003 .field("totalram", &self.totalram)
1004 .field("freeram", &self.freeram)
1005 .field("sharedram", &self.sharedram)
1006 .field("bufferram", &self.bufferram)
1007 .field("totalswap", &self.totalswap)
1008 .field("freeswap", &self.freeswap)
1009 .field("procs", &self.procs)
1010 .field("pad", &self.pad)
1011 .field("totalhigh", &self.totalhigh)
1012 .field("freehigh", &self.freehigh)
1013 .field("mem_unit", &self.mem_unit)
1014 // FIXME: .field("__reserved", &self.__reserved)
1015 .finish()
1016 }
1017 }
1018 impl ::hash::Hash for sysinfo {
1019 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1020 self.uptime.hash(state);
1021 self.loads.hash(state);
1022 self.totalram.hash(state);
1023 self.freeram.hash(state);
1024 self.sharedram.hash(state);
1025 self.bufferram.hash(state);
1026 self.totalswap.hash(state);
1027 self.freeswap.hash(state);
1028 self.procs.hash(state);
1029 self.pad.hash(state);
1030 self.totalhigh.hash(state);
1031 self.freehigh.hash(state);
1032 self.mem_unit.hash(state);
1033 self.__reserved.hash(state);
1034 }
1035 }
1036
1037 impl PartialEq for sockaddr_un {
1038 fn eq(&self, other: &sockaddr_un) -> bool {
1039 self.sun_family == other.sun_family
1040 && self
1041 .sun_path
1042 .iter()
1043 .zip(other.sun_path.iter())
1044 .all(|(a,b)| a == b)
1045 }
1046 }
1047 impl Eq for sockaddr_un {}
1048 impl ::fmt::Debug for sockaddr_un {
1049 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1050 f.debug_struct("sockaddr_un")
1051 .field("sun_family", &self.sun_family)
1052 // FIXME: .field("sun_path", &self.sun_path)
1053 .finish()
1054 }
1055 }
1056 impl ::hash::Hash for sockaddr_un {
1057 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1058 self.sun_family.hash(state);
1059 self.sun_path.hash(state);
1060 }
1061 }
1062
1063 impl PartialEq for sockaddr_storage {
1064 fn eq(&self, other: &sockaddr_storage) -> bool {
1065 self.ss_family == other.ss_family
1066 && self.__ss_align == other.__ss_align
1067 && self
1068 .__ss_pad2
1069 .iter()
1070 .zip(other.__ss_pad2.iter())
1071 .all(|(a, b)| a == b)
1072 }
1073 }
1074 impl Eq for sockaddr_storage {}
1075 impl ::fmt::Debug for sockaddr_storage {
1076 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1077 f.debug_struct("sockaddr_storage")
1078 .field("ss_family", &self.ss_family)
1079 .field("__ss_align", &self.__ss_align)
1080 // FIXME: .field("__ss_pad2", &self.__ss_pad2)
1081 .finish()
1082 }
1083 }
1084 impl ::hash::Hash for sockaddr_storage {
1085 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1086 self.ss_family.hash(state);
1087 self.__ss_align.hash(state);
1088 self.__ss_pad2.hash(state);
1089 }
1090 }
1091
1092 impl PartialEq for utsname {
1093 fn eq(&self, other: &utsname) -> bool {
1094 self.sysname
1095 .iter()
1096 .zip(other.sysname.iter())
1097 .all(|(a,b)| a == b)
1098 && self
1099 .nodename
1100 .iter()
1101 .zip(other.nodename.iter())
1102 .all(|(a,b)| a == b)
1103 && self
1104 .release
1105 .iter()
1106 .zip(other.release.iter())
1107 .all(|(a,b)| a == b)
1108 && self
1109 .version
1110 .iter()
1111 .zip(other.version.iter())
1112 .all(|(a,b)| a == b)
1113 && self
1114 .machine
1115 .iter()
1116 .zip(other.machine.iter())
1117 .all(|(a,b)| a == b)
1118 }
1119 }
1120 impl Eq for utsname {}
1121 impl ::fmt::Debug for utsname {
1122 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1123 f.debug_struct("utsname")
1124 // FIXME: .field("sysname", &self.sysname)
1125 // FIXME: .field("nodename", &self.nodename)
1126 // FIXME: .field("release", &self.release)
1127 // FIXME: .field("version", &self.version)
1128 // FIXME: .field("machine", &self.machine)
1129 .finish()
1130 }
1131 }
1132 impl ::hash::Hash for utsname {
1133 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1134 self.sysname.hash(state);
1135 self.nodename.hash(state);
1136 self.release.hash(state);
1137 self.version.hash(state);
1138 self.machine.hash(state);
1139 }
1140 }
1141
1142 impl PartialEq for dirent {
1143 fn eq(&self, other: &dirent) -> bool {
1144 self.d_ino == other.d_ino
1145 && self.d_off == other.d_off
1146 && self.d_reclen == other.d_reclen
1147 && self.d_type == other.d_type
1148 && self
1149 .d_name
1150 .iter()
1151 .zip(other.d_name.iter())
1152 .all(|(a,b)| a == b)
1153 }
1154 }
1155 impl Eq for dirent {}
1156 impl ::fmt::Debug for dirent {
1157 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1158 f.debug_struct("dirent")
1159 .field("d_ino", &self.d_ino)
1160 .field("d_off", &self.d_off)
1161 .field("d_reclen", &self.d_reclen)
1162 .field("d_type", &self.d_type)
1163 // FIXME: .field("d_name", &self.d_name)
1164 .finish()
1165 }
1166 }
1167 impl ::hash::Hash for dirent {
1168 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1169 self.d_ino.hash(state);
1170 self.d_off.hash(state);
1171 self.d_reclen.hash(state);
1172 self.d_type.hash(state);
1173 self.d_name.hash(state);
1174 }
1175 }
1176
1177 impl PartialEq for dirent64 {
1178 fn eq(&self, other: &dirent64) -> bool {
1179 self.d_ino == other.d_ino
1180 && self.d_off == other.d_off
1181 && self.d_reclen == other.d_reclen
1182 && self.d_type == other.d_type
1183 && self
1184 .d_name
1185 .iter()
1186 .zip(other.d_name.iter())
1187 .all(|(a,b)| a == b)
1188 }
1189 }
1190 impl Eq for dirent64 {}
1191 impl ::fmt::Debug for dirent64 {
1192 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1193 f.debug_struct("dirent64")
1194 .field("d_ino", &self.d_ino)
1195 .field("d_off", &self.d_off)
1196 .field("d_reclen", &self.d_reclen)
1197 .field("d_type", &self.d_type)
1198 // FIXME: .field("d_name", &self.d_name)
1199 .finish()
1200 }
1201 }
1202 impl ::hash::Hash for dirent64 {
1203 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1204 self.d_ino.hash(state);
1205 self.d_off.hash(state);
1206 self.d_reclen.hash(state);
1207 self.d_type.hash(state);
1208 self.d_name.hash(state);
1209 }
1210 }
Bryant Mairs7d235af2019-05-27 08:37:42 -07001211
1212 impl PartialEq for mq_attr {
1213 fn eq(&self, other: &mq_attr) -> bool {
1214 self.mq_flags == other.mq_flags &&
1215 self.mq_maxmsg == other.mq_maxmsg &&
1216 self.mq_msgsize == other.mq_msgsize &&
1217 self.mq_curmsgs == other.mq_curmsgs
1218 }
1219 }
1220 impl Eq for mq_attr {}
1221 impl ::fmt::Debug for mq_attr {
1222 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1223 f.debug_struct("mq_attr")
1224 .field("mq_flags", &self.mq_flags)
1225 .field("mq_maxmsg", &self.mq_maxmsg)
1226 .field("mq_msgsize", &self.mq_msgsize)
1227 .field("mq_curmsgs", &self.mq_curmsgs)
1228 .finish()
1229 }
1230 }
1231 impl ::hash::Hash for mq_attr {
1232 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1233 self.mq_flags.hash(state);
1234 self.mq_maxmsg.hash(state);
1235 self.mq_msgsize.hash(state);
1236 self.mq_curmsgs.hash(state);
1237 }
1238 }
Bryant Mairs0b345012019-05-27 08:45:28 -07001239
1240 impl PartialEq for sockaddr_nl {
1241 fn eq(&self, other: &sockaddr_nl) -> bool {
1242 self.nl_family == other.nl_family &&
1243 self.nl_pid == other.nl_pid &&
1244 self.nl_groups == other.nl_groups
1245 }
1246 }
1247 impl Eq for sockaddr_nl {}
1248 impl ::fmt::Debug for sockaddr_nl {
1249 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1250 f.debug_struct("sockaddr_nl")
1251 .field("nl_family", &self.nl_family)
1252 .field("nl_pid", &self.nl_pid)
1253 .field("nl_groups", &self.nl_groups)
1254 .finish()
1255 }
1256 }
1257 impl ::hash::Hash for sockaddr_nl {
1258 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1259 self.nl_family.hash(state);
1260 self.nl_pid.hash(state);
1261 self.nl_groups.hash(state);
1262 }
1263 }
Matthew Maurere9a2a712020-01-02 15:36:15 -08001264
1265 impl PartialEq for sigevent {
1266 fn eq(&self, other: &sigevent) -> bool {
1267 self.sigev_value == other.sigev_value
1268 && self.sigev_signo == other.sigev_signo
1269 && self.sigev_notify == other.sigev_notify
1270 && self.sigev_notify_function
1271 == other.sigev_notify_function
1272 && self.sigev_notify_attributes
1273 == other.sigev_notify_attributes
1274 }
1275 }
1276 impl Eq for sigevent {}
1277 impl ::fmt::Debug for sigevent {
1278 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
1279 f.debug_struct("sigevent")
1280 .field("sigev_value", &self.sigev_value)
1281 .field("sigev_signo", &self.sigev_signo)
1282 .field("sigev_notify", &self.sigev_notify)
1283 .field("sigev_notify_function", &self.sigev_notify_function)
1284 .field("sigev_notify_attributes",
1285 &self.sigev_notify_attributes)
1286 .finish()
1287 }
1288 }
1289 impl ::hash::Hash for sigevent {
1290 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
1291 self.sigev_value.hash(state);
1292 self.sigev_signo.hash(state);
1293 self.sigev_notify.hash(state);
1294 self.sigev_notify_function.hash(state);
1295 self.sigev_notify_attributes.hash(state);
1296 }
1297 }
Bryant Mairs35280a02019-02-22 07:30:45 -08001298 }
1299}
1300
Taylor Cramerb4cfe882017-11-15 11:29:01 -08001301// PUB_CONST
1302
gnzlbg5c1a6b82018-11-21 20:34:50 +01001303pub const INT_MIN: c_int = -2147483648;
1304pub const INT_MAX: c_int = 2147483647;
1305
Taylor Cramerb4cfe882017-11-15 11:29:01 -08001306pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
1307pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
1308pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
1309
1310pub const DT_FIFO: u8 = 1;
1311pub const DT_CHR: u8 = 2;
1312pub const DT_DIR: u8 = 4;
1313pub const DT_BLK: u8 = 6;
1314pub const DT_REG: u8 = 8;
1315pub const DT_LNK: u8 = 10;
1316pub const DT_SOCK: u8 = 12;
1317
1318pub const FD_CLOEXEC: ::c_int = 0x1;
1319
1320pub const USRQUOTA: ::c_int = 0;
1321pub const GRPQUOTA: ::c_int = 1;
1322
1323pub const SIGIOT: ::c_int = 6;
1324
1325pub const S_ISUID: ::c_int = 0x800;
1326pub const S_ISGID: ::c_int = 0x400;
1327pub const S_ISVTX: ::c_int = 0x200;
1328
1329pub const IF_NAMESIZE: ::size_t = 16;
1330
1331pub const LOG_EMERG: ::c_int = 0;
1332pub const LOG_ALERT: ::c_int = 1;
1333pub const LOG_CRIT: ::c_int = 2;
1334pub const LOG_ERR: ::c_int = 3;
1335pub const LOG_WARNING: ::c_int = 4;
1336pub const LOG_NOTICE: ::c_int = 5;
1337pub const LOG_INFO: ::c_int = 6;
1338pub const LOG_DEBUG: ::c_int = 7;
1339
1340pub const LOG_KERN: ::c_int = 0;
1341pub const LOG_USER: ::c_int = 1 << 3;
1342pub const LOG_MAIL: ::c_int = 2 << 3;
1343pub const LOG_DAEMON: ::c_int = 3 << 3;
1344pub const LOG_AUTH: ::c_int = 4 << 3;
1345pub const LOG_SYSLOG: ::c_int = 5 << 3;
1346pub const LOG_LPR: ::c_int = 6 << 3;
1347pub const LOG_NEWS: ::c_int = 7 << 3;
1348pub const LOG_UUCP: ::c_int = 8 << 3;
1349pub const LOG_LOCAL0: ::c_int = 16 << 3;
1350pub const LOG_LOCAL1: ::c_int = 17 << 3;
1351pub const LOG_LOCAL2: ::c_int = 18 << 3;
1352pub const LOG_LOCAL3: ::c_int = 19 << 3;
1353pub const LOG_LOCAL4: ::c_int = 20 << 3;
1354pub const LOG_LOCAL5: ::c_int = 21 << 3;
1355pub const LOG_LOCAL6: ::c_int = 22 << 3;
1356pub const LOG_LOCAL7: ::c_int = 23 << 3;
1357
1358pub const LOG_PID: ::c_int = 0x01;
1359pub const LOG_CONS: ::c_int = 0x02;
1360pub const LOG_ODELAY: ::c_int = 0x04;
1361pub const LOG_NDELAY: ::c_int = 0x08;
1362pub const LOG_NOWAIT: ::c_int = 0x10;
1363
1364pub const LOG_PRIMASK: ::c_int = 7;
1365pub const LOG_FACMASK: ::c_int = 0x3f8;
1366
1367pub const PRIO_PROCESS: ::c_int = 0;
1368pub const PRIO_PGRP: ::c_int = 1;
1369pub const PRIO_USER: ::c_int = 2;
1370
1371pub const PRIO_MIN: ::c_int = -20;
1372pub const PRIO_MAX: ::c_int = 20;
1373
1374pub const IPPROTO_ICMP: ::c_int = 1;
1375pub const IPPROTO_ICMPV6: ::c_int = 58;
1376pub const IPPROTO_TCP: ::c_int = 6;
1377pub const IPPROTO_UDP: ::c_int = 17;
1378pub const IPPROTO_IP: ::c_int = 0;
1379pub const IPPROTO_IPV6: ::c_int = 41;
1380
1381pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
1382pub const INADDR_ANY: in_addr_t = 0;
1383pub const INADDR_BROADCAST: in_addr_t = 4294967295;
1384pub const INADDR_NONE: in_addr_t = 4294967295;
1385
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001386pub const EXIT_FAILURE: ::c_int = 1;
1387pub const EXIT_SUCCESS: ::c_int = 0;
1388pub const RAND_MAX: ::c_int = 2147483647;
1389pub const EOF: ::c_int = -1;
1390pub const SEEK_SET: ::c_int = 0;
1391pub const SEEK_CUR: ::c_int = 1;
1392pub const SEEK_END: ::c_int = 2;
1393pub const _IOFBF: ::c_int = 0;
1394pub const _IONBF: ::c_int = 2;
1395pub const _IOLBF: ::c_int = 1;
1396
1397pub const F_DUPFD: ::c_int = 0;
1398pub const F_GETFD: ::c_int = 1;
1399pub const F_SETFD: ::c_int = 2;
1400pub const F_GETFL: ::c_int = 3;
1401pub const F_SETFL: ::c_int = 4;
1402
1403// Linux-specific fcntls
1404pub const F_SETLEASE: ::c_int = 1024;
1405pub const F_GETLEASE: ::c_int = 1025;
1406pub const F_NOTIFY: ::c_int = 1026;
1407pub const F_CANCELLK: ::c_int = 1029;
1408pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
1409pub const F_SETPIPE_SZ: ::c_int = 1031;
1410pub const F_GETPIPE_SZ: ::c_int = 1032;
1411pub const F_ADD_SEALS: ::c_int = 1033;
1412pub const F_GET_SEALS: ::c_int = 1034;
1413
1414pub const F_SEAL_SEAL: ::c_int = 0x0001;
1415pub const F_SEAL_SHRINK: ::c_int = 0x0002;
1416pub const F_SEAL_GROW: ::c_int = 0x0004;
1417pub const F_SEAL_WRITE: ::c_int = 0x0008;
1418
1419// TODO(#235): Include file sealing fcntls once we have a way to verify them.
1420
1421pub const SIGTRAP: ::c_int = 5;
1422
1423pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
1424pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
1425
1426pub const CLOCK_REALTIME: ::clockid_t = 0;
1427pub const CLOCK_MONOTONIC: ::clockid_t = 1;
1428pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
1429pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
1430pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4;
1431pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5;
1432pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6;
1433pub const CLOCK_BOOTTIME: ::clockid_t = 7;
1434pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8;
1435pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9;
1436// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
1437// 2014.) See also musl/mod.rs
1438// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
1439// pub const CLOCK_TAI: ::clockid_t = 11;
1440pub const TIMER_ABSTIME: ::c_int = 1;
1441
1442pub const RLIMIT_CPU: ::c_int = 0;
1443pub const RLIMIT_FSIZE: ::c_int = 1;
1444pub const RLIMIT_DATA: ::c_int = 2;
1445pub const RLIMIT_STACK: ::c_int = 3;
1446pub const RLIMIT_CORE: ::c_int = 4;
1447pub const RLIMIT_LOCKS: ::c_int = 10;
1448pub const RLIMIT_SIGPENDING: ::c_int = 11;
1449pub const RLIMIT_MSGQUEUE: ::c_int = 12;
1450pub const RLIMIT_NICE: ::c_int = 13;
1451pub const RLIMIT_RTPRIO: ::c_int = 14;
1452
1453pub const RUSAGE_SELF: ::c_int = 0;
1454
1455pub const O_RDONLY: ::c_int = 0;
1456pub const O_WRONLY: ::c_int = 1;
1457pub const O_RDWR: ::c_int = 2;
1458
1459pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
1460
1461pub const S_IFIFO: ::mode_t = 4096;
1462pub const S_IFCHR: ::mode_t = 8192;
1463pub const S_IFBLK: ::mode_t = 24576;
1464pub const S_IFDIR: ::mode_t = 16384;
1465pub const S_IFREG: ::mode_t = 32768;
1466pub const S_IFLNK: ::mode_t = 40960;
1467pub const S_IFSOCK: ::mode_t = 49152;
1468pub const S_IFMT: ::mode_t = 61440;
1469pub const S_IRWXU: ::mode_t = 448;
1470pub const S_IXUSR: ::mode_t = 64;
1471pub const S_IWUSR: ::mode_t = 128;
1472pub const S_IRUSR: ::mode_t = 256;
1473pub const S_IRWXG: ::mode_t = 56;
1474pub const S_IXGRP: ::mode_t = 8;
1475pub const S_IWGRP: ::mode_t = 16;
1476pub const S_IRGRP: ::mode_t = 32;
1477pub const S_IRWXO: ::mode_t = 7;
1478pub const S_IXOTH: ::mode_t = 1;
1479pub const S_IWOTH: ::mode_t = 2;
1480pub const S_IROTH: ::mode_t = 4;
1481pub const F_OK: ::c_int = 0;
1482pub const R_OK: ::c_int = 4;
1483pub const W_OK: ::c_int = 2;
1484pub const X_OK: ::c_int = 1;
1485pub const STDIN_FILENO: ::c_int = 0;
1486pub const STDOUT_FILENO: ::c_int = 1;
1487pub const STDERR_FILENO: ::c_int = 2;
1488pub const SIGHUP: ::c_int = 1;
1489pub const SIGINT: ::c_int = 2;
1490pub const SIGQUIT: ::c_int = 3;
1491pub const SIGILL: ::c_int = 4;
1492pub const SIGABRT: ::c_int = 6;
1493pub const SIGFPE: ::c_int = 8;
1494pub const SIGKILL: ::c_int = 9;
1495pub const SIGSEGV: ::c_int = 11;
1496pub const SIGPIPE: ::c_int = 13;
1497pub const SIGALRM: ::c_int = 14;
1498pub const SIGTERM: ::c_int = 15;
1499
1500pub const PROT_NONE: ::c_int = 0;
1501pub const PROT_READ: ::c_int = 1;
1502pub const PROT_WRITE: ::c_int = 2;
1503pub const PROT_EXEC: ::c_int = 4;
1504
1505pub const LC_CTYPE: ::c_int = 0;
1506pub const LC_NUMERIC: ::c_int = 1;
1507pub const LC_TIME: ::c_int = 2;
1508pub const LC_COLLATE: ::c_int = 3;
1509pub const LC_MONETARY: ::c_int = 4;
1510pub const LC_MESSAGES: ::c_int = 5;
1511pub const LC_ALL: ::c_int = 6;
1512pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
1513pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
1514pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
1515pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
1516pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
1517pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
1518// LC_ALL_MASK defined per platform
1519
1520pub const MAP_FILE: ::c_int = 0x0000;
1521pub const MAP_SHARED: ::c_int = 0x0001;
1522pub const MAP_PRIVATE: ::c_int = 0x0002;
1523pub const MAP_FIXED: ::c_int = 0x0010;
1524
1525pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
1526
1527// MS_ flags for msync(2)
1528pub const MS_ASYNC: ::c_int = 0x0001;
1529pub const MS_INVALIDATE: ::c_int = 0x0002;
1530pub const MS_SYNC: ::c_int = 0x0004;
1531
1532// MS_ flags for mount(2)
1533pub const MS_RDONLY: ::c_ulong = 0x01;
1534pub const MS_NOSUID: ::c_ulong = 0x02;
1535pub const MS_NODEV: ::c_ulong = 0x04;
1536pub const MS_NOEXEC: ::c_ulong = 0x08;
1537pub const MS_SYNCHRONOUS: ::c_ulong = 0x10;
1538pub const MS_REMOUNT: ::c_ulong = 0x20;
1539pub const MS_MANDLOCK: ::c_ulong = 0x40;
1540pub const MS_DIRSYNC: ::c_ulong = 0x80;
1541pub const MS_NOATIME: ::c_ulong = 0x0400;
1542pub const MS_NODIRATIME: ::c_ulong = 0x0800;
1543pub const MS_BIND: ::c_ulong = 0x1000;
1544pub const MS_MOVE: ::c_ulong = 0x2000;
1545pub const MS_REC: ::c_ulong = 0x4000;
1546pub const MS_SILENT: ::c_ulong = 0x8000;
1547pub const MS_POSIXACL: ::c_ulong = 0x010000;
1548pub const MS_UNBINDABLE: ::c_ulong = 0x020000;
1549pub const MS_PRIVATE: ::c_ulong = 0x040000;
1550pub const MS_SLAVE: ::c_ulong = 0x080000;
1551pub const MS_SHARED: ::c_ulong = 0x100000;
1552pub const MS_RELATIME: ::c_ulong = 0x200000;
1553pub const MS_KERNMOUNT: ::c_ulong = 0x400000;
1554pub const MS_I_VERSION: ::c_ulong = 0x800000;
1555pub const MS_STRICTATIME: ::c_ulong = 0x1000000;
1556pub const MS_ACTIVE: ::c_ulong = 0x40000000;
1557pub const MS_NOUSER: ::c_ulong = 0x80000000;
1558pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
1559pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
1560pub const MS_RMT_MASK: ::c_ulong = 0x800051;
1561
1562pub const EPERM: ::c_int = 1;
1563pub const ENOENT: ::c_int = 2;
1564pub const ESRCH: ::c_int = 3;
1565pub const EINTR: ::c_int = 4;
1566pub const EIO: ::c_int = 5;
1567pub const ENXIO: ::c_int = 6;
1568pub const E2BIG: ::c_int = 7;
1569pub const ENOEXEC: ::c_int = 8;
1570pub const EBADF: ::c_int = 9;
1571pub const ECHILD: ::c_int = 10;
1572pub const EAGAIN: ::c_int = 11;
1573pub const ENOMEM: ::c_int = 12;
1574pub const EACCES: ::c_int = 13;
1575pub const EFAULT: ::c_int = 14;
1576pub const ENOTBLK: ::c_int = 15;
1577pub const EBUSY: ::c_int = 16;
1578pub const EEXIST: ::c_int = 17;
1579pub const EXDEV: ::c_int = 18;
1580pub const ENODEV: ::c_int = 19;
1581pub const ENOTDIR: ::c_int = 20;
1582pub const EISDIR: ::c_int = 21;
1583pub const EINVAL: ::c_int = 22;
1584pub const ENFILE: ::c_int = 23;
1585pub const EMFILE: ::c_int = 24;
1586pub const ENOTTY: ::c_int = 25;
1587pub const ETXTBSY: ::c_int = 26;
1588pub const EFBIG: ::c_int = 27;
1589pub const ENOSPC: ::c_int = 28;
1590pub const ESPIPE: ::c_int = 29;
1591pub const EROFS: ::c_int = 30;
1592pub const EMLINK: ::c_int = 31;
1593pub const EPIPE: ::c_int = 32;
1594pub const EDOM: ::c_int = 33;
1595pub const ERANGE: ::c_int = 34;
1596pub const EWOULDBLOCK: ::c_int = EAGAIN;
1597
1598pub const SCM_RIGHTS: ::c_int = 0x01;
1599pub const SCM_CREDENTIALS: ::c_int = 0x02;
1600
1601pub const PROT_GROWSDOWN: ::c_int = 0x1000000;
1602pub const PROT_GROWSUP: ::c_int = 0x2000000;
1603
1604pub const MAP_TYPE: ::c_int = 0x000f;
1605
1606pub const MADV_NORMAL: ::c_int = 0;
1607pub const MADV_RANDOM: ::c_int = 1;
1608pub const MADV_SEQUENTIAL: ::c_int = 2;
1609pub const MADV_WILLNEED: ::c_int = 3;
1610pub const MADV_DONTNEED: ::c_int = 4;
1611pub const MADV_FREE: ::c_int = 8;
1612pub const MADV_REMOVE: ::c_int = 9;
1613pub const MADV_DONTFORK: ::c_int = 10;
1614pub const MADV_DOFORK: ::c_int = 11;
1615pub const MADV_MERGEABLE: ::c_int = 12;
1616pub const MADV_UNMERGEABLE: ::c_int = 13;
1617pub const MADV_HUGEPAGE: ::c_int = 14;
1618pub const MADV_NOHUGEPAGE: ::c_int = 15;
1619pub const MADV_DONTDUMP: ::c_int = 16;
1620pub const MADV_DODUMP: ::c_int = 17;
1621pub const MADV_HWPOISON: ::c_int = 100;
1622pub const MADV_SOFT_OFFLINE: ::c_int = 101;
1623
1624pub const IFF_UP: ::c_int = 0x1;
1625pub const IFF_BROADCAST: ::c_int = 0x2;
1626pub const IFF_DEBUG: ::c_int = 0x4;
1627pub const IFF_LOOPBACK: ::c_int = 0x8;
1628pub const IFF_POINTOPOINT: ::c_int = 0x10;
1629pub const IFF_NOTRAILERS: ::c_int = 0x20;
1630pub const IFF_RUNNING: ::c_int = 0x40;
1631pub const IFF_NOARP: ::c_int = 0x80;
1632pub const IFF_PROMISC: ::c_int = 0x100;
1633pub const IFF_ALLMULTI: ::c_int = 0x200;
1634pub const IFF_MASTER: ::c_int = 0x400;
1635pub const IFF_SLAVE: ::c_int = 0x800;
1636pub const IFF_MULTICAST: ::c_int = 0x1000;
1637pub const IFF_PORTSEL: ::c_int = 0x2000;
1638pub const IFF_AUTOMEDIA: ::c_int = 0x4000;
1639pub const IFF_DYNAMIC: ::c_int = 0x8000;
luozijun0f4ae0b2018-02-04 21:39:40 +08001640pub const IFF_TUN: ::c_int = 0x0001;
1641pub const IFF_TAP: ::c_int = 0x0002;
1642pub const IFF_NO_PI: ::c_int = 0x1000;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001643
1644pub const SOL_IP: ::c_int = 0;
1645pub const SOL_TCP: ::c_int = 6;
1646pub const SOL_UDP: ::c_int = 17;
1647pub const SOL_IPV6: ::c_int = 41;
1648pub const SOL_ICMPV6: ::c_int = 58;
1649pub const SOL_RAW: ::c_int = 255;
1650pub const SOL_DECNET: ::c_int = 261;
1651pub const SOL_X25: ::c_int = 262;
1652pub const SOL_PACKET: ::c_int = 263;
1653pub const SOL_ATM: ::c_int = 264;
1654pub const SOL_AAL: ::c_int = 265;
1655pub const SOL_IRDA: ::c_int = 266;
1656pub const SOL_NETBEUI: ::c_int = 267;
1657pub const SOL_LLC: ::c_int = 268;
1658pub const SOL_DCCP: ::c_int = 269;
1659pub const SOL_NETLINK: ::c_int = 270;
1660pub const SOL_TIPC: ::c_int = 271;
1661
1662pub const AF_UNSPEC: ::c_int = 0;
1663pub const AF_UNIX: ::c_int = 1;
1664pub const AF_LOCAL: ::c_int = 1;
1665pub const AF_INET: ::c_int = 2;
1666pub const AF_AX25: ::c_int = 3;
1667pub const AF_IPX: ::c_int = 4;
1668pub const AF_APPLETALK: ::c_int = 5;
1669pub const AF_NETROM: ::c_int = 6;
1670pub const AF_BRIDGE: ::c_int = 7;
1671pub const AF_ATMPVC: ::c_int = 8;
1672pub const AF_X25: ::c_int = 9;
1673pub const AF_INET6: ::c_int = 10;
1674pub const AF_ROSE: ::c_int = 11;
1675pub const AF_DECnet: ::c_int = 12;
1676pub const AF_NETBEUI: ::c_int = 13;
1677pub const AF_SECURITY: ::c_int = 14;
1678pub const AF_KEY: ::c_int = 15;
1679pub const AF_NETLINK: ::c_int = 16;
1680pub const AF_ROUTE: ::c_int = AF_NETLINK;
1681pub const AF_PACKET: ::c_int = 17;
1682pub const AF_ASH: ::c_int = 18;
1683pub const AF_ECONET: ::c_int = 19;
1684pub const AF_ATMSVC: ::c_int = 20;
1685pub const AF_RDS: ::c_int = 21;
1686pub const AF_SNA: ::c_int = 22;
1687pub const AF_IRDA: ::c_int = 23;
1688pub const AF_PPPOX: ::c_int = 24;
1689pub const AF_WANPIPE: ::c_int = 25;
1690pub const AF_LLC: ::c_int = 26;
1691pub const AF_CAN: ::c_int = 29;
1692pub const AF_TIPC: ::c_int = 30;
1693pub const AF_BLUETOOTH: ::c_int = 31;
1694pub const AF_IUCV: ::c_int = 32;
1695pub const AF_RXRPC: ::c_int = 33;
1696pub const AF_ISDN: ::c_int = 34;
1697pub const AF_PHONET: ::c_int = 35;
1698pub const AF_IEEE802154: ::c_int = 36;
1699pub const AF_CAIF: ::c_int = 37;
1700pub const AF_ALG: ::c_int = 38;
1701
1702pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
1703pub const PF_UNIX: ::c_int = AF_UNIX;
1704pub const PF_LOCAL: ::c_int = AF_LOCAL;
1705pub const PF_INET: ::c_int = AF_INET;
1706pub const PF_AX25: ::c_int = AF_AX25;
1707pub const PF_IPX: ::c_int = AF_IPX;
1708pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
1709pub const PF_NETROM: ::c_int = AF_NETROM;
1710pub const PF_BRIDGE: ::c_int = AF_BRIDGE;
1711pub const PF_ATMPVC: ::c_int = AF_ATMPVC;
1712pub const PF_X25: ::c_int = AF_X25;
1713pub const PF_INET6: ::c_int = AF_INET6;
1714pub const PF_ROSE: ::c_int = AF_ROSE;
1715pub const PF_DECnet: ::c_int = AF_DECnet;
1716pub const PF_NETBEUI: ::c_int = AF_NETBEUI;
1717pub const PF_SECURITY: ::c_int = AF_SECURITY;
1718pub const PF_KEY: ::c_int = AF_KEY;
1719pub const PF_NETLINK: ::c_int = AF_NETLINK;
1720pub const PF_ROUTE: ::c_int = AF_ROUTE;
1721pub const PF_PACKET: ::c_int = AF_PACKET;
1722pub const PF_ASH: ::c_int = AF_ASH;
1723pub const PF_ECONET: ::c_int = AF_ECONET;
1724pub const PF_ATMSVC: ::c_int = AF_ATMSVC;
1725pub const PF_RDS: ::c_int = AF_RDS;
1726pub const PF_SNA: ::c_int = AF_SNA;
1727pub const PF_IRDA: ::c_int = AF_IRDA;
1728pub const PF_PPPOX: ::c_int = AF_PPPOX;
1729pub const PF_WANPIPE: ::c_int = AF_WANPIPE;
1730pub const PF_LLC: ::c_int = AF_LLC;
1731pub const PF_CAN: ::c_int = AF_CAN;
1732pub const PF_TIPC: ::c_int = AF_TIPC;
1733pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
1734pub const PF_IUCV: ::c_int = AF_IUCV;
1735pub const PF_RXRPC: ::c_int = AF_RXRPC;
1736pub const PF_ISDN: ::c_int = AF_ISDN;
1737pub const PF_PHONET: ::c_int = AF_PHONET;
1738pub const PF_IEEE802154: ::c_int = AF_IEEE802154;
1739pub const PF_CAIF: ::c_int = AF_CAIF;
1740pub const PF_ALG: ::c_int = AF_ALG;
1741
1742pub const SOMAXCONN: ::c_int = 128;
1743
1744pub const MSG_OOB: ::c_int = 1;
1745pub const MSG_PEEK: ::c_int = 2;
1746pub const MSG_DONTROUTE: ::c_int = 4;
1747pub const MSG_CTRUNC: ::c_int = 8;
1748pub const MSG_TRUNC: ::c_int = 0x20;
1749pub const MSG_DONTWAIT: ::c_int = 0x40;
1750pub const MSG_EOR: ::c_int = 0x80;
1751pub const MSG_WAITALL: ::c_int = 0x100;
1752pub const MSG_FIN: ::c_int = 0x200;
1753pub const MSG_SYN: ::c_int = 0x400;
1754pub const MSG_CONFIRM: ::c_int = 0x800;
1755pub const MSG_RST: ::c_int = 0x1000;
1756pub const MSG_ERRQUEUE: ::c_int = 0x2000;
1757pub const MSG_NOSIGNAL: ::c_int = 0x4000;
1758pub const MSG_MORE: ::c_int = 0x8000;
1759pub const MSG_WAITFORONE: ::c_int = 0x10000;
1760pub const MSG_FASTOPEN: ::c_int = 0x20000000;
1761pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
1762
1763pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
1764
1765pub const SOCK_RAW: ::c_int = 3;
1766pub const SOCK_RDM: ::c_int = 4;
1767pub const IP_MULTICAST_IF: ::c_int = 32;
1768pub const IP_MULTICAST_TTL: ::c_int = 33;
1769pub const IP_MULTICAST_LOOP: ::c_int = 34;
1770pub const IP_TTL: ::c_int = 2;
1771pub const IP_HDRINCL: ::c_int = 3;
1772pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
1773pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
1774pub const IP_TRANSPARENT: ::c_int = 19;
Raph Levien709709d2018-02-28 15:41:50 -08001775pub const IPV6_UNICAST_HOPS: ::c_int = 16;
Benjamin Fry7ed55992018-02-25 10:58:44 -08001776pub const IPV6_MULTICAST_IF: ::c_int = 17;
1777pub const IPV6_MULTICAST_HOPS: ::c_int = 18;
1778pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001779pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
1780pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
Benjamin Fry7ed55992018-02-25 10:58:44 -08001781pub const IPV6_V6ONLY: ::c_int = 26;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001782
1783pub const TCP_NODELAY: ::c_int = 1;
1784pub const TCP_MAXSEG: ::c_int = 2;
1785pub const TCP_CORK: ::c_int = 3;
1786pub const TCP_KEEPIDLE: ::c_int = 4;
1787pub const TCP_KEEPINTVL: ::c_int = 5;
1788pub const TCP_KEEPCNT: ::c_int = 6;
1789pub const TCP_SYNCNT: ::c_int = 7;
1790pub const TCP_LINGER2: ::c_int = 8;
1791pub const TCP_DEFER_ACCEPT: ::c_int = 9;
1792pub const TCP_WINDOW_CLAMP: ::c_int = 10;
1793pub const TCP_INFO: ::c_int = 11;
1794pub const TCP_QUICKACK: ::c_int = 12;
1795pub const TCP_CONGESTION: ::c_int = 13;
1796
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001797pub const SO_DEBUG: ::c_int = 1;
1798
1799pub const SHUT_RD: ::c_int = 0;
1800pub const SHUT_WR: ::c_int = 1;
1801pub const SHUT_RDWR: ::c_int = 2;
1802
1803pub const LOCK_SH: ::c_int = 1;
1804pub const LOCK_EX: ::c_int = 2;
1805pub const LOCK_NB: ::c_int = 4;
1806pub const LOCK_UN: ::c_int = 8;
1807
1808pub const SS_ONSTACK: ::c_int = 1;
1809pub const SS_DISABLE: ::c_int = 2;
1810
1811pub const PATH_MAX: ::c_int = 4096;
1812
1813pub const FD_SETSIZE: usize = 1024;
1814
1815pub const EPOLLIN: ::c_int = 0x1;
1816pub const EPOLLPRI: ::c_int = 0x2;
1817pub const EPOLLOUT: ::c_int = 0x4;
1818pub const EPOLLRDNORM: ::c_int = 0x40;
1819pub const EPOLLRDBAND: ::c_int = 0x80;
1820pub const EPOLLWRNORM: ::c_int = 0x100;
1821pub const EPOLLWRBAND: ::c_int = 0x200;
1822pub const EPOLLMSG: ::c_int = 0x400;
1823pub const EPOLLERR: ::c_int = 0x8;
1824pub const EPOLLHUP: ::c_int = 0x10;
1825pub const EPOLLET: ::c_int = 0x80000000;
1826
1827pub const EPOLL_CTL_ADD: ::c_int = 1;
1828pub const EPOLL_CTL_MOD: ::c_int = 3;
1829pub const EPOLL_CTL_DEL: ::c_int = 2;
1830
1831pub const MNT_DETACH: ::c_int = 0x2;
1832pub const MNT_EXPIRE: ::c_int = 0x4;
1833
1834pub const Q_GETFMT: ::c_int = 0x800004;
1835pub const Q_GETINFO: ::c_int = 0x800005;
1836pub const Q_SETINFO: ::c_int = 0x800006;
gnzlbga0865262019-05-29 13:17:17 +02001837pub const QIF_BLIMITS: u32 = 1;
1838pub const QIF_SPACE: u32 = 2;
1839pub const QIF_ILIMITS: u32 = 4;
1840pub const QIF_INODES: u32 = 8;
1841pub const QIF_BTIME: u32 = 16;
1842pub const QIF_ITIME: u32 = 32;
1843pub const QIF_LIMITS: u32 = 5;
1844pub const QIF_USAGE: u32 = 10;
1845pub const QIF_TIMES: u32 = 48;
1846pub const QIF_ALL: u32 = 63;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001847
1848pub const MNT_FORCE: ::c_int = 0x1;
1849
1850pub const Q_SYNC: ::c_int = 0x800001;
1851pub const Q_QUOTAON: ::c_int = 0x800002;
1852pub const Q_QUOTAOFF: ::c_int = 0x800003;
1853pub const Q_GETQUOTA: ::c_int = 0x800007;
1854pub const Q_SETQUOTA: ::c_int = 0x800008;
1855
1856pub const TCIOFF: ::c_int = 2;
1857pub const TCION: ::c_int = 3;
1858pub const TCOOFF: ::c_int = 0;
1859pub const TCOON: ::c_int = 1;
1860pub const TCIFLUSH: ::c_int = 0;
1861pub const TCOFLUSH: ::c_int = 1;
1862pub const TCIOFLUSH: ::c_int = 2;
Matthew Maurere9a2a712020-01-02 15:36:15 -08001863pub const NL0: ::c_int = 0x00000000;
1864pub const NL1: ::c_int = 0x00000100;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001865pub const TAB0: ::c_int = 0x00000000;
Matthew Maurere9a2a712020-01-02 15:36:15 -08001866pub const CR0: ::c_int = 0x00000000;
1867pub const FF0: ::c_int = 0x00000000;
1868pub const BS0: ::c_int = 0x00000000;
1869pub const VT0: ::c_int = 0x00000000;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001870pub const VERASE: usize = 2;
1871pub const VKILL: usize = 3;
1872pub const VINTR: usize = 0;
1873pub const VQUIT: usize = 1;
1874pub const VLNEXT: usize = 15;
1875pub const IGNBRK: ::tcflag_t = 0x00000001;
1876pub const BRKINT: ::tcflag_t = 0x00000002;
1877pub const IGNPAR: ::tcflag_t = 0x00000004;
1878pub const PARMRK: ::tcflag_t = 0x00000008;
1879pub const INPCK: ::tcflag_t = 0x00000010;
1880pub const ISTRIP: ::tcflag_t = 0x00000020;
1881pub const INLCR: ::tcflag_t = 0x00000040;
1882pub const IGNCR: ::tcflag_t = 0x00000080;
1883pub const ICRNL: ::tcflag_t = 0x00000100;
1884pub const IXANY: ::tcflag_t = 0x00000800;
1885pub const IMAXBEL: ::tcflag_t = 0x00002000;
1886pub const OPOST: ::tcflag_t = 0x1;
1887pub const CS5: ::tcflag_t = 0x00000000;
1888pub const CRTSCTS: ::tcflag_t = 0x80000000;
1889pub const ECHO: ::tcflag_t = 0x00000008;
Matthew Maurere9a2a712020-01-02 15:36:15 -08001890pub const OCRNL: ::tcflag_t = 0o000010;
1891pub const ONOCR: ::tcflag_t = 0o000020;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001892pub const ONLRET: ::tcflag_t = 0o000040;
Matthew Maurere9a2a712020-01-02 15:36:15 -08001893pub const OFILL: ::tcflag_t = 0o000100;
1894pub const OFDEL: ::tcflag_t = 0o000200;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001895
1896pub const CLONE_VM: ::c_int = 0x100;
1897pub const CLONE_FS: ::c_int = 0x200;
1898pub const CLONE_FILES: ::c_int = 0x400;
1899pub const CLONE_SIGHAND: ::c_int = 0x800;
1900pub const CLONE_PTRACE: ::c_int = 0x2000;
1901pub const CLONE_VFORK: ::c_int = 0x4000;
1902pub const CLONE_PARENT: ::c_int = 0x8000;
1903pub const CLONE_THREAD: ::c_int = 0x10000;
1904pub const CLONE_NEWNS: ::c_int = 0x20000;
1905pub const CLONE_SYSVSEM: ::c_int = 0x40000;
1906pub const CLONE_SETTLS: ::c_int = 0x80000;
1907pub const CLONE_PARENT_SETTID: ::c_int = 0x100000;
1908pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
1909pub const CLONE_DETACHED: ::c_int = 0x400000;
1910pub const CLONE_UNTRACED: ::c_int = 0x800000;
1911pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
1912pub const CLONE_NEWUTS: ::c_int = 0x04000000;
1913pub const CLONE_NEWIPC: ::c_int = 0x08000000;
1914pub const CLONE_NEWUSER: ::c_int = 0x10000000;
1915pub const CLONE_NEWPID: ::c_int = 0x20000000;
1916pub const CLONE_NEWNET: ::c_int = 0x40000000;
1917pub const CLONE_IO: ::c_int = 0x80000000;
1918pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
1919
1920pub const WNOHANG: ::c_int = 0x00000001;
1921pub const WUNTRACED: ::c_int = 0x00000002;
1922pub const WSTOPPED: ::c_int = WUNTRACED;
1923pub const WEXITED: ::c_int = 0x00000004;
1924pub const WCONTINUED: ::c_int = 0x00000008;
1925pub const WNOWAIT: ::c_int = 0x01000000;
1926
gnzlbg7ac0fe52019-02-13 10:38:54 +01001927// ::Options set using PTRACE_SETOPTIONS.
Taylor Cramerf7f9be32017-11-15 10:22:26 -08001928pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001;
1929pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002;
1930pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004;
1931pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008;
1932pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010;
1933pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020;
1934pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040;
1935pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080;
1936pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
1937pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
1938pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
1939
1940// Wait extended result codes for the above trace options.
1941pub const PTRACE_EVENT_FORK: ::c_int = 1;
1942pub const PTRACE_EVENT_VFORK: ::c_int = 2;
1943pub const PTRACE_EVENT_CLONE: ::c_int = 3;
1944pub const PTRACE_EVENT_EXEC: ::c_int = 4;
1945pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5;
1946pub const PTRACE_EVENT_EXIT: ::c_int = 6;
1947pub const PTRACE_EVENT_SECCOMP: ::c_int = 7;
1948// PTRACE_EVENT_STOP was added to glibc in 2.26
1949// pub const PTRACE_EVENT_STOP: ::c_int = 128;
1950
1951pub const __WNOTHREAD: ::c_int = 0x20000000;
1952pub const __WALL: ::c_int = 0x40000000;
1953pub const __WCLONE: ::c_int = 0x80000000;
1954
1955pub const SPLICE_F_MOVE: ::c_uint = 0x01;
1956pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
1957pub const SPLICE_F_MORE: ::c_uint = 0x04;
1958pub const SPLICE_F_GIFT: ::c_uint = 0x08;
1959
1960pub const RTLD_LOCAL: ::c_int = 0;
1961pub const RTLD_LAZY: ::c_int = 1;
1962
1963pub const POSIX_FADV_NORMAL: ::c_int = 0;
1964pub const POSIX_FADV_RANDOM: ::c_int = 1;
1965pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
1966pub const POSIX_FADV_WILLNEED: ::c_int = 3;
1967
1968pub const AT_FDCWD: ::c_int = -100;
1969pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
1970pub const AT_REMOVEDIR: ::c_int = 0x200;
1971pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
1972pub const AT_NO_AUTOMOUNT: ::c_int = 0x800;
1973pub const AT_EMPTY_PATH: ::c_int = 0x1000;
1974
1975pub const LOG_CRON: ::c_int = 9 << 3;
1976pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
1977pub const LOG_FTP: ::c_int = 11 << 3;
1978pub const LOG_PERROR: ::c_int = 0x20;
1979
1980pub const PIPE_BUF: usize = 4096;
1981
1982pub const SI_LOAD_SHIFT: ::c_uint = 16;
1983
1984pub const SIGEV_SIGNAL: ::c_int = 0;
1985pub const SIGEV_NONE: ::c_int = 1;
1986pub const SIGEV_THREAD: ::c_int = 2;
1987
1988pub const P_ALL: idtype_t = 0;
1989pub const P_PID: idtype_t = 1;
1990pub const P_PGID: idtype_t = 2;
1991
1992pub const UTIME_OMIT: c_long = 1073741822;
1993pub const UTIME_NOW: c_long = 1073741823;
1994
1995pub const POLLIN: ::c_short = 0x1;
1996pub const POLLPRI: ::c_short = 0x2;
1997pub const POLLOUT: ::c_short = 0x4;
1998pub const POLLERR: ::c_short = 0x8;
1999pub const POLLHUP: ::c_short = 0x10;
2000pub const POLLNVAL: ::c_short = 0x20;
2001pub const POLLRDNORM: ::c_short = 0x040;
2002pub const POLLRDBAND: ::c_short = 0x080;
2003
Taylor Cramerf7f9be32017-11-15 10:22:26 -08002004pub const ABDAY_1: ::nl_item = 0x20000;
2005pub const ABDAY_2: ::nl_item = 0x20001;
2006pub const ABDAY_3: ::nl_item = 0x20002;
2007pub const ABDAY_4: ::nl_item = 0x20003;
2008pub const ABDAY_5: ::nl_item = 0x20004;
2009pub const ABDAY_6: ::nl_item = 0x20005;
2010pub const ABDAY_7: ::nl_item = 0x20006;
2011
2012pub const DAY_1: ::nl_item = 0x20007;
2013pub const DAY_2: ::nl_item = 0x20008;
2014pub const DAY_3: ::nl_item = 0x20009;
2015pub const DAY_4: ::nl_item = 0x2000A;
2016pub const DAY_5: ::nl_item = 0x2000B;
2017pub const DAY_6: ::nl_item = 0x2000C;
2018pub const DAY_7: ::nl_item = 0x2000D;
2019
2020pub const ABMON_1: ::nl_item = 0x2000E;
2021pub const ABMON_2: ::nl_item = 0x2000F;
2022pub const ABMON_3: ::nl_item = 0x20010;
2023pub const ABMON_4: ::nl_item = 0x20011;
2024pub const ABMON_5: ::nl_item = 0x20012;
2025pub const ABMON_6: ::nl_item = 0x20013;
2026pub const ABMON_7: ::nl_item = 0x20014;
2027pub const ABMON_8: ::nl_item = 0x20015;
2028pub const ABMON_9: ::nl_item = 0x20016;
2029pub const ABMON_10: ::nl_item = 0x20017;
2030pub const ABMON_11: ::nl_item = 0x20018;
2031pub const ABMON_12: ::nl_item = 0x20019;
2032
2033pub const MON_1: ::nl_item = 0x2001A;
2034pub const MON_2: ::nl_item = 0x2001B;
2035pub const MON_3: ::nl_item = 0x2001C;
2036pub const MON_4: ::nl_item = 0x2001D;
2037pub const MON_5: ::nl_item = 0x2001E;
2038pub const MON_6: ::nl_item = 0x2001F;
2039pub const MON_7: ::nl_item = 0x20020;
2040pub const MON_8: ::nl_item = 0x20021;
2041pub const MON_9: ::nl_item = 0x20022;
2042pub const MON_10: ::nl_item = 0x20023;
2043pub const MON_11: ::nl_item = 0x20024;
2044pub const MON_12: ::nl_item = 0x20025;
2045
2046pub const AM_STR: ::nl_item = 0x20026;
2047pub const PM_STR: ::nl_item = 0x20027;
2048
2049pub const D_T_FMT: ::nl_item = 0x20028;
2050pub const D_FMT: ::nl_item = 0x20029;
2051pub const T_FMT: ::nl_item = 0x2002A;
2052pub const T_FMT_AMPM: ::nl_item = 0x2002B;
2053
2054pub const ERA: ::nl_item = 0x2002C;
2055pub const ERA_D_FMT: ::nl_item = 0x2002E;
2056pub const ALT_DIGITS: ::nl_item = 0x2002F;
2057pub const ERA_D_T_FMT: ::nl_item = 0x20030;
2058pub const ERA_T_FMT: ::nl_item = 0x20031;
2059
2060pub const CODESET: ::nl_item = 14;
2061
2062pub const CRNCYSTR: ::nl_item = 0x4000F;
2063
2064pub const RUSAGE_THREAD: ::c_int = 1;
2065pub const RUSAGE_CHILDREN: ::c_int = -1;
2066
2067pub const RADIXCHAR: ::nl_item = 0x10000;
2068pub const THOUSEP: ::nl_item = 0x10001;
2069
2070pub const YESEXPR: ::nl_item = 0x50000;
2071pub const NOEXPR: ::nl_item = 0x50001;
2072pub const YESSTR: ::nl_item = 0x50002;
2073pub const NOSTR: ::nl_item = 0x50003;
2074
2075pub const FILENAME_MAX: ::c_uint = 4096;
2076pub const L_tmpnam: ::c_uint = 20;
2077pub const _PC_LINK_MAX: ::c_int = 0;
2078pub const _PC_MAX_CANON: ::c_int = 1;
2079pub const _PC_MAX_INPUT: ::c_int = 2;
2080pub const _PC_NAME_MAX: ::c_int = 3;
2081pub const _PC_PATH_MAX: ::c_int = 4;
2082pub const _PC_PIPE_BUF: ::c_int = 5;
2083pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
2084pub const _PC_NO_TRUNC: ::c_int = 7;
2085pub const _PC_VDISABLE: ::c_int = 8;
2086pub const _PC_SYNC_IO: ::c_int = 9;
2087pub const _PC_ASYNC_IO: ::c_int = 10;
2088pub const _PC_PRIO_IO: ::c_int = 11;
2089pub const _PC_SOCK_MAXBUF: ::c_int = 12;
2090pub const _PC_FILESIZEBITS: ::c_int = 13;
2091pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
2092pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
2093pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
2094pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
2095pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18;
2096pub const _PC_SYMLINK_MAX: ::c_int = 19;
2097pub const _PC_2_SYMLINKS: ::c_int = 20;
2098
2099pub const _SC_ARG_MAX: ::c_int = 0;
2100pub const _SC_CHILD_MAX: ::c_int = 1;
2101pub const _SC_CLK_TCK: ::c_int = 2;
2102pub const _SC_NGROUPS_MAX: ::c_int = 3;
2103pub const _SC_OPEN_MAX: ::c_int = 4;
2104pub const _SC_STREAM_MAX: ::c_int = 5;
2105pub const _SC_TZNAME_MAX: ::c_int = 6;
2106pub const _SC_JOB_CONTROL: ::c_int = 7;
2107pub const _SC_SAVED_IDS: ::c_int = 8;
2108pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
2109pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
2110pub const _SC_TIMERS: ::c_int = 11;
2111pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
2112pub const _SC_PRIORITIZED_IO: ::c_int = 13;
2113pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
2114pub const _SC_FSYNC: ::c_int = 15;
2115pub const _SC_MAPPED_FILES: ::c_int = 16;
2116pub const _SC_MEMLOCK: ::c_int = 17;
2117pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
2118pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
2119pub const _SC_MESSAGE_PASSING: ::c_int = 20;
2120pub const _SC_SEMAPHORES: ::c_int = 21;
2121pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
2122pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
2123pub const _SC_AIO_MAX: ::c_int = 24;
2124pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
2125pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
2126pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
2127pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
2128pub const _SC_VERSION: ::c_int = 29;
2129pub const _SC_PAGESIZE: ::c_int = 30;
2130pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
2131pub const _SC_RTSIG_MAX: ::c_int = 31;
2132pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
2133pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
2134pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
2135pub const _SC_TIMER_MAX: ::c_int = 35;
2136pub const _SC_BC_BASE_MAX: ::c_int = 36;
2137pub const _SC_BC_DIM_MAX: ::c_int = 37;
2138pub const _SC_BC_SCALE_MAX: ::c_int = 38;
2139pub const _SC_BC_STRING_MAX: ::c_int = 39;
2140pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
2141pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
2142pub const _SC_LINE_MAX: ::c_int = 43;
2143pub const _SC_RE_DUP_MAX: ::c_int = 44;
2144pub const _SC_2_VERSION: ::c_int = 46;
2145pub const _SC_2_C_BIND: ::c_int = 47;
2146pub const _SC_2_C_DEV: ::c_int = 48;
2147pub const _SC_2_FORT_DEV: ::c_int = 49;
2148pub const _SC_2_FORT_RUN: ::c_int = 50;
2149pub const _SC_2_SW_DEV: ::c_int = 51;
2150pub const _SC_2_LOCALEDEF: ::c_int = 52;
2151pub const _SC_UIO_MAXIOV: ::c_int = 60;
2152pub const _SC_IOV_MAX: ::c_int = 60;
2153pub const _SC_THREADS: ::c_int = 67;
2154pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
2155pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
2156pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
2157pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
2158pub const _SC_TTY_NAME_MAX: ::c_int = 72;
2159pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
2160pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
2161pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
2162pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
2163pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
2164pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
2165pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
2166pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
2167pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
2168pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82;
2169pub const _SC_NPROCESSORS_CONF: ::c_int = 83;
2170pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
2171pub const _SC_PHYS_PAGES: ::c_int = 85;
2172pub const _SC_AVPHYS_PAGES: ::c_int = 86;
2173pub const _SC_ATEXIT_MAX: ::c_int = 87;
2174pub const _SC_PASS_MAX: ::c_int = 88;
2175pub const _SC_XOPEN_VERSION: ::c_int = 89;
2176pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
2177pub const _SC_XOPEN_UNIX: ::c_int = 91;
2178pub const _SC_XOPEN_CRYPT: ::c_int = 92;
2179pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
2180pub const _SC_XOPEN_SHM: ::c_int = 94;
2181pub const _SC_2_CHAR_TERM: ::c_int = 95;
2182pub const _SC_2_UPE: ::c_int = 97;
2183pub const _SC_XOPEN_XPG2: ::c_int = 98;
2184pub const _SC_XOPEN_XPG3: ::c_int = 99;
2185pub const _SC_XOPEN_XPG4: ::c_int = 100;
2186pub const _SC_NZERO: ::c_int = 109;
2187pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
2188pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
2189pub const _SC_XBS5_LP64_OFF64: ::c_int = 127;
2190pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
2191pub const _SC_XOPEN_LEGACY: ::c_int = 129;
2192pub const _SC_XOPEN_REALTIME: ::c_int = 130;
2193pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
2194pub const _SC_ADVISORY_INFO: ::c_int = 132;
2195pub const _SC_BARRIERS: ::c_int = 133;
2196pub const _SC_CLOCK_SELECTION: ::c_int = 137;
2197pub const _SC_CPUTIME: ::c_int = 138;
2198pub const _SC_THREAD_CPUTIME: ::c_int = 139;
2199pub const _SC_MONOTONIC_CLOCK: ::c_int = 149;
2200pub const _SC_READER_WRITER_LOCKS: ::c_int = 153;
2201pub const _SC_SPIN_LOCKS: ::c_int = 154;
2202pub const _SC_REGEXP: ::c_int = 155;
2203pub const _SC_SHELL: ::c_int = 157;
2204pub const _SC_SPAWN: ::c_int = 159;
2205pub const _SC_SPORADIC_SERVER: ::c_int = 160;
2206pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161;
2207pub const _SC_TIMEOUTS: ::c_int = 164;
2208pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165;
2209pub const _SC_2_PBS: ::c_int = 168;
2210pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169;
2211pub const _SC_2_PBS_LOCATE: ::c_int = 170;
2212pub const _SC_2_PBS_MESSAGE: ::c_int = 171;
2213pub const _SC_2_PBS_TRACK: ::c_int = 172;
2214pub const _SC_SYMLOOP_MAX: ::c_int = 173;
2215pub const _SC_STREAMS: ::c_int = 174;
2216pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175;
2217pub const _SC_V6_ILP32_OFF32: ::c_int = 176;
2218pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177;
2219pub const _SC_V6_LP64_OFF64: ::c_int = 178;
2220pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179;
2221pub const _SC_HOST_NAME_MAX: ::c_int = 180;
2222pub const _SC_TRACE: ::c_int = 181;
2223pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182;
2224pub const _SC_TRACE_INHERIT: ::c_int = 183;
2225pub const _SC_TRACE_LOG: ::c_int = 184;
2226pub const _SC_IPV6: ::c_int = 235;
2227pub const _SC_RAW_SOCKETS: ::c_int = 236;
2228pub const _SC_V7_ILP32_OFF32: ::c_int = 237;
2229pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238;
2230pub const _SC_V7_LP64_OFF64: ::c_int = 239;
2231pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240;
2232pub const _SC_SS_REPL_MAX: ::c_int = 241;
2233pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242;
2234pub const _SC_TRACE_NAME_MAX: ::c_int = 243;
2235pub const _SC_TRACE_SYS_MAX: ::c_int = 244;
2236pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245;
2237pub const _SC_XOPEN_STREAMS: ::c_int = 246;
2238pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247;
2239pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248;
2240
2241pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
2242pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
2243
2244pub const GLOB_ERR: ::c_int = 1 << 0;
2245pub const GLOB_MARK: ::c_int = 1 << 1;
2246pub const GLOB_NOSORT: ::c_int = 1 << 2;
2247pub const GLOB_DOOFFS: ::c_int = 1 << 3;
2248pub const GLOB_NOCHECK: ::c_int = 1 << 4;
2249pub const GLOB_APPEND: ::c_int = 1 << 5;
2250pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
2251
2252pub const GLOB_NOSPACE: ::c_int = 1;
2253pub const GLOB_ABORTED: ::c_int = 2;
2254pub const GLOB_NOMATCH: ::c_int = 3;
2255
2256pub const POSIX_MADV_NORMAL: ::c_int = 0;
2257pub const POSIX_MADV_RANDOM: ::c_int = 1;
2258pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
2259pub const POSIX_MADV_WILLNEED: ::c_int = 3;
2260
2261pub const S_IEXEC: mode_t = 64;
2262pub const S_IWRITE: mode_t = 128;
2263pub const S_IREAD: mode_t = 256;
2264
2265pub const F_LOCK: ::c_int = 1;
2266pub const F_TEST: ::c_int = 3;
2267pub const F_TLOCK: ::c_int = 2;
2268pub const F_ULOCK: ::c_int = 0;
2269
2270pub const IFF_LOWER_UP: ::c_int = 0x10000;
2271pub const IFF_DORMANT: ::c_int = 0x20000;
2272pub const IFF_ECHO: ::c_int = 0x40000;
2273
2274pub const ST_RDONLY: ::c_ulong = 1;
2275pub const ST_NOSUID: ::c_ulong = 2;
2276pub const ST_NODEV: ::c_ulong = 4;
2277pub const ST_NOEXEC: ::c_ulong = 8;
2278pub const ST_SYNCHRONOUS: ::c_ulong = 16;
2279pub const ST_MANDLOCK: ::c_ulong = 64;
2280pub const ST_WRITE: ::c_ulong = 128;
2281pub const ST_APPEND: ::c_ulong = 256;
2282pub const ST_IMMUTABLE: ::c_ulong = 512;
2283pub const ST_NOATIME: ::c_ulong = 1024;
2284pub const ST_NODIRATIME: ::c_ulong = 2048;
2285
2286pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
2287pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
2288pub const RTLD_NODELETE: ::c_int = 0x1000;
2289pub const RTLD_NOW: ::c_int = 0x2;
2290
2291pub const TCP_MD5SIG: ::c_int = 14;
2292
Linus Färnstrand28196342018-07-21 00:47:01 +02002293align_const! {
2294 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
2295 size: [0; __SIZEOF_PTHREAD_MUTEX_T],
2296 };
2297 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
2298 size: [0; __SIZEOF_PTHREAD_COND_T],
2299 };
2300 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
2301 size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
2302 };
2303}
Taylor Cramerf7f9be32017-11-15 10:22:26 -08002304pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
2305pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
2306pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
2307pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
2308pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
2309pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
2310pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
2311
2312pub const RENAME_NOREPLACE: ::c_int = 1;
2313pub const RENAME_EXCHANGE: ::c_int = 2;
2314pub const RENAME_WHITEOUT: ::c_int = 4;
2315
2316pub const SCHED_OTHER: ::c_int = 0;
2317pub const SCHED_FIFO: ::c_int = 1;
2318pub const SCHED_RR: ::c_int = 2;
2319pub const SCHED_BATCH: ::c_int = 3;
2320pub const SCHED_IDLE: ::c_int = 5;
2321
2322// netinet/in.h
2323// NOTE: These are in addition to the constants defined in src/unix/mod.rs
2324
2325// IPPROTO_IP defined in src/unix/mod.rs
2326/// Hop-by-hop option header
2327pub const IPPROTO_HOPOPTS: ::c_int = 0;
2328// IPPROTO_ICMP defined in src/unix/mod.rs
2329/// group mgmt protocol
2330pub const IPPROTO_IGMP: ::c_int = 2;
2331/// for compatibility
2332pub const IPPROTO_IPIP: ::c_int = 4;
2333// IPPROTO_TCP defined in src/unix/mod.rs
2334/// exterior gateway protocol
2335pub const IPPROTO_EGP: ::c_int = 8;
2336/// pup
2337pub const IPPROTO_PUP: ::c_int = 12;
2338// IPPROTO_UDP defined in src/unix/mod.rs
2339/// xns idp
2340pub const IPPROTO_IDP: ::c_int = 22;
2341/// tp-4 w/ class negotiation
2342pub const IPPROTO_TP: ::c_int = 29;
2343/// DCCP
2344pub const IPPROTO_DCCP: ::c_int = 33;
2345// IPPROTO_IPV6 defined in src/unix/mod.rs
2346/// IP6 routing header
2347pub const IPPROTO_ROUTING: ::c_int = 43;
2348/// IP6 fragmentation header
2349pub const IPPROTO_FRAGMENT: ::c_int = 44;
2350/// resource reservation
2351pub const IPPROTO_RSVP: ::c_int = 46;
2352/// General Routing Encap.
2353pub const IPPROTO_GRE: ::c_int = 47;
2354/// IP6 Encap Sec. Payload
2355pub const IPPROTO_ESP: ::c_int = 50;
2356/// IP6 Auth Header
2357pub const IPPROTO_AH: ::c_int = 51;
2358// IPPROTO_ICMPV6 defined in src/unix/mod.rs
2359/// IP6 no next header
2360pub const IPPROTO_NONE: ::c_int = 59;
2361/// IP6 destination option
2362pub const IPPROTO_DSTOPTS: ::c_int = 60;
2363pub const IPPROTO_MTP: ::c_int = 92;
2364pub const IPPROTO_BEETPH: ::c_int = 94;
2365/// encapsulation header
2366pub const IPPROTO_ENCAP: ::c_int = 98;
2367/// Protocol indep. multicast
2368pub const IPPROTO_PIM: ::c_int = 103;
2369/// IP Payload Comp. Protocol
2370pub const IPPROTO_COMP: ::c_int = 108;
2371/// SCTP
2372pub const IPPROTO_SCTP: ::c_int = 132;
2373pub const IPPROTO_MH: ::c_int = 135;
2374pub const IPPROTO_UDPLITE: ::c_int = 136;
2375pub const IPPROTO_MPLS: ::c_int = 137;
2376/// raw IP packet
2377pub const IPPROTO_RAW: ::c_int = 255;
2378pub const IPPROTO_MAX: ::c_int = 256;
2379
2380pub const AF_IB: ::c_int = 27;
2381pub const AF_MPLS: ::c_int = 28;
2382pub const AF_NFC: ::c_int = 39;
2383pub const AF_VSOCK: ::c_int = 40;
2384pub const PF_IB: ::c_int = AF_IB;
2385pub const PF_MPLS: ::c_int = AF_MPLS;
2386pub const PF_NFC: ::c_int = AF_NFC;
2387pub const PF_VSOCK: ::c_int = AF_VSOCK;
2388
2389// System V IPC
2390pub const IPC_PRIVATE: ::key_t = 0;
2391
2392pub const IPC_CREAT: ::c_int = 0o1000;
2393pub const IPC_EXCL: ::c_int = 0o2000;
2394pub const IPC_NOWAIT: ::c_int = 0o4000;
2395
2396pub const IPC_RMID: ::c_int = 0;
2397pub const IPC_SET: ::c_int = 1;
2398pub const IPC_STAT: ::c_int = 2;
2399pub const IPC_INFO: ::c_int = 3;
2400pub const MSG_STAT: ::c_int = 11;
2401pub const MSG_INFO: ::c_int = 12;
2402
2403pub const MSG_NOERROR: ::c_int = 0o10000;
2404pub const MSG_EXCEPT: ::c_int = 0o20000;
2405pub const MSG_COPY: ::c_int = 0o40000;
2406
2407pub const SHM_R: ::c_int = 0o400;
2408pub const SHM_W: ::c_int = 0o200;
2409
2410pub const SHM_RDONLY: ::c_int = 0o10000;
2411pub const SHM_RND: ::c_int = 0o20000;
2412pub const SHM_REMAP: ::c_int = 0o40000;
2413pub const SHM_EXEC: ::c_int = 0o100000;
2414
2415pub const SHM_LOCK: ::c_int = 11;
2416pub const SHM_UNLOCK: ::c_int = 12;
2417
2418pub const SHM_HUGETLB: ::c_int = 0o4000;
2419pub const SHM_NORESERVE: ::c_int = 0o10000;
2420
2421pub const EPOLLRDHUP: ::c_int = 0x2000;
2422pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
2423pub const EPOLLONESHOT: ::c_int = 0x40000000;
2424
2425pub const QFMT_VFS_OLD: ::c_int = 1;
2426pub const QFMT_VFS_V0: ::c_int = 2;
2427pub const QFMT_VFS_V1: ::c_int = 4;
2428
2429pub const EFD_SEMAPHORE: ::c_int = 0x1;
2430
2431pub const LOG_NFACILITIES: ::c_int = 24;
2432
2433pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
2434
2435pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
2436pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
2437pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
2438pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
2439pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
2440pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32;
2441pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32;
2442
2443pub const AI_PASSIVE: ::c_int = 0x0001;
2444pub const AI_CANONNAME: ::c_int = 0x0002;
2445pub const AI_NUMERICHOST: ::c_int = 0x0004;
2446pub const AI_V4MAPPED: ::c_int = 0x0008;
2447pub const AI_ALL: ::c_int = 0x0010;
2448pub const AI_ADDRCONFIG: ::c_int = 0x0020;
2449
2450pub const AI_NUMERICSERV: ::c_int = 0x0400;
2451
2452pub const EAI_BADFLAGS: ::c_int = -1;
2453pub const EAI_NONAME: ::c_int = -2;
2454pub const EAI_AGAIN: ::c_int = -3;
2455pub const EAI_FAIL: ::c_int = -4;
2456pub const EAI_FAMILY: ::c_int = -6;
2457pub const EAI_SOCKTYPE: ::c_int = -7;
2458pub const EAI_SERVICE: ::c_int = -8;
2459pub const EAI_MEMORY: ::c_int = -10;
2460pub const EAI_OVERFLOW: ::c_int = -12;
2461
2462pub const NI_NUMERICHOST: ::c_int = 1;
2463pub const NI_NUMERICSERV: ::c_int = 2;
2464pub const NI_NOFQDN: ::c_int = 4;
2465pub const NI_NAMEREQD: ::c_int = 8;
2466pub const NI_DGRAM: ::c_int = 16;
2467
2468pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
2469pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
2470pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
2471
2472pub const EAI_SYSTEM: ::c_int = -11;
2473
2474pub const AIO_CANCELED: ::c_int = 0;
2475pub const AIO_NOTCANCELED: ::c_int = 1;
2476pub const AIO_ALLDONE: ::c_int = 2;
2477pub const LIO_READ: ::c_int = 0;
2478pub const LIO_WRITE: ::c_int = 1;
2479pub const LIO_NOP: ::c_int = 2;
2480pub const LIO_WAIT: ::c_int = 0;
2481pub const LIO_NOWAIT: ::c_int = 1;
2482
2483pub const MREMAP_MAYMOVE: ::c_int = 1;
2484pub const MREMAP_FIXED: ::c_int = 2;
2485
2486pub const PR_SET_PDEATHSIG: ::c_int = 1;
2487pub const PR_GET_PDEATHSIG: ::c_int = 2;
2488
2489pub const PR_GET_DUMPABLE: ::c_int = 3;
2490pub const PR_SET_DUMPABLE: ::c_int = 4;
2491
2492pub const PR_GET_UNALIGN: ::c_int = 5;
2493pub const PR_SET_UNALIGN: ::c_int = 6;
2494pub const PR_UNALIGN_NOPRINT: ::c_int = 1;
2495pub const PR_UNALIGN_SIGBUS: ::c_int = 2;
2496
2497pub const PR_GET_KEEPCAPS: ::c_int = 7;
2498pub const PR_SET_KEEPCAPS: ::c_int = 8;
2499
2500pub const PR_GET_FPEMU: ::c_int = 9;
2501pub const PR_SET_FPEMU: ::c_int = 10;
2502pub const PR_FPEMU_NOPRINT: ::c_int = 1;
2503pub const PR_FPEMU_SIGFPE: ::c_int = 2;
2504
2505pub const PR_GET_FPEXC: ::c_int = 11;
2506pub const PR_SET_FPEXC: ::c_int = 12;
2507pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80;
2508pub const PR_FP_EXC_DIV: ::c_int = 0x010000;
2509pub const PR_FP_EXC_OVF: ::c_int = 0x020000;
2510pub const PR_FP_EXC_UND: ::c_int = 0x040000;
2511pub const PR_FP_EXC_RES: ::c_int = 0x080000;
2512pub const PR_FP_EXC_INV: ::c_int = 0x100000;
2513pub const PR_FP_EXC_DISABLED: ::c_int = 0;
2514pub const PR_FP_EXC_NONRECOV: ::c_int = 1;
2515pub const PR_FP_EXC_ASYNC: ::c_int = 2;
2516pub const PR_FP_EXC_PRECISE: ::c_int = 3;
2517
2518pub const PR_GET_TIMING: ::c_int = 13;
2519pub const PR_SET_TIMING: ::c_int = 14;
2520pub const PR_TIMING_STATISTICAL: ::c_int = 0;
2521pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
2522
2523pub const PR_SET_NAME: ::c_int = 15;
2524pub const PR_GET_NAME: ::c_int = 16;
2525
2526pub const PR_GET_ENDIAN: ::c_int = 19;
2527pub const PR_SET_ENDIAN: ::c_int = 20;
2528pub const PR_ENDIAN_BIG: ::c_int = 0;
2529pub const PR_ENDIAN_LITTLE: ::c_int = 1;
2530pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2;
2531
2532pub const PR_GET_SECCOMP: ::c_int = 21;
2533pub const PR_SET_SECCOMP: ::c_int = 22;
2534
2535pub const PR_CAPBSET_READ: ::c_int = 23;
2536pub const PR_CAPBSET_DROP: ::c_int = 24;
2537
2538pub const PR_GET_TSC: ::c_int = 25;
2539pub const PR_SET_TSC: ::c_int = 26;
2540pub const PR_TSC_ENABLE: ::c_int = 1;
2541pub const PR_TSC_SIGSEGV: ::c_int = 2;
2542
2543pub const PR_GET_SECUREBITS: ::c_int = 27;
2544pub const PR_SET_SECUREBITS: ::c_int = 28;
2545
2546pub const PR_SET_TIMERSLACK: ::c_int = 29;
2547pub const PR_GET_TIMERSLACK: ::c_int = 30;
2548
2549pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31;
2550pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32;
2551
2552pub const PR_MCE_KILL: ::c_int = 33;
2553pub const PR_MCE_KILL_CLEAR: ::c_int = 0;
2554pub const PR_MCE_KILL_SET: ::c_int = 1;
2555
2556pub const PR_MCE_KILL_LATE: ::c_int = 0;
2557pub const PR_MCE_KILL_EARLY: ::c_int = 1;
2558pub const PR_MCE_KILL_DEFAULT: ::c_int = 2;
2559
2560pub const PR_MCE_KILL_GET: ::c_int = 34;
2561
2562pub const PR_SET_MM: ::c_int = 35;
2563pub const PR_SET_MM_START_CODE: ::c_int = 1;
2564pub const PR_SET_MM_END_CODE: ::c_int = 2;
2565pub const PR_SET_MM_START_DATA: ::c_int = 3;
2566pub const PR_SET_MM_END_DATA: ::c_int = 4;
2567pub const PR_SET_MM_START_STACK: ::c_int = 5;
2568pub const PR_SET_MM_START_BRK: ::c_int = 6;
2569pub const PR_SET_MM_BRK: ::c_int = 7;
2570pub const PR_SET_MM_ARG_START: ::c_int = 8;
2571pub const PR_SET_MM_ARG_END: ::c_int = 9;
2572pub const PR_SET_MM_ENV_START: ::c_int = 10;
2573pub const PR_SET_MM_ENV_END: ::c_int = 11;
2574pub const PR_SET_MM_AUXV: ::c_int = 12;
2575pub const PR_SET_MM_EXE_FILE: ::c_int = 13;
2576pub const PR_SET_MM_MAP: ::c_int = 14;
2577pub const PR_SET_MM_MAP_SIZE: ::c_int = 15;
2578
2579pub const PR_SET_PTRACER: ::c_int = 0x59616d61;
2580
2581pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36;
2582pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37;
2583
2584pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38;
2585pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39;
2586
2587pub const PR_GET_TID_ADDRESS: ::c_int = 40;
2588
2589pub const PR_SET_THP_DISABLE: ::c_int = 41;
2590pub const PR_GET_THP_DISABLE: ::c_int = 42;
2591
2592pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43;
2593pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44;
2594
2595pub const PR_SET_FP_MODE: ::c_int = 45;
2596pub const PR_GET_FP_MODE: ::c_int = 46;
2597pub const PR_FP_MODE_FR: ::c_int = 1 << 0;
2598pub const PR_FP_MODE_FRE: ::c_int = 1 << 1;
2599
2600pub const PR_CAP_AMBIENT: ::c_int = 47;
2601pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1;
2602pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2;
2603pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3;
2604pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4;
2605
Taylor Cramerf7f9be32017-11-15 10:22:26 -08002606pub const ITIMER_REAL: ::c_int = 0;
2607pub const ITIMER_VIRTUAL: ::c_int = 1;
2608pub const ITIMER_PROF: ::c_int = 2;
2609
2610pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC;
2611pub const TFD_NONBLOCK: ::c_int = O_NONBLOCK;
2612pub const TFD_TIMER_ABSTIME: ::c_int = 1;
2613
2614pub const XATTR_CREATE: ::c_int = 0x1;
2615pub const XATTR_REPLACE: ::c_int = 0x2;
2616
2617pub const _POSIX_VDISABLE: ::cc_t = 0;
2618
2619pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
2620pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
2621pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08;
2622pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10;
2623pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20;
2624pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40;
2625
2626// On Linux, libc doesn't define this constant, libattr does instead.
2627// We still define it for Linux as it's defined by libc on other platforms,
2628// and it's mentioned in the man pages for getxattr and setxattr.
2629pub const ENOATTR: ::c_int = ::ENODATA;
2630
2631pub const SO_ORIGINAL_DST: ::c_int = 80;
2632pub const IUTF8: ::tcflag_t = 0x00004000;
2633pub const CMSPAR: ::tcflag_t = 0o10000000000;
2634
2635pub const MFD_CLOEXEC: ::c_uint = 0x0001;
2636pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002;
2637
2638// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has
2639// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32
2640// so we can use that type here to avoid having to cast.
2641pub const PT_NULL: u32 = 0;
2642pub const PT_LOAD: u32 = 1;
2643pub const PT_DYNAMIC: u32 = 2;
2644pub const PT_INTERP: u32 = 3;
2645pub const PT_NOTE: u32 = 4;
2646pub const PT_SHLIB: u32 = 5;
2647pub const PT_PHDR: u32 = 6;
2648pub const PT_TLS: u32 = 7;
2649pub const PT_NUM: u32 = 8;
2650pub const PT_LOOS: u32 = 0x60000000;
2651pub const PT_GNU_EH_FRAME: u32 = 0x6474e550;
2652pub const PT_GNU_STACK: u32 = 0x6474e551;
2653pub const PT_GNU_RELRO: u32 = 0x6474e552;
2654
Taylor Cramerb4cfe882017-11-15 11:29:01 -08002655pub const SFD_CLOEXEC: ::c_int = 0x080000;
2656
2657pub const NCCS: usize = 32;
2658
Matthew Maurere9a2a712020-01-02 15:36:15 -08002659pub const O_TRUNC: ::c_int = 0x00040000;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08002660pub const O_NOATIME: ::c_int = 0x00002000;
2661pub const O_CLOEXEC: ::c_int = 0x00000100;
2662pub const O_TMPFILE: ::c_int = 0x00004000;
2663
2664pub const EBFONT: ::c_int = 59;
2665pub const ENOSTR: ::c_int = 60;
2666pub const ENODATA: ::c_int = 61;
2667pub const ETIME: ::c_int = 62;
2668pub const ENOSR: ::c_int = 63;
2669pub const ENONET: ::c_int = 64;
2670pub const ENOPKG: ::c_int = 65;
2671pub const EREMOTE: ::c_int = 66;
2672pub const ENOLINK: ::c_int = 67;
2673pub const EADV: ::c_int = 68;
2674pub const ESRMNT: ::c_int = 69;
2675pub const ECOMM: ::c_int = 70;
2676pub const EPROTO: ::c_int = 71;
2677pub const EDOTDOT: ::c_int = 73;
2678
2679pub const SA_NODEFER: ::c_int = 0x40000000;
2680pub const SA_RESETHAND: ::c_int = 0x80000000;
2681pub const SA_RESTART: ::c_int = 0x10000000;
2682pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
2683
2684pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
2685
2686pub const EFD_CLOEXEC: ::c_int = 0x80000;
2687
2688pub const BUFSIZ: ::c_uint = 1024;
2689pub const TMP_MAX: ::c_uint = 10000;
2690pub const FOPEN_MAX: ::c_uint = 1000;
2691pub const O_PATH: ::c_int = 0x00400000;
2692pub const O_EXEC: ::c_int = O_PATH;
2693pub const O_SEARCH: ::c_int = O_PATH;
2694pub const O_ACCMODE: ::c_int = (03 | O_SEARCH);
2695pub const O_NDELAY: ::c_int = O_NONBLOCK;
2696pub const NI_MAXHOST: ::socklen_t = 255;
2697pub const PTHREAD_STACK_MIN: ::size_t = 2048;
2698pub const POSIX_FADV_DONTNEED: ::c_int = 4;
2699pub const POSIX_FADV_NOREUSE: ::c_int = 5;
2700
2701pub const POSIX_MADV_DONTNEED: ::c_int = 4;
2702
2703pub const RLIM_INFINITY: ::rlim_t = !0;
2704pub const RLIMIT_RTTIME: ::c_int = 15;
2705pub const RLIMIT_NLIMITS: ::c_int = 16;
2706
2707pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
2708
2709pub const SOCK_DCCP: ::c_int = 6;
2710pub const SOCK_PACKET: ::c_int = 10;
2711
2712pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
2713pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16;
2714pub const TCP_THIN_DUPACK: ::c_int = 17;
2715pub const TCP_USER_TIMEOUT: ::c_int = 18;
2716pub const TCP_REPAIR: ::c_int = 19;
2717pub const TCP_REPAIR_QUEUE: ::c_int = 20;
2718pub const TCP_QUEUE_SEQ: ::c_int = 21;
2719pub const TCP_REPAIR_OPTIONS: ::c_int = 22;
2720pub const TCP_FASTOPEN: ::c_int = 23;
2721pub const TCP_TIMESTAMP: ::c_int = 24;
2722
2723pub const SIGUNUSED: ::c_int = ::SIGSYS;
2724
2725pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
2726pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
2727pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
2728
2729pub const CPU_SETSIZE: ::c_int = 128;
2730
2731pub const PTRACE_TRACEME: ::c_int = 0;
2732pub const PTRACE_PEEKTEXT: ::c_int = 1;
2733pub const PTRACE_PEEKDATA: ::c_int = 2;
2734pub const PTRACE_PEEKUSER: ::c_int = 3;
2735pub const PTRACE_POKETEXT: ::c_int = 4;
2736pub const PTRACE_POKEDATA: ::c_int = 5;
2737pub const PTRACE_POKEUSER: ::c_int = 6;
2738pub const PTRACE_CONT: ::c_int = 7;
2739pub const PTRACE_KILL: ::c_int = 8;
2740pub const PTRACE_SINGLESTEP: ::c_int = 9;
2741pub const PTRACE_GETREGS: ::c_int = 12;
2742pub const PTRACE_SETREGS: ::c_int = 13;
2743pub const PTRACE_GETFPREGS: ::c_int = 14;
2744pub const PTRACE_SETFPREGS: ::c_int = 15;
2745pub const PTRACE_ATTACH: ::c_int = 16;
2746pub const PTRACE_DETACH: ::c_int = 17;
2747pub const PTRACE_GETFPXREGS: ::c_int = 18;
2748pub const PTRACE_SETFPXREGS: ::c_int = 19;
2749pub const PTRACE_SYSCALL: ::c_int = 24;
2750pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
2751pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
2752pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
2753pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
2754pub const PTRACE_GETREGSET: ::c_int = 0x4204;
2755pub const PTRACE_SETREGSET: ::c_int = 0x4205;
2756pub const PTRACE_SEIZE: ::c_int = 0x4206;
2757pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
2758pub const PTRACE_LISTEN: ::c_int = 0x4208;
2759pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
2760
2761pub const EPOLLWAKEUP: ::c_int = 0x20000000;
2762
2763pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
2764
2765pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
2766
2767pub const TCSANOW: ::c_int = 0;
2768pub const TCSADRAIN: ::c_int = 1;
2769pub const TCSAFLUSH: ::c_int = 2;
2770
2771pub const TIOCINQ: ::c_int = ::FIONREAD;
2772
2773pub const RTLD_GLOBAL: ::c_int = 0x100;
2774pub const RTLD_NOLOAD: ::c_int = 0x4;
2775
2776// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux
2777// kernel 3.10). See also notbsd/mod.rs
2778pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
2779pub const CLOCK_TAI: ::clockid_t = 11;
2780
2781pub const MCL_CURRENT: ::c_int = 0x0001;
2782pub const MCL_FUTURE: ::c_int = 0x0002;
2783
2784pub const CBAUD: ::tcflag_t = 0o0010017;
2785pub const TAB1: ::c_int = 0x00000800;
2786pub const TAB2: ::c_int = 0x00001000;
2787pub const TAB3: ::c_int = 0x00001800;
Matthew Maurere9a2a712020-01-02 15:36:15 -08002788pub const CR1: ::c_int = 0x00000200;
2789pub const CR2: ::c_int = 0x00000400;
2790pub const CR3: ::c_int = 0x00000600;
2791pub const FF1: ::c_int = 0x00008000;
2792pub const BS1: ::c_int = 0x00002000;
2793pub const VT1: ::c_int = 0x00004000;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08002794pub const VWERASE: usize = 14;
2795pub const VREPRINT: usize = 12;
2796pub const VSUSP: usize = 10;
2797pub const VSTART: usize = 8;
2798pub const VSTOP: usize = 9;
2799pub const VDISCARD: usize = 13;
2800pub const VTIME: usize = 5;
2801pub const IXON: ::tcflag_t = 0x00000400;
2802pub const IXOFF: ::tcflag_t = 0x00001000;
2803pub const ONLCR: ::tcflag_t = 0x4;
2804pub const CSIZE: ::tcflag_t = 0x00000030;
2805pub const CS6: ::tcflag_t = 0x00000010;
2806pub const CS7: ::tcflag_t = 0x00000020;
2807pub const CS8: ::tcflag_t = 0x00000030;
2808pub const CSTOPB: ::tcflag_t = 0x00000040;
2809pub const CREAD: ::tcflag_t = 0x00000080;
2810pub const PARENB: ::tcflag_t = 0x00000100;
2811pub const PARODD: ::tcflag_t = 0x00000200;
2812pub const HUPCL: ::tcflag_t = 0x00000400;
2813pub const CLOCAL: ::tcflag_t = 0x00000800;
2814pub const ECHOKE: ::tcflag_t = 0x00000800;
2815pub const ECHOE: ::tcflag_t = 0x00000010;
2816pub const ECHOK: ::tcflag_t = 0x00000020;
2817pub const ECHONL: ::tcflag_t = 0x00000040;
2818pub const ECHOPRT: ::tcflag_t = 0x00000400;
2819pub const ECHOCTL: ::tcflag_t = 0x00000200;
2820pub const ISIG: ::tcflag_t = 0x00000001;
2821pub const ICANON: ::tcflag_t = 0x00000002;
2822pub const PENDIN: ::tcflag_t = 0x00004000;
2823pub const NOFLSH: ::tcflag_t = 0x00000080;
2824pub const CIBAUD: ::tcflag_t = 0o02003600000;
2825pub const CBAUDEX: ::tcflag_t = 0o010000;
2826pub const VSWTC: usize = 7;
Matthew Maurere9a2a712020-01-02 15:36:15 -08002827pub const OLCUC: ::tcflag_t = 0o000002;
2828pub const NLDLY: ::tcflag_t = 0o000400;
2829pub const CRDLY: ::tcflag_t = 0o003000;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08002830pub const TABDLY: ::tcflag_t = 0o014000;
Matthew Maurere9a2a712020-01-02 15:36:15 -08002831pub const BSDLY: ::tcflag_t = 0o020000;
2832pub const FFDLY: ::tcflag_t = 0o100000;
2833pub const VTDLY: ::tcflag_t = 0o040000;
2834pub const XTABS: ::tcflag_t = 0o014000;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08002835
2836pub const B0: ::speed_t = 0o000000;
2837pub const B50: ::speed_t = 0o000001;
2838pub const B75: ::speed_t = 0o000002;
2839pub const B110: ::speed_t = 0o000003;
2840pub const B134: ::speed_t = 0o000004;
2841pub const B150: ::speed_t = 0o000005;
2842pub const B200: ::speed_t = 0o000006;
2843pub const B300: ::speed_t = 0o000007;
2844pub const B600: ::speed_t = 0o000010;
2845pub const B1200: ::speed_t = 0o000011;
2846pub const B1800: ::speed_t = 0o000012;
2847pub const B2400: ::speed_t = 0o000013;
2848pub const B4800: ::speed_t = 0o000014;
2849pub const B9600: ::speed_t = 0o000015;
2850pub const B19200: ::speed_t = 0o000016;
2851pub const B38400: ::speed_t = 0o000017;
2852pub const EXTA: ::speed_t = B19200;
2853pub const EXTB: ::speed_t = B38400;
2854pub const B57600: ::speed_t = 0o010001;
2855pub const B115200: ::speed_t = 0o010002;
2856pub const B230400: ::speed_t = 0o010003;
2857pub const B460800: ::speed_t = 0o010004;
2858pub const B500000: ::speed_t = 0o010005;
2859pub const B576000: ::speed_t = 0o010006;
2860pub const B921600: ::speed_t = 0o010007;
2861pub const B1000000: ::speed_t = 0o010010;
2862pub const B1152000: ::speed_t = 0o010011;
2863pub const B1500000: ::speed_t = 0o010012;
2864pub const B2000000: ::speed_t = 0o010013;
2865pub const B2500000: ::speed_t = 0o010014;
2866pub const B3000000: ::speed_t = 0o010015;
2867pub const B3500000: ::speed_t = 0o010016;
2868pub const B4000000: ::speed_t = 0o010017;
2869
2870pub const SO_BINDTODEVICE: ::c_int = 25;
2871pub const SO_TIMESTAMP: ::c_int = 29;
2872pub const SO_MARK: ::c_int = 36;
2873pub const SO_RXQ_OVFL: ::c_int = 40;
2874pub const SO_PEEK_OFF: ::c_int = 42;
2875pub const SO_BUSY_POLL: ::c_int = 46;
2876
2877pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
2878pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
2879
2880pub const O_ASYNC: ::c_int = 0x00000400;
2881
2882pub const FIOCLEX: ::c_int = 0x5451;
2883pub const FIONBIO: ::c_int = 0x5421;
2884
2885pub const RLIMIT_RSS: ::c_int = 5;
2886pub const RLIMIT_NOFILE: ::c_int = 7;
2887pub const RLIMIT_AS: ::c_int = 9;
2888pub const RLIMIT_NPROC: ::c_int = 6;
2889pub const RLIMIT_MEMLOCK: ::c_int = 8;
2890
2891pub const O_APPEND: ::c_int = 0x00100000;
Matthew Maurere9a2a712020-01-02 15:36:15 -08002892pub const O_CREAT: ::c_int = 0x00010000;
2893pub const O_EXCL: ::c_int = 0x00020000;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08002894pub const O_NOCTTY: ::c_int = 0x00000200;
2895pub const O_NONBLOCK: ::c_int = 0x00000010;
Matthew Maurere9a2a712020-01-02 15:36:15 -08002896pub const O_SYNC: ::c_int = (0x00000040 | O_DSYNC);
2897pub const O_RSYNC: ::c_int = O_SYNC;
2898pub const O_DSYNC: ::c_int = 0x00000020;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08002899
2900pub const SOCK_NONBLOCK: ::c_int = 2048;
2901
2902pub const MAP_ANON: ::c_int = 0x0020;
2903pub const MAP_GROWSDOWN: ::c_int = 0x0100;
2904pub const MAP_DENYWRITE: ::c_int = 0x0800;
2905pub const MAP_EXECUTABLE: ::c_int = 0x01000;
2906pub const MAP_LOCKED: ::c_int = 0x02000;
2907pub const MAP_NORESERVE: ::c_int = 0x04000;
2908pub const MAP_POPULATE: ::c_int = 0x08000;
2909pub const MAP_NONBLOCK: ::c_int = 0x010000;
2910pub const MAP_STACK: ::c_int = 0x020000;
2911
2912pub const SOCK_STREAM: ::c_int = 1;
2913pub const SOCK_DGRAM: ::c_int = 2;
2914pub const SOCK_SEQPACKET: ::c_int = 5;
2915
2916pub const SOL_SOCKET: ::c_int = 1;
2917
2918pub const EDEADLK: ::c_int = 35;
2919pub const ENAMETOOLONG: ::c_int = 36;
2920pub const ENOLCK: ::c_int = 37;
2921pub const ENOSYS: ::c_int = 38;
2922pub const ENOTEMPTY: ::c_int = 39;
2923pub const ELOOP: ::c_int = 40;
2924pub const ENOMSG: ::c_int = 42;
2925pub const EIDRM: ::c_int = 43;
2926pub const ECHRNG: ::c_int = 44;
2927pub const EL2NSYNC: ::c_int = 45;
2928pub const EL3HLT: ::c_int = 46;
2929pub const EL3RST: ::c_int = 47;
2930pub const ELNRNG: ::c_int = 48;
2931pub const EUNATCH: ::c_int = 49;
2932pub const ENOCSI: ::c_int = 50;
2933pub const EL2HLT: ::c_int = 51;
2934pub const EBADE: ::c_int = 52;
2935pub const EBADR: ::c_int = 53;
2936pub const EXFULL: ::c_int = 54;
2937pub const ENOANO: ::c_int = 55;
2938pub const EBADRQC: ::c_int = 56;
2939pub const EBADSLT: ::c_int = 57;
2940pub const EDEADLOCK: ::c_int = EDEADLK;
2941pub const EMULTIHOP: ::c_int = 72;
2942pub const EBADMSG: ::c_int = 74;
2943pub const EOVERFLOW: ::c_int = 75;
2944pub const ENOTUNIQ: ::c_int = 76;
2945pub const EBADFD: ::c_int = 77;
2946pub const EREMCHG: ::c_int = 78;
2947pub const ELIBACC: ::c_int = 79;
2948pub const ELIBBAD: ::c_int = 80;
2949pub const ELIBSCN: ::c_int = 81;
2950pub const ELIBMAX: ::c_int = 82;
2951pub const ELIBEXEC: ::c_int = 83;
2952pub const EILSEQ: ::c_int = 84;
2953pub const ERESTART: ::c_int = 85;
2954pub const ESTRPIPE: ::c_int = 86;
2955pub const EUSERS: ::c_int = 87;
2956pub const ENOTSOCK: ::c_int = 88;
2957pub const EDESTADDRREQ: ::c_int = 89;
2958pub const EMSGSIZE: ::c_int = 90;
2959pub const EPROTOTYPE: ::c_int = 91;
2960pub const ENOPROTOOPT: ::c_int = 92;
2961pub const EPROTONOSUPPORT: ::c_int = 93;
2962pub const ESOCKTNOSUPPORT: ::c_int = 94;
2963pub const EOPNOTSUPP: ::c_int = 95;
2964pub const ENOTSUP: ::c_int = EOPNOTSUPP;
2965pub const EPFNOSUPPORT: ::c_int = 96;
2966pub const EAFNOSUPPORT: ::c_int = 97;
2967pub const EADDRINUSE: ::c_int = 98;
2968pub const EADDRNOTAVAIL: ::c_int = 99;
2969pub const ENETDOWN: ::c_int = 100;
2970pub const ENETUNREACH: ::c_int = 101;
2971pub const ENETRESET: ::c_int = 102;
2972pub const ECONNABORTED: ::c_int = 103;
2973pub const ECONNRESET: ::c_int = 104;
2974pub const ENOBUFS: ::c_int = 105;
2975pub const EISCONN: ::c_int = 106;
2976pub const ENOTCONN: ::c_int = 107;
2977pub const ESHUTDOWN: ::c_int = 108;
2978pub const ETOOMANYREFS: ::c_int = 109;
2979pub const ETIMEDOUT: ::c_int = 110;
2980pub const ECONNREFUSED: ::c_int = 111;
2981pub const EHOSTDOWN: ::c_int = 112;
2982pub const EHOSTUNREACH: ::c_int = 113;
2983pub const EALREADY: ::c_int = 114;
2984pub const EINPROGRESS: ::c_int = 115;
2985pub const ESTALE: ::c_int = 116;
2986pub const EUCLEAN: ::c_int = 117;
2987pub const ENOTNAM: ::c_int = 118;
2988pub const ENAVAIL: ::c_int = 119;
2989pub const EISNAM: ::c_int = 120;
2990pub const EREMOTEIO: ::c_int = 121;
2991pub const EDQUOT: ::c_int = 122;
2992pub const ENOMEDIUM: ::c_int = 123;
2993pub const EMEDIUMTYPE: ::c_int = 124;
2994pub const ECANCELED: ::c_int = 125;
2995pub const ENOKEY: ::c_int = 126;
2996pub const EKEYEXPIRED: ::c_int = 127;
2997pub const EKEYREVOKED: ::c_int = 128;
2998pub const EKEYREJECTED: ::c_int = 129;
2999pub const EOWNERDEAD: ::c_int = 130;
3000pub const ENOTRECOVERABLE: ::c_int = 131;
3001pub const ERFKILL: ::c_int = 132;
3002pub const EHWPOISON: ::c_int = 133;
3003
3004pub const SO_REUSEADDR: ::c_int = 2;
3005pub const SO_TYPE: ::c_int = 3;
3006pub const SO_ERROR: ::c_int = 4;
3007pub const SO_DONTROUTE: ::c_int = 5;
3008pub const SO_BROADCAST: ::c_int = 6;
3009pub const SO_SNDBUF: ::c_int = 7;
3010pub const SO_RCVBUF: ::c_int = 8;
3011pub const SO_KEEPALIVE: ::c_int = 9;
3012pub const SO_OOBINLINE: ::c_int = 10;
3013pub const SO_NO_CHECK: ::c_int = 11;
3014pub const SO_PRIORITY: ::c_int = 12;
3015pub const SO_LINGER: ::c_int = 13;
3016pub const SO_BSDCOMPAT: ::c_int = 14;
3017pub const SO_REUSEPORT: ::c_int = 15;
3018pub const SO_PASSCRED: ::c_int = 16;
3019pub const SO_PEERCRED: ::c_int = 17;
3020pub const SO_RCVLOWAT: ::c_int = 18;
3021pub const SO_SNDLOWAT: ::c_int = 19;
3022pub const SO_RCVTIMEO: ::c_int = 20;
3023pub const SO_SNDTIMEO: ::c_int = 21;
3024pub const SO_ACCEPTCONN: ::c_int = 30;
3025pub const SO_SNDBUFFORCE: ::c_int = 32;
3026pub const SO_RCVBUFFORCE: ::c_int = 33;
3027pub const SO_PROTOCOL: ::c_int = 38;
3028pub const SO_DOMAIN: ::c_int = 39;
3029
3030pub const SA_ONSTACK: ::c_int = 0x08000000;
3031pub const SA_SIGINFO: ::c_int = 0x00000004;
3032pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
3033
3034pub const SIGCHLD: ::c_int = 17;
3035pub const SIGBUS: ::c_int = 7;
3036pub const SIGTTIN: ::c_int = 21;
3037pub const SIGTTOU: ::c_int = 22;
3038pub const SIGXCPU: ::c_int = 24;
3039pub const SIGXFSZ: ::c_int = 25;
3040pub const SIGVTALRM: ::c_int = 26;
3041pub const SIGPROF: ::c_int = 27;
3042pub const SIGWINCH: ::c_int = 28;
3043pub const SIGUSR1: ::c_int = 10;
3044pub const SIGUSR2: ::c_int = 12;
3045pub const SIGCONT: ::c_int = 18;
3046pub const SIGSTOP: ::c_int = 19;
3047pub const SIGTSTP: ::c_int = 20;
3048pub const SIGURG: ::c_int = 23;
3049pub const SIGIO: ::c_int = 29;
3050pub const SIGSYS: ::c_int = 31;
3051pub const SIGSTKFLT: ::c_int = 16;
3052pub const SIGPOLL: ::c_int = 29;
3053pub const SIGPWR: ::c_int = 30;
3054pub const SIG_SETMASK: ::c_int = 2;
3055pub const SIG_BLOCK: ::c_int = 0x000000;
3056pub const SIG_UNBLOCK: ::c_int = 0x01;
3057
3058pub const EXTPROC: ::tcflag_t = 0x00010000;
3059
3060pub const MAP_HUGETLB: ::c_int = 0x040000;
3061
3062pub const F_GETLK: ::c_int = 5;
3063pub const F_GETOWN: ::c_int = 9;
3064pub const F_SETLK: ::c_int = 6;
3065pub const F_SETLKW: ::c_int = 7;
3066pub const F_SETOWN: ::c_int = 8;
3067
3068pub const VEOF: usize = 4;
3069pub const VEOL: usize = 11;
3070pub const VEOL2: usize = 16;
3071pub const VMIN: usize = 6;
3072pub const IEXTEN: ::tcflag_t = 0x00008000;
3073pub const TOSTOP: ::tcflag_t = 0x00000100;
3074pub const FLUSHO: ::tcflag_t = 0x00001000;
3075
3076pub const TCGETS: ::c_int = 0x5401;
3077pub const TCSETS: ::c_int = 0x5402;
3078pub const TCSETSW: ::c_int = 0x5403;
3079pub const TCSETSF: ::c_int = 0x5404;
3080pub const TCGETA: ::c_int = 0x5405;
3081pub const TCSETA: ::c_int = 0x5406;
3082pub const TCSETAW: ::c_int = 0x5407;
3083pub const TCSETAF: ::c_int = 0x5408;
3084pub const TCSBRK: ::c_int = 0x5409;
3085pub const TCXONC: ::c_int = 0x540A;
3086pub const TCFLSH: ::c_int = 0x540B;
3087pub const TIOCGSOFTCAR: ::c_int = 0x5419;
3088pub const TIOCSSOFTCAR: ::c_int = 0x541A;
3089pub const TIOCLINUX: ::c_int = 0x541C;
3090pub const TIOCGSERIAL: ::c_int = 0x541E;
3091pub const TIOCEXCL: ::c_int = 0x540C;
3092pub const TIOCNXCL: ::c_int = 0x540D;
3093pub const TIOCSCTTY: ::c_int = 0x540E;
3094pub const TIOCGPGRP: ::c_int = 0x540F;
3095pub const TIOCSPGRP: ::c_int = 0x5410;
3096pub const TIOCOUTQ: ::c_int = 0x5411;
3097pub const TIOCSTI: ::c_int = 0x5412;
3098pub const TIOCGWINSZ: ::c_int = 0x5413;
3099pub const TIOCSWINSZ: ::c_int = 0x5414;
3100pub const TIOCMGET: ::c_int = 0x5415;
3101pub const TIOCMBIS: ::c_int = 0x5416;
3102pub const TIOCMBIC: ::c_int = 0x5417;
3103pub const TIOCMSET: ::c_int = 0x5418;
3104pub const FIONREAD: ::c_int = 0x541B;
3105pub const TIOCCONS: ::c_int = 0x541D;
3106
3107pub const POLLWRNORM: ::c_short = 0x100;
3108pub const POLLWRBAND: ::c_short = 0x200;
3109
3110pub const TIOCM_LE: ::c_int = 0x001;
3111pub const TIOCM_DTR: ::c_int = 0x002;
3112pub const TIOCM_RTS: ::c_int = 0x004;
3113pub const TIOCM_ST: ::c_int = 0x008;
3114pub const TIOCM_SR: ::c_int = 0x010;
3115pub const TIOCM_CTS: ::c_int = 0x020;
3116pub const TIOCM_CAR: ::c_int = 0x040;
3117pub const TIOCM_RNG: ::c_int = 0x080;
3118pub const TIOCM_DSR: ::c_int = 0x100;
3119pub const TIOCM_CD: ::c_int = TIOCM_CAR;
3120pub const TIOCM_RI: ::c_int = TIOCM_RNG;
3121
3122pub const O_DIRECTORY: ::c_int = 0x00080000;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003123pub const O_DIRECT: ::c_int = 0x00000800;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003124pub const O_LARGEFILE: ::c_int = 0x00001000;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003125pub const O_NOFOLLOW: ::c_int = 0x00000080;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003126
3127// intentionally not public, only used for fd_set
3128cfg_if! {
3129 if #[cfg(target_pointer_width = "32")] {
3130 const ULONG_SIZE: usize = 32;
3131 } else if #[cfg(target_pointer_width = "64")] {
3132 const ULONG_SIZE: usize = 64;
3133 } else {
3134 // Unknown target_pointer_width
3135 }
3136}
3137
3138// END_PUB_CONST
3139
Taylor Cramerf7f9be32017-11-15 10:22:26 -08003140f! {
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003141 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
3142 let fd = fd as usize;
gnzlbg7ac0fe52019-02-13 10:38:54 +01003143 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003144 (*set).fds_bits[fd / size] &= !(1 << (fd % size));
3145 return
3146 }
3147
3148 pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
3149 let fd = fd as usize;
gnzlbg7ac0fe52019-02-13 10:38:54 +01003150 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003151 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
3152 }
3153
3154 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
3155 let fd = fd as usize;
gnzlbg7ac0fe52019-02-13 10:38:54 +01003156 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003157 (*set).fds_bits[fd / size] |= 1 << (fd % size);
3158 return
3159 }
3160
3161 pub fn FD_ZERO(set: *mut fd_set) -> () {
3162 for slot in (*set).fds_bits.iter_mut() {
3163 *slot = 0;
3164 }
3165 }
3166
3167 pub fn WIFSTOPPED(status: ::c_int) -> bool {
3168 (status & 0xff) == 0x7f
3169 }
3170
3171 pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
3172 (status >> 8) & 0xff
3173 }
3174
3175 pub fn WIFCONTINUED(status: ::c_int) -> bool {
3176 status == 0xffff
3177 }
3178
3179 pub fn WIFSIGNALED(status: ::c_int) -> bool {
3180 ((status & 0x7f) + 1) as i8 >= 2
3181 }
3182
3183 pub fn WTERMSIG(status: ::c_int) -> ::c_int {
3184 status & 0x7f
3185 }
3186
3187 pub fn WIFEXITED(status: ::c_int) -> bool {
3188 (status & 0x7f) == 0
3189 }
3190
3191 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
3192 (status >> 8) & 0xff
3193 }
3194
3195 pub fn WCOREDUMP(status: ::c_int) -> bool {
3196 (status & 0x80) != 0
3197 }
3198
3199 pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
3200 (cmd << 8) | (type_ & 0x00ff)
3201 }
3202
Taylor Cramerf7f9be32017-11-15 10:22:26 -08003203 pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
3204 for slot in cpuset.bits.iter_mut() {
3205 *slot = 0;
3206 }
3207 }
3208
3209 pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
gnzlbg7ac0fe52019-02-13 10:38:54 +01003210 let size_in_bits
3211 = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
Taylor Cramerf7f9be32017-11-15 10:22:26 -08003212 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
3213 cpuset.bits[idx] |= 1 << offset;
3214 ()
3215 }
3216
3217 pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
gnzlbg7ac0fe52019-02-13 10:38:54 +01003218 let size_in_bits
3219 = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
Taylor Cramerf7f9be32017-11-15 10:22:26 -08003220 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
3221 cpuset.bits[idx] &= !(1 << offset);
3222 ()
3223 }
3224
3225 pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
gnzlbg7ac0fe52019-02-13 10:38:54 +01003226 let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]);
Taylor Cramerf7f9be32017-11-15 10:22:26 -08003227 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
3228 0 != (cpuset.bits[idx] & (1 << offset))
3229 }
3230
3231 pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
3232 set1.bits == set2.bits
3233 }
3234
3235 pub fn major(dev: ::dev_t) -> ::c_uint {
3236 let mut major = 0;
3237 major |= (dev & 0x00000000000fff00) >> 8;
3238 major |= (dev & 0xfffff00000000000) >> 32;
3239 major as ::c_uint
3240 }
3241
3242 pub fn minor(dev: ::dev_t) -> ::c_uint {
3243 let mut minor = 0;
3244 minor |= (dev & 0x00000000000000ff) >> 0;
3245 minor |= (dev & 0x00000ffffff00000) >> 12;
3246 minor as ::c_uint
3247 }
3248
3249 pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
3250 let major = major as ::dev_t;
3251 let minor = minor as ::dev_t;
3252 let mut dev = 0;
3253 dev |= (major & 0x00000fff) << 8;
3254 dev |= (major & 0xfffff000) << 32;
3255 dev |= (minor & 0x000000ff) << 0;
3256 dev |= (minor & 0xffffff00) << 12;
3257 dev
3258 }
3259}
3260
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003261// EXTERN_FN
3262
3263#[link(name = "c")]
3264#[link(name = "fdio")]
Matthew Maurere9a2a712020-01-02 15:36:15 -08003265extern "C" {}
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003266
Bryant Mairsfa9cb782019-01-23 07:18:32 -08003267#[cfg_attr(feature = "extra_traits", derive(Debug))]
gnzlbg5c1a6b82018-11-21 20:34:50 +01003268pub enum FILE {}
gnzlbg7ac0fe52019-02-13 10:38:54 +01003269impl ::Copy for FILE {}
3270impl ::Clone for FILE {
Matthew Maurere9a2a712020-01-02 15:36:15 -08003271 fn clone(&self) -> FILE {
3272 *self
3273 }
Bryant Mairsf3684582019-01-23 07:23:09 -08003274}
Bryant Mairsfa9cb782019-01-23 07:18:32 -08003275#[cfg_attr(feature = "extra_traits", derive(Debug))]
gnzlbg5c1a6b82018-11-21 20:34:50 +01003276pub enum fpos_t {} // TODO: fill this out with a struct
gnzlbg7ac0fe52019-02-13 10:38:54 +01003277impl ::Copy for fpos_t {}
3278impl ::Clone for fpos_t {
Matthew Maurere9a2a712020-01-02 15:36:15 -08003279 fn clone(&self) -> fpos_t {
3280 *self
3281 }
Bryant Mairsf3684582019-01-23 07:23:09 -08003282}
gnzlbg5c1a6b82018-11-21 20:34:50 +01003283
Matthew Maurere9a2a712020-01-02 15:36:15 -08003284extern "C" {
gnzlbg5c1a6b82018-11-21 20:34:50 +01003285 pub fn isalnum(c: c_int) -> c_int;
3286 pub fn isalpha(c: c_int) -> c_int;
3287 pub fn iscntrl(c: c_int) -> c_int;
3288 pub fn isdigit(c: c_int) -> c_int;
3289 pub fn isgraph(c: c_int) -> c_int;
3290 pub fn islower(c: c_int) -> c_int;
3291 pub fn isprint(c: c_int) -> c_int;
3292 pub fn ispunct(c: c_int) -> c_int;
3293 pub fn isspace(c: c_int) -> c_int;
3294 pub fn isupper(c: c_int) -> c_int;
3295 pub fn isxdigit(c: c_int) -> c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003296 pub fn isblank(c: c_int) -> c_int;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003297 pub fn tolower(c: c_int) -> c_int;
3298 pub fn toupper(c: c_int) -> c_int;
3299 pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003300 pub fn freopen(
3301 filename: *const c_char,
3302 mode: *const c_char,
3303 file: *mut FILE,
3304 ) -> *mut FILE;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003305 pub fn fflush(file: *mut FILE) -> c_int;
3306 pub fn fclose(file: *mut FILE) -> c_int;
3307 pub fn remove(filename: *const c_char) -> c_int;
3308 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
3309 pub fn tmpfile() -> *mut FILE;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003310 pub fn setvbuf(
3311 stream: *mut FILE,
3312 buffer: *mut c_char,
3313 mode: c_int,
3314 size: size_t,
3315 ) -> c_int;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003316 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
3317 pub fn getchar() -> c_int;
3318 pub fn putchar(c: c_int) -> c_int;
3319 pub fn fgetc(stream: *mut FILE) -> c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003320 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
3321 -> *mut c_char;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003322 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
3323 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
3324 pub fn puts(s: *const c_char) -> c_int;
3325 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003326 pub fn fread(
3327 ptr: *mut c_void,
3328 size: size_t,
3329 nobj: size_t,
3330 stream: *mut FILE,
3331 ) -> size_t;
3332 pub fn fwrite(
3333 ptr: *const c_void,
3334 size: size_t,
3335 nobj: size_t,
3336 stream: *mut FILE,
3337 ) -> size_t;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003338 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
3339 pub fn ftell(stream: *mut FILE) -> c_long;
3340 pub fn rewind(stream: *mut FILE);
3341 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
3342 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
3343 pub fn feof(stream: *mut FILE) -> c_int;
3344 pub fn ferror(stream: *mut FILE) -> c_int;
3345 pub fn perror(s: *const c_char);
3346 pub fn atoi(s: *const c_char) -> c_int;
3347 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003348 pub fn strtol(
3349 s: *const c_char,
3350 endp: *mut *mut c_char,
3351 base: c_int,
3352 ) -> c_long;
3353 pub fn strtoul(
3354 s: *const c_char,
3355 endp: *mut *mut c_char,
3356 base: c_int,
3357 ) -> c_ulong;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003358 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
3359 pub fn malloc(size: size_t) -> *mut c_void;
3360 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
3361 pub fn free(p: *mut c_void);
3362 pub fn abort() -> !;
3363 pub fn exit(status: c_int) -> !;
3364 pub fn _exit(status: c_int) -> !;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003365 pub fn atexit(cb: extern "C" fn()) -> c_int;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003366 pub fn system(s: *const c_char) -> c_int;
3367 pub fn getenv(s: *const c_char) -> *mut c_char;
3368
3369 pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003370 pub fn strncpy(
3371 dst: *mut c_char,
3372 src: *const c_char,
3373 n: size_t,
3374 ) -> *mut c_char;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003375 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003376 pub fn strncat(
3377 s: *mut c_char,
3378 ct: *const c_char,
3379 n: size_t,
3380 ) -> *mut c_char;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003381 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
3382 pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
3383 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
3384 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
3385 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
3386 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
3387 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
3388 pub fn strdup(cs: *const c_char) -> *mut c_char;
3389 pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
3390 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
3391 pub fn strlen(cs: *const c_char) -> size_t;
3392 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
3393 pub fn strerror(n: c_int) -> *mut c_char;
3394 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
3395 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
3396 pub fn wcslen(buf: *const wchar_t) -> size_t;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003397 pub fn wcstombs(
3398 dest: *mut c_char,
3399 src: *const wchar_t,
3400 n: size_t,
3401 ) -> ::size_t;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003402
3403 pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
3404 pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003405 pub fn memcpy(
3406 dest: *mut c_void,
3407 src: *const c_void,
3408 n: size_t,
3409 ) -> *mut c_void;
3410 pub fn memmove(
3411 dest: *mut c_void,
3412 src: *const c_void,
3413 n: size_t,
3414 ) -> *mut c_void;
gnzlbg5c1a6b82018-11-21 20:34:50 +01003415 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
3416
3417 pub fn abs(i: c_int) -> c_int;
3418 pub fn atof(s: *const c_char) -> c_double;
3419 pub fn labs(i: c_long) -> c_long;
3420 pub fn rand() -> c_int;
3421 pub fn srand(seed: c_uint);
3422
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003423 pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
3424 pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
3425
Matthew Maurere9a2a712020-01-02 15:36:15 -08003426 pub fn fprintf(
3427 stream: *mut ::FILE,
3428 format: *const ::c_char,
3429 ...
3430 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003431 pub fn printf(format: *const ::c_char, ...) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003432 pub fn snprintf(
3433 s: *mut ::c_char,
3434 n: ::size_t,
3435 format: *const ::c_char,
3436 ...
3437 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003438 pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003439 pub fn fscanf(
3440 stream: *mut ::FILE,
3441 format: *const ::c_char,
3442 ...
3443 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003444 pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003445 pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
3446 -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003447 pub fn getchar_unlocked() -> ::c_int;
3448 pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
3449
3450 pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003451 pub fn connect(
3452 socket: ::c_int,
3453 address: *const sockaddr,
3454 len: socklen_t,
3455 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003456 pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003457 pub fn accept(
3458 socket: ::c_int,
3459 address: *mut sockaddr,
3460 address_len: *mut socklen_t,
3461 ) -> ::c_int;
3462 pub fn getpeername(
3463 socket: ::c_int,
3464 address: *mut sockaddr,
3465 address_len: *mut socklen_t,
3466 ) -> ::c_int;
3467 pub fn getsockname(
3468 socket: ::c_int,
3469 address: *mut sockaddr,
3470 address_len: *mut socklen_t,
3471 ) -> ::c_int;
3472 pub fn setsockopt(
3473 socket: ::c_int,
3474 level: ::c_int,
3475 name: ::c_int,
3476 value: *const ::c_void,
3477 option_len: socklen_t,
3478 ) -> ::c_int;
3479 pub fn socketpair(
3480 domain: ::c_int,
3481 type_: ::c_int,
3482 protocol: ::c_int,
3483 socket_vector: *mut ::c_int,
3484 ) -> ::c_int;
3485 pub fn sendto(
3486 socket: ::c_int,
3487 buf: *const ::c_void,
3488 len: ::size_t,
3489 flags: ::c_int,
3490 addr: *const sockaddr,
3491 addrlen: socklen_t,
3492 ) -> ::ssize_t;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003493 pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
3494
3495 pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int;
3496 pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
3497
3498 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
3499
3500 pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
3501
3502 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
3503
3504 pub fn pclose(stream: *mut ::FILE) -> ::c_int;
3505 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
3506 pub fn fileno(stream: *mut ::FILE) -> ::c_int;
3507
3508 pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
3509 pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
3510 pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
3511
3512 pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
3513 pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003514 pub fn readdir_r(
3515 dirp: *mut ::DIR,
3516 entry: *mut ::dirent,
3517 result: *mut *mut ::dirent,
3518 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003519 pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
3520 pub fn rewinddir(dirp: *mut ::DIR);
3521
Matthew Maurere9a2a712020-01-02 15:36:15 -08003522 pub fn openat(
3523 dirfd: ::c_int,
3524 pathname: *const ::c_char,
3525 flags: ::c_int,
3526 ...
3527 ) -> ::c_int;
3528 pub fn fchmodat(
3529 dirfd: ::c_int,
3530 pathname: *const ::c_char,
3531 mode: ::mode_t,
3532 flags: ::c_int,
3533 ) -> ::c_int;
3534 pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int;
3535 pub fn fchownat(
3536 dirfd: ::c_int,
3537 pathname: *const ::c_char,
3538 owner: ::uid_t,
3539 group: ::gid_t,
3540 flags: ::c_int,
3541 ) -> ::c_int;
3542 pub fn fstatat(
3543 dirfd: ::c_int,
3544 pathname: *const ::c_char,
3545 buf: *mut stat,
3546 flags: ::c_int,
3547 ) -> ::c_int;
3548 pub fn linkat(
3549 olddirfd: ::c_int,
3550 oldpath: *const ::c_char,
3551 newdirfd: ::c_int,
3552 newpath: *const ::c_char,
3553 flags: ::c_int,
3554 ) -> ::c_int;
3555 pub fn mkdirat(
3556 dirfd: ::c_int,
3557 pathname: *const ::c_char,
3558 mode: ::mode_t,
3559 ) -> ::c_int;
3560 pub fn readlinkat(
3561 dirfd: ::c_int,
3562 pathname: *const ::c_char,
3563 buf: *mut ::c_char,
3564 bufsiz: ::size_t,
3565 ) -> ::ssize_t;
3566 pub fn renameat(
3567 olddirfd: ::c_int,
3568 oldpath: *const ::c_char,
3569 newdirfd: ::c_int,
3570 newpath: *const ::c_char,
3571 ) -> ::c_int;
3572 pub fn symlinkat(
3573 target: *const ::c_char,
3574 newdirfd: ::c_int,
3575 linkpath: *const ::c_char,
3576 ) -> ::c_int;
3577 pub fn unlinkat(
3578 dirfd: ::c_int,
3579 pathname: *const ::c_char,
3580 flags: ::c_int,
3581 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003582
3583 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
3584 pub fn alarm(seconds: ::c_uint) -> ::c_uint;
3585 pub fn chdir(dir: *const c_char) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003586 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
3587 pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003588 pub fn close(fd: ::c_int) -> ::c_int;
3589 pub fn dup(fd: ::c_int) -> ::c_int;
3590 pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003591 pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
3592 pub fn execle(
3593 path: *const ::c_char,
3594 arg0: *const ::c_char,
3595 ...
3596 ) -> ::c_int;
3597 pub fn execlp(
3598 file: *const ::c_char,
3599 arg0: *const ::c_char,
3600 ...
3601 ) -> ::c_int;
3602 pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
3603 pub fn execve(
3604 prog: *const c_char,
3605 argv: *const *const c_char,
3606 envp: *const *const c_char,
3607 ) -> ::c_int;
3608 pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003609 pub fn fork() -> pid_t;
3610 pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
3611 pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
3612 pub fn getegid() -> gid_t;
3613 pub fn geteuid() -> uid_t;
3614 pub fn getgid() -> gid_t;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003615 pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003616 pub fn getlogin() -> *mut c_char;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003617 pub fn getopt(
3618 argc: ::c_int,
3619 argv: *const *mut c_char,
3620 optstr: *const c_char,
3621 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003622 pub fn getpgid(pid: pid_t) -> pid_t;
3623 pub fn getpgrp() -> pid_t;
3624 pub fn getpid() -> pid_t;
3625 pub fn getppid() -> pid_t;
3626 pub fn getuid() -> uid_t;
3627 pub fn isatty(fd: ::c_int) -> ::c_int;
3628 pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
3629 pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
3630 pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
3631 pub fn pause() -> ::c_int;
3632 pub fn pipe(fds: *mut ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003633 pub fn posix_memalign(
3634 memptr: *mut *mut ::c_void,
3635 align: ::size_t,
3636 size: ::size_t,
3637 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003638 pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
Matthew Maurere9a2a712020-01-02 15:36:15 -08003639 -> ::ssize_t;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003640 pub fn rmdir(path: *const c_char) -> ::c_int;
3641 pub fn seteuid(uid: uid_t) -> ::c_int;
xd0096421604cf52018-12-05 17:46:50 +00003642 pub fn setegid(gid: gid_t) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003643 pub fn setgid(gid: gid_t) -> ::c_int;
3644 pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
3645 pub fn setsid() -> pid_t;
3646 pub fn setuid(uid: uid_t) -> ::c_int;
3647 pub fn sleep(secs: ::c_uint) -> ::c_uint;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003648 pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003649 pub fn tcgetpgrp(fd: ::c_int) -> pid_t;
3650 pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int;
3651 pub fn ttyname(fd: ::c_int) -> *mut c_char;
3652 pub fn unlink(c: *const c_char) -> ::c_int;
3653 pub fn wait(status: *mut ::c_int) -> pid_t;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003654 pub fn waitpid(
3655 pid: pid_t,
3656 status: *mut ::c_int,
3657 options: ::c_int,
3658 ) -> pid_t;
3659 pub fn write(
3660 fd: ::c_int,
3661 buf: *const ::c_void,
3662 count: ::size_t,
3663 ) -> ::ssize_t;
3664 pub fn pread(
3665 fd: ::c_int,
3666 buf: *mut ::c_void,
3667 count: ::size_t,
3668 offset: off_t,
3669 ) -> ::ssize_t;
3670 pub fn pwrite(
3671 fd: ::c_int,
3672 buf: *const ::c_void,
3673 count: ::size_t,
3674 offset: off_t,
3675 ) -> ::ssize_t;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003676 pub fn umask(mask: mode_t) -> mode_t;
3677
3678 pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
3679
3680 pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int;
3681
3682 pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
3683 pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
3684 pub fn mlockall(flags: ::c_int) -> ::c_int;
3685 pub fn munlockall() -> ::c_int;
3686
Matthew Maurere9a2a712020-01-02 15:36:15 -08003687 pub fn mmap(
3688 addr: *mut ::c_void,
3689 len: ::size_t,
3690 prot: ::c_int,
3691 flags: ::c_int,
3692 fd: ::c_int,
3693 offset: off_t,
3694 ) -> *mut ::c_void;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003695 pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
3696
3697 pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003698 pub fn if_indextoname(
3699 ifindex: ::c_uint,
3700 ifname: *mut ::c_char,
3701 ) -> *mut ::c_char;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003702
3703 pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
3704
3705 pub fn fsync(fd: ::c_int) -> ::c_int;
3706
Matthew Maurere9a2a712020-01-02 15:36:15 -08003707 pub fn setenv(
3708 name: *const c_char,
3709 val: *const c_char,
3710 overwrite: ::c_int,
3711 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003712 pub fn unsetenv(name: *const c_char) -> ::c_int;
3713
Matthew Maurere9a2a712020-01-02 15:36:15 -08003714 pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003715
3716 pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
3717
3718 pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
3719
Matthew Maurere9a2a712020-01-02 15:36:15 -08003720 pub fn realpath(
3721 pathname: *const ::c_char,
3722 resolved: *mut ::c_char,
3723 ) -> *mut ::c_char;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003724
3725 pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
3726
Matthew Maurere9a2a712020-01-02 15:36:15 -08003727 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003728 pub fn times(buf: *mut ::tms) -> ::clock_t;
3729
3730 pub fn pthread_self() -> ::pthread_t;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003731 pub fn pthread_join(
3732 native: ::pthread_t,
3733 value: *mut *mut ::c_void,
3734 ) -> ::c_int;
3735 pub fn pthread_exit(value: *mut ::c_void) -> !;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003736 pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
3737 pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003738 pub fn pthread_attr_setstacksize(
3739 attr: *mut ::pthread_attr_t,
3740 stack_size: ::size_t,
3741 ) -> ::c_int;
3742 pub fn pthread_attr_setdetachstate(
3743 attr: *mut ::pthread_attr_t,
3744 state: ::c_int,
3745 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003746 pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
3747 pub fn sched_yield() -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003748 pub fn pthread_key_create(
3749 key: *mut pthread_key_t,
3750 dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>,
3751 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003752 pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int;
3753 pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003754 pub fn pthread_setspecific(
3755 key: pthread_key_t,
3756 value: *const ::c_void,
3757 ) -> ::c_int;
3758 pub fn pthread_mutex_init(
3759 lock: *mut pthread_mutex_t,
3760 attr: *const pthread_mutexattr_t,
3761 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003762 pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int;
3763 pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int;
3764 pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int;
3765 pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
3766
3767 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003768 pub fn pthread_mutexattr_destroy(
3769 attr: *mut pthread_mutexattr_t,
3770 ) -> ::c_int;
3771 pub fn pthread_mutexattr_settype(
3772 attr: *mut pthread_mutexattr_t,
3773 _type: ::c_int,
3774 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003775
Matthew Maurere9a2a712020-01-02 15:36:15 -08003776 pub fn pthread_cond_init(
3777 cond: *mut pthread_cond_t,
3778 attr: *const pthread_condattr_t,
3779 ) -> ::c_int;
3780 pub fn pthread_cond_wait(
3781 cond: *mut pthread_cond_t,
3782 lock: *mut pthread_mutex_t,
3783 ) -> ::c_int;
3784 pub fn pthread_cond_timedwait(
3785 cond: *mut pthread_cond_t,
3786 lock: *mut pthread_mutex_t,
3787 abstime: *const ::timespec,
3788 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003789 pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
3790 pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
3791 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
3792 pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
3793 pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003794 pub fn pthread_rwlock_init(
3795 lock: *mut pthread_rwlock_t,
3796 attr: *const pthread_rwlockattr_t,
3797 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003798 pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
3799 pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
3800 pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
3801 pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
3802 pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
3803 pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003804 pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t)
3805 -> ::c_int;
3806 pub fn pthread_rwlockattr_destroy(
3807 attr: *mut pthread_rwlockattr_t,
3808 ) -> ::c_int;
3809 pub fn strerror_r(
3810 errnum: ::c_int,
3811 buf: *mut c_char,
3812 buflen: ::size_t,
3813 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003814
Matthew Maurere9a2a712020-01-02 15:36:15 -08003815 pub fn getsockopt(
3816 sockfd: ::c_int,
3817 level: ::c_int,
3818 optname: ::c_int,
3819 optval: *mut ::c_void,
3820 optlen: *mut ::socklen_t,
3821 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003822 pub fn raise(signum: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003823 pub fn sigaction(
3824 signum: ::c_int,
3825 act: *const sigaction,
3826 oldact: *mut sigaction,
3827 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003828
Matthew Maurere9a2a712020-01-02 15:36:15 -08003829 pub fn utimes(
3830 filename: *const ::c_char,
3831 times: *const ::timeval,
3832 ) -> ::c_int;
3833 pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003834 pub fn dlerror() -> *mut ::c_char;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003835 pub fn dlsym(
3836 handle: *mut ::c_void,
3837 symbol: *const ::c_char,
3838 ) -> *mut ::c_void;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003839 pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
3840 pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
3841
Matthew Maurere9a2a712020-01-02 15:36:15 -08003842 pub fn getaddrinfo(
3843 node: *const c_char,
3844 service: *const c_char,
3845 hints: *const addrinfo,
3846 res: *mut *mut addrinfo,
3847 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003848 pub fn freeaddrinfo(res: *mut addrinfo);
3849 pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
3850 pub fn res_init() -> ::c_int;
3851
3852 pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
3853 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
3854 pub fn mktime(tm: *mut tm) -> time_t;
3855 pub fn time(time: *mut time_t) -> time_t;
3856 pub fn gmtime(time_p: *const time_t) -> *mut tm;
3857 pub fn localtime(time_p: *const time_t) -> *mut tm;
3858
Matthew Maurere9a2a712020-01-02 15:36:15 -08003859 pub fn mknod(
3860 pathname: *const ::c_char,
3861 mode: ::mode_t,
3862 dev: ::dev_t,
3863 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003864 pub fn uname(buf: *mut ::utsname) -> ::c_int;
3865 pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003866 pub fn getservbyname(
3867 name: *const ::c_char,
3868 proto: *const ::c_char,
3869 ) -> *mut servent;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003870 pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
3871 pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003872 pub fn usleep(secs: ::c_uint) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003873 pub fn send(
3874 socket: ::c_int,
3875 buf: *const ::c_void,
3876 len: ::size_t,
3877 flags: ::c_int,
3878 ) -> ::ssize_t;
3879 pub fn recv(
3880 socket: ::c_int,
3881 buf: *mut ::c_void,
3882 len: ::size_t,
3883 flags: ::c_int,
3884 ) -> ::ssize_t;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003885 pub fn putenv(string: *mut c_char) -> ::c_int;
3886 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003887 pub fn select(
3888 nfds: ::c_int,
3889 readfs: *mut fd_set,
3890 writefds: *mut fd_set,
3891 errorfds: *mut fd_set,
3892 timeout: *mut timeval,
3893 ) -> ::c_int;
3894 pub fn setlocale(
3895 category: ::c_int,
3896 locale: *const ::c_char,
3897 ) -> *mut ::c_char;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003898 pub fn localeconv() -> *mut lconv;
3899
3900 pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
3901 pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
3902 pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
3903 pub fn sem_post(sem: *mut sem_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003904 pub fn sem_init(
3905 sem: *mut sem_t,
3906 pshared: ::c_int,
3907 value: ::c_uint,
3908 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003909 pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
3910 pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
3911
Matthew Maurere9a2a712020-01-02 15:36:15 -08003912 pub fn readlink(
3913 path: *const c_char,
3914 buf: *mut c_char,
3915 bufsz: ::size_t,
3916 ) -> ::ssize_t;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003917
3918 pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
3919 pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
3920 pub fn sigfillset(set: *mut sigset_t) -> ::c_int;
3921 pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
3922 pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
3923
Matthew Maurere9a2a712020-01-02 15:36:15 -08003924 pub fn sigprocmask(
3925 how: ::c_int,
3926 set: *const sigset_t,
3927 oldset: *mut sigset_t,
3928 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003929 pub fn sigpending(set: *mut sigset_t) -> ::c_int;
3930
3931 pub fn timegm(tm: *mut ::tm) -> time_t;
3932
3933 pub fn getsid(pid: pid_t) -> pid_t;
3934
3935 pub fn sysconf(name: ::c_int) -> ::c_long;
3936
3937 pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
3938
Matthew Maurere9a2a712020-01-02 15:36:15 -08003939 pub fn pselect(
3940 nfds: ::c_int,
3941 readfs: *mut fd_set,
3942 writefds: *mut fd_set,
3943 errorfds: *mut fd_set,
3944 timeout: *const timespec,
3945 sigmask: *const sigset_t,
3946 ) -> ::c_int;
3947 pub fn fseeko(
3948 stream: *mut ::FILE,
3949 offset: ::off_t,
3950 whence: ::c_int,
3951 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003952 pub fn ftello(stream: *mut ::FILE) -> ::off_t;
3953 pub fn tcdrain(fd: ::c_int) -> ::c_int;
3954 pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
3955 pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t;
3956 pub fn cfmakeraw(termios: *mut ::termios);
3957 pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
3958 pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
3959 pub fn cfsetspeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
3960 pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003961 pub fn tcsetattr(
3962 fd: ::c_int,
3963 optional_actions: ::c_int,
3964 termios: *const ::termios,
3965 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003966 pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
3967 pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
3968 pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
3969 pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
3970 pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
3971 pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
3972
3973 pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char;
3974
3975 pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
3976 pub fn closelog();
3977 pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
3978 pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003979
3980 pub fn grantpt(fd: ::c_int) -> ::c_int;
3981 pub fn posix_openpt(flags: ::c_int) -> ::c_int;
3982 pub fn ptsname(fd: ::c_int) -> *mut ::c_char;
3983 pub fn unlockpt(fd: ::c_int) -> ::c_int;
3984
3985 pub fn fdatasync(fd: ::c_int) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003986 pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
3987 pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08003988 pub fn clock_settime(
3989 clk_id: ::clockid_t,
3990 tp: *const ::timespec,
3991 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08003992 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
3993
Matthew Maurere9a2a712020-01-02 15:36:15 -08003994 pub fn pthread_getattr_np(
3995 native: ::pthread_t,
3996 attr: *mut ::pthread_attr_t,
3997 ) -> ::c_int;
3998 pub fn pthread_attr_getstack(
3999 attr: *const ::pthread_attr_t,
4000 stackaddr: *mut *mut ::c_void,
4001 stacksize: *mut ::size_t,
4002 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004003 pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004004 pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004005 pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
4006 pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004007 pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004008 pub fn memrchr(
4009 cx: *const ::c_void,
4010 c: ::c_int,
4011 n: ::size_t,
4012 ) -> *mut ::c_void;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004013
Matthew Maurere9a2a712020-01-02 15:36:15 -08004014 pub fn posix_fadvise(
4015 fd: ::c_int,
4016 offset: ::off_t,
4017 len: ::off_t,
4018 advise: ::c_int,
4019 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004020 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004021 pub fn utimensat(
4022 dirfd: ::c_int,
4023 path: *const ::c_char,
4024 times: *const ::timespec,
4025 flag: ::c_int,
4026 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004027 pub fn duplocale(base: ::locale_t) -> ::locale_t;
4028 pub fn freelocale(loc: ::locale_t);
Matthew Maurere9a2a712020-01-02 15:36:15 -08004029 pub fn newlocale(
4030 mask: ::c_int,
4031 locale: *const ::c_char,
4032 base: ::locale_t,
4033 ) -> ::locale_t;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004034 pub fn uselocale(loc: ::locale_t) -> ::locale_t;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004035
4036 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
4037
Matthew Maurere9a2a712020-01-02 15:36:15 -08004038 pub fn mknodat(
4039 dirfd: ::c_int,
4040 pathname: *const ::c_char,
4041 mode: ::mode_t,
4042 dev: dev_t,
4043 ) -> ::c_int;
4044 pub fn pthread_condattr_getclock(
4045 attr: *const pthread_condattr_t,
4046 clock_id: *mut clockid_t,
4047 ) -> ::c_int;
4048 pub fn pthread_condattr_setclock(
4049 attr: *mut pthread_condattr_t,
4050 clock_id: ::clockid_t,
4051 ) -> ::c_int;
4052 pub fn accept4(
4053 fd: ::c_int,
4054 addr: *mut ::sockaddr,
4055 len: *mut ::socklen_t,
4056 flg: ::c_int,
4057 ) -> ::c_int;
4058 pub fn ptsname_r(
4059 fd: ::c_int,
4060 buf: *mut ::c_char,
4061 buflen: ::size_t,
4062 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004063 pub fn clearenv() -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004064 pub fn waitid(
4065 idtype: idtype_t,
4066 id: id_t,
4067 infop: *mut ::siginfo_t,
4068 options: ::c_int,
4069 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004070 pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int;
4071 pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004072 pub fn getresuid(
4073 ruid: *mut ::uid_t,
4074 euid: *mut ::uid_t,
4075 suid: *mut ::uid_t,
4076 ) -> ::c_int;
4077 pub fn getresgid(
4078 rgid: *mut ::gid_t,
4079 egid: *mut ::gid_t,
4080 sgid: *mut ::gid_t,
4081 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004082 pub fn acct(filename: *const ::c_char) -> ::c_int;
4083 pub fn brk(addr: *mut ::c_void) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004084 pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
4085 pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004086 pub fn openpty(
4087 amaster: *mut ::c_int,
4088 aslave: *mut ::c_int,
4089 name: *mut ::c_char,
4090 termp: *const termios,
4091 winp: *const ::winsize,
4092 ) -> ::c_int;
4093 pub fn execvpe(
4094 file: *const ::c_char,
4095 argv: *const *const ::c_char,
4096 envp: *const *const ::c_char,
4097 ) -> ::c_int;
4098 pub fn fexecve(
4099 fd: ::c_int,
4100 argv: *const *const ::c_char,
4101 envp: *const *const ::c_char,
4102 ) -> ::c_int;
Taylor Cramerb4cfe882017-11-15 11:29:01 -08004103
4104 pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004105
4106 pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
4107
4108 pub fn setpwent();
4109 pub fn endpwent();
4110 pub fn getpwent() -> *mut passwd;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004111
Matthew Maurere9a2a712020-01-02 15:36:15 -08004112 pub fn shm_open(
4113 name: *const c_char,
4114 oflag: ::c_int,
4115 mode: mode_t,
4116 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004117
4118 // System V IPC
4119 pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004120 pub fn shmat(
4121 shmid: ::c_int,
4122 shmaddr: *const ::c_void,
4123 shmflg: ::c_int,
4124 ) -> *mut ::c_void;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004125 pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004126 pub fn shmctl(
4127 shmid: ::c_int,
4128 cmd: ::c_int,
4129 buf: *mut ::shmid_ds,
4130 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004131 pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
4132 pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004133 pub fn semop(
4134 semid: ::c_int,
4135 sops: *mut ::sembuf,
4136 nsops: ::size_t,
4137 ) -> ::c_int;
4138 pub fn semctl(
4139 semid: ::c_int,
4140 semnum: ::c_int,
4141 cmd: ::c_int,
4142 ...
4143 ) -> ::c_int;
4144 pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds)
4145 -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004146 pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004147 pub fn msgrcv(
4148 msqid: ::c_int,
4149 msgp: *mut ::c_void,
4150 msgsz: ::size_t,
4151 msgtyp: ::c_long,
4152 msgflg: ::c_int,
4153 ) -> ::ssize_t;
4154 pub fn msgsnd(
4155 msqid: ::c_int,
4156 msgp: *const ::c_void,
4157 msgsz: ::size_t,
4158 msgflg: ::c_int,
4159 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004160
Matthew Maurere9a2a712020-01-02 15:36:15 -08004161 pub fn mprotect(
4162 addr: *mut ::c_void,
4163 len: ::size_t,
4164 prot: ::c_int,
4165 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004166 pub fn __errno_location() -> *mut ::c_int;
4167
Matthew Maurere9a2a712020-01-02 15:36:15 -08004168 pub fn fallocate(
4169 fd: ::c_int,
4170 mode: ::c_int,
4171 offset: ::off_t,
4172 len: ::off_t,
4173 ) -> ::c_int;
4174 pub fn posix_fallocate(
4175 fd: ::c_int,
4176 offset: ::off_t,
4177 len: ::off_t,
4178 ) -> ::c_int;
4179 pub fn readahead(
4180 fd: ::c_int,
4181 offset: ::off64_t,
4182 count: ::size_t,
4183 ) -> ::ssize_t;
4184 pub fn signalfd(
4185 fd: ::c_int,
4186 mask: *const ::sigset_t,
4187 flags: ::c_int,
4188 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004189 pub fn timerfd_create(clockid: ::c_int, flags: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004190 pub fn timerfd_gettime(
4191 fd: ::c_int,
4192 curr_value: *mut itimerspec,
4193 ) -> ::c_int;
4194 pub fn timerfd_settime(
4195 fd: ::c_int,
4196 flags: ::c_int,
4197 new_value: *const itimerspec,
4198 old_value: *mut itimerspec,
4199 ) -> ::c_int;
4200 pub fn pwritev(
4201 fd: ::c_int,
4202 iov: *const ::iovec,
4203 iovcnt: ::c_int,
4204 offset: ::off_t,
4205 ) -> ::ssize_t;
4206 pub fn preadv(
4207 fd: ::c_int,
4208 iov: *const ::iovec,
4209 iovcnt: ::c_int,
4210 offset: ::off_t,
4211 ) -> ::ssize_t;
4212 pub fn quotactl(
4213 cmd: ::c_int,
4214 special: *const ::c_char,
4215 id: ::c_int,
4216 data: *mut ::c_char,
4217 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004218 pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
4219 pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004220 pub fn mkostemps(
4221 template: *mut ::c_char,
4222 suffixlen: ::c_int,
4223 flags: ::c_int,
4224 ) -> ::c_int;
4225 pub fn sigtimedwait(
4226 set: *const sigset_t,
4227 info: *mut siginfo_t,
4228 timeout: *const ::timespec,
4229 ) -> ::c_int;
4230 pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
4231 pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t)
4232 -> *mut ::c_char;
4233 pub fn getnameinfo(
4234 sa: *const ::sockaddr,
4235 salen: ::socklen_t,
4236 host: *mut ::c_char,
4237 hostlen: ::socklen_t,
4238 serv: *mut ::c_char,
4239 sevlen: ::socklen_t,
4240 flags: ::c_int,
4241 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004242 pub fn reboot(how_to: ::c_int) -> ::c_int;
4243 pub fn setfsgid(gid: ::gid_t) -> ::c_int;
4244 pub fn setfsuid(uid: ::uid_t) -> ::c_int;
4245
4246 // Not available now on Android
Matthew Maurere9a2a712020-01-02 15:36:15 -08004247 pub fn mkfifoat(
4248 dirfd: ::c_int,
4249 pathname: *const ::c_char,
4250 mode: ::mode_t,
4251 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004252 pub fn if_nameindex() -> *mut if_nameindex;
4253 pub fn if_freenameindex(ptr: *mut if_nameindex);
Matthew Maurere9a2a712020-01-02 15:36:15 -08004254 pub fn sync_file_range(
4255 fd: ::c_int,
4256 offset: ::off64_t,
4257 nbytes: ::off64_t,
4258 flags: ::c_uint,
4259 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004260 pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
4261 pub fn freeifaddrs(ifa: *mut ::ifaddrs);
4262
Matthew Maurere9a2a712020-01-02 15:36:15 -08004263 pub fn glob(
4264 pattern: *const c_char,
4265 flags: ::c_int,
4266 errfunc: ::Option<
4267 extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int,
4268 >,
4269 pglob: *mut ::glob_t,
4270 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004271 pub fn globfree(pglob: *mut ::glob_t);
4272
Matthew Maurere9a2a712020-01-02 15:36:15 -08004273 pub fn posix_madvise(
4274 addr: *mut ::c_void,
4275 len: ::size_t,
4276 advice: ::c_int,
4277 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004278
4279 pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
4280
4281 pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
4282
4283 pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004284 pub fn madvise(
4285 addr: *mut ::c_void,
4286 len: ::size_t,
4287 advice: ::c_int,
4288 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004289
Matthew Maurere9a2a712020-01-02 15:36:15 -08004290 pub fn msync(
4291 addr: *mut ::c_void,
4292 len: ::size_t,
4293 flags: ::c_int,
4294 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004295
Matthew Maurere9a2a712020-01-02 15:36:15 -08004296 pub fn recvfrom(
4297 socket: ::c_int,
4298 buf: *mut ::c_void,
4299 len: ::size_t,
4300 flags: ::c_int,
4301 addr: *mut ::sockaddr,
4302 addrlen: *mut ::socklen_t,
4303 ) -> ::ssize_t;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004304 pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
4305 pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
4306 pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
4307
Matthew Maurere9a2a712020-01-02 15:36:15 -08004308 pub fn bind(
4309 socket: ::c_int,
4310 address: *const ::sockaddr,
4311 address_len: ::socklen_t,
4312 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004313
Matthew Maurere9a2a712020-01-02 15:36:15 -08004314 pub fn writev(
4315 fd: ::c_int,
4316 iov: *const ::iovec,
4317 iovcnt: ::c_int,
4318 ) -> ::ssize_t;
4319 pub fn readv(
4320 fd: ::c_int,
4321 iov: *const ::iovec,
4322 iovcnt: ::c_int,
4323 ) -> ::ssize_t;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004324
Matthew Maurere9a2a712020-01-02 15:36:15 -08004325 pub fn sendmsg(
4326 fd: ::c_int,
4327 msg: *const ::msghdr,
4328 flags: ::c_int,
4329 ) -> ::ssize_t;
4330 pub fn recvmsg(
4331 fd: ::c_int,
4332 msg: *mut ::msghdr,
4333 flags: ::c_int,
4334 ) -> ::ssize_t;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004335 pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
4336 pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
4337 pub fn vhangup() -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004338 pub fn sendmmsg(
4339 sockfd: ::c_int,
4340 msgvec: *mut mmsghdr,
4341 vlen: ::c_uint,
4342 flags: ::c_int,
4343 ) -> ::c_int;
4344 pub fn recvmmsg(
4345 sockfd: ::c_int,
4346 msgvec: *mut mmsghdr,
4347 vlen: ::c_uint,
4348 flags: ::c_int,
4349 timeout: *mut ::timespec,
4350 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004351 pub fn sync();
4352 pub fn syscall(num: ::c_long, ...) -> ::c_long;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004353 pub fn sched_getaffinity(
4354 pid: ::pid_t,
4355 cpusetsize: ::size_t,
4356 cpuset: *mut cpu_set_t,
4357 ) -> ::c_int;
4358 pub fn sched_setaffinity(
4359 pid: ::pid_t,
4360 cpusetsize: ::size_t,
4361 cpuset: *const cpu_set_t,
4362 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004363 pub fn umount(target: *const ::c_char) -> ::c_int;
4364 pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004365 pub fn tee(
4366 fd_in: ::c_int,
4367 fd_out: ::c_int,
4368 len: ::size_t,
4369 flags: ::c_uint,
4370 ) -> ::ssize_t;
4371 pub fn settimeofday(
4372 tv: *const ::timeval,
4373 tz: *const ::timezone,
4374 ) -> ::c_int;
4375 pub fn splice(
4376 fd_in: ::c_int,
4377 off_in: *mut ::loff_t,
4378 fd_out: ::c_int,
4379 off_out: *mut ::loff_t,
4380 len: ::size_t,
4381 flags: ::c_uint,
4382 ) -> ::ssize_t;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004383 pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004384 pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec)
4385 -> ::c_int;
4386 pub fn sem_timedwait(
4387 sem: *mut sem_t,
4388 abstime: *const ::timespec,
4389 ) -> ::c_int;
4390 pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
4391 pub fn sched_setparam(
4392 pid: ::pid_t,
4393 param: *const ::sched_param,
4394 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004395 pub fn swapoff(puath: *const ::c_char) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004396 pub fn vmsplice(
4397 fd: ::c_int,
4398 iov: *const ::iovec,
4399 nr_segs: ::size_t,
4400 flags: ::c_uint,
4401 ) -> ::ssize_t;
4402 pub fn mount(
4403 src: *const ::c_char,
4404 target: *const ::c_char,
4405 fstype: *const ::c_char,
4406 flags: ::c_ulong,
4407 data: *const ::c_void,
4408 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004409 pub fn personality(persona: ::c_ulong) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004410 pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004411 pub fn ppoll(
4412 fds: *mut ::pollfd,
4413 nfds: nfds_t,
4414 timeout: *const ::timespec,
4415 sigmask: *const sigset_t,
4416 ) -> ::c_int;
4417 pub fn pthread_mutex_timedlock(
4418 lock: *mut pthread_mutex_t,
4419 abstime: *const ::timespec,
4420 ) -> ::c_int;
4421 pub fn clone(
4422 cb: extern "C" fn(*mut ::c_void) -> ::c_int,
4423 child_stack: *mut ::c_void,
4424 flags: ::c_int,
4425 arg: *mut ::c_void,
4426 ...
4427 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004428 pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004429 pub fn clock_nanosleep(
4430 clk_id: ::clockid_t,
4431 flags: ::c_int,
4432 rqtp: *const ::timespec,
4433 rmtp: *mut ::timespec,
4434 ) -> ::c_int;
4435 pub fn pthread_attr_getguardsize(
4436 attr: *const ::pthread_attr_t,
4437 guardsize: *mut ::size_t,
4438 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004439 pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
4440 pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004441 pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004442 pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004443 pub fn sched_setscheduler(
4444 pid: ::pid_t,
4445 policy: ::c_int,
4446 param: *const ::sched_param,
4447 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004448 pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004449 pub fn getgrgid_r(
4450 gid: ::gid_t,
4451 grp: *mut ::group,
4452 buf: *mut ::c_char,
4453 buflen: ::size_t,
4454 result: *mut *mut ::group,
4455 ) -> ::c_int;
4456 pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004457 pub fn sem_close(sem: *mut sem_t) -> ::c_int;
4458 pub fn getdtablesize() -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004459 pub fn getgrnam_r(
4460 name: *const ::c_char,
4461 grp: *mut ::group,
4462 buf: *mut ::c_char,
4463 buflen: ::size_t,
4464 result: *mut *mut ::group,
4465 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004466 pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004467 pub fn pthread_sigmask(
4468 how: ::c_int,
4469 set: *const sigset_t,
4470 oldset: *mut sigset_t,
4471 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004472 pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
4473 pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
4474 pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
4475 pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
4476 pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
4477 pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004478 pub fn getpwnam_r(
4479 name: *const ::c_char,
4480 pwd: *mut passwd,
4481 buf: *mut ::c_char,
4482 buflen: ::size_t,
4483 result: *mut *mut passwd,
4484 ) -> ::c_int;
4485 pub fn getpwuid_r(
4486 uid: ::uid_t,
4487 pwd: *mut passwd,
4488 buf: *mut ::c_char,
4489 buflen: ::size_t,
4490 result: *mut *mut passwd,
4491 ) -> ::c_int;
4492 pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
4493 pub fn pthread_atfork(
4494 prepare: ::Option<unsafe extern "C" fn()>,
4495 parent: ::Option<unsafe extern "C" fn()>,
4496 child: ::Option<unsafe extern "C" fn()>,
4497 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004498 pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
Matthew Maurere9a2a712020-01-02 15:36:15 -08004499 pub fn getgrouplist(
4500 user: *const ::c_char,
4501 group: ::gid_t,
4502 groups: *mut ::gid_t,
4503 ngroups: *mut ::c_int,
4504 ) -> ::c_int;
4505 pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
4506 pub fn faccessat(
4507 dirfd: ::c_int,
4508 pathname: *const ::c_char,
4509 mode: ::c_int,
4510 flags: ::c_int,
4511 ) -> ::c_int;
4512 pub fn pthread_create(
4513 native: *mut ::pthread_t,
4514 attr: *const ::pthread_attr_t,
4515 f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
4516 value: *mut ::c_void,
4517 ) -> ::c_int;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004518 pub fn dl_iterate_phdr(
Matthew Maurere9a2a712020-01-02 15:36:15 -08004519 callback: ::Option<
4520 unsafe extern "C" fn(
4521 info: *mut ::dl_phdr_info,
4522 size: ::size_t,
4523 data: *mut ::c_void,
4524 ) -> ::c_int,
4525 >,
4526 data: *mut ::c_void,
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004527 ) -> ::c_int;
4528}
4529
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004530cfg_if! {
4531 if #[cfg(target_arch = "aarch64")] {
4532 mod aarch64;
4533 pub use self::aarch64::*;
Taylor Cramerf7f9be32017-11-15 10:22:26 -08004534 } else if #[cfg(any(target_arch = "x86_64"))] {
4535 mod x86_64;
4536 pub use self::x86_64::*;
4537 } else {
4538 // Unknown target_arch
4539 }
4540}
gnzlbg5c1a6b82018-11-21 20:34:50 +01004541
4542cfg_if! {
gnzlbga17a91c2019-02-07 11:37:21 +01004543 if #[cfg(libc_align)] {
4544 #[macro_use]
4545 mod align;
4546 } else {
4547 #[macro_use]
4548 mod no_align;
4549 }
4550}
4551expand_align!();
4552
4553cfg_if! {
4554 if #[cfg(libc_core_cvoid)] {
4555 pub use ::ffi::c_void;
gnzlbg5c1a6b82018-11-21 20:34:50 +01004556 } else {
4557 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
4558 // enable more optimization opportunities around it recognizing things
4559 // like malloc/free.
4560 #[repr(u8)]
Bryant Mairsf3684582019-01-23 07:23:09 -08004561 #[allow(missing_copy_implementations)]
gnzlbga17a91c2019-02-07 11:37:21 +01004562 #[allow(missing_debug_implementations)]
gnzlbg5c1a6b82018-11-21 20:34:50 +01004563 pub enum c_void {
4564 // Two dummy variants so the #[repr] attribute can be used.
4565 #[doc(hidden)]
4566 __variant1,
4567 #[doc(hidden)]
4568 __variant2,
4569 }
4570 }
4571}