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