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