blob: 022bea11a6cc38a3d9b4f517e3ede7a77ab86654 [file] [log] [blame]
Alex Crichton07d3a0d2015-10-30 10:21:32 -07001use dox::mem;
2
Alex Crichton5d6cf052015-09-11 14:52:34 -07003pub type sa_family_t = u16;
Alex Crichton239f9cd2015-09-18 16:31:34 -07004pub type pthread_key_t = ::c_uint;
Alex Crichton8dce9ad2015-12-03 11:44:14 -08005pub type speed_t = ::c_uint;
6pub type tcflag_t = ::c_uint;
Kamal Marhubi0cfc25f2016-02-04 15:57:10 -05007pub type loff_t = ::c_longlong;
NODA, Kai7e752a32016-03-31 18:59:05 +08008pub type clockid_t = ::c_int;
Raphael Cohnfabef1d2016-05-19 14:28:40 +01009pub type id_t = ::c_uint;
Alex Crichton5d6cf052015-09-11 14:52:34 -070010
11pub enum timezone {}
12
13s! {
Alex Crichton5d6cf052015-09-11 14:52:34 -070014 pub struct sockaddr {
15 pub sa_family: sa_family_t,
Alex Crichtonf3b97482015-09-16 14:13:20 -070016 pub sa_data: [::c_char; 14],
Alex Crichton5d6cf052015-09-11 14:52:34 -070017 }
18
Alex Crichton50a42e22015-09-15 14:27:15 -070019 pub struct sockaddr_in {
20 pub sin_family: sa_family_t,
21 pub sin_port: ::in_port_t,
22 pub sin_addr: ::in_addr,
23 pub sin_zero: [u8; 8],
24 }
25
26 pub struct sockaddr_in6 {
27 pub sin6_family: sa_family_t,
28 pub sin6_port: ::in_port_t,
29 pub sin6_flowinfo: u32,
30 pub sin6_addr: ::in6_addr,
31 pub sin6_scope_id: u32,
32 }
33
34 pub struct sockaddr_un {
35 pub sun_family: sa_family_t,
36 pub sun_path: [::c_char; 108]
37 }
38
Alex Crichton5d6cf052015-09-11 14:52:34 -070039 pub struct sockaddr_storage {
40 pub ss_family: sa_family_t,
Alex Crichtonf3b97482015-09-16 14:13:20 -070041 __ss_align: ::size_t,
Alex Crichton5d6cf052015-09-11 14:52:34 -070042 #[cfg(target_pointer_width = "32")]
43 __ss_pad2: [u8; 128 - 2 * 4],
44 #[cfg(target_pointer_width = "64")]
45 __ss_pad2: [u8; 128 - 2 * 8],
46 }
47
Alex Crichton5d6cf052015-09-11 14:52:34 -070048 pub struct addrinfo {
Alex Crichton239f9cd2015-09-18 16:31:34 -070049 pub ai_flags: ::c_int,
50 pub ai_family: ::c_int,
51 pub ai_socktype: ::c_int,
52 pub ai_protocol: ::c_int,
Alex Crichton5d6cf052015-09-11 14:52:34 -070053 pub ai_addrlen: socklen_t,
54
Brian Anderson7d1d5752015-11-26 23:27:45 +000055 #[cfg(any(target_os = "linux", target_os = "emscripten"))]
Alex Crichton50a42e22015-09-15 14:27:15 -070056 pub ai_addr: *mut ::sockaddr,
Alex Crichton5d6cf052015-09-11 14:52:34 -070057
58 pub ai_canonname: *mut c_char,
59
Alex Crichtoncd9b33e2015-09-17 14:47:40 -070060 #[cfg(target_os = "android")]
Alex Crichton50a42e22015-09-15 14:27:15 -070061 pub ai_addr: *mut ::sockaddr,
Alex Crichton5d6cf052015-09-11 14:52:34 -070062
63 pub ai_next: *mut addrinfo,
64 }
65
Paul Osborne9e94d5b2016-03-12 00:13:31 -060066 pub struct sockaddr_nl {
67 pub nl_family: ::sa_family_t,
68 nl_pad: ::c_ushort,
69 pub nl_pid: u32,
70 pub nl_groups: u32
71 }
72
Alex Crichton5d6cf052015-09-11 14:52:34 -070073 pub struct sockaddr_ll {
Alex Crichton239f9cd2015-09-18 16:31:34 -070074 pub sll_family: ::c_ushort,
75 pub sll_protocol: ::c_ushort,
76 pub sll_ifindex: ::c_int,
77 pub sll_hatype: ::c_ushort,
78 pub sll_pkttype: ::c_uchar,
79 pub sll_halen: ::c_uchar,
80 pub sll_addr: [::c_uchar; 8]
Alex Crichton5d6cf052015-09-11 14:52:34 -070081 }
Alex Crichton07d3a0d2015-10-30 10:21:32 -070082
83 pub struct fd_set {
84 fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
85 }
Alex Crichton568705e2015-11-03 14:18:52 -080086
87 pub struct tm {
88 pub tm_sec: ::c_int,
89 pub tm_min: ::c_int,
90 pub tm_hour: ::c_int,
91 pub tm_mday: ::c_int,
92 pub tm_mon: ::c_int,
93 pub tm_year: ::c_int,
94 pub tm_wday: ::c_int,
95 pub tm_yday: ::c_int,
96 pub tm_isdst: ::c_int,
97 pub tm_gmtoff: ::c_long,
98 pub tm_zone: *const ::c_char,
99 }
Alexander Polakove09951c2015-11-26 14:00:03 +0300100
101 pub struct sched_param {
102 pub sched_priority: ::c_int,
Timon Van Overveldtad728592015-12-26 06:13:31 -0800103 #[cfg(any(target_env = "musl",
104 target_env = "musleabi",
105 target_env = "musleabihf"))]
Alexander Polakove09951c2015-11-26 14:00:03 +0300106 pub sched_ss_low_priority: ::c_int,
Timon Van Overveldtad728592015-12-26 06:13:31 -0800107 #[cfg(any(target_env = "musl",
108 target_env = "musleabi",
109 target_env = "musleabihf"))]
Alexander Polakove09951c2015-11-26 14:00:03 +0300110 pub sched_ss_repl_period: ::timespec,
Timon Van Overveldtad728592015-12-26 06:13:31 -0800111 #[cfg(any(target_env = "musl",
112 target_env = "musleabi",
113 target_env = "musleabihf"))]
Alexander Polakove09951c2015-11-26 14:00:03 +0300114 pub sched_ss_init_budget: ::timespec,
Timon Van Overveldtad728592015-12-26 06:13:31 -0800115 #[cfg(any(target_env = "musl",
116 target_env = "musleabi",
117 target_env = "musleabihf"))]
Alexander Polakove09951c2015-11-26 14:00:03 +0300118 pub sched_ss_max_repl: ::c_int,
119 }
Alex Crichton49d7bca2015-11-27 09:40:37 -0800120
121 pub struct Dl_info {
122 pub dli_fname: *const ::c_char,
123 pub dli_fbase: *mut ::c_void,
124 pub dli_sname: *const ::c_char,
125 pub dli_saddr: *mut ::c_void,
126 }
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800127
Brian Anderson773aab82015-12-29 20:00:29 +0000128 #[cfg_attr(any(all(target_arch = "x86", not(target_env = "musl")),
129 target_arch = "x86_64"),
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800130 repr(packed))]
131 pub struct epoll_event {
132 pub events: ::uint32_t,
133 pub u64: ::uint64_t,
134 }
135
136 pub struct utsname {
137 pub sysname: [::c_char; 65],
138 pub nodename: [::c_char; 65],
139 pub release: [::c_char; 65],
140 pub version: [::c_char; 65],
141 pub machine: [::c_char; 65],
142 pub domainname: [::c_char; 65]
143 }
A.J. Gardner874852c2016-03-30 19:59:47 -0500144
145 pub struct lconv {
146 pub decimal_point: *mut ::c_char,
147 pub thousands_sep: *mut ::c_char,
148 pub grouping: *mut ::c_char,
149 pub int_curr_symbol: *mut ::c_char,
150 pub currency_symbol: *mut ::c_char,
151 pub mon_decimal_point: *mut ::c_char,
152 pub mon_thousands_sep: *mut ::c_char,
153 pub mon_grouping: *mut ::c_char,
154 pub positive_sign: *mut ::c_char,
155 pub negative_sign: *mut ::c_char,
156 pub int_frac_digits: ::c_char,
157 pub frac_digits: ::c_char,
158 pub p_cs_precedes: ::c_char,
159 pub p_sep_by_space: ::c_char,
160 pub n_cs_precedes: ::c_char,
161 pub n_sep_by_space: ::c_char,
162 pub p_sign_posn: ::c_char,
163 pub n_sign_posn: ::c_char,
164 pub int_p_cs_precedes: ::c_char,
165 pub int_p_sep_by_space: ::c_char,
166 pub int_n_cs_precedes: ::c_char,
167 pub int_n_sep_by_space: ::c_char,
168 pub int_p_sign_posn: ::c_char,
169 pub int_n_sign_posn: ::c_char,
170 }
Alex Crichton5d6cf052015-09-11 14:52:34 -0700171}
172
Alex Crichton07d3a0d2015-10-30 10:21:32 -0700173// intentionally not public, only used for fd_set
Alex Crichton8a8bc662016-02-29 23:02:36 -0800174cfg_if! {
175 if #[cfg(target_pointer_width = "32")] {
176 const ULONG_SIZE: usize = 32;
177 } else if #[cfg(target_pointer_width = "64")] {
178 const ULONG_SIZE: usize = 64;
179 } else {
Kamal Marhubi66c33752016-03-10 15:07:32 -0500180 // Unknown target_pointer_width
Alex Crichton8a8bc662016-02-29 23:02:36 -0800181 }
182}
Alex Crichton07d3a0d2015-10-30 10:21:32 -0700183
Alex Crichton239f9cd2015-09-18 16:31:34 -0700184pub const EXIT_FAILURE: ::c_int = 1;
185pub const EXIT_SUCCESS: ::c_int = 0;
186pub const RAND_MAX: ::c_int = 2147483647;
187pub const EOF: ::c_int = -1;
188pub const SEEK_SET: ::c_int = 0;
189pub const SEEK_CUR: ::c_int = 1;
190pub const SEEK_END: ::c_int = 2;
191pub const _IOFBF: ::c_int = 0;
192pub const _IONBF: ::c_int = 2;
193pub const _IOLBF: ::c_int = 1;
Alex Crichton5d6cf052015-09-11 14:52:34 -0700194
Alex Crichton239f9cd2015-09-18 16:31:34 -0700195pub const F_DUPFD: ::c_int = 0;
196pub const F_GETFD: ::c_int = 1;
197pub const F_SETFD: ::c_int = 2;
198pub const F_GETFL: ::c_int = 3;
199pub const F_SETFL: ::c_int = 4;
Alex Crichton5d6cf052015-09-11 14:52:34 -0700200
Kamal Marhubib43118c2016-03-17 14:29:00 -0400201// Linux-specific fcntls
202pub const F_SETLEASE: ::c_int = 1024;
203pub const F_GETLEASE: ::c_int = 1025;
204pub const F_NOTIFY: ::c_int = 1026;
205pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
206pub const F_SETPIPE_SZ: ::c_int = 1031;
207pub const F_GETPIPE_SZ: ::c_int = 1032;
208
209// TODO(#235): Include file sealing fcntls once we have a way to verify them.
210
Alex Crichton239f9cd2015-09-18 16:31:34 -0700211pub const SIGTRAP: ::c_int = 5;
Alex Crichton5d6cf052015-09-11 14:52:34 -0700212
Alex Crichton239f9cd2015-09-18 16:31:34 -0700213pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
214pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
Alex Crichton5d6cf052015-09-11 14:52:34 -0700215
NODA, Kai7e752a32016-03-31 18:59:05 +0800216pub const CLOCK_REALTIME: clockid_t = 0;
217pub const CLOCK_MONOTONIC: clockid_t = 1;
218pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
219pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
220pub const CLOCK_MONOTONIC_RAW: clockid_t = 4;
221pub const CLOCK_REALTIME_COARSE: clockid_t = 5;
222pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6;
223pub const CLOCK_BOOTTIME: clockid_t = 7;
224pub const CLOCK_REALTIME_ALARM: clockid_t = 8;
225pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9;
226// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
227// 2014.) See also musl/mod.rs
228// pub const CLOCK_SGI_CYCLE: clockid_t = 10;
229// pub const CLOCK_TAI: clockid_t = 11;
Alex Crichton5d6cf052015-09-11 14:52:34 -0700230
Alex Crichton239f9cd2015-09-18 16:31:34 -0700231pub const RLIMIT_CPU: ::c_int = 0;
232pub const RLIMIT_FSIZE: ::c_int = 1;
233pub const RLIMIT_DATA: ::c_int = 2;
234pub const RLIMIT_STACK: ::c_int = 3;
235pub const RLIMIT_CORE: ::c_int = 4;
236pub const RLIMIT_LOCKS: ::c_int = 10;
237pub const RLIMIT_SIGPENDING: ::c_int = 11;
238pub const RLIMIT_MSGQUEUE: ::c_int = 12;
239pub const RLIMIT_NICE: ::c_int = 13;
240pub const RLIMIT_RTPRIO: ::c_int = 14;
Alex Crichton5d6cf052015-09-11 14:52:34 -0700241
Alex Crichton239f9cd2015-09-18 16:31:34 -0700242pub const RUSAGE_SELF: ::c_int = 0;
Alex Crichtond3d77922015-09-11 17:03:39 -0700243
244pub const O_RDONLY: ::c_int = 0;
245pub const O_WRONLY: ::c_int = 1;
246pub const O_RDWR: ::c_int = 2;
Alex Crichtond3d77922015-09-11 17:03:39 -0700247pub const O_TRUNC: ::c_int = 512;
Alex Crichton14f7e022015-11-02 14:21:30 -0800248pub const O_CLOEXEC: ::c_int = 0x80000;
James Perryb979fe02016-01-23 21:28:42 +0000249
Brian Campbellcb12fdf2016-01-31 21:27:59 -0500250pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
James Perryb979fe02016-01-23 21:28:42 +0000251
Alex Crichtond3d77922015-09-11 17:03:39 -0700252pub const S_IFIFO: ::mode_t = 4096;
253pub const S_IFCHR: ::mode_t = 8192;
254pub const S_IFBLK: ::mode_t = 24576;
255pub const S_IFDIR: ::mode_t = 16384;
256pub const S_IFREG: ::mode_t = 32768;
257pub const S_IFLNK: ::mode_t = 40960;
258pub const S_IFSOCK: ::mode_t = 49152;
259pub const S_IFMT: ::mode_t = 61440;
260pub const S_IRWXU: ::mode_t = 448;
261pub const S_IXUSR: ::mode_t = 64;
262pub const S_IWUSR: ::mode_t = 128;
263pub const S_IRUSR: ::mode_t = 256;
264pub const S_IRWXG: ::mode_t = 56;
265pub const S_IXGRP: ::mode_t = 8;
266pub const S_IWGRP: ::mode_t = 16;
267pub const S_IRGRP: ::mode_t = 32;
268pub const S_IRWXO: ::mode_t = 7;
269pub const S_IXOTH: ::mode_t = 1;
270pub const S_IWOTH: ::mode_t = 2;
271pub const S_IROTH: ::mode_t = 4;
272pub const F_OK: ::c_int = 0;
273pub const R_OK: ::c_int = 4;
274pub const W_OK: ::c_int = 2;
275pub const X_OK: ::c_int = 1;
276pub const STDIN_FILENO: ::c_int = 0;
277pub const STDOUT_FILENO: ::c_int = 1;
278pub const STDERR_FILENO: ::c_int = 2;
279pub const SIGHUP: ::c_int = 1;
280pub const SIGINT: ::c_int = 2;
281pub const SIGQUIT: ::c_int = 3;
282pub const SIGILL: ::c_int = 4;
283pub const SIGABRT: ::c_int = 6;
284pub const SIGFPE: ::c_int = 8;
285pub const SIGKILL: ::c_int = 9;
286pub const SIGSEGV: ::c_int = 11;
287pub const SIGPIPE: ::c_int = 13;
288pub const SIGALRM: ::c_int = 14;
289pub const SIGTERM: ::c_int = 15;
290
291pub const PROT_NONE: ::c_int = 0;
292pub const PROT_READ: ::c_int = 1;
293pub const PROT_WRITE: ::c_int = 2;
294pub const PROT_EXEC: ::c_int = 4;
295
A.J. Gardner110152c2016-03-30 00:36:43 -0500296pub const LC_CTYPE: ::c_int = 0;
297pub const LC_NUMERIC: ::c_int = 1;
298pub const LC_TIME: ::c_int = 2;
299pub const LC_COLLATE: ::c_int = 3;
300pub const LC_MONETARY: ::c_int = 4;
301pub const LC_MESSAGES: ::c_int = 5;
302pub const LC_ALL: ::c_int = 6;
A.J. Gardner24c84f12016-03-31 20:08:03 -0500303pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
304pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
305pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
306pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
307pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
308pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
309// LC_ALL_MASK defined per platform
A.J. Gardner110152c2016-03-30 00:36:43 -0500310
Alex Crichtond3d77922015-09-11 17:03:39 -0700311pub const MAP_FILE: ::c_int = 0x0000;
312pub const MAP_SHARED: ::c_int = 0x0001;
313pub const MAP_PRIVATE: ::c_int = 0x0002;
314pub const MAP_FIXED: ::c_int = 0x0010;
Alex Crichtond3d77922015-09-11 17:03:39 -0700315
316pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
317
318pub const MCL_CURRENT: ::c_int = 0x0001;
319pub const MCL_FUTURE: ::c_int = 0x0002;
320
Kamal Marhubi4ff4ace2016-03-14 17:00:38 -0400321// MS_ flags for msync(2)
Alex Crichtond3d77922015-09-11 17:03:39 -0700322pub const MS_ASYNC: ::c_int = 0x0001;
323pub const MS_INVALIDATE: ::c_int = 0x0002;
324pub const MS_SYNC: ::c_int = 0x0004;
Kamal Marhubi4ff4ace2016-03-14 17:00:38 -0400325
326// MS_ flags for mount(2)
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800327pub const MS_RDONLY: ::c_ulong = 0x01;
328pub const MS_NOSUID: ::c_ulong = 0x02;
329pub const MS_NODEV: ::c_ulong = 0x04;
330pub const MS_NOEXEC: ::c_ulong = 0x08;
331pub const MS_SYNCHRONOUS: ::c_ulong = 0x10;
332pub const MS_REMOUNT: ::c_ulong = 0x20;
333pub const MS_MANDLOCK: ::c_ulong = 0x40;
334pub const MS_DIRSYNC: ::c_ulong = 0x80;
335pub const MS_NOATIME: ::c_ulong = 0x0400;
336pub const MS_NODIRATIME: ::c_ulong = 0x0800;
337pub const MS_BIND: ::c_ulong = 0x1000;
338pub const MS_MOVE: ::c_ulong = 0x2000;
339pub const MS_REC: ::c_ulong = 0x4000;
340pub const MS_SILENT: ::c_ulong = 0x8000;
341pub const MS_POSIXACL: ::c_ulong = 0x010000;
342pub const MS_UNBINDABLE: ::c_ulong = 0x020000;
343pub const MS_PRIVATE: ::c_ulong = 0x040000;
344pub const MS_SLAVE: ::c_ulong = 0x080000;
345pub const MS_SHARED: ::c_ulong = 0x100000;
Kamal Marhubi10bfe072016-03-14 17:29:54 -0400346pub const MS_RELATIME: ::c_ulong = 0x200000;
347pub const MS_KERNMOUNT: ::c_ulong = 0x400000;
348pub const MS_I_VERSION: ::c_ulong = 0x800000;
349pub const MS_STRICTATIME: ::c_ulong = 0x1000000;
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800350pub const MS_ACTIVE: ::c_ulong = 0x40000000;
351pub const MS_NOUSER: ::c_ulong = 0x80000000;
352pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
353pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
Jim Blandye91606d2016-01-11 20:47:08 -0800354pub const MS_RMT_MASK: ::c_ulong = 0x800051;
Alex Crichtond3d77922015-09-11 17:03:39 -0700355
356pub const EPERM: ::c_int = 1;
357pub const ENOENT: ::c_int = 2;
358pub const ESRCH: ::c_int = 3;
359pub const EINTR: ::c_int = 4;
360pub const EIO: ::c_int = 5;
361pub const ENXIO: ::c_int = 6;
362pub const E2BIG: ::c_int = 7;
363pub const ENOEXEC: ::c_int = 8;
364pub const EBADF: ::c_int = 9;
365pub const ECHILD: ::c_int = 10;
366pub const EAGAIN: ::c_int = 11;
367pub const ENOMEM: ::c_int = 12;
368pub const EACCES: ::c_int = 13;
369pub const EFAULT: ::c_int = 14;
370pub const ENOTBLK: ::c_int = 15;
371pub const EBUSY: ::c_int = 16;
372pub const EEXIST: ::c_int = 17;
373pub const EXDEV: ::c_int = 18;
374pub const ENODEV: ::c_int = 19;
375pub const ENOTDIR: ::c_int = 20;
376pub const EISDIR: ::c_int = 21;
377pub const EINVAL: ::c_int = 22;
378pub const ENFILE: ::c_int = 23;
379pub const EMFILE: ::c_int = 24;
380pub const ENOTTY: ::c_int = 25;
381pub const ETXTBSY: ::c_int = 26;
382pub const EFBIG: ::c_int = 27;
383pub const ENOSPC: ::c_int = 28;
384pub const ESPIPE: ::c_int = 29;
385pub const EROFS: ::c_int = 30;
386pub const EMLINK: ::c_int = 31;
387pub const EPIPE: ::c_int = 32;
388pub const EDOM: ::c_int = 33;
389pub const ERANGE: ::c_int = 34;
Alex Crichtond3d77922015-09-11 17:03:39 -0700390pub const EWOULDBLOCK: ::c_int = EAGAIN;
Alex Crichtond3d77922015-09-11 17:03:39 -0700391
392pub const EBFONT: ::c_int = 59;
393pub const ENOSTR: ::c_int = 60;
394pub const ENODATA: ::c_int = 61;
395pub const ETIME: ::c_int = 62;
396pub const ENOSR: ::c_int = 63;
397pub const ENONET: ::c_int = 64;
398pub const ENOPKG: ::c_int = 65;
399pub const EREMOTE: ::c_int = 66;
400pub const ENOLINK: ::c_int = 67;
401pub const EADV: ::c_int = 68;
402pub const ESRMNT: ::c_int = 69;
403pub const ECOMM: ::c_int = 70;
404pub const EPROTO: ::c_int = 71;
Alex Crichtond3d77922015-09-11 17:03:39 -0700405pub const EDOTDOT: ::c_int = 73;
Alex Crichtond3d77922015-09-11 17:03:39 -0700406
407pub const AF_PACKET: ::c_int = 17;
408pub const IPPROTO_RAW: ::c_int = 255;
409
Alex Crichtond3d77922015-09-11 17:03:39 -0700410pub const PROT_GROWSDOWN: ::c_int = 0x1000000;
411pub const PROT_GROWSUP: ::c_int = 0x2000000;
412
413pub const MAP_TYPE: ::c_int = 0x000f;
Alex Crichtond3d77922015-09-11 17:03:39 -0700414
415pub const MADV_NORMAL: ::c_int = 0;
416pub const MADV_RANDOM: ::c_int = 1;
417pub const MADV_SEQUENTIAL: ::c_int = 2;
418pub const MADV_WILLNEED: ::c_int = 3;
419pub const MADV_DONTNEED: ::c_int = 4;
420pub const MADV_REMOVE: ::c_int = 9;
421pub const MADV_DONTFORK: ::c_int = 10;
422pub const MADV_DOFORK: ::c_int = 11;
423pub const MADV_MERGEABLE: ::c_int = 12;
424pub const MADV_UNMERGEABLE: ::c_int = 13;
425pub const MADV_HWPOISON: ::c_int = 100;
426
427pub const IFF_LOOPBACK: ::c_int = 0x8;
428
429pub const AF_UNIX: ::c_int = 1;
430pub const AF_INET: ::c_int = 2;
431pub const AF_INET6: ::c_int = 10;
Alex Crichtond3d77922015-09-11 17:03:39 -0700432pub const SOCK_RAW: ::c_int = 3;
433pub const IPPROTO_TCP: ::c_int = 6;
434pub const IPPROTO_IP: ::c_int = 0;
435pub const IPPROTO_IPV6: ::c_int = 41;
436pub const IP_MULTICAST_TTL: ::c_int = 33;
437pub const IP_MULTICAST_LOOP: ::c_int = 34;
438pub const IP_TTL: ::c_int = 2;
439pub const IP_HDRINCL: ::c_int = 3;
440pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
441pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
Jakab Kristófd614a3f2016-01-19 18:07:14 +0100442pub const IP_TRANSPARENT: ::c_int = 19;
Alex Crichtond3d77922015-09-11 17:03:39 -0700443pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
444pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
445
446pub const TCP_NODELAY: ::c_int = 1;
447pub const TCP_MAXSEG: ::c_int = 2;
448pub const TCP_CORK: ::c_int = 3;
449pub const TCP_KEEPIDLE: ::c_int = 4;
450pub const TCP_KEEPINTVL: ::c_int = 5;
451pub const TCP_KEEPCNT: ::c_int = 6;
452pub const TCP_SYNCNT: ::c_int = 7;
453pub const TCP_LINGER2: ::c_int = 8;
454pub const TCP_DEFER_ACCEPT: ::c_int = 9;
455pub const TCP_WINDOW_CLAMP: ::c_int = 10;
456pub const TCP_INFO: ::c_int = 11;
457pub const TCP_QUICKACK: ::c_int = 12;
458pub const TCP_CONGESTION: ::c_int = 13;
459
Alex Crichtonbabf3902015-09-18 17:16:51 -0700460pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
461pub const IPV6_V6ONLY: ::c_int = 26;
462
Alex Crichtond3d77922015-09-11 17:03:39 -0700463pub const SO_DEBUG: ::c_int = 1;
Alex Crichtond3d77922015-09-11 17:03:39 -0700464
465pub const SHUT_RD: ::c_int = 0;
466pub const SHUT_WR: ::c_int = 1;
467pub const SHUT_RDWR: ::c_int = 2;
468
469pub const LOCK_SH: ::c_int = 1;
470pub const LOCK_EX: ::c_int = 2;
471pub const LOCK_NB: ::c_int = 4;
472pub const LOCK_UN: ::c_int = 8;
473
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700474pub const SIGSTKSZ: ::size_t = 8192;
475
Alex Crichton07d3a0d2015-10-30 10:21:32 -0700476pub const SA_NODEFER: ::c_int = 0x40000000;
477pub const SA_RESETHAND: ::c_int = 0x80000000;
478pub const SA_RESTART: ::c_int = 0x10000000;
479pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
480
Tomasz MiÄ…sko26e1ec12016-02-15 11:44:55 +0100481pub const SS_ONSTACK: ::c_int = 1;
482pub const SS_DISABLE: ::c_int = 2;
483
David Hotham8b296bd2015-12-12 11:52:54 +0000484pub const PATH_MAX: ::c_int = 4096;
485
Alex Crichton07d3a0d2015-10-30 10:21:32 -0700486pub const FD_SETSIZE: usize = 1024;
487
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800488pub const EPOLLIN: ::c_int = 0x1;
489pub const EPOLLPRI: ::c_int = 0x2;
490pub const EPOLLOUT: ::c_int = 0x4;
491pub const EPOLLRDNORM: ::c_int = 0x40;
492pub const EPOLLRDBAND: ::c_int = 0x80;
493pub const EPOLLWRNORM: ::c_int = 0x100;
494pub const EPOLLWRBAND: ::c_int = 0x200;
495pub const EPOLLMSG: ::c_int = 0x400;
496pub const EPOLLERR: ::c_int = 0x8;
497pub const EPOLLHUP: ::c_int = 0x10;
498pub const EPOLLET: ::c_int = 0x80000000;
499
500pub const EPOLL_CTL_ADD: ::c_int = 1;
501pub const EPOLL_CTL_MOD: ::c_int = 3;
502pub const EPOLL_CTL_DEL: ::c_int = 2;
503
504pub const MNT_DETACH: ::c_int = 0x2;
505pub const MNT_EXPIRE: ::c_int = 0x4;
506
507pub const Q_GETFMT: ::c_int = 0x800004;
508pub const Q_GETINFO: ::c_int = 0x800005;
509pub const Q_SETINFO: ::c_int = 0x800006;
510pub const QIF_BLIMITS: ::uint32_t = 1;
511pub const QIF_SPACE: ::uint32_t = 2;
512pub const QIF_ILIMITS: ::uint32_t = 4;
513pub const QIF_INODES: ::uint32_t = 8;
514pub const QIF_BTIME: ::uint32_t = 16;
515pub const QIF_ITIME: ::uint32_t = 32;
516pub const QIF_LIMITS: ::uint32_t = 5;
517pub const QIF_USAGE: ::uint32_t = 10;
518pub const QIF_TIMES: ::uint32_t = 48;
519pub const QIF_ALL: ::uint32_t = 63;
520
521pub const CBAUD: ::tcflag_t = 0o0010017;
522
523pub const EFD_CLOEXEC: ::c_int = 0x80000;
524
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800525pub const MNT_FORCE: ::c_int = 0x1;
526
527pub const Q_SYNC: ::c_int = 0x800001;
528pub const Q_QUOTAON: ::c_int = 0x800002;
529pub const Q_QUOTAOFF: ::c_int = 0x800003;
530pub const Q_GETQUOTA: ::c_int = 0x800007;
531pub const Q_SETQUOTA: ::c_int = 0x800008;
532
533pub const TCIOFF: ::c_int = 2;
534pub const TCION: ::c_int = 3;
535pub const TCOOFF: ::c_int = 0;
536pub const TCOON: ::c_int = 1;
537pub const TCIFLUSH: ::c_int = 0;
538pub const TCOFLUSH: ::c_int = 1;
539pub const TCIOFLUSH: ::c_int = 2;
540pub const NL0: ::c_int = 0x00000000;
541pub const NL1: ::c_int = 0x00000100;
542pub const TAB0: ::c_int = 0x00000000;
543pub const TAB1: ::c_int = 0x00000800;
544pub const TAB2: ::c_int = 0x00001000;
545pub const TAB3: ::c_int = 0x00001800;
546pub const CR0: ::c_int = 0x00000000;
547pub const CR1: ::c_int = 0x00000200;
548pub const CR2: ::c_int = 0x00000400;
549pub const CR3: ::c_int = 0x00000600;
550pub const FF0: ::c_int = 0x00000000;
551pub const FF1: ::c_int = 0x00008000;
552pub const BS0: ::c_int = 0x00000000;
553pub const BS1: ::c_int = 0x00002000;
554pub const VT0: ::c_int = 0x00000000;
555pub const VT1: ::c_int = 0x00004000;
556pub const VERASE: usize = 2;
557pub const VWERASE: usize = 14;
558pub const VKILL: usize = 3;
559pub const VREPRINT: usize = 12;
560pub const VINTR: usize = 0;
561pub const VQUIT: usize = 1;
562pub const VSUSP: usize = 10;
563pub const VSTART: usize = 8;
564pub const VSTOP: usize = 9;
565pub const VLNEXT: usize = 15;
566pub const VDISCARD: usize = 13;
567pub const VTIME: usize = 5;
568pub const IGNBRK: ::tcflag_t = 0x00000001;
569pub const BRKINT: ::tcflag_t = 0x00000002;
570pub const IGNPAR: ::tcflag_t = 0x00000004;
571pub const PARMRK: ::tcflag_t = 0x00000008;
572pub const INPCK: ::tcflag_t = 0x00000010;
573pub const ISTRIP: ::tcflag_t = 0x00000020;
574pub const INLCR: ::tcflag_t = 0x00000040;
575pub const IGNCR: ::tcflag_t = 0x00000080;
576pub const ICRNL: ::tcflag_t = 0x00000100;
577pub const IXON: ::tcflag_t = 0x00000400;
578pub const IXOFF: ::tcflag_t = 0x00001000;
579pub const IXANY: ::tcflag_t = 0x00000800;
580pub const IMAXBEL: ::tcflag_t = 0x00002000;
581pub const OPOST: ::tcflag_t = 0x1;
582pub const ONLCR: ::tcflag_t = 0x4;
583pub const CSIZE: ::tcflag_t = 0x00000030;
584pub const CS5: ::tcflag_t = 0x00000000;
585pub const CS6: ::tcflag_t = 0x00000010;
586pub const CS7: ::tcflag_t = 0x00000020;
587pub const CS8: ::tcflag_t = 0x00000030;
588pub const CSTOPB: ::tcflag_t = 0x00000040;
589pub const CREAD: ::tcflag_t = 0x00000080;
590pub const PARENB: ::tcflag_t = 0x00000100;
591pub const PARODD: ::tcflag_t = 0x00000200;
592pub const HUPCL: ::tcflag_t = 0x00000400;
593pub const CLOCAL: ::tcflag_t = 0x00000800;
594pub const CRTSCTS: ::tcflag_t = 0x80000000;
595pub const ECHOKE: ::tcflag_t = 0x00000800;
596pub const ECHOE: ::tcflag_t = 0x00000010;
597pub const ECHOK: ::tcflag_t = 0x00000020;
598pub const ECHO: ::tcflag_t = 0x00000008;
599pub const ECHONL: ::tcflag_t = 0x00000040;
600pub const ECHOPRT: ::tcflag_t = 0x00000400;
601pub const ECHOCTL: ::tcflag_t = 0x00000200;
602pub const ISIG: ::tcflag_t = 0x00000001;
603pub const ICANON: ::tcflag_t = 0x00000002;
604pub const PENDIN: ::tcflag_t = 0x00004000;
605pub const NOFLSH: ::tcflag_t = 0x00000080;
606
607pub const CLONE_VM: ::c_int = 0x100;
608pub const CLONE_FS: ::c_int = 0x200;
609pub const CLONE_FILES: ::c_int = 0x400;
610pub const CLONE_SIGHAND: ::c_int = 0x800;
611pub const CLONE_PTRACE: ::c_int = 0x2000;
612pub const CLONE_VFORK: ::c_int = 0x4000;
613pub const CLONE_PARENT: ::c_int = 0x8000;
614pub const CLONE_THREAD: ::c_int = 0x10000;
615pub const CLONE_NEWNS: ::c_int = 0x20000;
616pub const CLONE_SYSVSEM: ::c_int = 0x40000;
617pub const CLONE_SETTLS: ::c_int = 0x80000;
618pub const CLONE_PARENT_SETTID: ::c_int = 0x100000;
619pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
620pub const CLONE_DETACHED: ::c_int = 0x400000;
621pub const CLONE_UNTRACED: ::c_int = 0x800000;
622pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
Kamal Marhubiae69a162016-03-13 16:05:36 -0400623pub const CLONE_NEWUTS: ::c_int = 0x04000000;
624pub const CLONE_NEWIPC: ::c_int = 0x08000000;
625pub const CLONE_NEWUSER: ::c_int = 0x10000000;
626pub const CLONE_NEWPID: ::c_int = 0x20000000;
627pub const CLONE_NEWNET: ::c_int = 0x40000000;
628pub const CLONE_IO: ::c_int = 0x80000000;
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800629
Nikita Baksalyar25726a62016-01-17 21:41:34 +0300630pub const WNOHANG: ::c_int = 1;
631
Kamal Marhubi0cfc25f2016-02-04 15:57:10 -0500632pub const SPLICE_F_MOVE: ::c_uint = 0x01;
633pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
634pub const SPLICE_F_MORE: ::c_uint = 0x04;
635pub const SPLICE_F_GIFT: ::c_uint = 0x08;
636
Alex Crichton29de5982016-02-04 13:48:13 -0800637pub const RTLD_LOCAL: ::c_int = 0;
638
Austin Bonander10543d02016-02-06 18:58:18 -0800639pub const POSIX_FADV_NORMAL: ::c_int = 0;
640pub const POSIX_FADV_RANDOM: ::c_int = 1;
641pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
642pub const POSIX_FADV_WILLNEED: ::c_int = 3;
643pub const POSIX_FADV_DONTNEED: ::c_int = 4;
644pub const POSIX_FADV_NOREUSE: ::c_int = 5;
645
fpgaminerf5885ee2016-03-06 19:49:06 -0800646pub const AT_FDCWD: ::c_int = -100;
647pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
648
Raphael Cohn7fc09692016-05-05 15:41:21 +0100649pub const LOG_CRON: ::c_int = 9 << 3;
650pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
651pub const LOG_FTP: ::c_int = 11 << 3;
Raphael Cohn7fc09692016-05-05 15:41:21 +0100652pub const LOG_PERROR: ::c_int = 0x20;
653
Kamal Marhubice0dc732016-05-05 16:46:50 -0400654pub const PIPE_BUF: usize = 4096;
655
Raphael Cohne6150ae2016-05-13 11:18:34 +0100656pub const SI_LOAD_SHIFT: ::c_uint = 16;
657
Alex Crichton07d3a0d2015-10-30 10:21:32 -0700658f! {
659 pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
660 let fd = fd as usize;
Alex Crichtonef66d122015-11-09 23:53:57 -0800661 let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
Alex Crichton07d3a0d2015-10-30 10:21:32 -0700662 (*set).fds_bits[fd / size] &= !(1 << (fd % size));
663 return
664 }
665
666 pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
667 let fd = fd as usize;
Alex Crichtonef66d122015-11-09 23:53:57 -0800668 let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
Alex Crichton07d3a0d2015-10-30 10:21:32 -0700669 return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
670 }
671
672 pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
673 let fd = fd as usize;
Alex Crichtonef66d122015-11-09 23:53:57 -0800674 let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
Alex Crichton07d3a0d2015-10-30 10:21:32 -0700675 (*set).fds_bits[fd / size] |= 1 << (fd % size);
676 return
677 }
678
679 pub fn FD_ZERO(set: *mut fd_set) -> () {
680 for slot in (*set).fds_bits.iter_mut() {
681 *slot = 0;
682 }
683 }
684
685 pub fn WIFEXITED(status: ::c_int) -> bool {
686 (status & 0xff) == 0
687 }
688
689 pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
690 (status >> 8) & 0xff
691 }
692
693 pub fn WTERMSIG(status: ::c_int) -> ::c_int {
694 status & 0x7f
695 }
696}
697
Alex Crichtond3d77922015-09-11 17:03:39 -0700698extern {
Nikita Baksalyarbff38922016-01-17 22:17:20 +0300699 pub fn getpwuid_r(uid: ::uid_t,
700 pwd: *mut passwd,
701 buf: *mut ::c_char,
702 buflen: ::size_t,
703 result: *mut *mut passwd) -> ::c_int;
Alex Crichtond3d77922015-09-11 17:03:39 -0700704 pub fn fdatasync(fd: ::c_int) -> ::c_int;
Alex Crichton8293ced2015-09-15 17:05:19 -0700705 pub fn mincore(addr: *mut ::c_void, len: ::size_t,
706 vec: *mut ::c_uchar) -> ::c_int;
NODA, Kai7e752a32016-03-31 18:59:05 +0800707 pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
708 pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
Alex Crichtoncd9b33e2015-09-17 14:47:40 -0700709 pub fn prctl(option: ::c_int, ...) -> ::c_int;
710 pub fn pthread_getattr_np(native: ::pthread_t,
711 attr: *mut ::pthread_attr_t) -> ::c_int;
712 pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
713 guardsize: *mut ::size_t) -> ::c_int;
714 pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
715 stackaddr: *mut *mut ::c_void,
716 stacksize: *mut ::size_t) -> ::c_int;
Alex Crichtonde9736d2015-09-17 15:47:44 -0700717 pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
718 pub fn setgroups(ngroups: ::size_t,
719 ptr: *const ::gid_t) -> ::c_int;
Alex Crichton8a8bc662016-02-29 23:02:36 -0800720 pub fn sched_setscheduler(pid: ::pid_t,
721 policy: ::c_int,
722 param: *const sched_param) -> ::c_int;
Alexander Polakove09951c2015-11-26 14:00:03 +0300723 pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
Alexander Polakov557c6702015-11-30 16:55:51 +0300724 pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
725 pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
Alex Crichton8dce9ad2015-12-03 11:44:14 -0800726 pub fn epoll_create(size: ::c_int) -> ::c_int;
727 pub fn epoll_ctl(epfd: ::c_int,
728 op: ::c_int,
729 fd: ::c_int,
730 event: *mut epoll_event) -> ::c_int;
731 pub fn epoll_wait(epfd: ::c_int,
732 events: *mut epoll_event,
733 maxevents: ::c_int,
734 timeout: ::c_int) -> ::c_int;
735 pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
736 pub fn mount(src: *const ::c_char,
737 target: *const ::c_char,
738 fstype: *const ::c_char,
739 flags: ::c_ulong,
740 data: *const ::c_void) -> ::c_int;
741 pub fn umount(target: *const ::c_char) -> ::c_int;
742 pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
743 pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
744 child_stack: *mut ::c_void,
745 flags: ::c_int,
746 arg: *mut ::c_void, ...) -> ::c_int;
747 pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
748 pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
Alex Crichton8a8bc662016-02-29 23:02:36 -0800749 pub fn memrchr(cx: *const ::c_void,
750 c: ::c_int,
751 n: ::size_t) -> *mut ::c_void;
Alex Crichton881ef9b2015-12-01 09:04:13 -0800752 pub fn syscall(num: ::c_long, ...) -> ::c_long;
Kamal Marhubi143358b2016-02-04 14:08:50 -0500753 pub fn sendfile(out_fd: ::c_int,
754 in_fd: ::c_int,
755 offset: *mut off_t,
756 count: ::size_t) -> ::ssize_t;
Kamal Marhubi0cfc25f2016-02-04 15:57:10 -0500757 pub fn splice(fd_in: ::c_int,
758 off_in: *mut ::loff_t,
759 fd_out: ::c_int,
760 off_out: *mut ::loff_t,
761 len: ::size_t,
762 flags: ::c_uint) -> ::ssize_t;
763 pub fn tee(fd_in: ::c_int,
764 fd_out: ::c_int,
765 len: ::size_t,
766 flags: ::c_uint) -> ::ssize_t;
767 pub fn vmsplice(fd: ::c_int,
768 iov: *const ::iovec,
769 nr_segs: ::size_t,
770 flags: ::c_uint) -> ::ssize_t;
Austin Bonander10543d02016-02-06 18:58:18 -0800771
Paul Dicker9853b462016-02-29 21:10:29 +0100772 pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
Austin Bonander10543d02016-02-06 18:58:18 -0800773 advise: ::c_int) -> ::c_int;
Paul Dicker9853b462016-02-29 21:10:29 +0100774 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
fpgaminerf5885ee2016-03-06 19:49:06 -0800775 pub fn utimensat(dirfd: ::c_int, path: *const ::c_char,
776 times: *const ::timespec, flag: ::c_int) -> ::c_int;
A.J. Gardner24c84f12016-03-31 20:08:03 -0500777 pub fn duplocale(base: ::locale_t) -> ::locale_t;
778 pub fn freelocale(loc: ::locale_t);
779 pub fn newlocale(mask: ::c_int,
780 locale: *const ::c_char,
781 base: ::locale_t) -> ::locale_t;
782 pub fn uselocale(loc: ::locale_t) -> ::locale_t;
Kamal Marhubib9750b62016-04-27 14:04:31 -0400783 pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
784 pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
785 pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
786 pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
787 pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
788 pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
789 pub fn mmap64(addr: *mut ::c_void,
790 len: ::size_t,
791 prot: ::c_int,
792 flags: ::c_int,
793 fd: ::c_int,
794 offset: off64_t)
795 -> *mut ::c_void;
796 pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
797 pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
798 offset: off64_t) -> ::ssize_t;
799 pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
800 offset: off64_t) -> ::ssize_t;
801 pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64,
802 result: *mut *mut ::dirent64) -> ::c_int;
803 pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
804 pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
805 pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
Raphael Cohne6150ae2016-05-13 11:18:34 +0100806 pub fn sysinfo (info: *mut ::sysinfo) -> ::c_int;
Axel Viala26ee7822016-06-10 02:33:32 +0200807
808 pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
809 flags: ::c_int, ...) -> ::c_int;
810 pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
811 mode: ::c_int, flags: ::c_int) -> ::c_int;
812 pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
813 mode: ::mode_t, flags: ::c_int) -> ::c_int;
814 pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
815 owner: ::uid_t, group: ::gid_t,
816 flags: ::c_int) -> ::c_int;
817 pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
818 buf: *mut stat, flags: ::c_int) -> ::c_int;
819 pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
820 newdirfd: ::c_int, newpath: *const ::c_char,
821 flags: ::c_int) -> ::c_int;
822 pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
823 mode: ::mode_t) -> ::c_int;
824 pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
825 mode: ::mode_t, dev: dev_t) -> ::c_int;
826 pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
827 buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
828 pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
829 newdirfd: ::c_int, newpath: *const ::c_char)
830 -> ::c_int;
831 pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
832 linkpath: *const ::c_char) -> ::c_int;
833 pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
834 flags: ::c_int) -> ::c_int;
Alex Crichton5d6cf052015-09-11 14:52:34 -0700835}
836
837cfg_if! {
Brian Anderson7d1d5752015-11-26 23:27:45 +0000838 if #[cfg(any(target_os = "linux",
839 target_os = "emscripten"))] {
Alex Crichton5d6cf052015-09-11 14:52:34 -0700840 mod linux;
841 pub use self::linux::*;
842 } else if #[cfg(target_os = "android")] {
843 mod android;
844 pub use self::android::*;
845 } else {
Kamal Marhubi66c33752016-03-10 15:07:32 -0500846 // Unknown target_os
Alex Crichton5d6cf052015-09-11 14:52:34 -0700847 }
848}