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