]> git.proxmox.com Git - rustc.git/blame - src/liblibc/src/unix/notbsd/mod.rs
New upstream version 1.18.0+dfsg1
[rustc.git] / src / liblibc / src / unix / notbsd / mod.rs
CommitLineData
92a42be0
SL
1use dox::mem;
2
92a42be0
SL
3pub type sa_family_t = u16;
4pub type pthread_key_t = ::c_uint;
9cc50fc6
SL
5pub type speed_t = ::c_uint;
6pub type tcflag_t = ::c_uint;
7453a54e 7pub type loff_t = ::c_longlong;
54a0048b 8pub type clockid_t = ::c_int;
9e0c209e 9pub type key_t = ::c_int;
3157f602 10pub type id_t = ::c_uint;
92a42be0
SL
11
12pub enum timezone {}
13
14s! {
15 pub struct sockaddr {
16 pub sa_family: sa_family_t,
17 pub sa_data: [::c_char; 14],
18 }
19
20 pub struct sockaddr_in {
21 pub sin_family: sa_family_t,
22 pub sin_port: ::in_port_t,
23 pub sin_addr: ::in_addr,
24 pub sin_zero: [u8; 8],
25 }
26
27 pub struct sockaddr_in6 {
28 pub sin6_family: sa_family_t,
29 pub sin6_port: ::in_port_t,
30 pub sin6_flowinfo: u32,
31 pub sin6_addr: ::in6_addr,
32 pub sin6_scope_id: u32,
33 }
34
35 pub struct sockaddr_un {
36 pub sun_family: sa_family_t,
37 pub sun_path: [::c_char; 108]
38 }
39
40 pub struct sockaddr_storage {
41 pub ss_family: sa_family_t,
42 __ss_align: ::size_t,
43 #[cfg(target_pointer_width = "32")]
44 __ss_pad2: [u8; 128 - 2 * 4],
45 #[cfg(target_pointer_width = "64")]
46 __ss_pad2: [u8; 128 - 2 * 8],
47 }
48
49 pub struct addrinfo {
50 pub ai_flags: ::c_int,
51 pub ai_family: ::c_int,
52 pub ai_socktype: ::c_int,
53 pub ai_protocol: ::c_int,
54 pub ai_addrlen: socklen_t,
55
c30ab7b3
SL
56 #[cfg(any(target_os = "linux",
57 target_os = "emscripten",
58 target_os = "fuchsia"))]
92a42be0
SL
59 pub ai_addr: *mut ::sockaddr,
60
61 pub ai_canonname: *mut c_char,
62
63 #[cfg(target_os = "android")]
64 pub ai_addr: *mut ::sockaddr,
65
66 pub ai_next: *mut addrinfo,
67 }
68
54a0048b
SL
69 pub struct sockaddr_nl {
70 pub nl_family: ::sa_family_t,
71 nl_pad: ::c_ushort,
72 pub nl_pid: u32,
73 pub nl_groups: u32
74 }
75
92a42be0
SL
76 pub struct sockaddr_ll {
77 pub sll_family: ::c_ushort,
78 pub sll_protocol: ::c_ushort,
79 pub sll_ifindex: ::c_int,
80 pub sll_hatype: ::c_ushort,
81 pub sll_pkttype: ::c_uchar,
82 pub sll_halen: ::c_uchar,
83 pub sll_addr: [::c_uchar; 8]
84 }
85
86 pub struct fd_set {
87 fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
88 }
89
90 pub struct tm {
91 pub tm_sec: ::c_int,
92 pub tm_min: ::c_int,
93 pub tm_hour: ::c_int,
94 pub tm_mday: ::c_int,
95 pub tm_mon: ::c_int,
96 pub tm_year: ::c_int,
97 pub tm_wday: ::c_int,
98 pub tm_yday: ::c_int,
99 pub tm_isdst: ::c_int,
100 pub tm_gmtoff: ::c_long,
101 pub tm_zone: *const ::c_char,
102 }
9cc50fc6
SL
103
104 pub struct sched_param {
105 pub sched_priority: ::c_int,
5bcae85e 106 #[cfg(any(target_env = "musl"))]
9cc50fc6 107 pub sched_ss_low_priority: ::c_int,
5bcae85e 108 #[cfg(any(target_env = "musl"))]
9cc50fc6 109 pub sched_ss_repl_period: ::timespec,
5bcae85e 110 #[cfg(any(target_env = "musl"))]
9cc50fc6 111 pub sched_ss_init_budget: ::timespec,
5bcae85e 112 #[cfg(any(target_env = "musl"))]
9cc50fc6
SL
113 pub sched_ss_max_repl: ::c_int,
114 }
115
116 pub struct Dl_info {
117 pub dli_fname: *const ::c_char,
118 pub dli_fbase: *mut ::c_void,
119 pub dli_sname: *const ::c_char,
120 pub dli_saddr: *mut ::c_void,
121 }
122
cc61c64b
XL
123 #[cfg_attr(any(all(target_arch = "x86",
124 not(target_env = "musl"),
125 not(target_os = "android")),
7453a54e 126 target_arch = "x86_64"),
9cc50fc6
SL
127 repr(packed))]
128 pub struct epoll_event {
129 pub events: ::uint32_t,
130 pub u64: ::uint64_t,
131 }
132
133 pub struct utsname {
134 pub sysname: [::c_char; 65],
135 pub nodename: [::c_char; 65],
136 pub release: [::c_char; 65],
137 pub version: [::c_char; 65],
138 pub machine: [::c_char; 65],
139 pub domainname: [::c_char; 65]
140 }
54a0048b
SL
141
142 pub struct lconv {
143 pub decimal_point: *mut ::c_char,
144 pub thousands_sep: *mut ::c_char,
145 pub grouping: *mut ::c_char,
146 pub int_curr_symbol: *mut ::c_char,
147 pub currency_symbol: *mut ::c_char,
148 pub mon_decimal_point: *mut ::c_char,
149 pub mon_thousands_sep: *mut ::c_char,
150 pub mon_grouping: *mut ::c_char,
151 pub positive_sign: *mut ::c_char,
152 pub negative_sign: *mut ::c_char,
153 pub int_frac_digits: ::c_char,
154 pub frac_digits: ::c_char,
155 pub p_cs_precedes: ::c_char,
156 pub p_sep_by_space: ::c_char,
157 pub n_cs_precedes: ::c_char,
158 pub n_sep_by_space: ::c_char,
159 pub p_sign_posn: ::c_char,
160 pub n_sign_posn: ::c_char,
161 pub int_p_cs_precedes: ::c_char,
162 pub int_p_sep_by_space: ::c_char,
163 pub int_n_cs_precedes: ::c_char,
164 pub int_n_sep_by_space: ::c_char,
165 pub int_p_sign_posn: ::c_char,
166 pub int_n_sign_posn: ::c_char,
167 }
476ff2be
SL
168
169 pub struct sigevent {
170 pub sigev_value: ::sigval,
171 pub sigev_signo: ::c_int,
172 pub sigev_notify: ::c_int,
173 // Actually a union. We only expose sigev_notify_thread_id because it's
174 // the most useful member
175 pub sigev_notify_thread_id: ::c_int,
176 #[cfg(target_pointer_width = "64")]
177 __unused1: [::c_int; 11],
178 #[cfg(target_pointer_width = "32")]
179 __unused1: [::c_int; 12]
180 }
92a42be0
SL
181}
182
183// intentionally not public, only used for fd_set
54a0048b
SL
184cfg_if! {
185 if #[cfg(target_pointer_width = "32")] {
186 const ULONG_SIZE: usize = 32;
187 } else if #[cfg(target_pointer_width = "64")] {
188 const ULONG_SIZE: usize = 64;
189 } else {
190 // Unknown target_pointer_width
191 }
192}
92a42be0
SL
193
194pub const EXIT_FAILURE: ::c_int = 1;
195pub const EXIT_SUCCESS: ::c_int = 0;
196pub const RAND_MAX: ::c_int = 2147483647;
197pub const EOF: ::c_int = -1;
198pub const SEEK_SET: ::c_int = 0;
199pub const SEEK_CUR: ::c_int = 1;
200pub const SEEK_END: ::c_int = 2;
201pub const _IOFBF: ::c_int = 0;
202pub const _IONBF: ::c_int = 2;
203pub const _IOLBF: ::c_int = 1;
204
205pub const F_DUPFD: ::c_int = 0;
206pub const F_GETFD: ::c_int = 1;
207pub const F_SETFD: ::c_int = 2;
208pub const F_GETFL: ::c_int = 3;
209pub const F_SETFL: ::c_int = 4;
210
54a0048b
SL
211// Linux-specific fcntls
212pub const F_SETLEASE: ::c_int = 1024;
213pub const F_GETLEASE: ::c_int = 1025;
214pub const F_NOTIFY: ::c_int = 1026;
215pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
216pub const F_SETPIPE_SZ: ::c_int = 1031;
217pub const F_GETPIPE_SZ: ::c_int = 1032;
218
219// TODO(#235): Include file sealing fcntls once we have a way to verify them.
220
92a42be0
SL
221pub const SIGTRAP: ::c_int = 5;
222
223pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
224pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
225
54a0048b
SL
226pub const CLOCK_REALTIME: clockid_t = 0;
227pub const CLOCK_MONOTONIC: clockid_t = 1;
228pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
229pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
230pub const CLOCK_MONOTONIC_RAW: clockid_t = 4;
231pub const CLOCK_REALTIME_COARSE: clockid_t = 5;
232pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6;
233pub const CLOCK_BOOTTIME: clockid_t = 7;
234pub const CLOCK_REALTIME_ALARM: clockid_t = 8;
235pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9;
236// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
237// 2014.) See also musl/mod.rs
238// pub const CLOCK_SGI_CYCLE: clockid_t = 10;
239// pub const CLOCK_TAI: clockid_t = 11;
9e0c209e 240pub const TIMER_ABSTIME: ::c_int = 1;
92a42be0
SL
241
242pub const RLIMIT_CPU: ::c_int = 0;
243pub const RLIMIT_FSIZE: ::c_int = 1;
244pub const RLIMIT_DATA: ::c_int = 2;
245pub const RLIMIT_STACK: ::c_int = 3;
246pub const RLIMIT_CORE: ::c_int = 4;
247pub const RLIMIT_LOCKS: ::c_int = 10;
248pub const RLIMIT_SIGPENDING: ::c_int = 11;
249pub const RLIMIT_MSGQUEUE: ::c_int = 12;
250pub const RLIMIT_NICE: ::c_int = 13;
251pub const RLIMIT_RTPRIO: ::c_int = 14;
252
253pub const RUSAGE_SELF: ::c_int = 0;
254
255pub const O_RDONLY: ::c_int = 0;
256pub const O_WRONLY: ::c_int = 1;
257pub const O_RDWR: ::c_int = 2;
8bb4bdeb 258pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
7453a54e
SL
259
260pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
261
92a42be0
SL
262pub const S_IFIFO: ::mode_t = 4096;
263pub const S_IFCHR: ::mode_t = 8192;
264pub const S_IFBLK: ::mode_t = 24576;
265pub const S_IFDIR: ::mode_t = 16384;
266pub const S_IFREG: ::mode_t = 32768;
267pub const S_IFLNK: ::mode_t = 40960;
268pub const S_IFSOCK: ::mode_t = 49152;
269pub const S_IFMT: ::mode_t = 61440;
270pub const S_IRWXU: ::mode_t = 448;
271pub const S_IXUSR: ::mode_t = 64;
272pub const S_IWUSR: ::mode_t = 128;
273pub const S_IRUSR: ::mode_t = 256;
274pub const S_IRWXG: ::mode_t = 56;
275pub const S_IXGRP: ::mode_t = 8;
276pub const S_IWGRP: ::mode_t = 16;
277pub const S_IRGRP: ::mode_t = 32;
278pub const S_IRWXO: ::mode_t = 7;
279pub const S_IXOTH: ::mode_t = 1;
280pub const S_IWOTH: ::mode_t = 2;
281pub const S_IROTH: ::mode_t = 4;
282pub const F_OK: ::c_int = 0;
283pub const R_OK: ::c_int = 4;
284pub const W_OK: ::c_int = 2;
285pub const X_OK: ::c_int = 1;
286pub const STDIN_FILENO: ::c_int = 0;
287pub const STDOUT_FILENO: ::c_int = 1;
288pub const STDERR_FILENO: ::c_int = 2;
289pub const SIGHUP: ::c_int = 1;
290pub const SIGINT: ::c_int = 2;
291pub const SIGQUIT: ::c_int = 3;
292pub const SIGILL: ::c_int = 4;
293pub const SIGABRT: ::c_int = 6;
294pub const SIGFPE: ::c_int = 8;
295pub const SIGKILL: ::c_int = 9;
296pub const SIGSEGV: ::c_int = 11;
297pub const SIGPIPE: ::c_int = 13;
298pub const SIGALRM: ::c_int = 14;
299pub const SIGTERM: ::c_int = 15;
300
301pub const PROT_NONE: ::c_int = 0;
302pub const PROT_READ: ::c_int = 1;
303pub const PROT_WRITE: ::c_int = 2;
304pub const PROT_EXEC: ::c_int = 4;
305
54a0048b
SL
306pub const LC_CTYPE: ::c_int = 0;
307pub const LC_NUMERIC: ::c_int = 1;
308pub const LC_TIME: ::c_int = 2;
309pub const LC_COLLATE: ::c_int = 3;
310pub const LC_MONETARY: ::c_int = 4;
311pub const LC_MESSAGES: ::c_int = 5;
312pub const LC_ALL: ::c_int = 6;
a7813a04
XL
313pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
314pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
315pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
316pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
317pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
318pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
319// LC_ALL_MASK defined per platform
54a0048b 320
92a42be0
SL
321pub const MAP_FILE: ::c_int = 0x0000;
322pub const MAP_SHARED: ::c_int = 0x0001;
323pub const MAP_PRIVATE: ::c_int = 0x0002;
324pub const MAP_FIXED: ::c_int = 0x0010;
325
326pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
327
54a0048b 328// MS_ flags for msync(2)
92a42be0
SL
329pub const MS_ASYNC: ::c_int = 0x0001;
330pub const MS_INVALIDATE: ::c_int = 0x0002;
331pub const MS_SYNC: ::c_int = 0x0004;
54a0048b
SL
332
333// MS_ flags for mount(2)
9cc50fc6
SL
334pub const MS_RDONLY: ::c_ulong = 0x01;
335pub const MS_NOSUID: ::c_ulong = 0x02;
336pub const MS_NODEV: ::c_ulong = 0x04;
337pub const MS_NOEXEC: ::c_ulong = 0x08;
338pub const MS_SYNCHRONOUS: ::c_ulong = 0x10;
339pub const MS_REMOUNT: ::c_ulong = 0x20;
340pub const MS_MANDLOCK: ::c_ulong = 0x40;
341pub const MS_DIRSYNC: ::c_ulong = 0x80;
342pub const MS_NOATIME: ::c_ulong = 0x0400;
343pub const MS_NODIRATIME: ::c_ulong = 0x0800;
344pub const MS_BIND: ::c_ulong = 0x1000;
345pub const MS_MOVE: ::c_ulong = 0x2000;
346pub const MS_REC: ::c_ulong = 0x4000;
347pub const MS_SILENT: ::c_ulong = 0x8000;
348pub const MS_POSIXACL: ::c_ulong = 0x010000;
349pub const MS_UNBINDABLE: ::c_ulong = 0x020000;
350pub const MS_PRIVATE: ::c_ulong = 0x040000;
351pub const MS_SLAVE: ::c_ulong = 0x080000;
352pub const MS_SHARED: ::c_ulong = 0x100000;
54a0048b
SL
353pub const MS_RELATIME: ::c_ulong = 0x200000;
354pub const MS_KERNMOUNT: ::c_ulong = 0x400000;
355pub const MS_I_VERSION: ::c_ulong = 0x800000;
356pub const MS_STRICTATIME: ::c_ulong = 0x1000000;
9cc50fc6
SL
357pub const MS_ACTIVE: ::c_ulong = 0x40000000;
358pub const MS_NOUSER: ::c_ulong = 0x80000000;
359pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
360pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
361pub const MS_RMT_MASK: ::c_ulong = 0x800051;
92a42be0
SL
362
363pub const EPERM: ::c_int = 1;
364pub const ENOENT: ::c_int = 2;
365pub const ESRCH: ::c_int = 3;
366pub const EINTR: ::c_int = 4;
367pub const EIO: ::c_int = 5;
368pub const ENXIO: ::c_int = 6;
369pub const E2BIG: ::c_int = 7;
370pub const ENOEXEC: ::c_int = 8;
371pub const EBADF: ::c_int = 9;
372pub const ECHILD: ::c_int = 10;
373pub const EAGAIN: ::c_int = 11;
374pub const ENOMEM: ::c_int = 12;
375pub const EACCES: ::c_int = 13;
376pub const EFAULT: ::c_int = 14;
377pub const ENOTBLK: ::c_int = 15;
378pub const EBUSY: ::c_int = 16;
379pub const EEXIST: ::c_int = 17;
380pub const EXDEV: ::c_int = 18;
381pub const ENODEV: ::c_int = 19;
382pub const ENOTDIR: ::c_int = 20;
383pub const EISDIR: ::c_int = 21;
384pub const EINVAL: ::c_int = 22;
385pub const ENFILE: ::c_int = 23;
386pub const EMFILE: ::c_int = 24;
387pub const ENOTTY: ::c_int = 25;
388pub const ETXTBSY: ::c_int = 26;
389pub const EFBIG: ::c_int = 27;
390pub const ENOSPC: ::c_int = 28;
391pub const ESPIPE: ::c_int = 29;
392pub const EROFS: ::c_int = 30;
393pub const EMLINK: ::c_int = 31;
394pub const EPIPE: ::c_int = 32;
395pub const EDOM: ::c_int = 33;
396pub const ERANGE: ::c_int = 34;
397pub const EWOULDBLOCK: ::c_int = EAGAIN;
398
cc61c64b
XL
399pub const SCM_RIGHTS: ::c_int = 0x01;
400pub const SCM_CREDENTIALS: ::c_int = 0x02;
401
92a42be0
SL
402pub const IPPROTO_RAW: ::c_int = 255;
403
404pub const PROT_GROWSDOWN: ::c_int = 0x1000000;
405pub const PROT_GROWSUP: ::c_int = 0x2000000;
406
407pub const MAP_TYPE: ::c_int = 0x000f;
408
409pub const MADV_NORMAL: ::c_int = 0;
410pub const MADV_RANDOM: ::c_int = 1;
411pub const MADV_SEQUENTIAL: ::c_int = 2;
412pub const MADV_WILLNEED: ::c_int = 3;
413pub const MADV_DONTNEED: ::c_int = 4;
414pub const MADV_REMOVE: ::c_int = 9;
415pub const MADV_DONTFORK: ::c_int = 10;
416pub const MADV_DOFORK: ::c_int = 11;
417pub const MADV_MERGEABLE: ::c_int = 12;
418pub const MADV_UNMERGEABLE: ::c_int = 13;
419pub const MADV_HWPOISON: ::c_int = 100;
420
9e0c209e
SL
421pub const IFF_UP: ::c_int = 0x1;
422pub const IFF_BROADCAST: ::c_int = 0x2;
423pub const IFF_DEBUG: ::c_int = 0x4;
92a42be0 424pub const IFF_LOOPBACK: ::c_int = 0x8;
9e0c209e
SL
425pub const IFF_POINTOPOINT: ::c_int = 0x10;
426pub const IFF_NOTRAILERS: ::c_int = 0x20;
427pub const IFF_RUNNING: ::c_int = 0x40;
428pub const IFF_NOARP: ::c_int = 0x80;
429pub const IFF_PROMISC: ::c_int = 0x100;
430pub const IFF_ALLMULTI: ::c_int = 0x200;
431pub const IFF_MASTER: ::c_int = 0x400;
432pub const IFF_SLAVE: ::c_int = 0x800;
433pub const IFF_MULTICAST: ::c_int = 0x1000;
434pub const IFF_PORTSEL: ::c_int = 0x2000;
435pub const IFF_AUTOMEDIA: ::c_int = 0x4000;
436pub const IFF_DYNAMIC: ::c_int = 0x8000;
92a42be0 437
cc61c64b
XL
438pub const SOL_IP: ::c_int = 0;
439pub const SOL_TCP: ::c_int = 6;
440pub const SOL_IPV6: ::c_int = 41;
441pub const SOL_ICMPV6: ::c_int = 58;
442pub const SOL_RAW: ::c_int = 255;
443pub const SOL_DECNET: ::c_int = 261;
444pub const SOL_X25: ::c_int = 262;
445pub const SOL_PACKET: ::c_int = 263;
446pub const SOL_ATM: ::c_int = 264;
447pub const SOL_AAL: ::c_int = 265;
448pub const SOL_IRDA: ::c_int = 266;
449pub const SOL_NETBEUI: ::c_int = 267;
450pub const SOL_LLC: ::c_int = 268;
451pub const SOL_DCCP: ::c_int = 269;
452pub const SOL_NETLINK: ::c_int = 270;
453pub const SOL_TIPC: ::c_int = 271;
454
455pub const AF_UNSPEC: ::c_int = 0;
92a42be0 456pub const AF_UNIX: ::c_int = 1;
cc61c64b 457pub const AF_LOCAL: ::c_int = 1;
92a42be0 458pub const AF_INET: ::c_int = 2;
cc61c64b
XL
459pub const AF_AX25: ::c_int = 3;
460pub const AF_IPX: ::c_int = 4;
461pub const AF_APPLETALK: ::c_int = 5;
462pub const AF_NETROM: ::c_int = 6;
463pub const AF_BRIDGE: ::c_int = 7;
464pub const AF_ATMPVC: ::c_int = 8;
465pub const AF_X25: ::c_int = 9;
92a42be0 466pub const AF_INET6: ::c_int = 10;
cc61c64b
XL
467pub const AF_ROSE: ::c_int = 11;
468pub const AF_DECnet: ::c_int = 12;
469pub const AF_NETBEUI: ::c_int = 13;
470pub const AF_SECURITY: ::c_int = 14;
471pub const AF_KEY: ::c_int = 15;
9e0c209e 472pub const AF_NETLINK: ::c_int = 16;
cc61c64b
XL
473pub const AF_ROUTE: ::c_int = AF_NETLINK;
474pub const AF_PACKET: ::c_int = 17;
475pub const AF_ASH: ::c_int = 18;
476pub const AF_ECONET: ::c_int = 19;
477pub const AF_ATMSVC: ::c_int = 20;
478pub const AF_RDS: ::c_int = 21;
479pub const AF_SNA: ::c_int = 22;
480pub const AF_IRDA: ::c_int = 23;
481pub const AF_PPPOX: ::c_int = 24;
482pub const AF_WANPIPE: ::c_int = 25;
483pub const AF_LLC: ::c_int = 26;
484pub const AF_CAN: ::c_int = 29;
485pub const AF_TIPC: ::c_int = 30;
486pub const AF_BLUETOOTH: ::c_int = 31;
487pub const AF_IUCV: ::c_int = 32;
488pub const AF_RXRPC: ::c_int = 33;
489pub const AF_ISDN: ::c_int = 34;
490pub const AF_PHONET: ::c_int = 35;
491pub const AF_IEEE802154: ::c_int = 36;
492pub const AF_CAIF: ::c_int = 37;
493pub const AF_ALG: ::c_int = 38;
494
495pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
496pub const PF_UNIX: ::c_int = AF_UNIX;
497pub const PF_LOCAL: ::c_int = AF_LOCAL;
498pub const PF_INET: ::c_int = AF_INET;
499pub const PF_AX25: ::c_int = AF_AX25;
500pub const PF_IPX: ::c_int = AF_IPX;
501pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
502pub const PF_NETROM: ::c_int = AF_NETROM;
503pub const PF_BRIDGE: ::c_int = AF_BRIDGE;
504pub const PF_ATMPVC: ::c_int = AF_ATMPVC;
505pub const PF_X25: ::c_int = AF_X25;
506pub const PF_INET6: ::c_int = AF_INET6;
507pub const PF_ROSE: ::c_int = AF_ROSE;
508pub const PF_DECnet: ::c_int = AF_DECnet;
509pub const PF_NETBEUI: ::c_int = AF_NETBEUI;
510pub const PF_SECURITY: ::c_int = AF_SECURITY;
511pub const PF_KEY: ::c_int = AF_KEY;
512pub const PF_NETLINK: ::c_int = AF_NETLINK;
513pub const PF_ROUTE: ::c_int = AF_ROUTE;
514pub const PF_PACKET: ::c_int = AF_PACKET;
515pub const PF_ASH: ::c_int = AF_ASH;
516pub const PF_ECONET: ::c_int = AF_ECONET;
517pub const PF_ATMSVC: ::c_int = AF_ATMSVC;
518pub const PF_RDS: ::c_int = AF_RDS;
519pub const PF_SNA: ::c_int = AF_SNA;
520pub const PF_IRDA: ::c_int = AF_IRDA;
521pub const PF_PPPOX: ::c_int = AF_PPPOX;
522pub const PF_WANPIPE: ::c_int = AF_WANPIPE;
523pub const PF_LLC: ::c_int = AF_LLC;
524pub const PF_CAN: ::c_int = AF_CAN;
525pub const PF_TIPC: ::c_int = AF_TIPC;
526pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
527pub const PF_IUCV: ::c_int = AF_IUCV;
528pub const PF_RXRPC: ::c_int = AF_RXRPC;
529pub const PF_ISDN: ::c_int = AF_ISDN;
530pub const PF_PHONET: ::c_int = AF_PHONET;
531pub const PF_IEEE802154: ::c_int = AF_IEEE802154;
532pub const PF_CAIF: ::c_int = AF_CAIF;
533pub const PF_ALG: ::c_int = AF_ALG;
534
535pub const SOMAXCONN: ::c_int = 128;
536
537pub const MSG_OOB: ::c_int = 1;
538pub const MSG_PEEK: ::c_int = 2;
539pub const MSG_DONTROUTE: ::c_int = 4;
540pub const MSG_CTRUNC: ::c_int = 8;
541pub const MSG_TRUNC: ::c_int = 0x20;
542pub const MSG_DONTWAIT: ::c_int = 0x40;
543pub const MSG_EOR: ::c_int = 0x80;
544pub const MSG_WAITALL: ::c_int = 0x100;
545pub const MSG_FIN: ::c_int = 0x200;
546pub const MSG_SYN: ::c_int = 0x400;
547pub const MSG_CONFIRM: ::c_int = 0x800;
548pub const MSG_RST: ::c_int = 0x1000;
549pub const MSG_ERRQUEUE: ::c_int = 0x2000;
550pub const MSG_NOSIGNAL: ::c_int = 0x4000;
551pub const MSG_MORE: ::c_int = 0x8000;
552pub const MSG_WAITFORONE: ::c_int = 0x10000;
553pub const MSG_FASTOPEN: ::c_int = 0x20000000;
554pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
555
92a42be0 556pub const SOCK_RAW: ::c_int = 3;
8bb4bdeb
XL
557pub const IPPROTO_ICMP: ::c_int = 1;
558pub const IPPROTO_ICMPV6: ::c_int = 58;
92a42be0
SL
559pub const IPPROTO_TCP: ::c_int = 6;
560pub const IPPROTO_IP: ::c_int = 0;
561pub const IPPROTO_IPV6: ::c_int = 41;
562pub const IP_MULTICAST_TTL: ::c_int = 33;
563pub const IP_MULTICAST_LOOP: ::c_int = 34;
564pub const IP_TTL: ::c_int = 2;
565pub const IP_HDRINCL: ::c_int = 3;
566pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
567pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
7453a54e 568pub const IP_TRANSPARENT: ::c_int = 19;
92a42be0
SL
569pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
570pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
571
572pub const TCP_NODELAY: ::c_int = 1;
573pub const TCP_MAXSEG: ::c_int = 2;
574pub const TCP_CORK: ::c_int = 3;
575pub const TCP_KEEPIDLE: ::c_int = 4;
576pub const TCP_KEEPINTVL: ::c_int = 5;
577pub const TCP_KEEPCNT: ::c_int = 6;
578pub const TCP_SYNCNT: ::c_int = 7;
579pub const TCP_LINGER2: ::c_int = 8;
580pub const TCP_DEFER_ACCEPT: ::c_int = 9;
581pub const TCP_WINDOW_CLAMP: ::c_int = 10;
582pub const TCP_INFO: ::c_int = 11;
583pub const TCP_QUICKACK: ::c_int = 12;
584pub const TCP_CONGESTION: ::c_int = 13;
585
586pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
587pub const IPV6_V6ONLY: ::c_int = 26;
588
589pub const SO_DEBUG: ::c_int = 1;
590
591pub const SHUT_RD: ::c_int = 0;
592pub const SHUT_WR: ::c_int = 1;
593pub const SHUT_RDWR: ::c_int = 2;
594
595pub const LOCK_SH: ::c_int = 1;
596pub const LOCK_EX: ::c_int = 2;
597pub const LOCK_NB: ::c_int = 4;
598pub const LOCK_UN: ::c_int = 8;
599
7453a54e
SL
600pub const SS_ONSTACK: ::c_int = 1;
601pub const SS_DISABLE: ::c_int = 2;
602
9cc50fc6
SL
603pub const PATH_MAX: ::c_int = 4096;
604
92a42be0
SL
605pub const FD_SETSIZE: usize = 1024;
606
9cc50fc6
SL
607pub const EPOLLIN: ::c_int = 0x1;
608pub const EPOLLPRI: ::c_int = 0x2;
609pub const EPOLLOUT: ::c_int = 0x4;
610pub const EPOLLRDNORM: ::c_int = 0x40;
611pub const EPOLLRDBAND: ::c_int = 0x80;
612pub const EPOLLWRNORM: ::c_int = 0x100;
613pub const EPOLLWRBAND: ::c_int = 0x200;
614pub const EPOLLMSG: ::c_int = 0x400;
615pub const EPOLLERR: ::c_int = 0x8;
616pub const EPOLLHUP: ::c_int = 0x10;
617pub const EPOLLET: ::c_int = 0x80000000;
618
619pub const EPOLL_CTL_ADD: ::c_int = 1;
620pub const EPOLL_CTL_MOD: ::c_int = 3;
621pub const EPOLL_CTL_DEL: ::c_int = 2;
622
623pub const MNT_DETACH: ::c_int = 0x2;
624pub const MNT_EXPIRE: ::c_int = 0x4;
625
626pub const Q_GETFMT: ::c_int = 0x800004;
627pub const Q_GETINFO: ::c_int = 0x800005;
628pub const Q_SETINFO: ::c_int = 0x800006;
629pub const QIF_BLIMITS: ::uint32_t = 1;
630pub const QIF_SPACE: ::uint32_t = 2;
631pub const QIF_ILIMITS: ::uint32_t = 4;
632pub const QIF_INODES: ::uint32_t = 8;
633pub const QIF_BTIME: ::uint32_t = 16;
634pub const QIF_ITIME: ::uint32_t = 32;
635pub const QIF_LIMITS: ::uint32_t = 5;
636pub const QIF_USAGE: ::uint32_t = 10;
637pub const QIF_TIMES: ::uint32_t = 48;
638pub const QIF_ALL: ::uint32_t = 63;
639
9cc50fc6
SL
640pub const MNT_FORCE: ::c_int = 0x1;
641
642pub const Q_SYNC: ::c_int = 0x800001;
643pub const Q_QUOTAON: ::c_int = 0x800002;
644pub const Q_QUOTAOFF: ::c_int = 0x800003;
645pub const Q_GETQUOTA: ::c_int = 0x800007;
646pub const Q_SETQUOTA: ::c_int = 0x800008;
647
648pub const TCIOFF: ::c_int = 2;
649pub const TCION: ::c_int = 3;
650pub const TCOOFF: ::c_int = 0;
651pub const TCOON: ::c_int = 1;
652pub const TCIFLUSH: ::c_int = 0;
653pub const TCOFLUSH: ::c_int = 1;
654pub const TCIOFLUSH: ::c_int = 2;
655pub const NL0: ::c_int = 0x00000000;
656pub const NL1: ::c_int = 0x00000100;
657pub const TAB0: ::c_int = 0x00000000;
9cc50fc6 658pub const CR0: ::c_int = 0x00000000;
9cc50fc6 659pub const FF0: ::c_int = 0x00000000;
9cc50fc6 660pub const BS0: ::c_int = 0x00000000;
9cc50fc6 661pub const VT0: ::c_int = 0x00000000;
9cc50fc6 662pub const VERASE: usize = 2;
9cc50fc6 663pub const VKILL: usize = 3;
9cc50fc6
SL
664pub const VINTR: usize = 0;
665pub const VQUIT: usize = 1;
9cc50fc6 666pub const VLNEXT: usize = 15;
9cc50fc6
SL
667pub const IGNBRK: ::tcflag_t = 0x00000001;
668pub const BRKINT: ::tcflag_t = 0x00000002;
669pub const IGNPAR: ::tcflag_t = 0x00000004;
670pub const PARMRK: ::tcflag_t = 0x00000008;
671pub const INPCK: ::tcflag_t = 0x00000010;
672pub const ISTRIP: ::tcflag_t = 0x00000020;
673pub const INLCR: ::tcflag_t = 0x00000040;
674pub const IGNCR: ::tcflag_t = 0x00000080;
675pub const ICRNL: ::tcflag_t = 0x00000100;
9cc50fc6
SL
676pub const IXANY: ::tcflag_t = 0x00000800;
677pub const IMAXBEL: ::tcflag_t = 0x00002000;
cc61c64b 678pub const IUTF8: ::tcflag_t = 0x00004000;
9cc50fc6 679pub const OPOST: ::tcflag_t = 0x1;
9cc50fc6 680pub const CS5: ::tcflag_t = 0x00000000;
9cc50fc6 681pub const CRTSCTS: ::tcflag_t = 0x80000000;
9cc50fc6 682pub const ECHO: ::tcflag_t = 0x00000008;
9cc50fc6
SL
683
684pub const CLONE_VM: ::c_int = 0x100;
685pub const CLONE_FS: ::c_int = 0x200;
686pub const CLONE_FILES: ::c_int = 0x400;
687pub const CLONE_SIGHAND: ::c_int = 0x800;
688pub const CLONE_PTRACE: ::c_int = 0x2000;
689pub const CLONE_VFORK: ::c_int = 0x4000;
690pub const CLONE_PARENT: ::c_int = 0x8000;
691pub const CLONE_THREAD: ::c_int = 0x10000;
692pub const CLONE_NEWNS: ::c_int = 0x20000;
693pub const CLONE_SYSVSEM: ::c_int = 0x40000;
694pub const CLONE_SETTLS: ::c_int = 0x80000;
695pub const CLONE_PARENT_SETTID: ::c_int = 0x100000;
696pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
697pub const CLONE_DETACHED: ::c_int = 0x400000;
698pub const CLONE_UNTRACED: ::c_int = 0x800000;
699pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
54a0048b
SL
700pub const CLONE_NEWUTS: ::c_int = 0x04000000;
701pub const CLONE_NEWIPC: ::c_int = 0x08000000;
702pub const CLONE_NEWUSER: ::c_int = 0x10000000;
703pub const CLONE_NEWPID: ::c_int = 0x20000000;
704pub const CLONE_NEWNET: ::c_int = 0x40000000;
705pub const CLONE_IO: ::c_int = 0x80000000;
9cc50fc6 706
5bcae85e
SL
707pub const WNOHANG: ::c_int = 0x00000001;
708pub const WUNTRACED: ::c_int = 0x00000002;
709pub const WSTOPPED: ::c_int = WUNTRACED;
710pub const WEXITED: ::c_int = 0x00000004;
711pub const WCONTINUED: ::c_int = 0x00000008;
712pub const WNOWAIT: ::c_int = 0x01000000;
713
714pub const __WNOTHREAD: ::c_int = 0x20000000;
715pub const __WALL: ::c_int = 0x40000000;
716pub const __WCLONE: ::c_int = 0x80000000;
7453a54e
SL
717
718pub const SPLICE_F_MOVE: ::c_uint = 0x01;
719pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
720pub const SPLICE_F_MORE: ::c_uint = 0x04;
721pub const SPLICE_F_GIFT: ::c_uint = 0x08;
722
723pub const RTLD_LOCAL: ::c_int = 0;
724
725pub const POSIX_FADV_NORMAL: ::c_int = 0;
726pub const POSIX_FADV_RANDOM: ::c_int = 1;
727pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
728pub const POSIX_FADV_WILLNEED: ::c_int = 3;
7453a54e 729
54a0048b
SL
730pub const AT_FDCWD: ::c_int = -100;
731pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
cc61c64b
XL
732pub const AT_REMOVEDIR: ::c_int = 0x200;
733pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
734pub const AT_NO_AUTOMOUNT: ::c_int = 0x800;
735pub const AT_EMPTY_PATH: ::c_int = 0x1000;
54a0048b 736
a7813a04
XL
737pub const LOG_CRON: ::c_int = 9 << 3;
738pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
739pub const LOG_FTP: ::c_int = 11 << 3;
740pub const LOG_PERROR: ::c_int = 0x20;
741
742pub const PIPE_BUF: usize = 4096;
743
3157f602
XL
744pub const SI_LOAD_SHIFT: ::c_uint = 16;
745
476ff2be
SL
746pub const SIGEV_SIGNAL: ::c_int = 0;
747pub const SIGEV_NONE: ::c_int = 1;
748pub const SIGEV_THREAD: ::c_int = 2;
749
8bb4bdeb
XL
750pub const P_ALL: idtype_t = 0;
751pub const P_PID: idtype_t = 1;
752pub const P_PGID: idtype_t = 2;
753
cc61c64b
XL
754pub const UTIME_OMIT: c_long = 1073741822;
755pub const UTIME_NOW: c_long = 1073741823;
756
92a42be0
SL
757f! {
758 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
759 let fd = fd as usize;
760 let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
761 (*set).fds_bits[fd / size] &= !(1 << (fd % size));
762 return
763 }
764
765 pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
766 let fd = fd as usize;
767 let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
768 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
769 }
770
771 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
772 let fd = fd as usize;
773 let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
774 (*set).fds_bits[fd / size] |= 1 << (fd % size);
775 return
776 }
777
778 pub fn FD_ZERO(set: *mut fd_set) -> () {
779 for slot in (*set).fds_bits.iter_mut() {
780 *slot = 0;
781 }
782 }
783
5bcae85e
SL
784 pub fn WIFSTOPPED(status: ::c_int) -> bool {
785 (status & 0xff) == 0x7f
92a42be0
SL
786 }
787
5bcae85e 788 pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
92a42be0
SL
789 (status >> 8) & 0xff
790 }
791
8bb4bdeb
XL
792 pub fn WIFCONTINUED(status: ::c_int) -> bool {
793 status == 0xffff
794 }
795
5bcae85e 796 pub fn WIFSIGNALED(status: ::c_int) -> bool {
32a655c1 797 ((status & 0x7f) + 1) as i8 >= 2
5bcae85e
SL
798 }
799
92a42be0
SL
800 pub fn WTERMSIG(status: ::c_int) -> ::c_int {
801 status & 0x7f
802 }
5bcae85e
SL
803
804 pub fn WIFEXITED(status: ::c_int) -> bool {
805 (status & 0x7f) == 0
806 }
807
808 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
809 (status >> 8) & 0xff
810 }
811
812 pub fn WCOREDUMP(status: ::c_int) -> bool {
813 (status & 0x80) != 0
814 }
92a42be0
SL
815}
816
817extern {
9e0c209e
SL
818 pub fn getpwnam_r(name: *const ::c_char,
819 pwd: *mut passwd,
820 buf: *mut ::c_char,
821 buflen: ::size_t,
822 result: *mut *mut passwd) -> ::c_int;
7453a54e
SL
823 pub fn getpwuid_r(uid: ::uid_t,
824 pwd: *mut passwd,
825 buf: *mut ::c_char,
826 buflen: ::size_t,
827 result: *mut *mut passwd) -> ::c_int;
92a42be0
SL
828 pub fn fdatasync(fd: ::c_int) -> ::c_int;
829 pub fn mincore(addr: *mut ::c_void, len: ::size_t,
830 vec: *mut ::c_uchar) -> ::c_int;
54a0048b
SL
831 pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
832 pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
9e0c209e
SL
833 pub fn clock_nanosleep(clk_id: clockid_t,
834 flags: ::c_int,
835 rqtp: *const ::timespec,
836 rmtp: *mut ::timespec) -> ::c_int;
32a655c1 837 pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
92a42be0
SL
838 pub fn prctl(option: ::c_int, ...) -> ::c_int;
839 pub fn pthread_getattr_np(native: ::pthread_t,
840 attr: *mut ::pthread_attr_t) -> ::c_int;
841 pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
842 guardsize: *mut ::size_t) -> ::c_int;
843 pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
844 stackaddr: *mut *mut ::c_void,
845 stacksize: *mut ::size_t) -> ::c_int;
846 pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
847 pub fn setgroups(ngroups: ::size_t,
848 ptr: *const ::gid_t) -> ::c_int;
32a655c1 849 pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
54a0048b
SL
850 pub fn sched_setscheduler(pid: ::pid_t,
851 policy: ::c_int,
852 param: *const sched_param) -> ::c_int;
9cc50fc6
SL
853 pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
854 pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
855 pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
856 pub fn epoll_create(size: ::c_int) -> ::c_int;
5bcae85e 857 pub fn epoll_create1(flags: ::c_int) -> ::c_int;
9cc50fc6
SL
858 pub fn epoll_ctl(epfd: ::c_int,
859 op: ::c_int,
860 fd: ::c_int,
861 event: *mut epoll_event) -> ::c_int;
862 pub fn epoll_wait(epfd: ::c_int,
863 events: *mut epoll_event,
864 maxevents: ::c_int,
865 timeout: ::c_int) -> ::c_int;
866 pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
867 pub fn mount(src: *const ::c_char,
868 target: *const ::c_char,
869 fstype: *const ::c_char,
870 flags: ::c_ulong,
871 data: *const ::c_void) -> ::c_int;
872 pub fn umount(target: *const ::c_char) -> ::c_int;
873 pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
874 pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
875 child_stack: *mut ::c_void,
876 flags: ::c_int,
877 arg: *mut ::c_void, ...) -> ::c_int;
878 pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
879 pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
54a0048b
SL
880 pub fn memrchr(cx: *const ::c_void,
881 c: ::c_int,
882 n: ::size_t) -> *mut ::c_void;
9cc50fc6 883 pub fn syscall(num: ::c_long, ...) -> ::c_long;
7453a54e
SL
884 pub fn sendfile(out_fd: ::c_int,
885 in_fd: ::c_int,
886 offset: *mut off_t,
887 count: ::size_t) -> ::ssize_t;
888 pub fn splice(fd_in: ::c_int,
889 off_in: *mut ::loff_t,
890 fd_out: ::c_int,
891 off_out: *mut ::loff_t,
892 len: ::size_t,
893 flags: ::c_uint) -> ::ssize_t;
894 pub fn tee(fd_in: ::c_int,
895 fd_out: ::c_int,
896 len: ::size_t,
897 flags: ::c_uint) -> ::ssize_t;
898 pub fn vmsplice(fd: ::c_int,
899 iov: *const ::iovec,
900 nr_segs: ::size_t,
901 flags: ::c_uint) -> ::ssize_t;
902
54a0048b 903 pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
7453a54e 904 advise: ::c_int) -> ::c_int;
54a0048b
SL
905 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
906 pub fn utimensat(dirfd: ::c_int, path: *const ::c_char,
907 times: *const ::timespec, flag: ::c_int) -> ::c_int;
a7813a04
XL
908 pub fn duplocale(base: ::locale_t) -> ::locale_t;
909 pub fn freelocale(loc: ::locale_t);
910 pub fn newlocale(mask: ::c_int,
911 locale: *const ::c_char,
912 base: ::locale_t) -> ::locale_t;
913 pub fn uselocale(loc: ::locale_t) -> ::locale_t;
914 pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
915 pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
916 pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
917 pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
918 pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
919 pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
920 pub fn mmap64(addr: *mut ::c_void,
921 len: ::size_t,
922 prot: ::c_int,
923 flags: ::c_int,
924 fd: ::c_int,
925 offset: off64_t)
926 -> *mut ::c_void;
927 pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
cc61c64b
XL
928 pub fn openat64(fd: ::c_int,
929 path: *const c_char,
930 oflag: ::c_int, ...) -> ::c_int;
a7813a04
XL
931 pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
932 offset: off64_t) -> ::ssize_t;
933 pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
934 offset: off64_t) -> ::ssize_t;
cc61c64b 935 pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
a7813a04
XL
936 pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64,
937 result: *mut *mut ::dirent64) -> ::c_int;
938 pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
939 pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
cc61c64b 940 pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
a7813a04 941 pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
3157f602 942 pub fn sysinfo (info: *mut ::sysinfo) -> ::c_int;
5bcae85e 943
cc61c64b
XL
944 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
945
5bcae85e
SL
946 pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
947 mode: ::mode_t, dev: dev_t) -> ::c_int;
cc61c64b
XL
948 pub fn ppoll(fds: *mut ::pollfd,
949 nfds: nfds_t,
950 timeout: *const ::timespec,
951 sigmask: *const sigset_t) -> ::c_int;
5bcae85e
SL
952 pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
953 clock_id: *mut clockid_t) -> ::c_int;
954 pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
955 clock_id: clockid_t) -> ::c_int;
8bb4bdeb
XL
956 pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
957 pshared: ::c_int) -> ::c_int;
958 pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
959 pshared: *mut ::c_int) -> ::c_int;
9e0c209e
SL
960 pub fn sched_getaffinity(pid: ::pid_t,
961 cpusetsize: ::size_t,
962 cpuset: *mut cpu_set_t) -> ::c_int;
963 pub fn sched_setaffinity(pid: ::pid_t,
964 cpusetsize: ::size_t,
965 cpuset: *const cpu_set_t) -> ::c_int;
966 pub fn unshare(flags: ::c_int) -> ::c_int;
967 pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
968 pub fn sem_timedwait(sem: *mut sem_t,
969 abstime: *const ::timespec) -> ::c_int;
970 pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t,
971 flg: ::c_int) -> ::c_int;
972 pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
973 abstime: *const ::timespec) -> ::c_int;
8bb4bdeb
XL
974 pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
975 pshared: ::c_int) -> ::c_int;
976 pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
977 pshared: *mut ::c_int) -> ::c_int;
c30ab7b3
SL
978 pub fn ptsname_r(fd: ::c_int,
979 buf: *mut ::c_char,
980 buflen: ::size_t) -> ::c_int;
32a655c1 981 pub fn clearenv() -> ::c_int;
8bb4bdeb
XL
982 pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
983 options: ::c_int) -> ::c_int;
92a42be0
SL
984}
985
986cfg_if! {
9cc50fc6 987 if #[cfg(any(target_os = "linux",
c30ab7b3
SL
988 target_os = "emscripten",
989 target_os = "fuchsia"))] {
92a42be0
SL
990 mod linux;
991 pub use self::linux::*;
992 } else if #[cfg(target_os = "android")] {
993 mod android;
994 pub use self::android::*;
995 } else {
54a0048b 996 // Unknown target_os
92a42be0
SL
997 }
998}