]> git.proxmox.com Git - rustc.git/blame - vendor/libc/src/unix/uclibc/mod.rs
New upstream version 1.38.0+dfsg1
[rustc.git] / vendor / libc / src / unix / uclibc / mod.rs
CommitLineData
041b39d2
XL
1pub type sa_family_t = u16;
2pub type pthread_key_t = ::c_uint;
3pub type speed_t = ::c_uint;
4pub type tcflag_t = ::c_uint;
5pub type loff_t = ::c_longlong;
6pub type clockid_t = ::c_int;
7pub type key_t = ::c_int;
8pub type id_t = ::c_uint;
9pub type useconds_t = u32;
10pub type dev_t = u64;
11pub type socklen_t = u32;
041b39d2
XL
12pub type mode_t = u32;
13pub type ino64_t = u64;
14pub type off64_t = i64;
15pub type blkcnt64_t = i64;
16pub type rlim64_t = u64;
17pub type shmatt_t = ::c_ulong;
18pub type mqd_t = ::c_int;
19pub type msgqnum_t = ::c_ulong;
20pub type msglen_t = ::c_ulong;
21pub type nfds_t = ::c_ulong;
22pub type nl_item = ::c_int;
23pub type idtype_t = ::c_uint;
24
532ac7d7 25#[cfg_attr(feature = "extra_traits", derive(Debug))]
041b39d2 26pub enum fpos64_t {} // TODO: fill this out with a struct
532ac7d7
XL
27impl ::Copy for fpos64_t {}
28impl ::Clone for fpos64_t {
29 fn clone(&self) -> fpos64_t { *self }
30}
041b39d2 31
532ac7d7 32#[cfg_attr(feature = "extra_traits", derive(Debug))]
041b39d2 33pub enum timezone {}
532ac7d7
XL
34impl ::Copy for timezone {}
35impl ::Clone for timezone {
36 fn clone(&self) -> timezone { *self }
37}
041b39d2
XL
38
39s! {
532ac7d7
XL
40 pub struct in_addr {
41 pub s_addr: ::in_addr_t,
42 }
43
44 pub struct ip_mreq {
45 pub imr_multiaddr: in_addr,
46 pub imr_interface: in_addr,
47 }
48
041b39d2
XL
49 pub struct sockaddr {
50 pub sa_family: sa_family_t,
51 pub sa_data: [::c_char; 14],
52 }
53
54 pub struct sockaddr_in {
55 pub sin_family: sa_family_t,
56 pub sin_port: ::in_port_t,
57 pub sin_addr: ::in_addr,
58 pub sin_zero: [u8; 8],
59 }
60
61 pub struct sockaddr_in6 {
62 pub sin6_family: sa_family_t,
63 pub sin6_port: ::in_port_t,
64 pub sin6_flowinfo: u32,
65 pub sin6_addr: ::in6_addr,
66 pub sin6_scope_id: u32,
67 }
68
041b39d2
XL
69 pub struct addrinfo {
70 pub ai_flags: ::c_int,
71 pub ai_family: ::c_int,
72 pub ai_socktype: ::c_int,
73 pub ai_protocol: ::c_int,
74 pub ai_addrlen: socklen_t,
75
76 pub ai_addr: *mut ::sockaddr,
77
78 pub ai_canonname: *mut c_char,
79
80 pub ai_next: *mut addrinfo,
81 }
82
041b39d2
XL
83 pub struct sockaddr_ll {
84 pub sll_family: ::c_ushort,
85 pub sll_protocol: ::c_ushort,
86 pub sll_ifindex: ::c_int,
87 pub sll_hatype: ::c_ushort,
88 pub sll_pkttype: ::c_uchar,
89 pub sll_halen: ::c_uchar,
90 pub sll_addr: [::c_uchar; 8]
91 }
92
93 pub struct fd_set {
94 fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
95 }
96
97 pub struct tm {
98 pub tm_sec: ::c_int,
99 pub tm_min: ::c_int,
100 pub tm_hour: ::c_int,
101 pub tm_mday: ::c_int,
102 pub tm_mon: ::c_int,
103 pub tm_year: ::c_int,
104 pub tm_wday: ::c_int,
105 pub tm_yday: ::c_int,
106 pub tm_isdst: ::c_int,
107 pub tm_gmtoff: ::c_long,
108 pub tm_zone: *const ::c_char,
109 }
110
111 pub struct sched_param {
112 pub sched_priority: ::c_int,
113 }
114
115 pub struct Dl_info {
116 pub dli_fname: *const ::c_char,
117 pub dli_fbase: *mut ::c_void,
118 pub dli_sname: *const ::c_char,
119 pub dli_saddr: *mut ::c_void,
120 }
121
041b39d2
XL
122 pub struct lconv {
123 pub decimal_point: *mut ::c_char,
124 pub thousands_sep: *mut ::c_char,
125 pub grouping: *mut ::c_char,
126 pub int_curr_symbol: *mut ::c_char,
127 pub currency_symbol: *mut ::c_char,
128 pub mon_decimal_point: *mut ::c_char,
129 pub mon_thousands_sep: *mut ::c_char,
130 pub mon_grouping: *mut ::c_char,
131 pub positive_sign: *mut ::c_char,
132 pub negative_sign: *mut ::c_char,
133 pub int_frac_digits: ::c_char,
134 pub frac_digits: ::c_char,
135 pub p_cs_precedes: ::c_char,
136 pub p_sep_by_space: ::c_char,
137 pub n_cs_precedes: ::c_char,
138 pub n_sep_by_space: ::c_char,
139 pub p_sign_posn: ::c_char,
140 pub n_sign_posn: ::c_char,
141 pub int_p_cs_precedes: ::c_char,
142 pub int_p_sep_by_space: ::c_char,
143 pub int_n_cs_precedes: ::c_char,
144 pub int_n_sep_by_space: ::c_char,
145 pub int_p_sign_posn: ::c_char,
146 pub int_n_sign_posn: ::c_char,
147 }
148
041b39d2
XL
149 pub struct rlimit64 {
150 pub rlim_cur: rlim64_t,
151 pub rlim_max: rlim64_t,
152 }
153
154 pub struct glob_t {
155 pub gl_pathc: ::size_t,
156 pub gl_pathv: *mut *mut c_char,
157 pub gl_offs: ::size_t,
158 pub gl_flags: ::c_int,
159
160 __unused1: *mut ::c_void,
161 __unused2: *mut ::c_void,
162 __unused3: *mut ::c_void,
163 __unused4: *mut ::c_void,
164 __unused5: *mut ::c_void,
165 }
166
167 pub struct ifaddrs {
168 pub ifa_next: *mut ifaddrs,
169 pub ifa_name: *mut c_char,
170 pub ifa_flags: ::c_uint,
171 pub ifa_addr: *mut ::sockaddr,
172 pub ifa_netmask: *mut ::sockaddr,
173 pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
174 pub ifa_data: *mut ::c_void
175 }
176
041b39d2
XL
177 pub struct pthread_rwlockattr_t {
178 __lockkind: ::c_int,
179 __pshared: ::c_int,
180 }
181
041b39d2
XL
182 pub struct passwd {
183 pub pw_name: *mut ::c_char,
184 pub pw_passwd: *mut ::c_char,
185 pub pw_uid: ::uid_t,
186 pub pw_gid: ::gid_t,
187 pub pw_gecos: *mut ::c_char,
188 pub pw_dir: *mut ::c_char,
189 pub pw_shell: *mut ::c_char,
190 }
191
192 pub struct spwd {
193 pub sp_namp: *mut ::c_char,
194 pub sp_pwdp: *mut ::c_char,
195 pub sp_lstchg: ::c_long,
196 pub sp_min: ::c_long,
197 pub sp_max: ::c_long,
198 pub sp_warn: ::c_long,
199 pub sp_inact: ::c_long,
200 pub sp_expire: ::c_long,
201 pub sp_flag: ::c_ulong,
202 }
203
204 pub struct statvfs {
205 pub f_bsize: ::c_ulong,
206 pub f_frsize: ::c_ulong,
207 pub f_blocks: ::fsblkcnt_t,
208 pub f_bfree: ::fsblkcnt_t,
209 pub f_bavail: ::fsblkcnt_t,
210 pub f_files: ::fsfilcnt_t,
211 pub f_ffree: ::fsfilcnt_t,
212 pub f_favail: ::fsfilcnt_t,
213 #[cfg(target_endian = "little")]
214 pub f_fsid: ::c_ulong,
215 #[cfg(target_pointer_width = "32")]
216 __f_unused: ::c_int,
217 #[cfg(target_endian = "big")]
218 pub f_fsid: ::c_ulong,
219 pub f_flag: ::c_ulong,
220 pub f_namemax: ::c_ulong,
221 __f_spare: [::c_int; 6],
222 }
223
224 pub struct dqblk {
416331ca
XL
225 pub dqb_bhardlimit: u32,
226 pub dqb_bsoftlimit: u32,
227 pub dqb_curblocks: u32,
228 pub dqb_ihardlimit: u32,
229 pub dqb_isoftlimit: u32,
230 pub dqb_curinodes: u32,
041b39d2
XL
231 pub dqb_btime: ::time_t,
232 pub dqb_itime: ::time_t,
233 }
234
235 pub struct signalfd_siginfo {
416331ca
XL
236 pub ssi_signo: u32,
237 pub ssi_errno: i32,
238 pub ssi_code: i32,
239 pub ssi_pid: u32,
240 pub ssi_uid: u32,
241 pub ssi_fd: i32,
242 pub ssi_tid: u32,
243 pub ssi_band: u32,
244 pub ssi_overrun: u32,
245 pub ssi_trapno: u32,
246 pub ssi_status: i32,
247 pub ssi_int: i32,
248 pub ssi_ptr: u64,
249 pub ssi_utime: u64,
250 pub ssi_stime: u64,
251 pub ssi_addr: u64,
252 pub ssi_addr_lsb: u16,
253 _pad2: u16,
254 pub ssi_syscall: i32,
255 pub ssi_call_addr: u64,
256 pub ssi_arch: u32,
257 _pad: [u8; 28],
041b39d2
XL
258 }
259
260 pub struct fsid_t {
261 __val: [::c_int; 2],
262 }
263
041b39d2
XL
264 pub struct cpu_set_t {
265 #[cfg(target_pointer_width = "32")]
266 bits: [u32; 32],
267 #[cfg(target_pointer_width = "64")]
268 bits: [u64; 16],
269 }
270
271 pub struct if_nameindex {
272 pub if_index: ::c_uint,
273 pub if_name: *mut ::c_char,
274 }
275
276 // System V IPC
277 pub struct msginfo {
278 pub msgpool: ::c_int,
279 pub msgmap: ::c_int,
280 pub msgmax: ::c_int,
281 pub msgmnb: ::c_int,
282 pub msgmni: ::c_int,
283 pub msgssz: ::c_int,
284 pub msgtql: ::c_int,
285 pub msgseg: ::c_ushort,
286 }
287}
288
532ac7d7
XL
289s_no_extra_traits! {
290 #[cfg_attr(
291 any(target_arch = "x86", target_arch = "x86_64"),
292 repr(packed)
293 )]
294 #[allow(missing_debug_implementations)]
295 pub struct epoll_event {
416331ca
XL
296 pub events: u32,
297 pub u64: u64,
532ac7d7
XL
298 }
299
300 #[allow(missing_debug_implementations)]
301 pub struct sockaddr_un {
302 pub sun_family: sa_family_t,
303 pub sun_path: [::c_char; 108]
304 }
305
306 #[allow(missing_debug_implementations)]
307 pub struct sockaddr_storage {
308 pub ss_family: sa_family_t,
309 __ss_align: ::size_t,
310 #[cfg(target_pointer_width = "32")]
311 __ss_pad2: [u8; 128 - 2 * 4],
312 #[cfg(target_pointer_width = "64")]
313 __ss_pad2: [u8; 128 - 2 * 8],
314 }
315
316 #[allow(missing_debug_implementations)]
317 pub struct utsname {
318 pub sysname: [::c_char; 65],
319 pub nodename: [::c_char; 65],
320 pub release: [::c_char; 65],
321 pub version: [::c_char; 65],
322 pub machine: [::c_char; 65],
323 pub domainname: [::c_char; 65]
324 }
325
326 #[allow(missing_debug_implementations)]
327 pub struct dirent {
328 pub d_ino: ::ino_t,
329 pub d_off: ::off_t,
330 pub d_reclen: ::c_ushort,
331 pub d_type: ::c_uchar,
332 pub d_name: [::c_char; 256],
333 }
334
335 #[allow(missing_debug_implementations)]
336 pub struct dirent64 {
337 pub d_ino: ::ino64_t,
338 pub d_off: ::off64_t,
339 pub d_reclen: ::c_ushort,
340 pub d_type: ::c_uchar,
341 pub d_name: [::c_char; 256],
342 }
416331ca
XL
343
344 pub struct mq_attr {
345 pub mq_flags: ::c_long,
346 pub mq_maxmsg: ::c_long,
347 pub mq_msgsize: ::c_long,
348 pub mq_curmsgs: ::c_long,
349 pad: [::c_long; 4]
350 }
351
352 pub struct sockaddr_nl {
353 pub nl_family: ::sa_family_t,
354 nl_pad: ::c_ushort,
355 pub nl_pid: u32,
356 pub nl_groups: u32
357 }
358
359 pub struct sigevent {
360 pub sigev_value: ::sigval,
361 pub sigev_signo: ::c_int,
362 pub sigev_notify: ::c_int,
363 // Actually a union. We only expose sigev_notify_thread_id because it's
364 // the most useful member
365 pub sigev_notify_thread_id: ::c_int,
366 #[cfg(target_pointer_width = "64")]
367 __unused1: [::c_int; 11],
368 #[cfg(target_pointer_width = "32")]
369 __unused1: [::c_int; 12]
370 }
371}
372
373cfg_if! {
374 if #[cfg(feature = "extra_traits")] {
375 impl PartialEq for mq_attr {
376 fn eq(&self, other: &mq_attr) -> bool {
377 self.mq_flags == other.mq_flags &&
378 self.mq_maxmsg == other.mq_maxmsg &&
379 self.mq_msgsize == other.mq_msgsize &&
380 self.mq_curmsgs == other.mq_curmsgs
381 }
382 }
383 impl Eq for mq_attr {}
384 impl ::fmt::Debug for mq_attr {
385 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
386 f.debug_struct("mq_attr")
387 .field("mq_flags", &self.mq_flags)
388 .field("mq_maxmsg", &self.mq_maxmsg)
389 .field("mq_msgsize", &self.mq_msgsize)
390 .field("mq_curmsgs", &self.mq_curmsgs)
391 .finish()
392 }
393 }
394 impl ::hash::Hash for mq_attr {
395 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
396 self.mq_flags.hash(state);
397 self.mq_maxmsg.hash(state);
398 self.mq_msgsize.hash(state);
399 self.mq_curmsgs.hash(state);
400 }
401 }
402
403 impl PartialEq for sockaddr_nl {
404 fn eq(&self, other: &sockaddr_nl) -> bool {
405 self.nl_family == other.nl_family &&
406 self.nl_pid == other.nl_pid &&
407 self.nl_groups == other.nl_groups
408 }
409 }
410 impl Eq for sockaddr_nl {}
411 impl ::fmt::Debug for sockaddr_nl {
412 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
413 f.debug_struct("sockaddr_nl")
414 .field("nl_family", &self.nl_family)
415 .field("nl_pid", &self.nl_pid)
416 .field("nl_groups", &self.nl_groups)
417 .finish()
418 }
419 }
420 impl ::hash::Hash for sockaddr_nl {
421 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
422 self.nl_family.hash(state);
423 self.nl_pid.hash(state);
424 self.nl_groups.hash(state);
425 }
426 }
427
428 impl PartialEq for sigevent {
429 fn eq(&self, other: &sigevent) -> bool {
430 self.sigev_value == other.sigev_value
431 && self.sigev_signo == other.sigev_signo
432 && self.sigev_notify == other.sigev_notify
433 && self.sigev_notify_thread_id
434 == other.sigev_notify_thread_id
435 }
436 }
437 impl Eq for sigevent {}
438 impl ::fmt::Debug for sigevent {
439 fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
440 f.debug_struct("sigevent")
441 .field("sigev_value", &self.sigev_value)
442 .field("sigev_signo", &self.sigev_signo)
443 .field("sigev_notify", &self.sigev_notify)
444 .field("sigev_notify_thread_id",
445 &self.sigev_notify_thread_id)
446 .finish()
447 }
448 }
449 impl ::hash::Hash for sigevent {
450 fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
451 self.sigev_value.hash(state);
452 self.sigev_signo.hash(state);
453 self.sigev_notify.hash(state);
454 self.sigev_notify_thread_id.hash(state);
455 }
456 }
457 }
532ac7d7
XL
458}
459
041b39d2
XL
460// intentionally not public, only used for fd_set
461cfg_if! {
462 if #[cfg(target_pointer_width = "32")] {
463 const ULONG_SIZE: usize = 32;
464 } else if #[cfg(target_pointer_width = "64")] {
465 const ULONG_SIZE: usize = 64;
466 } else {
467 // Unknown target_pointer_width
468 }
469}
470
471pub const EXIT_FAILURE: ::c_int = 1;
472pub const EXIT_SUCCESS: ::c_int = 0;
473pub const RAND_MAX: ::c_int = 2147483647;
474pub const EOF: ::c_int = -1;
475pub const SEEK_SET: ::c_int = 0;
476pub const SEEK_CUR: ::c_int = 1;
477pub const SEEK_END: ::c_int = 2;
478pub const _IOFBF: ::c_int = 0;
479pub const _IONBF: ::c_int = 2;
480pub const _IOLBF: ::c_int = 1;
481
482pub const F_DUPFD: ::c_int = 0;
483pub const F_GETFD: ::c_int = 1;
484pub const F_SETFD: ::c_int = 2;
485pub const F_GETFL: ::c_int = 3;
486pub const F_SETFL: ::c_int = 4;
487
488// Linux-specific fcntls
489pub const F_SETLEASE: ::c_int = 1024;
490pub const F_GETLEASE: ::c_int = 1025;
491pub const F_NOTIFY: ::c_int = 1026;
492pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
493
494// TODO(#235): Include file sealing fcntls once we have a way to verify them.
495
496pub const SIGTRAP: ::c_int = 5;
497
498pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
499pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
500
ea8adc8c
XL
501pub const CLOCK_REALTIME: ::clockid_t = 0;
502pub const CLOCK_MONOTONIC: ::clockid_t = 1;
503pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
504pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
041b39d2
XL
505// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
506// 2014.) See also musl/mod.rs
ea8adc8c
XL
507// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
508// pub const CLOCK_TAI: ::clockid_t = 11;
041b39d2
XL
509pub const TIMER_ABSTIME: ::c_int = 1;
510
511pub const RLIMIT_CPU: ::c_int = 0;
512pub const RLIMIT_FSIZE: ::c_int = 1;
513pub const RLIMIT_DATA: ::c_int = 2;
514pub const RLIMIT_STACK: ::c_int = 3;
515pub const RLIMIT_CORE: ::c_int = 4;
516pub const RLIMIT_LOCKS: ::c_int = 10;
517pub const RLIMIT_SIGPENDING: ::c_int = 11;
518pub const RLIMIT_MSGQUEUE: ::c_int = 12;
519pub const RLIMIT_NICE: ::c_int = 13;
520pub const RLIMIT_RTPRIO: ::c_int = 14;
521
522pub const RUSAGE_SELF: ::c_int = 0;
523
524pub const O_RDONLY: ::c_int = 0;
525pub const O_WRONLY: ::c_int = 1;
526pub const O_RDWR: ::c_int = 2;
527
528pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
529
530pub const S_IFIFO: ::mode_t = 4096;
531pub const S_IFCHR: ::mode_t = 8192;
532pub const S_IFBLK: ::mode_t = 24576;
533pub const S_IFDIR: ::mode_t = 16384;
534pub const S_IFREG: ::mode_t = 32768;
535pub const S_IFLNK: ::mode_t = 40960;
536pub const S_IFSOCK: ::mode_t = 49152;
537pub const S_IFMT: ::mode_t = 61440;
538pub const S_IRWXU: ::mode_t = 448;
539pub const S_IXUSR: ::mode_t = 64;
540pub const S_IWUSR: ::mode_t = 128;
541pub const S_IRUSR: ::mode_t = 256;
542pub const S_IRWXG: ::mode_t = 56;
543pub const S_IXGRP: ::mode_t = 8;
544pub const S_IWGRP: ::mode_t = 16;
545pub const S_IRGRP: ::mode_t = 32;
546pub const S_IRWXO: ::mode_t = 7;
547pub const S_IXOTH: ::mode_t = 1;
548pub const S_IWOTH: ::mode_t = 2;
549pub const S_IROTH: ::mode_t = 4;
550pub const F_OK: ::c_int = 0;
551pub const R_OK: ::c_int = 4;
552pub const W_OK: ::c_int = 2;
553pub const X_OK: ::c_int = 1;
554pub const STDIN_FILENO: ::c_int = 0;
555pub const STDOUT_FILENO: ::c_int = 1;
556pub const STDERR_FILENO: ::c_int = 2;
557pub const SIGHUP: ::c_int = 1;
558pub const SIGINT: ::c_int = 2;
559pub const SIGQUIT: ::c_int = 3;
560pub const SIGILL: ::c_int = 4;
561pub const SIGABRT: ::c_int = 6;
562pub const SIGFPE: ::c_int = 8;
563pub const SIGKILL: ::c_int = 9;
564pub const SIGSEGV: ::c_int = 11;
565pub const SIGPIPE: ::c_int = 13;
566pub const SIGALRM: ::c_int = 14;
567pub const SIGTERM: ::c_int = 15;
568
569pub const PROT_NONE: ::c_int = 0;
570pub const PROT_READ: ::c_int = 1;
571pub const PROT_WRITE: ::c_int = 2;
572pub const PROT_EXEC: ::c_int = 4;
573
574pub const LC_CTYPE: ::c_int = 0;
575pub const LC_NUMERIC: ::c_int = 1;
576pub const LC_MONETARY: ::c_int = 2;
577pub const LC_TIME: ::c_int = 3;
578pub const LC_COLLATE: ::c_int = 4;
579pub const LC_MESSAGES: ::c_int = 5;
580pub const LC_ALL: ::c_int = 6;
581pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
582pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
583pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
584pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
585pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
586pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
587// LC_ALL_MASK defined per platform
588
589pub const MAP_FILE: ::c_int = 0x0000;
590pub const MAP_SHARED: ::c_int = 0x0001;
591pub const MAP_PRIVATE: ::c_int = 0x0002;
592pub const MAP_FIXED: ::c_int = 0x0010;
593
594pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
595
596// MS_ flags for msync(2)
597pub const MS_ASYNC: ::c_int = 0x0001;
598pub const MS_INVALIDATE: ::c_int = 0x0002;
599pub const MS_SYNC: ::c_int = 0x0004;
600
601// MS_ flags for mount(2)
602pub const MS_RDONLY: ::c_ulong = 0x01;
603pub const MS_NOSUID: ::c_ulong = 0x02;
604pub const MS_NODEV: ::c_ulong = 0x04;
605pub const MS_NOEXEC: ::c_ulong = 0x08;
606pub const MS_SYNCHRONOUS: ::c_ulong = 0x10;
607pub const MS_REMOUNT: ::c_ulong = 0x20;
608pub const MS_MANDLOCK: ::c_ulong = 0x40;
609pub const MS_NOATIME: ::c_ulong = 0x0400;
610pub const MS_NODIRATIME: ::c_ulong = 0x0800;
611pub const MS_BIND: ::c_ulong = 0x1000;
612pub const MS_NOUSER: ::c_ulong = 0x80000000;
613pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
614pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
615pub const MS_RMT_MASK: ::c_ulong = 0x800051;
616
617pub const EPERM: ::c_int = 1;
618pub const ENOENT: ::c_int = 2;
619pub const ESRCH: ::c_int = 3;
620pub const EINTR: ::c_int = 4;
621pub const EIO: ::c_int = 5;
622pub const ENXIO: ::c_int = 6;
623pub const E2BIG: ::c_int = 7;
624pub const ENOEXEC: ::c_int = 8;
625pub const EBADF: ::c_int = 9;
626pub const ECHILD: ::c_int = 10;
627pub const EAGAIN: ::c_int = 11;
628pub const ENOMEM: ::c_int = 12;
629pub const EACCES: ::c_int = 13;
630pub const EFAULT: ::c_int = 14;
631pub const ENOTBLK: ::c_int = 15;
632pub const EBUSY: ::c_int = 16;
633pub const EEXIST: ::c_int = 17;
634pub const EXDEV: ::c_int = 18;
635pub const ENODEV: ::c_int = 19;
636pub const ENOTDIR: ::c_int = 20;
637pub const EISDIR: ::c_int = 21;
638pub const EINVAL: ::c_int = 22;
639pub const ENFILE: ::c_int = 23;
640pub const EMFILE: ::c_int = 24;
641pub const ENOTTY: ::c_int = 25;
642pub const ETXTBSY: ::c_int = 26;
643pub const EFBIG: ::c_int = 27;
644pub const ENOSPC: ::c_int = 28;
645pub const ESPIPE: ::c_int = 29;
646pub const EROFS: ::c_int = 30;
647pub const EMLINK: ::c_int = 31;
648pub const EPIPE: ::c_int = 32;
649pub const EDOM: ::c_int = 33;
650pub const ERANGE: ::c_int = 34;
651pub const EWOULDBLOCK: ::c_int = EAGAIN;
652
653pub const SCM_RIGHTS: ::c_int = 0x01;
654pub const SCM_CREDENTIALS: ::c_int = 0x02;
655
ea8adc8c
XL
656// netinet/in.h
657// NOTE: These are in addition to the constants defined in src/unix/mod.rs
658
659// IPPROTO_IP defined in src/unix/mod.rs
660/// Hop-by-hop option header
661pub const IPPROTO_HOPOPTS: ::c_int = 0;
662// IPPROTO_ICMP defined in src/unix/mod.rs
663/// group mgmt protocol
664pub const IPPROTO_IGMP: ::c_int = 2;
665/// for compatibility
666pub const IPPROTO_IPIP: ::c_int = 4;
667// IPPROTO_TCP defined in src/unix/mod.rs
668/// exterior gateway protocol
669pub const IPPROTO_EGP: ::c_int = 8;
670/// pup
671pub const IPPROTO_PUP: ::c_int = 12;
672// IPPROTO_UDP defined in src/unix/mod.rs
673/// xns idp
674pub const IPPROTO_IDP: ::c_int = 22;
675/// tp-4 w/ class negotiation
676pub const IPPROTO_TP: ::c_int = 29;
677/// DCCP
678pub const IPPROTO_DCCP: ::c_int = 33;
679// IPPROTO_IPV6 defined in src/unix/mod.rs
680/// IP6 routing header
681pub const IPPROTO_ROUTING: ::c_int = 43;
682/// IP6 fragmentation header
683pub const IPPROTO_FRAGMENT: ::c_int = 44;
684/// resource reservation
685pub const IPPROTO_RSVP: ::c_int = 46;
686/// General Routing Encap.
687pub const IPPROTO_GRE: ::c_int = 47;
688/// IP6 Encap Sec. Payload
689pub const IPPROTO_ESP: ::c_int = 50;
690/// IP6 Auth Header
691pub const IPPROTO_AH: ::c_int = 51;
692// IPPROTO_ICMPV6 defined in src/unix/mod.rs
693/// IP6 no next header
694pub const IPPROTO_NONE: ::c_int = 59;
695/// IP6 destination option
696pub const IPPROTO_DSTOPTS: ::c_int = 60;
697pub const IPPROTO_MTP: ::c_int = 92;
698pub const IPPROTO_BEETPH: ::c_int = 94;
699/// encapsulation header
700pub const IPPROTO_ENCAP: ::c_int = 98;
701/// Protocol indep. multicast
702pub const IPPROTO_PIM: ::c_int = 103;
703/// IP Payload Comp. Protocol
704pub const IPPROTO_COMP: ::c_int = 108;
705/// SCTP
706pub const IPPROTO_SCTP: ::c_int = 132;
707pub const IPPROTO_MH: ::c_int = 135;
708pub const IPPROTO_UDPLITE: ::c_int = 136;
709pub const IPPROTO_MPLS: ::c_int = 137;
710/// raw IP packet
041b39d2 711pub const IPPROTO_RAW: ::c_int = 255;
ea8adc8c 712pub const IPPROTO_MAX: ::c_int = 256;
041b39d2
XL
713
714pub const PROT_GROWSDOWN: ::c_int = 0x1000000;
715pub const PROT_GROWSUP: ::c_int = 0x2000000;
716
717pub const MAP_TYPE: ::c_int = 0x000f;
718
719pub const MADV_NORMAL: ::c_int = 0;
720pub const MADV_RANDOM: ::c_int = 1;
721pub const MADV_SEQUENTIAL: ::c_int = 2;
722pub const MADV_WILLNEED: ::c_int = 3;
723pub const MADV_DONTNEED: ::c_int = 4;
724pub const MADV_REMOVE: ::c_int = 9;
725pub const MADV_DONTFORK: ::c_int = 10;
726pub const MADV_DOFORK: ::c_int = 11;
727pub const MADV_MERGEABLE: ::c_int = 12;
728pub const MADV_UNMERGEABLE: ::c_int = 13;
729pub const MADV_HWPOISON: ::c_int = 100;
730
ff7c6d11
XL
731// https://github.com/kraj/uClibc/blob/master/include/net/if.h#L44
732pub const IFF_UP: ::c_int = 0x1; // Interface is up.
733pub const IFF_BROADCAST: ::c_int = 0x2; // Broadcast address valid.
734pub const IFF_DEBUG: ::c_int = 0x4; // Turn on debugging.
735pub const IFF_LOOPBACK: ::c_int = 0x8; // Is a loopback net.
736pub const IFF_POINTOPOINT: ::c_int = 0x10; // Interface is point-to-point link.
737pub const IFF_NOTRAILERS: ::c_int = 0x20; // Avoid use of trailers.
738pub const IFF_RUNNING: ::c_int = 0x40; // Resources allocated.
739pub const IFF_NOARP: ::c_int = 0x80; // No address resolution protocol.
740pub const IFF_PROMISC: ::c_int = 0x100; // Receive all packets.
741// Not supported
742pub const IFF_ALLMULTI: ::c_int = 0x200; // Receive all multicast packets.
743pub const IFF_MASTER: ::c_int = 0x400; // Master of a load balancer.
744pub const IFF_SLAVE: ::c_int = 0x800; // Slave of a load balancer.
745pub const IFF_MULTICAST: ::c_int = 0x1000; // Supports multicast.
746pub const IFF_PORTSEL: ::c_int = 0x2000; // Can set media type.
747pub const IFF_AUTOMEDIA: ::c_int = 0x4000; // Auto media select active.
748// Dialup device with changing addresses.
041b39d2
XL
749pub const IFF_DYNAMIC: ::c_int = 0x8000;
750
751pub const SOL_IP: ::c_int = 0;
752pub const SOL_TCP: ::c_int = 6;
753pub const SOL_IPV6: ::c_int = 41;
754pub const SOL_ICMPV6: ::c_int = 58;
755pub const SOL_RAW: ::c_int = 255;
756pub const SOL_DECNET: ::c_int = 261;
757pub const SOL_X25: ::c_int = 262;
758pub const SOL_PACKET: ::c_int = 263;
759pub const SOL_ATM: ::c_int = 264;
760pub const SOL_AAL: ::c_int = 265;
761pub const SOL_IRDA: ::c_int = 266;
762
763pub const AF_UNSPEC: ::c_int = 0;
764pub const AF_UNIX: ::c_int = 1;
765pub const AF_LOCAL: ::c_int = 1;
766pub const AF_INET: ::c_int = 2;
767pub const AF_AX25: ::c_int = 3;
768pub const AF_IPX: ::c_int = 4;
769pub const AF_APPLETALK: ::c_int = 5;
770pub const AF_NETROM: ::c_int = 6;
771pub const AF_BRIDGE: ::c_int = 7;
772pub const AF_ATMPVC: ::c_int = 8;
773pub const AF_X25: ::c_int = 9;
774pub const AF_INET6: ::c_int = 10;
775pub const AF_ROSE: ::c_int = 11;
776pub const AF_DECnet: ::c_int = 12;
777pub const AF_NETBEUI: ::c_int = 13;
778pub const AF_SECURITY: ::c_int = 14;
779pub const AF_KEY: ::c_int = 15;
780pub const AF_NETLINK: ::c_int = 16;
781pub const AF_ROUTE: ::c_int = AF_NETLINK;
782pub const AF_PACKET: ::c_int = 17;
783pub const AF_ASH: ::c_int = 18;
784pub const AF_ECONET: ::c_int = 19;
785pub const AF_ATMSVC: ::c_int = 20;
786pub const AF_SNA: ::c_int = 22;
787pub const AF_IRDA: ::c_int = 23;
788pub const AF_PPPOX: ::c_int = 24;
789pub const AF_WANPIPE: ::c_int = 25;
790pub const AF_LLC: ::c_int = 26;
791pub const AF_CAN: ::c_int = 29;
792pub const AF_TIPC: ::c_int = 30;
793pub const AF_BLUETOOTH: ::c_int = 31;
794pub const AF_IUCV: ::c_int = 32;
795pub const AF_RXRPC: ::c_int = 33;
796pub const AF_ISDN: ::c_int = 34;
797pub const AF_PHONET: ::c_int = 35;
798pub const AF_IEEE802154: ::c_int = 36;
799pub const AF_CAIF: ::c_int = 37;
800pub const AF_ALG: ::c_int = 38;
801
802pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
803pub const PF_UNIX: ::c_int = AF_UNIX;
804pub const PF_LOCAL: ::c_int = AF_LOCAL;
805pub const PF_INET: ::c_int = AF_INET;
806pub const PF_AX25: ::c_int = AF_AX25;
807pub const PF_IPX: ::c_int = AF_IPX;
808pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
809pub const PF_NETROM: ::c_int = AF_NETROM;
810pub const PF_BRIDGE: ::c_int = AF_BRIDGE;
811pub const PF_ATMPVC: ::c_int = AF_ATMPVC;
812pub const PF_X25: ::c_int = AF_X25;
813pub const PF_INET6: ::c_int = AF_INET6;
814pub const PF_ROSE: ::c_int = AF_ROSE;
815pub const PF_DECnet: ::c_int = AF_DECnet;
816pub const PF_NETBEUI: ::c_int = AF_NETBEUI;
817pub const PF_SECURITY: ::c_int = AF_SECURITY;
818pub const PF_KEY: ::c_int = AF_KEY;
819pub const PF_NETLINK: ::c_int = AF_NETLINK;
820pub const PF_ROUTE: ::c_int = AF_ROUTE;
821pub const PF_PACKET: ::c_int = AF_PACKET;
822pub const PF_ASH: ::c_int = AF_ASH;
823pub const PF_ECONET: ::c_int = AF_ECONET;
824pub const PF_ATMSVC: ::c_int = AF_ATMSVC;
825pub const PF_SNA: ::c_int = AF_SNA;
826pub const PF_IRDA: ::c_int = AF_IRDA;
827pub const PF_PPPOX: ::c_int = AF_PPPOX;
828pub const PF_WANPIPE: ::c_int = AF_WANPIPE;
829pub const PF_LLC: ::c_int = AF_LLC;
830pub const PF_CAN: ::c_int = AF_CAN;
831pub const PF_TIPC: ::c_int = AF_TIPC;
832pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
833pub const PF_IUCV: ::c_int = AF_IUCV;
834pub const PF_RXRPC: ::c_int = AF_RXRPC;
835pub const PF_ISDN: ::c_int = AF_ISDN;
836pub const PF_PHONET: ::c_int = AF_PHONET;
837pub const PF_IEEE802154: ::c_int = AF_IEEE802154;
838pub const PF_CAIF: ::c_int = AF_CAIF;
839pub const PF_ALG: ::c_int = AF_ALG;
840
841pub const SOMAXCONN: ::c_int = 128;
842
843pub const MSG_OOB: ::c_int = 1;
844pub const MSG_PEEK: ::c_int = 2;
845pub const MSG_DONTROUTE: ::c_int = 4;
846pub const MSG_CTRUNC: ::c_int = 8;
847pub const MSG_TRUNC: ::c_int = 0x20;
848pub const MSG_DONTWAIT: ::c_int = 0x40;
849pub const MSG_EOR: ::c_int = 0x80;
850pub const MSG_WAITALL: ::c_int = 0x100;
851pub const MSG_FIN: ::c_int = 0x200;
852pub const MSG_SYN: ::c_int = 0x400;
853pub const MSG_CONFIRM: ::c_int = 0x800;
854pub const MSG_RST: ::c_int = 0x1000;
855pub const MSG_ERRQUEUE: ::c_int = 0x2000;
856pub const MSG_NOSIGNAL: ::c_int = 0x4000;
857pub const MSG_MORE: ::c_int = 0x8000;
858pub const MSG_WAITFORONE: ::c_int = 0x10000;
859pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
860
861pub const SOCK_RAW: ::c_int = 3;
041b39d2
XL
862pub const IP_MULTICAST_TTL: ::c_int = 33;
863pub const IP_MULTICAST_LOOP: ::c_int = 34;
864pub const IP_TTL: ::c_int = 2;
865pub const IP_HDRINCL: ::c_int = 3;
866pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
867pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
2c00a5a8
XL
868pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
869pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
041b39d2 870
3b2f2976
XL
871pub const IPV6_JOIN_GROUP: ::c_int = 20;
872pub const IPV6_LEAVE_GROUP: ::c_int = 21;
873
041b39d2
XL
874pub const TCP_NODELAY: ::c_int = 1;
875pub const TCP_MAXSEG: ::c_int = 2;
876pub const TCP_CORK: ::c_int = 3;
877pub const TCP_KEEPIDLE: ::c_int = 4;
878pub const TCP_KEEPINTVL: ::c_int = 5;
879pub const TCP_KEEPCNT: ::c_int = 6;
880pub const TCP_SYNCNT: ::c_int = 7;
881pub const TCP_LINGER2: ::c_int = 8;
882pub const TCP_DEFER_ACCEPT: ::c_int = 9;
883pub const TCP_WINDOW_CLAMP: ::c_int = 10;
884pub const TCP_INFO: ::c_int = 11;
885pub const TCP_QUICKACK: ::c_int = 12;
886pub const TCP_CONGESTION: ::c_int = 13;
887
888pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
889pub const IPV6_V6ONLY: ::c_int = 26;
890
891pub const SO_DEBUG: ::c_int = 1;
892
893pub const SHUT_RD: ::c_int = 0;
894pub const SHUT_WR: ::c_int = 1;
895pub const SHUT_RDWR: ::c_int = 2;
896
897pub const LOCK_SH: ::c_int = 1;
898pub const LOCK_EX: ::c_int = 2;
899pub const LOCK_NB: ::c_int = 4;
900pub const LOCK_UN: ::c_int = 8;
901
902pub const SS_ONSTACK: ::c_int = 1;
903pub const SS_DISABLE: ::c_int = 2;
904
905pub const PATH_MAX: ::c_int = 4096;
906
907pub const FD_SETSIZE: usize = 1024;
908
909pub const EPOLLIN: ::c_int = 0x1;
910pub const EPOLLPRI: ::c_int = 0x2;
911pub const EPOLLOUT: ::c_int = 0x4;
912pub const EPOLLRDNORM: ::c_int = 0x40;
913pub const EPOLLRDBAND: ::c_int = 0x80;
914pub const EPOLLWRNORM: ::c_int = 0x100;
915pub const EPOLLWRBAND: ::c_int = 0x200;
916pub const EPOLLMSG: ::c_int = 0x400;
917pub const EPOLLERR: ::c_int = 0x8;
918pub const EPOLLHUP: ::c_int = 0x10;
919pub const EPOLLET: ::c_int = 0x80000000;
920
921pub const EPOLL_CTL_ADD: ::c_int = 1;
922pub const EPOLL_CTL_MOD: ::c_int = 3;
923pub const EPOLL_CTL_DEL: ::c_int = 2;
924
925pub const MNT_DETACH: ::c_int = 0x2;
926pub const MNT_EXPIRE: ::c_int = 0x4;
927
928pub const MNT_FORCE: ::c_int = 0x1;
929
930pub const Q_SYNC: ::c_int = 0x600;
931pub const Q_QUOTAON: ::c_int = 0x100;
932pub const Q_QUOTAOFF: ::c_int = 0x200;
933pub const Q_GETQUOTA: ::c_int = 0x300;
934pub const Q_SETQUOTA: ::c_int = 0x400;
935
936pub const TCIOFF: ::c_int = 2;
937pub const TCION: ::c_int = 3;
938pub const TCOOFF: ::c_int = 0;
939pub const TCOON: ::c_int = 1;
940pub const TCIFLUSH: ::c_int = 0;
941pub const TCOFLUSH: ::c_int = 1;
942pub const TCIOFLUSH: ::c_int = 2;
416331ca
XL
943pub const NL0: ::tcflag_t = 0x00000000;
944pub const NL1: ::tcflag_t = 0x00000100;
945pub const TAB0: ::tcflag_t = 0x00000000;
946pub const CR0: ::tcflag_t = 0x00000000;
947pub const FF0: ::tcflag_t = 0x00000000;
948pub const BS0: ::tcflag_t = 0x00000000;
949pub const VT0: ::tcflag_t = 0x00000000;
041b39d2
XL
950pub const VERASE: usize = 2;
951pub const VKILL: usize = 3;
952pub const VINTR: usize = 0;
953pub const VQUIT: usize = 1;
954pub const VLNEXT: usize = 15;
955pub const IGNBRK: ::tcflag_t = 0x00000001;
956pub const BRKINT: ::tcflag_t = 0x00000002;
957pub const IGNPAR: ::tcflag_t = 0x00000004;
958pub const PARMRK: ::tcflag_t = 0x00000008;
959pub const INPCK: ::tcflag_t = 0x00000010;
960pub const ISTRIP: ::tcflag_t = 0x00000020;
961pub const INLCR: ::tcflag_t = 0x00000040;
962pub const IGNCR: ::tcflag_t = 0x00000080;
963pub const ICRNL: ::tcflag_t = 0x00000100;
964pub const IXANY: ::tcflag_t = 0x00000800;
965pub const IMAXBEL: ::tcflag_t = 0x00002000;
966pub const OPOST: ::tcflag_t = 0x1;
967pub const CS5: ::tcflag_t = 0x00000000;
968pub const CRTSCTS: ::tcflag_t = 0x80000000;
969pub const ECHO: ::tcflag_t = 0x00000008;
970
971pub const CLONE_VM: ::c_int = 0x100;
972pub const CLONE_FS: ::c_int = 0x200;
973pub const CLONE_FILES: ::c_int = 0x400;
974pub const CLONE_SIGHAND: ::c_int = 0x800;
975pub const CLONE_PTRACE: ::c_int = 0x2000;
976pub const CLONE_VFORK: ::c_int = 0x4000;
977pub const CLONE_PARENT: ::c_int = 0x8000;
978pub const CLONE_THREAD: ::c_int = 0x10000;
979pub const CLONE_NEWNS: ::c_int = 0x20000;
980pub const CLONE_SYSVSEM: ::c_int = 0x40000;
981pub const CLONE_SETTLS: ::c_int = 0x80000;
982pub const CLONE_PARENT_SETTID: ::c_int = 0x100000;
983pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
984pub const CLONE_DETACHED: ::c_int = 0x400000;
985pub const CLONE_UNTRACED: ::c_int = 0x800000;
986pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
987pub const CLONE_NEWUTS: ::c_int = 0x04000000;
988pub const CLONE_NEWIPC: ::c_int = 0x08000000;
989pub const CLONE_NEWUSER: ::c_int = 0x10000000;
990pub const CLONE_NEWPID: ::c_int = 0x20000000;
991pub const CLONE_NEWNET: ::c_int = 0x40000000;
992pub const CLONE_IO: ::c_int = 0x80000000;
993
994pub const WNOHANG: ::c_int = 0x00000001;
995pub const WUNTRACED: ::c_int = 0x00000002;
996pub const WSTOPPED: ::c_int = WUNTRACED;
997pub const WEXITED: ::c_int = 0x00000004;
998pub const WCONTINUED: ::c_int = 0x00000008;
999pub const WNOWAIT: ::c_int = 0x01000000;
1000
1001pub const __WNOTHREAD: ::c_int = 0x20000000;
1002pub const __WALL: ::c_int = 0x40000000;
1003pub const __WCLONE: ::c_int = 0x80000000;
1004
1005pub const SPLICE_F_MOVE: ::c_uint = 0x01;
1006pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
1007pub const SPLICE_F_MORE: ::c_uint = 0x04;
1008pub const SPLICE_F_GIFT: ::c_uint = 0x08;
1009
1010pub const RTLD_LOCAL: ::c_int = 0;
abe05a73 1011pub const RTLD_LAZY: ::c_int = 1;
041b39d2
XL
1012
1013pub const POSIX_FADV_NORMAL: ::c_int = 0;
1014pub const POSIX_FADV_RANDOM: ::c_int = 1;
1015pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
1016pub const POSIX_FADV_WILLNEED: ::c_int = 3;
1017
1018pub const AT_FDCWD: ::c_int = -100;
1019pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
1020pub const AT_REMOVEDIR: ::c_int = 0x200;
1021pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
1022
1023pub const LOG_CRON: ::c_int = 9 << 3;
1024pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
1025pub const LOG_FTP: ::c_int = 11 << 3;
1026pub const LOG_PERROR: ::c_int = 0x20;
1027
abe05a73
XL
1028pub const POLLIN: ::c_short = 0x1;
1029pub const POLLPRI: ::c_short = 0x2;
1030pub const POLLOUT: ::c_short = 0x4;
1031pub const POLLERR: ::c_short = 0x8;
1032pub const POLLHUP: ::c_short = 0x10;
1033pub const POLLNVAL: ::c_short = 0x20;
1034
041b39d2
XL
1035pub const PIPE_BUF: usize = 4096;
1036
1037pub const SI_LOAD_SHIFT: ::c_uint = 16;
1038
1039pub const SIGEV_SIGNAL: ::c_int = 0;
1040pub const SIGEV_NONE: ::c_int = 1;
1041pub const SIGEV_THREAD: ::c_int = 2;
1042
1043pub const P_ALL: idtype_t = 0;
1044pub const P_PID: idtype_t = 1;
1045pub const P_PGID: idtype_t = 2;
1046
1047pub const UTIME_OMIT: c_long = 1073741822;
1048pub const UTIME_NOW: c_long = 1073741823;
1049
1050pub const L_tmpnam: ::c_uint = 20;
1051pub const _PC_LINK_MAX: ::c_int = 0;
1052pub const _PC_MAX_CANON: ::c_int = 1;
1053pub const _PC_MAX_INPUT: ::c_int = 2;
1054pub const _PC_NAME_MAX: ::c_int = 3;
1055pub const _PC_PATH_MAX: ::c_int = 4;
1056pub const _PC_PIPE_BUF: ::c_int = 5;
1057pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
1058pub const _PC_NO_TRUNC: ::c_int = 7;
1059pub const _PC_VDISABLE: ::c_int = 8;
1060
1061pub const _SC_ARG_MAX: ::c_int = 0;
1062pub const _SC_CHILD_MAX: ::c_int = 1;
1063pub const _SC_CLK_TCK: ::c_int = 2;
1064pub const _SC_NGROUPS_MAX: ::c_int = 3;
1065pub const _SC_OPEN_MAX: ::c_int = 4;
1066pub const _SC_STREAM_MAX: ::c_int = 5;
1067pub const _SC_TZNAME_MAX: ::c_int = 6;
1068pub const _SC_JOB_CONTROL: ::c_int = 7;
1069pub const _SC_SAVED_IDS: ::c_int = 8;
1070pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
1071pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
1072pub const _SC_TIMERS: ::c_int = 11;
1073pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
1074pub const _SC_PRIORITIZED_IO: ::c_int = 13;
1075pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
1076pub const _SC_FSYNC: ::c_int = 15;
1077pub const _SC_MAPPED_FILES: ::c_int = 16;
1078pub const _SC_MEMLOCK: ::c_int = 17;
1079pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
1080pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
1081pub const _SC_MESSAGE_PASSING: ::c_int = 20;
1082pub const _SC_SEMAPHORES: ::c_int = 21;
1083pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
1084pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
1085pub const _SC_AIO_MAX: ::c_int = 24;
1086pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
1087pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
1088pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
1089pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
1090pub const _SC_VERSION: ::c_int = 29;
1091pub const _SC_PAGESIZE: ::c_int = 30;
1092pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
1093pub const _SC_RTSIG_MAX: ::c_int = 31;
1094pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
1095pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
1096pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
1097pub const _SC_TIMER_MAX: ::c_int = 35;
1098pub const _SC_BC_BASE_MAX: ::c_int = 36;
1099pub const _SC_BC_DIM_MAX: ::c_int = 37;
1100pub const _SC_BC_SCALE_MAX: ::c_int = 38;
1101pub const _SC_BC_STRING_MAX: ::c_int = 39;
1102pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
1103pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
1104pub const _SC_LINE_MAX: ::c_int = 43;
1105pub const _SC_RE_DUP_MAX: ::c_int = 44;
1106pub const _SC_2_VERSION: ::c_int = 46;
1107pub const _SC_2_C_BIND: ::c_int = 47;
1108pub const _SC_2_C_DEV: ::c_int = 48;
1109pub const _SC_2_FORT_DEV: ::c_int = 49;
1110pub const _SC_2_FORT_RUN: ::c_int = 50;
1111pub const _SC_2_SW_DEV: ::c_int = 51;
1112pub const _SC_2_LOCALEDEF: ::c_int = 52;
1113pub const _SC_IOV_MAX: ::c_int = 60;
1114pub const _SC_THREADS: ::c_int = 67;
1115pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
1116pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
1117pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
1118pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
1119pub const _SC_TTY_NAME_MAX: ::c_int = 72;
1120pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
1121pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
1122pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
1123pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
1124pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
1125pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
1126pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
1127pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
1128pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
1129pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
1130pub const _SC_ATEXIT_MAX: ::c_int = 87;
1131pub const _SC_XOPEN_VERSION: ::c_int = 89;
1132pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
1133pub const _SC_XOPEN_UNIX: ::c_int = 91;
1134pub const _SC_XOPEN_CRYPT: ::c_int = 92;
1135pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
1136pub const _SC_XOPEN_SHM: ::c_int = 94;
1137pub const _SC_2_CHAR_TERM: ::c_int = 95;
1138pub const _SC_2_UPE: ::c_int = 97;
1139pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
1140pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
1141pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
1142pub const _SC_XOPEN_LEGACY: ::c_int = 129;
1143pub const _SC_XOPEN_REALTIME: ::c_int = 130;
1144pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
1145pub const _SC_HOST_NAME_MAX: ::c_int = 180;
1146
1147pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
1148pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
1149
1150pub const GLOB_ERR: ::c_int = 1 << 0;
1151pub const GLOB_MARK: ::c_int = 1 << 1;
1152pub const GLOB_NOSORT: ::c_int = 1 << 2;
1153pub const GLOB_DOOFFS: ::c_int = 1 << 3;
1154pub const GLOB_NOCHECK: ::c_int = 1 << 4;
1155pub const GLOB_APPEND: ::c_int = 1 << 5;
1156pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
1157
1158pub const GLOB_NOSPACE: ::c_int = 1;
1159pub const GLOB_ABORTED: ::c_int = 2;
1160pub const GLOB_NOMATCH: ::c_int = 3;
1161
1162pub const POSIX_MADV_NORMAL: ::c_int = 0;
1163pub const POSIX_MADV_RANDOM: ::c_int = 1;
1164pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
1165pub const POSIX_MADV_WILLNEED: ::c_int = 3;
1166
1167pub const S_IEXEC: mode_t = 64;
1168pub const S_IWRITE: mode_t = 128;
1169pub const S_IREAD: mode_t = 256;
1170
1171pub const F_LOCK: ::c_int = 1;
1172pub const F_TEST: ::c_int = 3;
1173pub const F_TLOCK: ::c_int = 2;
1174pub const F_ULOCK: ::c_int = 0;
1175
1176pub const ST_RDONLY: ::c_ulong = 1;
1177pub const ST_NOSUID: ::c_ulong = 2;
1178pub const ST_NODEV: ::c_ulong = 4;
1179pub const ST_NOEXEC: ::c_ulong = 8;
1180pub const ST_SYNCHRONOUS: ::c_ulong = 16;
1181pub const ST_MANDLOCK: ::c_ulong = 64;
1182pub const ST_WRITE: ::c_ulong = 128;
1183pub const ST_APPEND: ::c_ulong = 256;
1184pub const ST_IMMUTABLE: ::c_ulong = 512;
1185pub const ST_NOATIME: ::c_ulong = 1024;
1186pub const ST_NODIRATIME: ::c_ulong = 2048;
1187
1188pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
1189pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
1190pub const RTLD_NODELETE: ::c_int = 0x1000;
1191pub const RTLD_NOW: ::c_int = 0x2;
1192
1193pub const TCP_MD5SIG: ::c_int = 14;
1194
b7449926
XL
1195align_const! {
1196 pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
1197 size: [0; __SIZEOF_PTHREAD_MUTEX_T],
1198 };
1199 pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
1200 size: [0; __SIZEOF_PTHREAD_COND_T],
1201 };
1202 pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
1203 size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
1204 };
1205}
041b39d2
XL
1206pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
1207pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
1208pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
1209pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
1210pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
1211
1212pub const SCHED_OTHER: ::c_int = 0;
1213pub const SCHED_FIFO: ::c_int = 1;
1214pub const SCHED_RR: ::c_int = 2;
1215pub const SCHED_BATCH: ::c_int = 3;
1216pub const SCHED_IDLE: ::c_int = 5;
1217
1218// System V IPC
1219pub const IPC_PRIVATE: ::key_t = 0;
1220
1221pub const IPC_CREAT: ::c_int = 0o1000;
1222pub const IPC_EXCL: ::c_int = 0o2000;
1223pub const IPC_NOWAIT: ::c_int = 0o4000;
1224
1225pub const IPC_RMID: ::c_int = 0;
1226pub const IPC_SET: ::c_int = 1;
1227pub const IPC_STAT: ::c_int = 2;
1228pub const IPC_INFO: ::c_int = 3;
1229pub const MSG_STAT: ::c_int = 11;
1230pub const MSG_INFO: ::c_int = 12;
1231
1232pub const MSG_NOERROR: ::c_int = 0o10000;
1233pub const MSG_EXCEPT: ::c_int = 0o20000;
1234
1235pub const SHM_R: ::c_int = 0o400;
1236pub const SHM_W: ::c_int = 0o200;
1237
1238pub const SHM_RDONLY: ::c_int = 0o10000;
1239pub const SHM_RND: ::c_int = 0o20000;
1240pub const SHM_REMAP: ::c_int = 0o40000;
1241
1242pub const SHM_LOCK: ::c_int = 11;
1243pub const SHM_UNLOCK: ::c_int = 12;
1244
1245pub const SHM_HUGETLB: ::c_int = 0o4000;
1246pub const SHM_NORESERVE: ::c_int = 0o10000;
1247
1248pub const EPOLLRDHUP: ::c_int = 0x2000;
1249pub const EPOLLONESHOT: ::c_int = 0x40000000;
1250
1251pub const QFMT_VFS_OLD: ::c_int = 1;
1252pub const QFMT_VFS_V0: ::c_int = 2;
1253
1254pub const EFD_SEMAPHORE: ::c_int = 0x1;
1255
1256pub const LOG_NFACILITIES: ::c_int = 24;
1257
1258pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
1259
1260pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
1261pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
1262pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
1263pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
1264pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
1265
1266pub const AI_PASSIVE: ::c_int = 0x0001;
1267pub const AI_CANONNAME: ::c_int = 0x0002;
1268pub const AI_NUMERICHOST: ::c_int = 0x0004;
1269pub const AI_V4MAPPED: ::c_int = 0x0008;
1270pub const AI_ALL: ::c_int = 0x0010;
1271pub const AI_ADDRCONFIG: ::c_int = 0x0020;
1272
1273pub const AI_NUMERICSERV: ::c_int = 0x0400;
1274
1275pub const EAI_BADFLAGS: ::c_int = -1;
1276pub const EAI_NONAME: ::c_int = -2;
1277pub const EAI_AGAIN: ::c_int = -3;
1278pub const EAI_FAIL: ::c_int = -4;
1279pub const EAI_FAMILY: ::c_int = -6;
1280pub const EAI_SOCKTYPE: ::c_int = -7;
1281pub const EAI_SERVICE: ::c_int = -8;
1282pub const EAI_MEMORY: ::c_int = -10;
1283pub const EAI_OVERFLOW: ::c_int = -12;
1284
1285pub const NI_NUMERICHOST: ::c_int = 1;
1286pub const NI_NUMERICSERV: ::c_int = 2;
1287pub const NI_NOFQDN: ::c_int = 4;
1288pub const NI_NAMEREQD: ::c_int = 8;
1289pub const NI_DGRAM: ::c_int = 16;
1290
1291pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
1292pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
1293pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
1294
1295pub const EAI_SYSTEM: ::c_int = -11;
1296
1297pub const MREMAP_MAYMOVE: ::c_int = 1;
1298pub const MREMAP_FIXED: ::c_int = 2;
1299
1300pub const PR_SET_PDEATHSIG: ::c_int = 1;
1301pub const PR_GET_PDEATHSIG: ::c_int = 2;
1302
1303pub const PR_GET_DUMPABLE: ::c_int = 3;
1304pub const PR_SET_DUMPABLE: ::c_int = 4;
1305
1306pub const PR_GET_UNALIGN: ::c_int = 5;
1307pub const PR_SET_UNALIGN: ::c_int = 6;
1308pub const PR_UNALIGN_NOPRINT: ::c_int = 1;
1309pub const PR_UNALIGN_SIGBUS: ::c_int = 2;
1310
1311pub const PR_GET_KEEPCAPS: ::c_int = 7;
1312pub const PR_SET_KEEPCAPS: ::c_int = 8;
1313
1314pub const PR_GET_FPEMU: ::c_int = 9;
1315pub const PR_SET_FPEMU: ::c_int = 10;
1316pub const PR_FPEMU_NOPRINT: ::c_int = 1;
1317pub const PR_FPEMU_SIGFPE: ::c_int = 2;
1318
1319pub const PR_GET_FPEXC: ::c_int = 11;
1320pub const PR_SET_FPEXC: ::c_int = 12;
1321pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80;
1322pub const PR_FP_EXC_DIV: ::c_int = 0x010000;
1323pub const PR_FP_EXC_OVF: ::c_int = 0x020000;
1324pub const PR_FP_EXC_UND: ::c_int = 0x040000;
1325pub const PR_FP_EXC_RES: ::c_int = 0x080000;
1326pub const PR_FP_EXC_INV: ::c_int = 0x100000;
1327pub const PR_FP_EXC_DISABLED: ::c_int = 0;
1328pub const PR_FP_EXC_NONRECOV: ::c_int = 1;
1329pub const PR_FP_EXC_ASYNC: ::c_int = 2;
1330pub const PR_FP_EXC_PRECISE: ::c_int = 3;
1331
1332pub const PR_GET_TIMING: ::c_int = 13;
1333pub const PR_SET_TIMING: ::c_int = 14;
1334pub const PR_TIMING_STATISTICAL: ::c_int = 0;
1335pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
1336
1337pub const PR_SET_NAME: ::c_int = 15;
1338pub const PR_GET_NAME: ::c_int = 16;
1339
1340pub const PR_GET_ENDIAN: ::c_int = 19;
1341pub const PR_SET_ENDIAN: ::c_int = 20;
1342pub const PR_ENDIAN_BIG: ::c_int = 0;
1343pub const PR_ENDIAN_LITTLE: ::c_int = 1;
1344pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2;
1345
1346pub const PR_GET_SECCOMP: ::c_int = 21;
1347pub const PR_SET_SECCOMP: ::c_int = 22;
1348
1349pub const PR_CAPBSET_READ: ::c_int = 23;
1350pub const PR_CAPBSET_DROP: ::c_int = 24;
1351
1352pub const PR_GET_TSC: ::c_int = 25;
1353pub const PR_SET_TSC: ::c_int = 26;
1354pub const PR_TSC_ENABLE: ::c_int = 1;
1355pub const PR_TSC_SIGSEGV: ::c_int = 2;
1356
1357pub const PR_GET_SECUREBITS: ::c_int = 27;
1358pub const PR_SET_SECUREBITS: ::c_int = 28;
1359
1360pub const PR_SET_TIMERSLACK: ::c_int = 29;
1361pub const PR_GET_TIMERSLACK: ::c_int = 30;
1362
1363pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31;
1364pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32;
1365
1366pub const PR_MCE_KILL: ::c_int = 33;
1367pub const PR_MCE_KILL_CLEAR: ::c_int = 0;
1368pub const PR_MCE_KILL_SET: ::c_int = 1;
1369
1370pub const PR_MCE_KILL_LATE: ::c_int = 0;
1371pub const PR_MCE_KILL_EARLY: ::c_int = 1;
1372pub const PR_MCE_KILL_DEFAULT: ::c_int = 2;
1373
1374pub const PR_MCE_KILL_GET: ::c_int = 34;
1375
1376pub const PR_SET_MM: ::c_int = 35;
1377pub const PR_SET_MM_START_CODE: ::c_int = 1;
1378pub const PR_SET_MM_END_CODE: ::c_int = 2;
1379pub const PR_SET_MM_START_DATA: ::c_int = 3;
1380pub const PR_SET_MM_END_DATA: ::c_int = 4;
1381pub const PR_SET_MM_START_STACK: ::c_int = 5;
1382pub const PR_SET_MM_START_BRK: ::c_int = 6;
1383pub const PR_SET_MM_BRK: ::c_int = 7;
1384pub const PR_SET_MM_ARG_START: ::c_int = 8;
1385pub const PR_SET_MM_ARG_END: ::c_int = 9;
1386pub const PR_SET_MM_ENV_START: ::c_int = 10;
1387pub const PR_SET_MM_ENV_END: ::c_int = 11;
1388pub const PR_SET_MM_AUXV: ::c_int = 12;
1389pub const PR_SET_MM_EXE_FILE: ::c_int = 13;
1390pub const PR_SET_MM_MAP: ::c_int = 14;
1391pub const PR_SET_MM_MAP_SIZE: ::c_int = 15;
1392
1393pub const PR_SET_PTRACER: ::c_int = 0x59616d61;
1394
1395pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36;
1396pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37;
1397
1398pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38;
1399pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39;
1400
1401pub const PR_GET_TID_ADDRESS: ::c_int = 40;
1402
1403pub const PR_SET_THP_DISABLE: ::c_int = 41;
1404pub const PR_GET_THP_DISABLE: ::c_int = 42;
1405
8faf50e0
XL
1406pub const GRND_NONBLOCK: ::c_uint = 0x0001;
1407pub const GRND_RANDOM: ::c_uint = 0x0002;
1408
041b39d2
XL
1409pub const ABDAY_1: ::nl_item = 0x300;
1410pub const ABDAY_2: ::nl_item = 0x301;
1411pub const ABDAY_3: ::nl_item = 0x302;
1412pub const ABDAY_4: ::nl_item = 0x303;
1413pub const ABDAY_5: ::nl_item = 0x304;
1414pub const ABDAY_6: ::nl_item = 0x305;
1415pub const ABDAY_7: ::nl_item = 0x306;
1416
1417pub const DAY_1: ::nl_item = 0x307;
1418pub const DAY_2: ::nl_item = 0x308;
1419pub const DAY_3: ::nl_item = 0x309;
1420pub const DAY_4: ::nl_item = 0x30A;
1421pub const DAY_5: ::nl_item = 0x30B;
1422pub const DAY_6: ::nl_item = 0x30C;
1423pub const DAY_7: ::nl_item = 0x30D;
1424
1425pub const ABMON_1: ::nl_item = 0x30E;
1426pub const ABMON_2: ::nl_item = 0x30F;
1427pub const ABMON_3: ::nl_item = 0x310;
1428pub const ABMON_4: ::nl_item = 0x311;
1429pub const ABMON_5: ::nl_item = 0x312;
1430pub const ABMON_6: ::nl_item = 0x313;
1431pub const ABMON_7: ::nl_item = 0x314;
1432pub const ABMON_8: ::nl_item = 0x315;
1433pub const ABMON_9: ::nl_item = 0x316;
1434pub const ABMON_10: ::nl_item = 0x317;
1435pub const ABMON_11: ::nl_item = 0x318;
1436pub const ABMON_12: ::nl_item = 0x319;
1437
1438pub const MON_1: ::nl_item = 0x31A;
1439pub const MON_2: ::nl_item = 0x31B;
1440pub const MON_3: ::nl_item = 0x31C;
1441pub const MON_4: ::nl_item = 0x31D;
1442pub const MON_5: ::nl_item = 0x31E;
1443pub const MON_6: ::nl_item = 0x31F;
1444pub const MON_7: ::nl_item = 0x320;
1445pub const MON_8: ::nl_item = 0x321;
1446pub const MON_9: ::nl_item = 0x322;
1447pub const MON_10: ::nl_item = 0x323;
1448pub const MON_11: ::nl_item = 0x324;
1449pub const MON_12: ::nl_item = 0x325;
1450
1451pub const AM_STR: ::nl_item = 0x326;
1452pub const PM_STR: ::nl_item = 0x327;
1453
1454pub const D_T_FMT: ::nl_item = 0x328;
1455pub const D_FMT: ::nl_item = 0x329;
1456pub const T_FMT: ::nl_item = 0x32A;
1457pub const T_FMT_AMPM: ::nl_item = 0x32B;
1458
1459pub const ERA: ::nl_item = 0x32C;
1460pub const ERA_D_FMT: ::nl_item = 0x32E;
1461pub const ALT_DIGITS: ::nl_item = 0x32F;
1462pub const ERA_D_T_FMT: ::nl_item = 0x330;
1463pub const ERA_T_FMT: ::nl_item = 0x331;
1464
1465pub const CODESET: ::nl_item = 10;
1466
1467pub const CRNCYSTR: ::nl_item = 0x215;
1468
1469pub const RADIXCHAR: ::nl_item = 0x100;
1470pub const THOUSEP: ::nl_item = 0x101;
1471
1472pub const NOEXPR: ::nl_item = 0x501;
1473pub const YESSTR: ::nl_item = 0x502;
1474pub const NOSTR: ::nl_item = 0x503;
1475
1476pub const FILENAME_MAX: ::c_uint = 4095;
1477
041b39d2
XL
1478f! {
1479 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
1480 let fd = fd as usize;
532ac7d7 1481 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
041b39d2
XL
1482 (*set).fds_bits[fd / size] &= !(1 << (fd % size));
1483 return
1484 }
1485
1486 pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
1487 let fd = fd as usize;
532ac7d7 1488 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
041b39d2
XL
1489 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
1490 }
1491
1492 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
1493 let fd = fd as usize;
532ac7d7 1494 let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
041b39d2
XL
1495 (*set).fds_bits[fd / size] |= 1 << (fd % size);
1496 return
1497 }
1498
1499 pub fn FD_ZERO(set: *mut fd_set) -> () {
1500 for slot in (*set).fds_bits.iter_mut() {
1501 *slot = 0;
1502 }
1503 }
1504
1505 pub fn WIFSTOPPED(status: ::c_int) -> bool {
1506 (status & 0xff) == 0x7f
1507 }
1508
1509 pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
1510 (status >> 8) & 0xff
1511 }
1512
1513 pub fn WIFCONTINUED(status: ::c_int) -> bool {
1514 status == 0xffff
1515 }
1516
1517 pub fn WIFSIGNALED(status: ::c_int) -> bool {
1518 ((status & 0x7f) + 1) as i8 >= 2
1519 }
1520
1521 pub fn WTERMSIG(status: ::c_int) -> ::c_int {
1522 status & 0x7f
1523 }
1524
1525 pub fn WIFEXITED(status: ::c_int) -> bool {
1526 (status & 0x7f) == 0
1527 }
1528
1529 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
1530 (status >> 8) & 0xff
1531 }
1532
1533 pub fn WCOREDUMP(status: ::c_int) -> bool {
1534 (status & 0x80) != 0
1535 }
1536
1537 pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
1538 for slot in cpuset.bits.iter_mut() {
1539 *slot = 0;
1540 }
1541 }
1542
1543 pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
532ac7d7
XL
1544 let size_in_bits
1545 = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
041b39d2
XL
1546 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1547 cpuset.bits[idx] |= 1 << offset;
1548 ()
1549 }
1550
1551 pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
532ac7d7
XL
1552 let size_in_bits
1553 = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
041b39d2
XL
1554 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1555 cpuset.bits[idx] &= !(1 << offset);
1556 ()
1557 }
1558
1559 pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
532ac7d7 1560 let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]);
041b39d2
XL
1561 let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
1562 0 != (cpuset.bits[idx] & (1 << offset))
1563 }
1564
1565 pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
1566 set1.bits == set2.bits
1567 }
ea8adc8c
XL
1568
1569 pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
1570 (cmd << 8) | (type_ & 0x00ff)
1571 }
041b39d2
XL
1572}
1573
1574extern {
416331ca
XL
1575 #[cfg_attr(target_os = "linux",
1576 link_name = "__xpg_strerror_r")]
1577 pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
1578 buflen: ::size_t) -> ::c_int;
1579
532ac7d7
XL
1580 pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
1581 pub fn sem_init(sem: *mut sem_t,
1582 pshared: ::c_int,
1583 value: ::c_uint)
1584 -> ::c_int;
1585
69743fb6
XL
1586 pub fn abs(i: ::c_int) -> ::c_int;
1587 pub fn atof(s: *const ::c_char) -> ::c_double;
1588 pub fn labs(i: ::c_long) -> ::c_long;
1589 pub fn rand() -> ::c_int;
1590 pub fn srand(seed: ::c_uint);
1591
041b39d2 1592 pub fn fdatasync(fd: ::c_int) -> ::c_int;
416331ca
XL
1593 pub fn gettimeofday(tp: *mut ::timeval,
1594 tz: *mut ::timezone) -> ::c_int;
041b39d2
XL
1595 pub fn mincore(addr: *mut ::c_void, len: ::size_t,
1596 vec: *mut ::c_uchar) -> ::c_int;
ea8adc8c
XL
1597 pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1598 pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1599 pub fn clock_nanosleep(clk_id: ::clockid_t,
041b39d2
XL
1600 flags: ::c_int,
1601 rqtp: *const ::timespec,
1602 rmtp: *mut ::timespec) -> ::c_int;
ea8adc8c 1603 pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
041b39d2
XL
1604 pub fn prctl(option: ::c_int, ...) -> ::c_int;
1605 pub fn pthread_getattr_np(native: ::pthread_t,
1606 attr: *mut ::pthread_attr_t) -> ::c_int;
1607 pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
1608 guardsize: *mut ::size_t) -> ::c_int;
1609 pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
1610 stackaddr: *mut *mut ::c_void,
1611 stacksize: *mut ::size_t) -> ::c_int;
1612 pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
1613 pub fn setgroups(ngroups: ::size_t,
1614 ptr: *const ::gid_t) -> ::c_int;
1615 pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
1616 pub fn sched_setscheduler(pid: ::pid_t,
1617 policy: ::c_int,
ea8adc8c 1618 param: *const ::sched_param) -> ::c_int;
041b39d2
XL
1619 pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
1620 pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
1621 pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
1622 pub fn epoll_create(size: ::c_int) -> ::c_int;
1623 pub fn epoll_create1(flags: ::c_int) -> ::c_int;
1624 pub fn epoll_ctl(epfd: ::c_int,
1625 op: ::c_int,
1626 fd: ::c_int,
ea8adc8c 1627 event: *mut ::epoll_event) -> ::c_int;
041b39d2 1628 pub fn epoll_wait(epfd: ::c_int,
ea8adc8c 1629 events: *mut ::epoll_event,
041b39d2
XL
1630 maxevents: ::c_int,
1631 timeout: ::c_int) -> ::c_int;
1632 pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
1633 pub fn mount(src: *const ::c_char,
1634 target: *const ::c_char,
1635 fstype: *const ::c_char,
1636 flags: ::c_ulong,
1637 data: *const ::c_void) -> ::c_int;
1638 pub fn umount(target: *const ::c_char) -> ::c_int;
1639 pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
1640 pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
1641 child_stack: *mut ::c_void,
1642 flags: ::c_int,
1643 arg: *mut ::c_void, ...) -> ::c_int;
1644 pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
1645 pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
1646 pub fn memrchr(cx: *const ::c_void,
1647 c: ::c_int,
1648 n: ::size_t) -> *mut ::c_void;
1649 pub fn syscall(num: ::c_long, ...) -> ::c_long;
1650 pub fn sendfile(out_fd: ::c_int,
1651 in_fd: ::c_int,
1652 offset: *mut off_t,
1653 count: ::size_t) -> ::ssize_t;
1654 pub fn splice(fd_in: ::c_int,
1655 off_in: *mut ::loff_t,
1656 fd_out: ::c_int,
1657 off_out: *mut ::loff_t,
1658 len: ::size_t,
1659 flags: ::c_uint) -> ::ssize_t;
1660 pub fn tee(fd_in: ::c_int,
1661 fd_out: ::c_int,
1662 len: ::size_t,
1663 flags: ::c_uint) -> ::ssize_t;
1664 pub fn vmsplice(fd: ::c_int,
1665 iov: *const ::iovec,
1666 nr_segs: ::size_t,
1667 flags: ::c_uint) -> ::ssize_t;
1668
1669 pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
1670 advise: ::c_int) -> ::c_int;
416331ca
XL
1671 pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
1672 pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
041b39d2
XL
1673 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
1674 pub fn utimensat(dirfd: ::c_int, path: *const ::c_char,
1675 times: *const ::timespec, flag: ::c_int) -> ::c_int;
1676 pub fn duplocale(base: ::locale_t) -> ::locale_t;
1677 pub fn freelocale(loc: ::locale_t);
1678 pub fn newlocale(mask: ::c_int,
1679 locale: *const ::c_char,
1680 base: ::locale_t) -> ::locale_t;
1681 pub fn uselocale(loc: ::locale_t) -> ::locale_t;
1682 pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
1683 pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
69743fb6
XL
1684 pub fn fstatat64(fildes: ::c_int, path: *const ::c_char,
1685 buf: *mut stat64, flag: ::c_int) -> ::c_int;
041b39d2
XL
1686 pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
1687 pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
1688 pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
1689 pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
1690 pub fn mmap64(addr: *mut ::c_void,
1691 len: ::size_t,
1692 prot: ::c_int,
1693 flags: ::c_int,
1694 fd: ::c_int,
1695 offset: off64_t)
1696 -> *mut ::c_void;
1697 pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
1698 pub fn openat64(fd: ::c_int,
1699 path: *const c_char,
1700 oflag: ::c_int, ...) -> ::c_int;
1701 pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
1702 offset: off64_t) -> ::ssize_t;
1703 pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
1704 offset: off64_t) -> ::ssize_t;
1705 pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
1706 pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64,
1707 result: *mut *mut ::dirent64) -> ::c_int;
1708 pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
1709 pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
1710 pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
1711 pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
1712
041b39d2
XL
1713 pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
1714 mode: ::mode_t, dev: dev_t) -> ::c_int;
1715 pub fn ppoll(fds: *mut ::pollfd,
1716 nfds: nfds_t,
1717 timeout: *const ::timespec,
1718 sigmask: *const sigset_t) -> ::c_int;
1719 pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
1720 clock_id: *mut clockid_t) -> ::c_int;
1721 pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
ea8adc8c 1722 clock_id: ::clockid_t) -> ::c_int;
041b39d2
XL
1723 pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
1724 pshared: ::c_int) -> ::c_int;
1725 pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
1726 pshared: *mut ::c_int) -> ::c_int;
1727 pub fn sched_getaffinity(pid: ::pid_t,
1728 cpusetsize: ::size_t,
1729 cpuset: *mut cpu_set_t) -> ::c_int;
1730 pub fn sched_setaffinity(pid: ::pid_t,
1731 cpusetsize: ::size_t,
1732 cpuset: *const cpu_set_t) -> ::c_int;
1733 pub fn unshare(flags: ::c_int) -> ::c_int;
1734 pub fn sem_timedwait(sem: *mut sem_t,
1735 abstime: *const ::timespec) -> ::c_int;
8faf50e0
XL
1736 pub fn sem_getvalue(sem: *mut sem_t,
1737 sval: *mut ::c_int) -> ::c_int;
041b39d2
XL
1738 pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t,
1739 flg: ::c_int) -> ::c_int;
1740 pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
1741 abstime: *const ::timespec) -> ::c_int;
1742 pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
1743 pshared: ::c_int) -> ::c_int;
1744 pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
1745 pshared: *mut ::c_int) -> ::c_int;
1746 pub fn pthread_rwlockattr_getkind_np(attr: *const pthread_rwlockattr_t,
1747 val: *mut ::c_int) -> ::c_int;
1748 pub fn pthread_rwlockattr_setkind_np(attr: *mut pthread_rwlockattr_t,
1749 val: ::c_int) -> ::c_int;
1750 pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
1751 val: *mut ::c_int) -> ::c_int;
1752 pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
1753 val: ::c_int) -> ::c_int;
1754 pub fn ptsname_r(fd: ::c_int,
1755 buf: *mut ::c_char,
1756 buflen: ::size_t) -> ::c_int;
1757 pub fn clearenv() -> ::c_int;
1758 pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
1759 options: ::c_int) -> ::c_int;
1760
1761 pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
1762
1763 pub fn setpwent();
ea8adc8c 1764 pub fn endpwent();
041b39d2
XL
1765 pub fn getpwent() -> *mut passwd;
1766 pub fn setspent();
1767 pub fn endspent();
1768 pub fn getspent() -> *mut spwd;
1769 pub fn getspnam(__name: *const ::c_char) -> *mut spwd;
1770
1771 pub fn shm_open(name: *const c_char, oflag: ::c_int,
1772 mode: mode_t) -> ::c_int;
1773
1774 // System V IPC
1775 pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
1776 pub fn shmat(shmid: ::c_int,
1777 shmaddr: *const ::c_void,
1778 shmflg: ::c_int) -> *mut ::c_void;
1779 pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
1780 pub fn shmctl(shmid: ::c_int,
1781 cmd: ::c_int,
1782 buf: *mut ::shmid_ds) -> ::c_int;
1783 pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
1784 pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int;
1785 pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
1786 pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
1787 msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t;
1788 pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
1789 msgflg: ::c_int) -> ::c_int;
1790
1791 pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
1792 -> ::c_int;
1793 pub fn __errno_location() -> *mut ::c_int;
1794
1795 pub fn fopen64(filename: *const c_char,
1796 mode: *const c_char) -> *mut ::FILE;
1797 pub fn freopen64(filename: *const c_char, mode: *const c_char,
1798 file: *mut ::FILE) -> *mut ::FILE;
1799 pub fn tmpfile64() -> *mut ::FILE;
1800 pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
1801 pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
1802 pub fn fseeko64(stream: *mut ::FILE,
1803 offset: ::off64_t,
1804 whence: ::c_int) -> ::c_int;
1805 pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
1806 pub fn readahead(fd: ::c_int, offset: ::off64_t,
1807 count: ::size_t) -> ::ssize_t;
1808 pub fn getxattr(path: *const c_char, name: *const c_char,
1809 value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
1810 pub fn lgetxattr(path: *const c_char, name: *const c_char,
1811 value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
1812 pub fn fgetxattr(filedes: ::c_int, name: *const c_char,
1813 value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
1814 pub fn setxattr(path: *const c_char, name: *const c_char,
1815 value: *const ::c_void, size: ::size_t,
1816 flags: ::c_int) -> ::c_int;
1817 pub fn lsetxattr(path: *const c_char, name: *const c_char,
1818 value: *const ::c_void, size: ::size_t,
1819 flags: ::c_int) -> ::c_int;
1820 pub fn fsetxattr(filedes: ::c_int, name: *const c_char,
1821 value: *const ::c_void, size: ::size_t,
1822 flags: ::c_int) -> ::c_int;
1823 pub fn listxattr(path: *const c_char, list: *mut c_char,
1824 size: ::size_t) -> ::ssize_t;
1825 pub fn llistxattr(path: *const c_char, list: *mut c_char,
1826 size: ::size_t) -> ::ssize_t;
1827 pub fn flistxattr(filedes: ::c_int, list: *mut c_char,
1828 size: ::size_t) -> ::ssize_t;
1829 pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
1830 pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
1831 pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
1832 pub fn signalfd(fd: ::c_int,
1833 mask: *const ::sigset_t,
1834 flags: ::c_int) -> ::c_int;
1835 pub fn quotactl(cmd: ::c_int,
1836 special: *const ::c_char,
1837 id: ::c_int,
1838 data: *mut ::c_char) -> ::c_int;
1839 pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
1840 pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
1841 pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
1842 pub fn mq_receive(mqd: ::mqd_t,
1843 msg_ptr: *mut ::c_char,
1844 msg_len: ::size_t,
1845 msq_prio: *mut ::c_uint) -> ::ssize_t;
1846 pub fn mq_send(mqd: ::mqd_t,
1847 msg_ptr: *const ::c_char,
1848 msg_len: ::size_t,
1849 msq_prio: ::c_uint) -> ::c_int;
1850 pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
1851 pub fn mq_setattr(mqd: ::mqd_t,
1852 newattr: *const ::mq_attr,
1853 oldattr: *mut ::mq_attr) -> ::c_int;
1854 pub fn epoll_pwait(epfd: ::c_int,
1855 events: *mut ::epoll_event,
1856 maxevents: ::c_int,
1857 timeout: ::c_int,
1858 sigmask: *const ::sigset_t) -> ::c_int;
1859 pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
1860 pub fn sigtimedwait(set: *const sigset_t,
1861 info: *mut siginfo_t,
1862 timeout: *const ::timespec) -> ::c_int;
1863 pub fn sigwaitinfo(set: *const sigset_t,
1864 info: *mut siginfo_t) -> ::c_int;
1865 pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
1866 pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit,
1867 old_limit: *mut ::rlimit) -> ::c_int;
1868 pub fn prlimit64(pid: ::pid_t,
1869 resource: ::c_int,
1870 new_limit: *const ::rlimit64,
1871 old_limit: *mut ::rlimit64) -> ::c_int;
1872 pub fn reboot(how_to: ::c_int) -> ::c_int;
1873 pub fn setfsgid(gid: ::gid_t) -> ::c_int;
1874 pub fn setfsuid(uid: ::uid_t) -> ::c_int;
1875 pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
1876 pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
1877
1878 // Not available now on Android
1879 pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
1880 mode: ::mode_t) -> ::c_int;
1881 pub fn if_nameindex() -> *mut if_nameindex;
1882 pub fn if_freenameindex(ptr: *mut if_nameindex);
1883 pub fn sync_file_range(fd: ::c_int, offset: ::off64_t,
1884 nbytes: ::off64_t, flags: ::c_uint) -> ::c_int;
1885 pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
1886 pub fn freeifaddrs(ifa: *mut ::ifaddrs);
1887
1888 pub fn mremap(addr: *mut ::c_void,
1889 len: ::size_t,
1890 new_len: ::size_t,
1891 flags: ::c_int,
1892 ...) -> *mut ::c_void;
1893
1894 pub fn glob(pattern: *const c_char,
1895 flags: ::c_int,
532ac7d7 1896 errfunc: ::Option<extern fn(epath: *const c_char,
041b39d2
XL
1897 errno: ::c_int) -> ::c_int>,
1898 pglob: *mut ::glob_t) -> ::c_int;
1899 pub fn globfree(pglob: *mut ::glob_t);
1900
1901 pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
1902
1903 pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
1904
69743fb6
XL
1905 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
1906
041b39d2
XL
1907 pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
1908 pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
1909 -> ::c_int;
1910
1911 pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
1912
1913 pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
1914 flags: ::c_int, addr: *mut ::sockaddr,
1915 addrlen: *mut ::socklen_t) -> ::ssize_t;
1916 pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
1917
1918 pub fn bind(socket: ::c_int, address: *const ::sockaddr,
1919 address_len: ::socklen_t) -> ::c_int;
1920
1921 pub fn writev(fd: ::c_int,
1922 iov: *const ::iovec,
1923 iovcnt: ::c_int) -> ::ssize_t;
1924 pub fn readv(fd: ::c_int,
1925 iov: *const ::iovec,
1926 iovcnt: ::c_int) -> ::ssize_t;
1927
1928 pub fn sendmsg(fd: ::c_int,
1929 msg: *const ::msghdr,
1930 flags: ::c_int) -> ::ssize_t;
1931 pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
1932 -> ::ssize_t;
ea8adc8c 1933 #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
48663c56 1934 pub fn getgrgid_r(gid: ::gid_t,
ea8adc8c
XL
1935 grp: *mut ::group,
1936 buf: *mut ::c_char,
1937 buflen: ::size_t,
1938 result: *mut *mut ::group) -> ::c_int;
1939 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1940 link_name = "sigaltstack$UNIX2003")]
1941 #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
1942 pub fn sigaltstack(ss: *const stack_t,
1943 oss: *mut stack_t) -> ::c_int;
1944 pub fn sem_close(sem: *mut sem_t) -> ::c_int;
1945 pub fn getdtablesize() -> ::c_int;
1946 #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
1947 pub fn getgrnam_r(name: *const ::c_char,
1948 grp: *mut ::group,
1949 buf: *mut ::c_char,
1950 buflen: ::size_t,
1951 result: *mut *mut ::group) -> ::c_int;
1952 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1953 link_name = "pthread_sigmask$UNIX2003")]
1954 pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
1955 oldset: *mut sigset_t) -> ::c_int;
1956 pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
1957 pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
1958 pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
1959 pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
1960 pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
1961 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
1962 #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
1963 pub fn getpwnam_r(name: *const ::c_char,
1964 pwd: *mut passwd,
1965 buf: *mut ::c_char,
1966 buflen: ::size_t,
1967 result: *mut *mut passwd) -> ::c_int;
1968 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
1969 #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
1970 pub fn getpwuid_r(uid: ::uid_t,
1971 pwd: *mut passwd,
1972 buf: *mut ::c_char,
1973 buflen: ::size_t,
1974 result: *mut *mut passwd) -> ::c_int;
1975 #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
1976 link_name = "sigwait$UNIX2003")]
1977 #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
1978 pub fn sigwait(set: *const sigset_t,
1979 sig: *mut ::c_int) -> ::c_int;
532ac7d7
XL
1980 pub fn pthread_atfork(prepare: ::Option<unsafe extern fn()>,
1981 parent: ::Option<unsafe extern fn()>,
1982 child: ::Option<unsafe extern fn()>) -> ::c_int;
ea8adc8c
XL
1983 pub fn pthread_create(native: *mut ::pthread_t,
1984 attr: *const ::pthread_attr_t,
1985 f: extern fn(*mut ::c_void) -> *mut ::c_void,
1986 value: *mut ::c_void) -> ::c_int;
1987 pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
1988 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1989 link_name = "popen$UNIX2003")]
1990 pub fn popen(command: *const c_char,
1991 mode: *const c_char) -> *mut ::FILE;
532ac7d7 1992 pub fn uname(buf: *mut ::utsname) -> ::c_int;
041b39d2
XL
1993}
1994
1995cfg_if! {
69743fb6 1996 if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] {
041b39d2
XL
1997 mod mips;
1998 pub use self::mips::*;
1999 } else if #[cfg(target_arch = "x86_64")] {
2000 mod x86_64;
2001 pub use self::x86_64::*;
532ac7d7
XL
2002 } else if #[cfg(target_arch = "arm")] {
2003 mod arm;
2004 pub use self::arm::*;
041b39d2
XL
2005 } else {
2006 pub use unsupported_target;
2007 }
2008}
ea8adc8c 2009
532ac7d7
XL
2010cfg_if! {
2011 if #[cfg(libc_align)] {
2012 #[macro_use]
2013 mod align;
2014 } else {
2015 #[macro_use]
2016 mod no_align;
2017 }
2018}
2019
2020expand_align!();