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