]>
Commit | Line | Data |
---|---|---|
476ff2be SL |
1 | pub type sa_family_t = u16; |
2 | pub type pthread_key_t = ::c_uint; | |
3 | pub type speed_t = ::c_uint; | |
4 | pub type tcflag_t = ::c_uint; | |
476ff2be SL |
5 | pub type clockid_t = ::c_int; |
6 | pub type key_t = ::c_int; | |
7 | pub type id_t = ::c_uint; | |
8 | ||
532ac7d7 | 9 | #[cfg_attr(feature = "extra_traits", derive(Debug))] |
476ff2be | 10 | pub enum timezone {} |
532ac7d7 XL |
11 | impl ::Copy for timezone {} |
12 | impl ::Clone for timezone { | |
13 | fn clone(&self) -> timezone { *self } | |
14 | } | |
476ff2be SL |
15 | |
16 | s! { | |
532ac7d7 XL |
17 | pub struct in_addr { |
18 | pub s_addr: ::in_addr_t, | |
19 | } | |
20 | ||
21 | pub struct ip_mreq { | |
22 | pub imr_multiaddr: in_addr, | |
23 | pub imr_interface: in_addr, | |
24 | } | |
25 | ||
476ff2be SL |
26 | pub struct sockaddr { |
27 | pub sa_family: sa_family_t, | |
28 | pub sa_data: [::c_char; 14], | |
29 | } | |
30 | ||
31 | pub struct sockaddr_in { | |
32 | pub sin_family: sa_family_t, | |
33 | pub sin_port: ::in_port_t, | |
34 | pub sin_addr: ::in_addr, | |
35 | pub sin_zero: [u8; 8], | |
36 | } | |
37 | ||
38 | pub struct sockaddr_in6 { | |
39 | pub sin6_family: sa_family_t, | |
40 | pub sin6_port: ::in_port_t, | |
41 | pub sin6_flowinfo: u32, | |
42 | pub sin6_addr: ::in6_addr, | |
43 | pub sin6_scope_id: u32, | |
44 | } | |
45 | ||
476ff2be SL |
46 | pub struct addrinfo { |
47 | pub ai_flags: ::c_int, | |
48 | pub ai_family: ::c_int, | |
49 | pub ai_socktype: ::c_int, | |
50 | pub ai_protocol: ::c_int, | |
51 | pub ai_addrlen: socklen_t, | |
52 | ||
8bb4bdeb | 53 | #[cfg(any(target_os = "linux", |
69743fb6 | 54 | target_os = "emscripten"))] |
476ff2be SL |
55 | pub ai_addr: *mut ::sockaddr, |
56 | ||
57 | pub ai_canonname: *mut c_char, | |
58 | ||
59 | #[cfg(target_os = "android")] | |
60 | pub ai_addr: *mut ::sockaddr, | |
61 | ||
62 | pub ai_next: *mut addrinfo, | |
63 | } | |
64 | ||
65 | pub struct sockaddr_nl { | |
66 | pub nl_family: ::sa_family_t, | |
67 | nl_pad: ::c_ushort, | |
68 | pub nl_pid: u32, | |
69 | pub nl_groups: u32 | |
70 | } | |
71 | ||
72 | pub struct sockaddr_ll { | |
73 | pub sll_family: ::c_ushort, | |
74 | pub sll_protocol: ::c_ushort, | |
75 | pub sll_ifindex: ::c_int, | |
76 | pub sll_hatype: ::c_ushort, | |
77 | pub sll_pkttype: ::c_uchar, | |
78 | pub sll_halen: ::c_uchar, | |
79 | pub sll_addr: [::c_uchar; 8] | |
80 | } | |
81 | ||
82 | pub struct fd_set { | |
83 | fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE], | |
84 | } | |
85 | ||
86 | pub struct tm { | |
87 | pub tm_sec: ::c_int, | |
88 | pub tm_min: ::c_int, | |
89 | pub tm_hour: ::c_int, | |
90 | pub tm_mday: ::c_int, | |
91 | pub tm_mon: ::c_int, | |
92 | pub tm_year: ::c_int, | |
93 | pub tm_wday: ::c_int, | |
94 | pub tm_yday: ::c_int, | |
95 | pub tm_isdst: ::c_int, | |
96 | pub tm_gmtoff: ::c_long, | |
97 | pub tm_zone: *const ::c_char, | |
98 | } | |
99 | ||
100 | pub struct sched_param { | |
101 | pub sched_priority: ::c_int, | |
ea8adc8c | 102 | #[cfg(any(target_env = "musl", target_os = "emscripten"))] |
476ff2be | 103 | pub sched_ss_low_priority: ::c_int, |
ea8adc8c | 104 | #[cfg(any(target_env = "musl", target_os = "emscripten"))] |
476ff2be | 105 | pub sched_ss_repl_period: ::timespec, |
ea8adc8c | 106 | #[cfg(any(target_env = "musl", target_os = "emscripten"))] |
476ff2be | 107 | pub sched_ss_init_budget: ::timespec, |
ea8adc8c | 108 | #[cfg(any(target_env = "musl", target_os = "emscripten"))] |
476ff2be SL |
109 | pub sched_ss_max_repl: ::c_int, |
110 | } | |
111 | ||
112 | pub struct Dl_info { | |
113 | pub dli_fname: *const ::c_char, | |
114 | pub dli_fbase: *mut ::c_void, | |
115 | pub dli_sname: *const ::c_char, | |
116 | pub dli_saddr: *mut ::c_void, | |
117 | } | |
118 | ||
476ff2be SL |
119 | pub struct lconv { |
120 | pub decimal_point: *mut ::c_char, | |
121 | pub thousands_sep: *mut ::c_char, | |
122 | pub grouping: *mut ::c_char, | |
123 | pub int_curr_symbol: *mut ::c_char, | |
124 | pub currency_symbol: *mut ::c_char, | |
125 | pub mon_decimal_point: *mut ::c_char, | |
126 | pub mon_thousands_sep: *mut ::c_char, | |
127 | pub mon_grouping: *mut ::c_char, | |
128 | pub positive_sign: *mut ::c_char, | |
129 | pub negative_sign: *mut ::c_char, | |
130 | pub int_frac_digits: ::c_char, | |
131 | pub frac_digits: ::c_char, | |
132 | pub p_cs_precedes: ::c_char, | |
133 | pub p_sep_by_space: ::c_char, | |
134 | pub n_cs_precedes: ::c_char, | |
135 | pub n_sep_by_space: ::c_char, | |
136 | pub p_sign_posn: ::c_char, | |
137 | pub n_sign_posn: ::c_char, | |
138 | pub int_p_cs_precedes: ::c_char, | |
139 | pub int_p_sep_by_space: ::c_char, | |
140 | pub int_n_cs_precedes: ::c_char, | |
141 | pub int_n_sep_by_space: ::c_char, | |
142 | pub int_p_sign_posn: ::c_char, | |
143 | pub int_n_sign_posn: ::c_char, | |
144 | } | |
8bb4bdeb XL |
145 | |
146 | pub struct sigevent { | |
147 | pub sigev_value: ::sigval, | |
148 | pub sigev_signo: ::c_int, | |
149 | pub sigev_notify: ::c_int, | |
150 | // Actually a union. We only expose sigev_notify_thread_id because it's | |
151 | // the most useful member | |
152 | pub sigev_notify_thread_id: ::c_int, | |
153 | #[cfg(target_pointer_width = "64")] | |
154 | __unused1: [::c_int; 11], | |
155 | #[cfg(target_pointer_width = "32")] | |
156 | __unused1: [::c_int; 12] | |
157 | } | |
8faf50e0 XL |
158 | |
159 | pub struct in_pktinfo { | |
160 | pub ipi_ifindex: ::c_int, | |
161 | pub ipi_spec_dst: ::in_addr, | |
162 | pub ipi_addr: ::in_addr, | |
163 | } | |
164 | ||
165 | pub struct ifaddrs { | |
166 | pub ifa_next: *mut ifaddrs, | |
167 | pub ifa_name: *mut c_char, | |
168 | pub ifa_flags: ::c_uint, | |
169 | pub ifa_addr: *mut ::sockaddr, | |
170 | pub ifa_netmask: *mut ::sockaddr, | |
171 | pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union | |
172 | pub ifa_data: *mut ::c_void | |
173 | } | |
174 | ||
175 | pub struct in6_rtmsg { | |
176 | rtmsg_dst: ::in6_addr, | |
177 | rtmsg_src: ::in6_addr, | |
178 | rtmsg_gateway: ::in6_addr, | |
179 | rtmsg_type: u32, | |
180 | rtmsg_dst_len: u16, | |
181 | rtmsg_src_len: u16, | |
182 | rtmsg_metric: u32, | |
183 | rtmsg_info: ::c_ulong, | |
184 | rtmsg_flags: u32, | |
185 | rtmsg_ifindex: ::c_int, | |
186 | } | |
b7449926 XL |
187 | |
188 | pub struct arpreq { | |
189 | pub arp_pa: ::sockaddr, | |
190 | pub arp_ha: ::sockaddr, | |
191 | pub arp_flags: ::c_int, | |
192 | pub arp_netmask: ::sockaddr, | |
193 | pub arp_dev: [::c_char; 16], | |
194 | } | |
195 | ||
196 | pub struct arpreq_old { | |
197 | pub arp_pa: ::sockaddr, | |
198 | pub arp_ha: ::sockaddr, | |
199 | pub arp_flags: ::c_int, | |
200 | pub arp_netmask: ::sockaddr, | |
201 | } | |
202 | ||
203 | pub struct arphdr { | |
204 | pub ar_hrd: u16, | |
205 | pub ar_pro: u16, | |
206 | pub ar_hln: u8, | |
207 | pub ar_pln: u8, | |
208 | pub ar_op: u16, | |
209 | } | |
532ac7d7 XL |
210 | |
211 | pub struct mmsghdr { | |
212 | pub msg_hdr: ::msghdr, | |
213 | pub msg_len: ::c_uint, | |
214 | } | |
215 | } | |
216 | ||
217 | s_no_extra_traits!{ | |
218 | #[cfg_attr( | |
219 | any( | |
220 | all( | |
221 | target_arch = "x86", | |
222 | not(target_env = "musl"), | |
223 | not(target_os = "android")), | |
224 | target_arch = "x86_64"), | |
225 | repr(packed))] | |
226 | pub struct epoll_event { | |
227 | pub events: ::uint32_t, | |
228 | pub u64: ::uint64_t, | |
229 | } | |
230 | ||
231 | pub struct sockaddr_un { | |
232 | pub sun_family: sa_family_t, | |
233 | pub sun_path: [::c_char; 108] | |
234 | } | |
235 | ||
236 | pub struct sockaddr_storage { | |
237 | pub ss_family: sa_family_t, | |
238 | __ss_align: ::size_t, | |
239 | #[cfg(target_pointer_width = "32")] | |
240 | __ss_pad2: [u8; 128 - 2 * 4], | |
241 | #[cfg(target_pointer_width = "64")] | |
242 | __ss_pad2: [u8; 128 - 2 * 8], | |
243 | } | |
244 | ||
245 | pub struct utsname { | |
246 | pub sysname: [::c_char; 65], | |
247 | pub nodename: [::c_char; 65], | |
248 | pub release: [::c_char; 65], | |
249 | pub version: [::c_char; 65], | |
250 | pub machine: [::c_char; 65], | |
251 | pub domainname: [::c_char; 65] | |
252 | } | |
253 | } | |
254 | ||
255 | cfg_if! { | |
256 | if #[cfg(feature = "extra_traits")] { | |
257 | impl PartialEq for epoll_event { | |
258 | fn eq(&self, other: &epoll_event) -> bool { | |
259 | self.events == other.events | |
260 | && self.u64 == other.u64 | |
261 | } | |
262 | } | |
263 | impl Eq for epoll_event {} | |
264 | impl ::fmt::Debug for epoll_event { | |
265 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
266 | let events = self.events; | |
267 | let u64 = self.u64; | |
268 | f.debug_struct("epoll_event") | |
269 | .field("events", &events) | |
270 | .field("u64", &u64) | |
271 | .finish() | |
272 | } | |
273 | } | |
274 | impl ::hash::Hash for epoll_event { | |
275 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
276 | let events = self.events; | |
277 | let u64 = self.u64; | |
278 | events.hash(state); | |
279 | u64.hash(state); | |
280 | } | |
281 | } | |
282 | ||
283 | impl PartialEq for sockaddr_un { | |
284 | fn eq(&self, other: &sockaddr_un) -> bool { | |
285 | self.sun_family == other.sun_family | |
286 | && self | |
287 | .sun_path | |
288 | .iter() | |
289 | .zip(other.sun_path.iter()) | |
290 | .all(|(a, b)| a == b) | |
291 | } | |
292 | } | |
293 | impl Eq for sockaddr_un {} | |
294 | impl ::fmt::Debug for sockaddr_un { | |
295 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
296 | f.debug_struct("sockaddr_un") | |
297 | .field("sun_family", &self.sun_family) | |
298 | // FIXME: .field("sun_path", &self.sun_path) | |
299 | .finish() | |
300 | } | |
301 | } | |
302 | impl ::hash::Hash for sockaddr_un { | |
303 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
304 | self.sun_family.hash(state); | |
305 | self.sun_path.hash(state); | |
306 | } | |
307 | } | |
308 | ||
309 | impl PartialEq for sockaddr_storage { | |
310 | fn eq(&self, other: &sockaddr_storage) -> bool { | |
311 | self.ss_family == other.ss_family | |
312 | && self | |
313 | .__ss_pad2 | |
314 | .iter() | |
315 | .zip(other.__ss_pad2.iter()) | |
316 | .all(|(a, b)| a == b) | |
317 | } | |
318 | } | |
319 | ||
320 | impl Eq for sockaddr_storage {} | |
321 | ||
322 | impl ::fmt::Debug for sockaddr_storage { | |
323 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
324 | f.debug_struct("sockaddr_storage") | |
325 | .field("ss_family", &self.ss_family) | |
326 | .field("__ss_align", &self.__ss_align) | |
327 | // FIXME: .field("__ss_pad2", &self.__ss_pad2) | |
328 | .finish() | |
329 | } | |
330 | } | |
331 | ||
332 | impl ::hash::Hash for sockaddr_storage { | |
333 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
334 | self.ss_family.hash(state); | |
335 | self.__ss_pad2.hash(state); | |
336 | } | |
337 | } | |
338 | ||
339 | impl PartialEq for utsname { | |
340 | fn eq(&self, other: &utsname) -> bool { | |
341 | self.sysname | |
342 | .iter() | |
343 | .zip(other.sysname.iter()) | |
344 | .all(|(a, b)| a == b) | |
345 | && self | |
346 | .nodename | |
347 | .iter() | |
348 | .zip(other.nodename.iter()) | |
349 | .all(|(a, b)| a == b) | |
350 | && self | |
351 | .release | |
352 | .iter() | |
353 | .zip(other.release.iter()) | |
354 | .all(|(a, b)| a == b) | |
355 | && self | |
356 | .version | |
357 | .iter() | |
358 | .zip(other.version.iter()) | |
359 | .all(|(a, b)| a == b) | |
360 | && self | |
361 | .machine | |
362 | .iter() | |
363 | .zip(other.machine.iter()) | |
364 | .all(|(a, b)| a == b) | |
365 | && self | |
366 | .domainname | |
367 | .iter() | |
368 | .zip(other.domainname.iter()) | |
369 | .all(|(a, b)| a == b) | |
370 | } | |
371 | } | |
372 | ||
373 | impl Eq for utsname {} | |
374 | ||
375 | impl ::fmt::Debug for utsname { | |
376 | fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | |
377 | f.debug_struct("utsname") | |
378 | // FIXME: .field("sysname", &self.sysname) | |
379 | // FIXME: .field("nodename", &self.nodename) | |
380 | // FIXME: .field("release", &self.release) | |
381 | // FIXME: .field("version", &self.version) | |
382 | // FIXME: .field("machine", &self.machine) | |
383 | // FIXME: .field("domainname", &self.domainname) | |
384 | .finish() | |
385 | } | |
386 | } | |
387 | ||
388 | impl ::hash::Hash for utsname { | |
389 | fn hash<H: ::hash::Hasher>(&self, state: &mut H) { | |
390 | self.sysname.hash(state); | |
391 | self.nodename.hash(state); | |
392 | self.release.hash(state); | |
393 | self.version.hash(state); | |
394 | self.machine.hash(state); | |
395 | self.domainname.hash(state); | |
396 | } | |
397 | } | |
398 | } | |
476ff2be SL |
399 | } |
400 | ||
401 | // intentionally not public, only used for fd_set | |
402 | cfg_if! { | |
403 | if #[cfg(target_pointer_width = "32")] { | |
404 | const ULONG_SIZE: usize = 32; | |
405 | } else if #[cfg(target_pointer_width = "64")] { | |
406 | const ULONG_SIZE: usize = 64; | |
407 | } else { | |
408 | // Unknown target_pointer_width | |
409 | } | |
410 | } | |
411 | ||
412 | pub const EXIT_FAILURE: ::c_int = 1; | |
413 | pub const EXIT_SUCCESS: ::c_int = 0; | |
414 | pub const RAND_MAX: ::c_int = 2147483647; | |
415 | pub const EOF: ::c_int = -1; | |
416 | pub const SEEK_SET: ::c_int = 0; | |
417 | pub const SEEK_CUR: ::c_int = 1; | |
418 | pub const SEEK_END: ::c_int = 2; | |
419 | pub const _IOFBF: ::c_int = 0; | |
420 | pub const _IONBF: ::c_int = 2; | |
421 | pub const _IOLBF: ::c_int = 1; | |
422 | ||
423 | pub const F_DUPFD: ::c_int = 0; | |
424 | pub const F_GETFD: ::c_int = 1; | |
425 | pub const F_SETFD: ::c_int = 2; | |
426 | pub const F_GETFL: ::c_int = 3; | |
427 | pub const F_SETFL: ::c_int = 4; | |
428 | ||
429 | // Linux-specific fcntls | |
430 | pub const F_SETLEASE: ::c_int = 1024; | |
431 | pub const F_GETLEASE: ::c_int = 1025; | |
432 | pub const F_NOTIFY: ::c_int = 1026; | |
ea8adc8c | 433 | pub const F_CANCELLK: ::c_int = 1029; |
476ff2be SL |
434 | pub const F_DUPFD_CLOEXEC: ::c_int = 1030; |
435 | pub const F_SETPIPE_SZ: ::c_int = 1031; | |
436 | pub const F_GETPIPE_SZ: ::c_int = 1032; | |
ea8adc8c XL |
437 | pub const F_ADD_SEALS: ::c_int = 1033; |
438 | pub const F_GET_SEALS: ::c_int = 1034; | |
439 | ||
440 | pub const F_SEAL_SEAL: ::c_int = 0x0001; | |
441 | pub const F_SEAL_SHRINK: ::c_int = 0x0002; | |
442 | pub const F_SEAL_GROW: ::c_int = 0x0004; | |
443 | pub const F_SEAL_WRITE: ::c_int = 0x0008; | |
476ff2be SL |
444 | |
445 | // TODO(#235): Include file sealing fcntls once we have a way to verify them. | |
446 | ||
447 | pub const SIGTRAP: ::c_int = 5; | |
448 | ||
449 | pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; | |
450 | pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; | |
451 | ||
ea8adc8c XL |
452 | pub const CLOCK_REALTIME: ::clockid_t = 0; |
453 | pub const CLOCK_MONOTONIC: ::clockid_t = 1; | |
454 | pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; | |
455 | pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3; | |
456 | pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4; | |
457 | pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5; | |
458 | pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; | |
459 | pub const CLOCK_BOOTTIME: ::clockid_t = 7; | |
460 | pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8; | |
461 | pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9; | |
476ff2be SL |
462 | // TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep |
463 | // 2014.) See also musl/mod.rs | |
ea8adc8c XL |
464 | // pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; |
465 | // pub const CLOCK_TAI: ::clockid_t = 11; | |
476ff2be SL |
466 | pub const TIMER_ABSTIME: ::c_int = 1; |
467 | ||
468 | pub const RLIMIT_CPU: ::c_int = 0; | |
469 | pub const RLIMIT_FSIZE: ::c_int = 1; | |
470 | pub const RLIMIT_DATA: ::c_int = 2; | |
471 | pub const RLIMIT_STACK: ::c_int = 3; | |
472 | pub const RLIMIT_CORE: ::c_int = 4; | |
473 | pub const RLIMIT_LOCKS: ::c_int = 10; | |
474 | pub const RLIMIT_SIGPENDING: ::c_int = 11; | |
475 | pub const RLIMIT_MSGQUEUE: ::c_int = 12; | |
476 | pub const RLIMIT_NICE: ::c_int = 13; | |
477 | pub const RLIMIT_RTPRIO: ::c_int = 14; | |
478 | ||
479 | pub const RUSAGE_SELF: ::c_int = 0; | |
480 | ||
481 | pub const O_RDONLY: ::c_int = 0; | |
482 | pub const O_WRONLY: ::c_int = 1; | |
483 | pub const O_RDWR: ::c_int = 2; | |
476ff2be SL |
484 | |
485 | pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; | |
486 | ||
487 | pub const S_IFIFO: ::mode_t = 4096; | |
488 | pub const S_IFCHR: ::mode_t = 8192; | |
489 | pub const S_IFBLK: ::mode_t = 24576; | |
490 | pub const S_IFDIR: ::mode_t = 16384; | |
491 | pub const S_IFREG: ::mode_t = 32768; | |
492 | pub const S_IFLNK: ::mode_t = 40960; | |
493 | pub const S_IFSOCK: ::mode_t = 49152; | |
494 | pub const S_IFMT: ::mode_t = 61440; | |
495 | pub const S_IRWXU: ::mode_t = 448; | |
496 | pub const S_IXUSR: ::mode_t = 64; | |
497 | pub const S_IWUSR: ::mode_t = 128; | |
498 | pub const S_IRUSR: ::mode_t = 256; | |
499 | pub const S_IRWXG: ::mode_t = 56; | |
500 | pub const S_IXGRP: ::mode_t = 8; | |
501 | pub const S_IWGRP: ::mode_t = 16; | |
502 | pub const S_IRGRP: ::mode_t = 32; | |
503 | pub const S_IRWXO: ::mode_t = 7; | |
504 | pub const S_IXOTH: ::mode_t = 1; | |
505 | pub const S_IWOTH: ::mode_t = 2; | |
506 | pub const S_IROTH: ::mode_t = 4; | |
507 | pub const F_OK: ::c_int = 0; | |
508 | pub const R_OK: ::c_int = 4; | |
509 | pub const W_OK: ::c_int = 2; | |
510 | pub const X_OK: ::c_int = 1; | |
511 | pub const STDIN_FILENO: ::c_int = 0; | |
512 | pub const STDOUT_FILENO: ::c_int = 1; | |
513 | pub const STDERR_FILENO: ::c_int = 2; | |
514 | pub const SIGHUP: ::c_int = 1; | |
515 | pub const SIGINT: ::c_int = 2; | |
516 | pub const SIGQUIT: ::c_int = 3; | |
517 | pub const SIGILL: ::c_int = 4; | |
518 | pub const SIGABRT: ::c_int = 6; | |
519 | pub const SIGFPE: ::c_int = 8; | |
520 | pub const SIGKILL: ::c_int = 9; | |
521 | pub const SIGSEGV: ::c_int = 11; | |
522 | pub const SIGPIPE: ::c_int = 13; | |
523 | pub const SIGALRM: ::c_int = 14; | |
524 | pub const SIGTERM: ::c_int = 15; | |
525 | ||
526 | pub const PROT_NONE: ::c_int = 0; | |
527 | pub const PROT_READ: ::c_int = 1; | |
528 | pub const PROT_WRITE: ::c_int = 2; | |
529 | pub const PROT_EXEC: ::c_int = 4; | |
530 | ||
531 | pub const LC_CTYPE: ::c_int = 0; | |
532 | pub const LC_NUMERIC: ::c_int = 1; | |
533 | pub const LC_TIME: ::c_int = 2; | |
534 | pub const LC_COLLATE: ::c_int = 3; | |
535 | pub const LC_MONETARY: ::c_int = 4; | |
536 | pub const LC_MESSAGES: ::c_int = 5; | |
537 | pub const LC_ALL: ::c_int = 6; | |
538 | pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE); | |
539 | pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC); | |
540 | pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME); | |
541 | pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE); | |
542 | pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY); | |
543 | pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES); | |
544 | // LC_ALL_MASK defined per platform | |
545 | ||
546 | pub const MAP_FILE: ::c_int = 0x0000; | |
547 | pub const MAP_SHARED: ::c_int = 0x0001; | |
548 | pub const MAP_PRIVATE: ::c_int = 0x0002; | |
549 | pub const MAP_FIXED: ::c_int = 0x0010; | |
550 | ||
551 | pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; | |
552 | ||
553 | // MS_ flags for msync(2) | |
554 | pub const MS_ASYNC: ::c_int = 0x0001; | |
555 | pub const MS_INVALIDATE: ::c_int = 0x0002; | |
556 | pub const MS_SYNC: ::c_int = 0x0004; | |
557 | ||
558 | // MS_ flags for mount(2) | |
559 | pub const MS_RDONLY: ::c_ulong = 0x01; | |
560 | pub const MS_NOSUID: ::c_ulong = 0x02; | |
561 | pub const MS_NODEV: ::c_ulong = 0x04; | |
562 | pub const MS_NOEXEC: ::c_ulong = 0x08; | |
563 | pub const MS_SYNCHRONOUS: ::c_ulong = 0x10; | |
564 | pub const MS_REMOUNT: ::c_ulong = 0x20; | |
565 | pub const MS_MANDLOCK: ::c_ulong = 0x40; | |
566 | pub const MS_DIRSYNC: ::c_ulong = 0x80; | |
567 | pub const MS_NOATIME: ::c_ulong = 0x0400; | |
568 | pub const MS_NODIRATIME: ::c_ulong = 0x0800; | |
569 | pub const MS_BIND: ::c_ulong = 0x1000; | |
570 | pub const MS_MOVE: ::c_ulong = 0x2000; | |
571 | pub const MS_REC: ::c_ulong = 0x4000; | |
572 | pub const MS_SILENT: ::c_ulong = 0x8000; | |
573 | pub const MS_POSIXACL: ::c_ulong = 0x010000; | |
574 | pub const MS_UNBINDABLE: ::c_ulong = 0x020000; | |
575 | pub const MS_PRIVATE: ::c_ulong = 0x040000; | |
576 | pub const MS_SLAVE: ::c_ulong = 0x080000; | |
577 | pub const MS_SHARED: ::c_ulong = 0x100000; | |
578 | pub const MS_RELATIME: ::c_ulong = 0x200000; | |
579 | pub const MS_KERNMOUNT: ::c_ulong = 0x400000; | |
580 | pub const MS_I_VERSION: ::c_ulong = 0x800000; | |
581 | pub const MS_STRICTATIME: ::c_ulong = 0x1000000; | |
582 | pub const MS_ACTIVE: ::c_ulong = 0x40000000; | |
583 | pub const MS_NOUSER: ::c_ulong = 0x80000000; | |
584 | pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; | |
585 | pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; | |
586 | pub const MS_RMT_MASK: ::c_ulong = 0x800051; | |
587 | ||
588 | pub const EPERM: ::c_int = 1; | |
589 | pub const ENOENT: ::c_int = 2; | |
590 | pub const ESRCH: ::c_int = 3; | |
591 | pub const EINTR: ::c_int = 4; | |
592 | pub const EIO: ::c_int = 5; | |
593 | pub const ENXIO: ::c_int = 6; | |
594 | pub const E2BIG: ::c_int = 7; | |
595 | pub const ENOEXEC: ::c_int = 8; | |
596 | pub const EBADF: ::c_int = 9; | |
597 | pub const ECHILD: ::c_int = 10; | |
598 | pub const EAGAIN: ::c_int = 11; | |
599 | pub const ENOMEM: ::c_int = 12; | |
600 | pub const EACCES: ::c_int = 13; | |
601 | pub const EFAULT: ::c_int = 14; | |
602 | pub const ENOTBLK: ::c_int = 15; | |
603 | pub const EBUSY: ::c_int = 16; | |
604 | pub const EEXIST: ::c_int = 17; | |
605 | pub const EXDEV: ::c_int = 18; | |
606 | pub const ENODEV: ::c_int = 19; | |
607 | pub const ENOTDIR: ::c_int = 20; | |
608 | pub const EISDIR: ::c_int = 21; | |
609 | pub const EINVAL: ::c_int = 22; | |
610 | pub const ENFILE: ::c_int = 23; | |
611 | pub const EMFILE: ::c_int = 24; | |
612 | pub const ENOTTY: ::c_int = 25; | |
613 | pub const ETXTBSY: ::c_int = 26; | |
614 | pub const EFBIG: ::c_int = 27; | |
615 | pub const ENOSPC: ::c_int = 28; | |
616 | pub const ESPIPE: ::c_int = 29; | |
617 | pub const EROFS: ::c_int = 30; | |
618 | pub const EMLINK: ::c_int = 31; | |
619 | pub const EPIPE: ::c_int = 32; | |
620 | pub const EDOM: ::c_int = 33; | |
621 | pub const ERANGE: ::c_int = 34; | |
622 | pub const EWOULDBLOCK: ::c_int = EAGAIN; | |
623 | ||
8bb4bdeb XL |
624 | pub const SCM_RIGHTS: ::c_int = 0x01; |
625 | pub const SCM_CREDENTIALS: ::c_int = 0x02; | |
476ff2be | 626 | |
476ff2be SL |
627 | pub const PROT_GROWSDOWN: ::c_int = 0x1000000; |
628 | pub const PROT_GROWSUP: ::c_int = 0x2000000; | |
629 | ||
630 | pub const MAP_TYPE: ::c_int = 0x000f; | |
631 | ||
632 | pub const MADV_NORMAL: ::c_int = 0; | |
633 | pub const MADV_RANDOM: ::c_int = 1; | |
634 | pub const MADV_SEQUENTIAL: ::c_int = 2; | |
635 | pub const MADV_WILLNEED: ::c_int = 3; | |
636 | pub const MADV_DONTNEED: ::c_int = 4; | |
ea8adc8c | 637 | pub const MADV_FREE: ::c_int = 8; |
476ff2be SL |
638 | pub const MADV_REMOVE: ::c_int = 9; |
639 | pub const MADV_DONTFORK: ::c_int = 10; | |
640 | pub const MADV_DOFORK: ::c_int = 11; | |
641 | pub const MADV_MERGEABLE: ::c_int = 12; | |
642 | pub const MADV_UNMERGEABLE: ::c_int = 13; | |
ea8adc8c XL |
643 | pub const MADV_HUGEPAGE: ::c_int = 14; |
644 | pub const MADV_NOHUGEPAGE: ::c_int = 15; | |
645 | pub const MADV_DONTDUMP: ::c_int = 16; | |
646 | pub const MADV_DODUMP: ::c_int = 17; | |
476ff2be | 647 | pub const MADV_HWPOISON: ::c_int = 100; |
ea8adc8c | 648 | pub const MADV_SOFT_OFFLINE: ::c_int = 101; |
476ff2be SL |
649 | |
650 | pub const IFF_UP: ::c_int = 0x1; | |
651 | pub const IFF_BROADCAST: ::c_int = 0x2; | |
652 | pub const IFF_DEBUG: ::c_int = 0x4; | |
653 | pub const IFF_LOOPBACK: ::c_int = 0x8; | |
654 | pub const IFF_POINTOPOINT: ::c_int = 0x10; | |
655 | pub const IFF_NOTRAILERS: ::c_int = 0x20; | |
656 | pub const IFF_RUNNING: ::c_int = 0x40; | |
657 | pub const IFF_NOARP: ::c_int = 0x80; | |
658 | pub const IFF_PROMISC: ::c_int = 0x100; | |
659 | pub const IFF_ALLMULTI: ::c_int = 0x200; | |
660 | pub const IFF_MASTER: ::c_int = 0x400; | |
661 | pub const IFF_SLAVE: ::c_int = 0x800; | |
662 | pub const IFF_MULTICAST: ::c_int = 0x1000; | |
663 | pub const IFF_PORTSEL: ::c_int = 0x2000; | |
664 | pub const IFF_AUTOMEDIA: ::c_int = 0x4000; | |
665 | pub const IFF_DYNAMIC: ::c_int = 0x8000; | |
666 | ||
8bb4bdeb XL |
667 | pub const SOL_IP: ::c_int = 0; |
668 | pub const SOL_TCP: ::c_int = 6; | |
3b2f2976 | 669 | pub const SOL_UDP: ::c_int = 17; |
8bb4bdeb XL |
670 | pub const SOL_IPV6: ::c_int = 41; |
671 | pub const SOL_ICMPV6: ::c_int = 58; | |
672 | pub const SOL_RAW: ::c_int = 255; | |
673 | pub const SOL_DECNET: ::c_int = 261; | |
674 | pub const SOL_X25: ::c_int = 262; | |
675 | pub const SOL_PACKET: ::c_int = 263; | |
676 | pub const SOL_ATM: ::c_int = 264; | |
677 | pub const SOL_AAL: ::c_int = 265; | |
678 | pub const SOL_IRDA: ::c_int = 266; | |
679 | pub const SOL_NETBEUI: ::c_int = 267; | |
680 | pub const SOL_LLC: ::c_int = 268; | |
681 | pub const SOL_DCCP: ::c_int = 269; | |
682 | pub const SOL_NETLINK: ::c_int = 270; | |
683 | pub const SOL_TIPC: ::c_int = 271; | |
69743fb6 | 684 | pub const SOL_BLUETOOTH: ::c_int = 274; |
532ac7d7 | 685 | pub const SOL_ALG: ::c_int = 279; |
8bb4bdeb XL |
686 | |
687 | pub const AF_UNSPEC: ::c_int = 0; | |
476ff2be | 688 | pub const AF_UNIX: ::c_int = 1; |
8bb4bdeb | 689 | pub const AF_LOCAL: ::c_int = 1; |
476ff2be | 690 | pub const AF_INET: ::c_int = 2; |
8bb4bdeb XL |
691 | pub const AF_AX25: ::c_int = 3; |
692 | pub const AF_IPX: ::c_int = 4; | |
693 | pub const AF_APPLETALK: ::c_int = 5; | |
694 | pub const AF_NETROM: ::c_int = 6; | |
695 | pub const AF_BRIDGE: ::c_int = 7; | |
696 | pub const AF_ATMPVC: ::c_int = 8; | |
697 | pub const AF_X25: ::c_int = 9; | |
476ff2be | 698 | pub const AF_INET6: ::c_int = 10; |
8bb4bdeb XL |
699 | pub const AF_ROSE: ::c_int = 11; |
700 | pub const AF_DECnet: ::c_int = 12; | |
701 | pub const AF_NETBEUI: ::c_int = 13; | |
702 | pub const AF_SECURITY: ::c_int = 14; | |
703 | pub const AF_KEY: ::c_int = 15; | |
476ff2be | 704 | pub const AF_NETLINK: ::c_int = 16; |
8bb4bdeb XL |
705 | pub const AF_ROUTE: ::c_int = AF_NETLINK; |
706 | pub const AF_PACKET: ::c_int = 17; | |
707 | pub const AF_ASH: ::c_int = 18; | |
708 | pub const AF_ECONET: ::c_int = 19; | |
709 | pub const AF_ATMSVC: ::c_int = 20; | |
710 | pub const AF_RDS: ::c_int = 21; | |
711 | pub const AF_SNA: ::c_int = 22; | |
712 | pub const AF_IRDA: ::c_int = 23; | |
713 | pub const AF_PPPOX: ::c_int = 24; | |
714 | pub const AF_WANPIPE: ::c_int = 25; | |
715 | pub const AF_LLC: ::c_int = 26; | |
716 | pub const AF_CAN: ::c_int = 29; | |
717 | pub const AF_TIPC: ::c_int = 30; | |
718 | pub const AF_BLUETOOTH: ::c_int = 31; | |
719 | pub const AF_IUCV: ::c_int = 32; | |
720 | pub const AF_RXRPC: ::c_int = 33; | |
721 | pub const AF_ISDN: ::c_int = 34; | |
722 | pub const AF_PHONET: ::c_int = 35; | |
723 | pub const AF_IEEE802154: ::c_int = 36; | |
724 | pub const AF_CAIF: ::c_int = 37; | |
725 | pub const AF_ALG: ::c_int = 38; | |
726 | ||
727 | pub const PF_UNSPEC: ::c_int = AF_UNSPEC; | |
728 | pub const PF_UNIX: ::c_int = AF_UNIX; | |
729 | pub const PF_LOCAL: ::c_int = AF_LOCAL; | |
730 | pub const PF_INET: ::c_int = AF_INET; | |
731 | pub const PF_AX25: ::c_int = AF_AX25; | |
732 | pub const PF_IPX: ::c_int = AF_IPX; | |
733 | pub const PF_APPLETALK: ::c_int = AF_APPLETALK; | |
734 | pub const PF_NETROM: ::c_int = AF_NETROM; | |
735 | pub const PF_BRIDGE: ::c_int = AF_BRIDGE; | |
736 | pub const PF_ATMPVC: ::c_int = AF_ATMPVC; | |
737 | pub const PF_X25: ::c_int = AF_X25; | |
738 | pub const PF_INET6: ::c_int = AF_INET6; | |
739 | pub const PF_ROSE: ::c_int = AF_ROSE; | |
740 | pub const PF_DECnet: ::c_int = AF_DECnet; | |
741 | pub const PF_NETBEUI: ::c_int = AF_NETBEUI; | |
742 | pub const PF_SECURITY: ::c_int = AF_SECURITY; | |
743 | pub const PF_KEY: ::c_int = AF_KEY; | |
744 | pub const PF_NETLINK: ::c_int = AF_NETLINK; | |
745 | pub const PF_ROUTE: ::c_int = AF_ROUTE; | |
746 | pub const PF_PACKET: ::c_int = AF_PACKET; | |
747 | pub const PF_ASH: ::c_int = AF_ASH; | |
748 | pub const PF_ECONET: ::c_int = AF_ECONET; | |
749 | pub const PF_ATMSVC: ::c_int = AF_ATMSVC; | |
750 | pub const PF_RDS: ::c_int = AF_RDS; | |
751 | pub const PF_SNA: ::c_int = AF_SNA; | |
752 | pub const PF_IRDA: ::c_int = AF_IRDA; | |
753 | pub const PF_PPPOX: ::c_int = AF_PPPOX; | |
754 | pub const PF_WANPIPE: ::c_int = AF_WANPIPE; | |
755 | pub const PF_LLC: ::c_int = AF_LLC; | |
756 | pub const PF_CAN: ::c_int = AF_CAN; | |
757 | pub const PF_TIPC: ::c_int = AF_TIPC; | |
758 | pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; | |
759 | pub const PF_IUCV: ::c_int = AF_IUCV; | |
760 | pub const PF_RXRPC: ::c_int = AF_RXRPC; | |
761 | pub const PF_ISDN: ::c_int = AF_ISDN; | |
762 | pub const PF_PHONET: ::c_int = AF_PHONET; | |
763 | pub const PF_IEEE802154: ::c_int = AF_IEEE802154; | |
764 | pub const PF_CAIF: ::c_int = AF_CAIF; | |
765 | pub const PF_ALG: ::c_int = AF_ALG; | |
766 | ||
767 | pub const SOMAXCONN: ::c_int = 128; | |
768 | ||
769 | pub const MSG_OOB: ::c_int = 1; | |
770 | pub const MSG_PEEK: ::c_int = 2; | |
771 | pub const MSG_DONTROUTE: ::c_int = 4; | |
772 | pub const MSG_CTRUNC: ::c_int = 8; | |
773 | pub const MSG_TRUNC: ::c_int = 0x20; | |
774 | pub const MSG_DONTWAIT: ::c_int = 0x40; | |
775 | pub const MSG_EOR: ::c_int = 0x80; | |
776 | pub const MSG_WAITALL: ::c_int = 0x100; | |
777 | pub const MSG_FIN: ::c_int = 0x200; | |
778 | pub const MSG_SYN: ::c_int = 0x400; | |
779 | pub const MSG_CONFIRM: ::c_int = 0x800; | |
780 | pub const MSG_RST: ::c_int = 0x1000; | |
781 | pub const MSG_ERRQUEUE: ::c_int = 0x2000; | |
782 | pub const MSG_NOSIGNAL: ::c_int = 0x4000; | |
783 | pub const MSG_MORE: ::c_int = 0x8000; | |
784 | pub const MSG_WAITFORONE: ::c_int = 0x10000; | |
785 | pub const MSG_FASTOPEN: ::c_int = 0x20000000; | |
786 | pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; | |
787 | ||
3b2f2976 XL |
788 | pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP; |
789 | ||
476ff2be | 790 | pub const SOCK_RAW: ::c_int = 3; |
3b2f2976 XL |
791 | pub const SOCK_RDM: ::c_int = 4; |
792 | pub const IP_MULTICAST_IF: ::c_int = 32; | |
476ff2be SL |
793 | pub const IP_MULTICAST_TTL: ::c_int = 33; |
794 | pub const IP_MULTICAST_LOOP: ::c_int = 34; | |
0731742a | 795 | pub const IP_TOS: ::c_int = 1; |
476ff2be SL |
796 | pub const IP_TTL: ::c_int = 2; |
797 | pub const IP_HDRINCL: ::c_int = 3; | |
8faf50e0 | 798 | pub const IP_PKTINFO: ::c_int = 8; |
0731742a | 799 | pub const IP_RECVTOS: ::c_int = 13; |
476ff2be SL |
800 | pub const IP_ADD_MEMBERSHIP: ::c_int = 35; |
801 | pub const IP_DROP_MEMBERSHIP: ::c_int = 36; | |
802 | pub const IP_TRANSPARENT: ::c_int = 19; | |
2c00a5a8 XL |
803 | pub const IPV6_UNICAST_HOPS: ::c_int = 16; |
804 | pub const IPV6_MULTICAST_IF: ::c_int = 17; | |
805 | pub const IPV6_MULTICAST_HOPS: ::c_int = 18; | |
806 | pub const IPV6_MULTICAST_LOOP: ::c_int = 19; | |
476ff2be SL |
807 | pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20; |
808 | pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21; | |
2c00a5a8 | 809 | pub const IPV6_V6ONLY: ::c_int = 26; |
8faf50e0 XL |
810 | pub const IPV6_RECVPKTINFO: ::c_int = 49; |
811 | pub const IPV6_PKTINFO: ::c_int = 50; | |
0731742a XL |
812 | pub const IPV6_RECVTCLASS: ::c_int = 66; |
813 | pub const IPV6_TCLASS: ::c_int = 67; | |
476ff2be SL |
814 | |
815 | pub const TCP_NODELAY: ::c_int = 1; | |
816 | pub const TCP_MAXSEG: ::c_int = 2; | |
817 | pub const TCP_CORK: ::c_int = 3; | |
818 | pub const TCP_KEEPIDLE: ::c_int = 4; | |
819 | pub const TCP_KEEPINTVL: ::c_int = 5; | |
820 | pub const TCP_KEEPCNT: ::c_int = 6; | |
821 | pub const TCP_SYNCNT: ::c_int = 7; | |
822 | pub const TCP_LINGER2: ::c_int = 8; | |
823 | pub const TCP_DEFER_ACCEPT: ::c_int = 9; | |
824 | pub const TCP_WINDOW_CLAMP: ::c_int = 10; | |
825 | pub const TCP_INFO: ::c_int = 11; | |
826 | pub const TCP_QUICKACK: ::c_int = 12; | |
827 | pub const TCP_CONGESTION: ::c_int = 13; | |
828 | ||
476ff2be SL |
829 | pub const SO_DEBUG: ::c_int = 1; |
830 | ||
476ff2be SL |
831 | pub const SHUT_RD: ::c_int = 0; |
832 | pub const SHUT_WR: ::c_int = 1; | |
833 | pub const SHUT_RDWR: ::c_int = 2; | |
834 | ||
835 | pub const LOCK_SH: ::c_int = 1; | |
836 | pub const LOCK_EX: ::c_int = 2; | |
837 | pub const LOCK_NB: ::c_int = 4; | |
838 | pub const LOCK_UN: ::c_int = 8; | |
839 | ||
476ff2be SL |
840 | pub const SS_ONSTACK: ::c_int = 1; |
841 | pub const SS_DISABLE: ::c_int = 2; | |
842 | ||
843 | pub const PATH_MAX: ::c_int = 4096; | |
844 | ||
845 | pub const FD_SETSIZE: usize = 1024; | |
846 | ||
847 | pub const EPOLLIN: ::c_int = 0x1; | |
848 | pub const EPOLLPRI: ::c_int = 0x2; | |
849 | pub const EPOLLOUT: ::c_int = 0x4; | |
850 | pub const EPOLLRDNORM: ::c_int = 0x40; | |
851 | pub const EPOLLRDBAND: ::c_int = 0x80; | |
852 | pub const EPOLLWRNORM: ::c_int = 0x100; | |
853 | pub const EPOLLWRBAND: ::c_int = 0x200; | |
854 | pub const EPOLLMSG: ::c_int = 0x400; | |
855 | pub const EPOLLERR: ::c_int = 0x8; | |
856 | pub const EPOLLHUP: ::c_int = 0x10; | |
857 | pub const EPOLLET: ::c_int = 0x80000000; | |
858 | ||
859 | pub const EPOLL_CTL_ADD: ::c_int = 1; | |
860 | pub const EPOLL_CTL_MOD: ::c_int = 3; | |
861 | pub const EPOLL_CTL_DEL: ::c_int = 2; | |
862 | ||
476ff2be SL |
863 | pub const MNT_DETACH: ::c_int = 0x2; |
864 | pub const MNT_EXPIRE: ::c_int = 0x4; | |
865 | ||
866 | pub const Q_GETFMT: ::c_int = 0x800004; | |
867 | pub const Q_GETINFO: ::c_int = 0x800005; | |
868 | pub const Q_SETINFO: ::c_int = 0x800006; | |
869 | pub const QIF_BLIMITS: ::uint32_t = 1; | |
870 | pub const QIF_SPACE: ::uint32_t = 2; | |
871 | pub const QIF_ILIMITS: ::uint32_t = 4; | |
872 | pub const QIF_INODES: ::uint32_t = 8; | |
873 | pub const QIF_BTIME: ::uint32_t = 16; | |
874 | pub const QIF_ITIME: ::uint32_t = 32; | |
875 | pub const QIF_LIMITS: ::uint32_t = 5; | |
876 | pub const QIF_USAGE: ::uint32_t = 10; | |
877 | pub const QIF_TIMES: ::uint32_t = 48; | |
878 | pub const QIF_ALL: ::uint32_t = 63; | |
879 | ||
476ff2be SL |
880 | pub const MNT_FORCE: ::c_int = 0x1; |
881 | ||
882 | pub const Q_SYNC: ::c_int = 0x800001; | |
883 | pub const Q_QUOTAON: ::c_int = 0x800002; | |
884 | pub const Q_QUOTAOFF: ::c_int = 0x800003; | |
885 | pub const Q_GETQUOTA: ::c_int = 0x800007; | |
886 | pub const Q_SETQUOTA: ::c_int = 0x800008; | |
887 | ||
888 | pub const TCIOFF: ::c_int = 2; | |
889 | pub const TCION: ::c_int = 3; | |
890 | pub const TCOOFF: ::c_int = 0; | |
891 | pub const TCOON: ::c_int = 1; | |
892 | pub const TCIFLUSH: ::c_int = 0; | |
893 | pub const TCOFLUSH: ::c_int = 1; | |
894 | pub const TCIOFLUSH: ::c_int = 2; | |
895 | pub const NL0: ::c_int = 0x00000000; | |
896 | pub const NL1: ::c_int = 0x00000100; | |
897 | pub const TAB0: ::c_int = 0x00000000; | |
898 | pub const CR0: ::c_int = 0x00000000; | |
899 | pub const FF0: ::c_int = 0x00000000; | |
900 | pub const BS0: ::c_int = 0x00000000; | |
901 | pub const VT0: ::c_int = 0x00000000; | |
902 | pub const VERASE: usize = 2; | |
903 | pub const VKILL: usize = 3; | |
904 | pub const VINTR: usize = 0; | |
905 | pub const VQUIT: usize = 1; | |
906 | pub const VLNEXT: usize = 15; | |
907 | pub const IGNBRK: ::tcflag_t = 0x00000001; | |
908 | pub const BRKINT: ::tcflag_t = 0x00000002; | |
909 | pub const IGNPAR: ::tcflag_t = 0x00000004; | |
910 | pub const PARMRK: ::tcflag_t = 0x00000008; | |
911 | pub const INPCK: ::tcflag_t = 0x00000010; | |
912 | pub const ISTRIP: ::tcflag_t = 0x00000020; | |
913 | pub const INLCR: ::tcflag_t = 0x00000040; | |
914 | pub const IGNCR: ::tcflag_t = 0x00000080; | |
915 | pub const ICRNL: ::tcflag_t = 0x00000100; | |
916 | pub const IXANY: ::tcflag_t = 0x00000800; | |
917 | pub const IMAXBEL: ::tcflag_t = 0x00002000; | |
918 | pub const OPOST: ::tcflag_t = 0x1; | |
919 | pub const CS5: ::tcflag_t = 0x00000000; | |
920 | pub const CRTSCTS: ::tcflag_t = 0x80000000; | |
921 | pub const ECHO: ::tcflag_t = 0x00000008; | |
041b39d2 XL |
922 | pub const OCRNL: ::tcflag_t = 0o000010; |
923 | pub const ONOCR: ::tcflag_t = 0o000020; | |
924 | pub const ONLRET: ::tcflag_t = 0o000040; | |
925 | pub const OFILL: ::tcflag_t = 0o000100; | |
926 | pub const OFDEL: ::tcflag_t = 0o000200; | |
476ff2be SL |
927 | |
928 | pub const CLONE_VM: ::c_int = 0x100; | |
929 | pub const CLONE_FS: ::c_int = 0x200; | |
930 | pub const CLONE_FILES: ::c_int = 0x400; | |
931 | pub const CLONE_SIGHAND: ::c_int = 0x800; | |
932 | pub const CLONE_PTRACE: ::c_int = 0x2000; | |
933 | pub const CLONE_VFORK: ::c_int = 0x4000; | |
934 | pub const CLONE_PARENT: ::c_int = 0x8000; | |
935 | pub const CLONE_THREAD: ::c_int = 0x10000; | |
936 | pub const CLONE_NEWNS: ::c_int = 0x20000; | |
937 | pub const CLONE_SYSVSEM: ::c_int = 0x40000; | |
938 | pub const CLONE_SETTLS: ::c_int = 0x80000; | |
939 | pub const CLONE_PARENT_SETTID: ::c_int = 0x100000; | |
940 | pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000; | |
941 | pub const CLONE_DETACHED: ::c_int = 0x400000; | |
942 | pub const CLONE_UNTRACED: ::c_int = 0x800000; | |
943 | pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000; | |
944 | pub const CLONE_NEWUTS: ::c_int = 0x04000000; | |
945 | pub const CLONE_NEWIPC: ::c_int = 0x08000000; | |
946 | pub const CLONE_NEWUSER: ::c_int = 0x10000000; | |
947 | pub const CLONE_NEWPID: ::c_int = 0x20000000; | |
948 | pub const CLONE_NEWNET: ::c_int = 0x40000000; | |
949 | pub const CLONE_IO: ::c_int = 0x80000000; | |
041b39d2 | 950 | pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; |
476ff2be SL |
951 | |
952 | pub const WNOHANG: ::c_int = 0x00000001; | |
953 | pub const WUNTRACED: ::c_int = 0x00000002; | |
954 | pub const WSTOPPED: ::c_int = WUNTRACED; | |
955 | pub const WEXITED: ::c_int = 0x00000004; | |
956 | pub const WCONTINUED: ::c_int = 0x00000008; | |
957 | pub const WNOWAIT: ::c_int = 0x01000000; | |
958 | ||
ea8adc8c XL |
959 | // Options set using PTRACE_SETOPTIONS. |
960 | pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001; | |
961 | pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002; | |
962 | pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004; | |
963 | pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008; | |
964 | pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010; | |
965 | pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020; | |
966 | pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040; | |
967 | pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080; | |
968 | pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000; | |
969 | pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000; | |
970 | pub const PTRACE_O_MASK: ::c_int = 0x003000ff; | |
971 | ||
972 | // Wait extended result codes for the above trace options. | |
973 | pub const PTRACE_EVENT_FORK: ::c_int = 1; | |
974 | pub const PTRACE_EVENT_VFORK: ::c_int = 2; | |
975 | pub const PTRACE_EVENT_CLONE: ::c_int = 3; | |
976 | pub const PTRACE_EVENT_EXEC: ::c_int = 4; | |
977 | pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5; | |
978 | pub const PTRACE_EVENT_EXIT: ::c_int = 6; | |
979 | pub const PTRACE_EVENT_SECCOMP: ::c_int = 7; | |
980 | // PTRACE_EVENT_STOP was added to glibc in 2.26 | |
981 | // pub const PTRACE_EVENT_STOP: ::c_int = 128; | |
982 | ||
476ff2be SL |
983 | pub const __WNOTHREAD: ::c_int = 0x20000000; |
984 | pub const __WALL: ::c_int = 0x40000000; | |
985 | pub const __WCLONE: ::c_int = 0x80000000; | |
986 | ||
987 | pub const SPLICE_F_MOVE: ::c_uint = 0x01; | |
988 | pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02; | |
989 | pub const SPLICE_F_MORE: ::c_uint = 0x04; | |
990 | pub const SPLICE_F_GIFT: ::c_uint = 0x08; | |
991 | ||
992 | pub const RTLD_LOCAL: ::c_int = 0; | |
abe05a73 | 993 | pub const RTLD_LAZY: ::c_int = 1; |
476ff2be SL |
994 | |
995 | pub const POSIX_FADV_NORMAL: ::c_int = 0; | |
996 | pub const POSIX_FADV_RANDOM: ::c_int = 1; | |
997 | pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2; | |
998 | pub const POSIX_FADV_WILLNEED: ::c_int = 3; | |
999 | ||
1000 | pub const AT_FDCWD: ::c_int = -100; | |
1001 | pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; | |
7cac9316 XL |
1002 | pub const AT_REMOVEDIR: ::c_int = 0x200; |
1003 | pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; | |
1004 | pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; | |
1005 | pub const AT_EMPTY_PATH: ::c_int = 0x1000; | |
476ff2be SL |
1006 | |
1007 | pub const LOG_CRON: ::c_int = 9 << 3; | |
1008 | pub const LOG_AUTHPRIV: ::c_int = 10 << 3; | |
1009 | pub const LOG_FTP: ::c_int = 11 << 3; | |
1010 | pub const LOG_PERROR: ::c_int = 0x20; | |
1011 | ||
1012 | pub const PIPE_BUF: usize = 4096; | |
1013 | ||
1014 | pub const SI_LOAD_SHIFT: ::c_uint = 16; | |
1015 | ||
8bb4bdeb XL |
1016 | pub const SIGEV_SIGNAL: ::c_int = 0; |
1017 | pub const SIGEV_NONE: ::c_int = 1; | |
1018 | pub const SIGEV_THREAD: ::c_int = 2; | |
1019 | ||
1020 | pub const P_ALL: idtype_t = 0; | |
1021 | pub const P_PID: idtype_t = 1; | |
1022 | pub const P_PGID: idtype_t = 2; | |
1023 | ||
7cac9316 XL |
1024 | pub const UTIME_OMIT: c_long = 1073741822; |
1025 | pub const UTIME_NOW: c_long = 1073741823; | |
1026 | ||
abe05a73 XL |
1027 | pub const POLLIN: ::c_short = 0x1; |
1028 | pub const POLLPRI: ::c_short = 0x2; | |
1029 | pub const POLLOUT: ::c_short = 0x4; | |
1030 | pub const POLLERR: ::c_short = 0x8; | |
1031 | pub const POLLHUP: ::c_short = 0x10; | |
1032 | pub const POLLNVAL: ::c_short = 0x20; | |
3b2f2976 XL |
1033 | pub const POLLRDNORM: ::c_short = 0x040; |
1034 | pub const POLLRDBAND: ::c_short = 0x080; | |
1035 | ||
8faf50e0 XL |
1036 | pub const IPTOS_LOWDELAY: u8 = 0x10; |
1037 | pub const IPTOS_THROUGHPUT: u8 = 0x08; | |
1038 | pub const IPTOS_RELIABILITY: u8 = 0x04; | |
1039 | pub const IPTOS_MINCOST: u8 = 0x02; | |
1040 | ||
1041 | pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0; | |
1042 | pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0; | |
1043 | pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0; | |
1044 | pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80; | |
1045 | pub const IPTOS_PREC_FLASH: u8 = 0x60; | |
1046 | pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40; | |
1047 | pub const IPTOS_PREC_PRIORITY: u8 = 0x20; | |
1048 | pub const IPTOS_PREC_ROUTINE: u8 = 0x00; | |
1049 | ||
0731742a XL |
1050 | pub const IPTOS_ECN_MASK: u8 = 0x03; |
1051 | pub const IPTOS_ECN_ECT1: u8 = 0x01; | |
1052 | pub const IPTOS_ECN_ECT0: u8 = 0x02; | |
1053 | pub const IPTOS_ECN_CE: u8 = 0x03; | |
1054 | ||
8faf50e0 XL |
1055 | pub const IPOPT_COPY: u8 = 0x80; |
1056 | pub const IPOPT_CLASS_MASK: u8 = 0x60; | |
1057 | pub const IPOPT_NUMBER_MASK: u8 = 0x1f; | |
1058 | ||
1059 | pub const IPOPT_CONTROL: u8 = 0x00; | |
1060 | pub const IPOPT_RESERVED1: u8 = 0x20; | |
1061 | pub const IPOPT_MEASUREMENT: u8 = 0x40; | |
1062 | pub const IPOPT_RESERVED2: u8 = 0x60; | |
1063 | pub const IPOPT_END: u8 = (0 |IPOPT_CONTROL); | |
1064 | pub const IPOPT_NOOP: u8 = (1 |IPOPT_CONTROL); | |
1065 | pub const IPOPT_SEC: u8 = (2 |IPOPT_CONTROL|IPOPT_COPY); | |
1066 | pub const IPOPT_LSRR: u8 = (3 |IPOPT_CONTROL|IPOPT_COPY); | |
1067 | pub const IPOPT_TIMESTAMP: u8 = (4 |IPOPT_MEASUREMENT); | |
1068 | pub const IPOPT_RR: u8 = (7 |IPOPT_CONTROL); | |
1069 | pub const IPOPT_SID: u8 = (8 |IPOPT_CONTROL|IPOPT_COPY); | |
1070 | pub const IPOPT_SSRR: u8 = (9 |IPOPT_CONTROL|IPOPT_COPY); | |
1071 | pub const IPOPT_RA: u8 = (20|IPOPT_CONTROL|IPOPT_COPY); | |
1072 | pub const IPVERSION: u8 = 4; | |
1073 | pub const MAXTTL: u8 = 255; | |
1074 | pub const IPDEFTTL: u8 = 64; | |
1075 | pub const IPOPT_OPTVAL: u8 = 0; | |
1076 | pub const IPOPT_OLEN: u8 = 1; | |
1077 | pub const IPOPT_OFFSET: u8 = 2; | |
1078 | pub const IPOPT_MINOFF: u8 = 4; | |
1079 | pub const MAX_IPOPTLEN: u8 = 40; | |
1080 | pub const IPOPT_NOP: u8 = IPOPT_NOOP; | |
1081 | pub const IPOPT_EOL: u8 = IPOPT_END; | |
1082 | pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP; | |
1083 | pub const IPOPT_TS_TSONLY: u8 = 0; | |
1084 | pub const IPOPT_TS_TSANDADDR: u8 = 1; | |
1085 | pub const IPOPT_TS_PRESPEC: u8 = 3; | |
1086 | ||
b7449926 XL |
1087 | pub const ARPOP_RREQUEST: u16 = 3; |
1088 | pub const ARPOP_RREPLY: u16 = 4; | |
1089 | pub const ARPOP_InREQUEST: u16 = 8; | |
1090 | pub const ARPOP_InREPLY: u16 = 9; | |
1091 | pub const ARPOP_NAK: u16 = 10; | |
1092 | ||
1093 | pub const ATF_NETMASK: ::c_int = 0x20; | |
1094 | pub const ATF_DONTPUB: ::c_int = 0x40; | |
1095 | ||
1096 | pub const ARPHRD_NETROM: u16 = 0; | |
1097 | pub const ARPHRD_ETHER: u16 = 1; | |
1098 | pub const ARPHRD_EETHER: u16 = 2; | |
1099 | pub const ARPHRD_AX25: u16 = 3; | |
1100 | pub const ARPHRD_PRONET: u16 = 4; | |
1101 | pub const ARPHRD_CHAOS: u16 = 5; | |
1102 | pub const ARPHRD_IEEE802: u16 = 6; | |
1103 | pub const ARPHRD_ARCNET: u16 = 7; | |
1104 | pub const ARPHRD_APPLETLK: u16 = 8; | |
1105 | pub const ARPHRD_DLCI: u16 = 15; | |
1106 | pub const ARPHRD_ATM: u16 = 19; | |
1107 | pub const ARPHRD_METRICOM: u16 = 23; | |
1108 | pub const ARPHRD_IEEE1394: u16 = 24; | |
1109 | pub const ARPHRD_EUI64: u16 = 27; | |
1110 | pub const ARPHRD_INFINIBAND: u16 = 32; | |
1111 | ||
1112 | pub const ARPHRD_SLIP: u16 = 256; | |
1113 | pub const ARPHRD_CSLIP: u16 = 257; | |
1114 | pub const ARPHRD_SLIP6: u16 = 258; | |
1115 | pub const ARPHRD_CSLIP6: u16 = 259; | |
1116 | pub const ARPHRD_RSRVD: u16 = 260; | |
1117 | pub const ARPHRD_ADAPT: u16 = 264; | |
1118 | pub const ARPHRD_ROSE: u16 = 270; | |
1119 | pub const ARPHRD_X25: u16 = 271; | |
1120 | pub const ARPHRD_HWX25: u16 = 272; | |
1121 | pub const ARPHRD_PPP: u16 = 512; | |
1122 | pub const ARPHRD_CISCO: u16 = 513; | |
1123 | pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO; | |
1124 | pub const ARPHRD_LAPB: u16 = 516; | |
1125 | pub const ARPHRD_DDCMP: u16 = 517; | |
1126 | pub const ARPHRD_RAWHDLC: u16 = 518; | |
1127 | ||
1128 | pub const ARPHRD_TUNNEL: u16 = 768; | |
1129 | pub const ARPHRD_TUNNEL6: u16 = 769; | |
1130 | pub const ARPHRD_FRAD: u16 = 770; | |
1131 | pub const ARPHRD_SKIP: u16 = 771; | |
1132 | pub const ARPHRD_LOOPBACK: u16 = 772; | |
1133 | pub const ARPHRD_LOCALTLK: u16 = 773; | |
1134 | pub const ARPHRD_FDDI: u16 = 774; | |
1135 | pub const ARPHRD_BIF: u16 = 775; | |
1136 | pub const ARPHRD_SIT: u16 = 776; | |
1137 | pub const ARPHRD_IPDDP: u16 = 777; | |
1138 | pub const ARPHRD_IPGRE: u16 = 778; | |
1139 | pub const ARPHRD_PIMREG: u16 = 779; | |
1140 | pub const ARPHRD_HIPPI: u16 = 780; | |
1141 | pub const ARPHRD_ASH: u16 = 781; | |
1142 | pub const ARPHRD_ECONET: u16 = 782; | |
1143 | pub const ARPHRD_IRDA: u16 = 783; | |
1144 | pub const ARPHRD_FCPP: u16 = 784; | |
1145 | pub const ARPHRD_FCAL: u16 = 785; | |
1146 | pub const ARPHRD_FCPL: u16 = 786; | |
1147 | pub const ARPHRD_FCFABRIC: u16 = 787; | |
1148 | pub const ARPHRD_IEEE802_TR: u16 = 800; | |
1149 | pub const ARPHRD_IEEE80211: u16 = 801; | |
1150 | pub const ARPHRD_IEEE80211_PRISM: u16 = 802; | |
1151 | pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803; | |
1152 | pub const ARPHRD_IEEE802154: u16 = 804; | |
1153 | ||
1154 | pub const ARPHRD_VOID: u16 = 0xFFFF; | |
1155 | pub const ARPHRD_NONE: u16 = 0xFFFE; | |
1156 | ||
532ac7d7 XL |
1157 | fn CMSG_ALIGN(len: usize) -> usize { |
1158 | len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1) | |
1159 | } | |
1160 | ||
476ff2be | 1161 | f! { |
69743fb6 | 1162 | pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { |
532ac7d7 | 1163 | if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() { |
69743fb6 XL |
1164 | (*mhdr).msg_control as *mut cmsghdr |
1165 | } else { | |
1166 | 0 as *mut cmsghdr | |
1167 | } | |
1168 | } | |
1169 | ||
69743fb6 XL |
1170 | pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar { |
1171 | cmsg.offset(1) as *mut ::c_uchar | |
1172 | } | |
1173 | ||
1174 | pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { | |
532ac7d7 XL |
1175 | (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>())) |
1176 | as ::c_uint | |
69743fb6 XL |
1177 | } |
1178 | ||
1179 | pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { | |
532ac7d7 | 1180 | CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length |
69743fb6 XL |
1181 | } |
1182 | ||
476ff2be SL |
1183 | pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { |
1184 | let fd = fd as usize; | |
532ac7d7 | 1185 | let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; |
476ff2be SL |
1186 | (*set).fds_bits[fd / size] &= !(1 << (fd % size)); |
1187 | return | |
1188 | } | |
1189 | ||
1190 | pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool { | |
1191 | let fd = fd as usize; | |
532ac7d7 | 1192 | let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; |
476ff2be SL |
1193 | return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0 |
1194 | } | |
1195 | ||
1196 | pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { | |
1197 | let fd = fd as usize; | |
532ac7d7 | 1198 | let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; |
476ff2be SL |
1199 | (*set).fds_bits[fd / size] |= 1 << (fd % size); |
1200 | return | |
1201 | } | |
1202 | ||
1203 | pub fn FD_ZERO(set: *mut fd_set) -> () { | |
1204 | for slot in (*set).fds_bits.iter_mut() { | |
1205 | *slot = 0; | |
1206 | } | |
1207 | } | |
1208 | ||
1209 | pub fn WIFSTOPPED(status: ::c_int) -> bool { | |
1210 | (status & 0xff) == 0x7f | |
1211 | } | |
1212 | ||
1213 | pub fn WSTOPSIG(status: ::c_int) -> ::c_int { | |
1214 | (status >> 8) & 0xff | |
1215 | } | |
1216 | ||
8bb4bdeb XL |
1217 | pub fn WIFCONTINUED(status: ::c_int) -> bool { |
1218 | status == 0xffff | |
1219 | } | |
1220 | ||
476ff2be | 1221 | pub fn WIFSIGNALED(status: ::c_int) -> bool { |
8bb4bdeb | 1222 | ((status & 0x7f) + 1) as i8 >= 2 |
476ff2be SL |
1223 | } |
1224 | ||
1225 | pub fn WTERMSIG(status: ::c_int) -> ::c_int { | |
1226 | status & 0x7f | |
1227 | } | |
1228 | ||
1229 | pub fn WIFEXITED(status: ::c_int) -> bool { | |
1230 | (status & 0x7f) == 0 | |
1231 | } | |
1232 | ||
1233 | pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { | |
1234 | (status >> 8) & 0xff | |
1235 | } | |
1236 | ||
1237 | pub fn WCOREDUMP(status: ::c_int) -> bool { | |
1238 | (status & 0x80) != 0 | |
1239 | } | |
ea8adc8c XL |
1240 | |
1241 | pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int { | |
1242 | (cmd << 8) | (type_ & 0x00ff) | |
1243 | } | |
8faf50e0 XL |
1244 | |
1245 | pub fn IPOPT_COPIED(o: u8) -> u8 { | |
1246 | o & IPOPT_COPY | |
1247 | } | |
1248 | ||
1249 | pub fn IPOPT_CLASS(o: u8) -> u8 { | |
1250 | o & IPOPT_CLASS_MASK | |
1251 | } | |
1252 | ||
1253 | pub fn IPOPT_NUMBER(o: u8) -> u8 { | |
1254 | o & IPOPT_NUMBER_MASK | |
1255 | } | |
0731742a XL |
1256 | |
1257 | pub fn IPTOS_ECN(x: u8) -> u8 { | |
1258 | x & ::IPTOS_ECN_MASK | |
1259 | } | |
476ff2be SL |
1260 | } |
1261 | ||
1262 | extern { | |
532ac7d7 XL |
1263 | pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; |
1264 | pub fn sem_init(sem: *mut sem_t, | |
1265 | pshared: ::c_int, | |
1266 | value: ::c_uint) | |
1267 | -> ::c_int; | |
1268 | ||
476ff2be SL |
1269 | pub fn fdatasync(fd: ::c_int) -> ::c_int; |
1270 | pub fn mincore(addr: *mut ::c_void, len: ::size_t, | |
1271 | vec: *mut ::c_uchar) -> ::c_int; | |
ea8adc8c XL |
1272 | pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; |
1273 | pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; | |
1274 | pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; | |
041b39d2 | 1275 | pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; |
041b39d2 | 1276 | |
476ff2be SL |
1277 | pub fn pthread_getattr_np(native: ::pthread_t, |
1278 | attr: *mut ::pthread_attr_t) -> ::c_int; | |
476ff2be SL |
1279 | pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t, |
1280 | stackaddr: *mut *mut ::c_void, | |
1281 | stacksize: *mut ::size_t) -> ::c_int; | |
1282 | pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; | |
1283 | pub fn setgroups(ngroups: ::size_t, | |
1284 | ptr: *const ::gid_t) -> ::c_int; | |
476ff2be | 1285 | pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; |
476ff2be | 1286 | pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; |
ea8adc8c | 1287 | pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int; |
476ff2be | 1288 | pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; |
ea8adc8c XL |
1289 | pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int; |
1290 | pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int; | |
1291 | pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int; | |
476ff2be SL |
1292 | pub fn memrchr(cx: *const ::c_void, |
1293 | c: ::c_int, | |
1294 | n: ::size_t) -> *mut ::c_void; | |
476ff2be SL |
1295 | |
1296 | pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, | |
1297 | advise: ::c_int) -> ::c_int; | |
1298 | pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; | |
1299 | pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, | |
1300 | times: *const ::timespec, flag: ::c_int) -> ::c_int; | |
1301 | pub fn duplocale(base: ::locale_t) -> ::locale_t; | |
1302 | pub fn freelocale(loc: ::locale_t); | |
1303 | pub fn newlocale(mask: ::c_int, | |
1304 | locale: *const ::c_char, | |
1305 | base: ::locale_t) -> ::locale_t; | |
1306 | pub fn uselocale(loc: ::locale_t) -> ::locale_t; | |
1307 | pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int; | |
1308 | pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int; | |
abe05a73 XL |
1309 | pub fn fstatat64(dirfd: ::c_int, pathname: *const c_char, |
1310 | buf: *mut stat64, flags: ::c_int) -> ::c_int; | |
476ff2be SL |
1311 | pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int; |
1312 | pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int; | |
1313 | pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t; | |
1314 | pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int; | |
1315 | pub fn mmap64(addr: *mut ::c_void, | |
1316 | len: ::size_t, | |
1317 | prot: ::c_int, | |
1318 | flags: ::c_int, | |
1319 | fd: ::c_int, | |
1320 | offset: off64_t) | |
1321 | -> *mut ::c_void; | |
1322 | pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; | |
7cac9316 XL |
1323 | pub fn openat64(fd: ::c_int, |
1324 | path: *const c_char, | |
1325 | oflag: ::c_int, ...) -> ::c_int; | |
476ff2be SL |
1326 | pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, |
1327 | offset: off64_t) -> ::ssize_t; | |
abe05a73 XL |
1328 | pub fn preadv64(fd: ::c_int, |
1329 | iov: *const ::iovec, | |
1330 | iovcnt: ::c_int, | |
1331 | offset: ::off64_t) -> ::ssize_t; | |
476ff2be SL |
1332 | pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t, |
1333 | offset: off64_t) -> ::ssize_t; | |
abe05a73 XL |
1334 | pub fn pwritev64(fd: ::c_int, |
1335 | iov: *const ::iovec, | |
1336 | iovcnt: ::c_int, | |
1337 | offset: ::off64_t) -> ::ssize_t; | |
7cac9316 | 1338 | pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64; |
476ff2be SL |
1339 | pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64, |
1340 | result: *mut *mut ::dirent64) -> ::c_int; | |
1341 | pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int; | |
1342 | pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; | |
7cac9316 | 1343 | pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int; |
476ff2be | 1344 | |
476ff2be SL |
1345 | pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, |
1346 | mode: ::mode_t, dev: dev_t) -> ::c_int; | |
476ff2be SL |
1347 | pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t, |
1348 | clock_id: *mut clockid_t) -> ::c_int; | |
1349 | pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, | |
ea8adc8c | 1350 | clock_id: ::clockid_t) -> ::c_int; |
8bb4bdeb XL |
1351 | pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, |
1352 | pshared: ::c_int) -> ::c_int; | |
476ff2be SL |
1353 | pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t, |
1354 | flg: ::c_int) -> ::c_int; | |
8bb4bdeb XL |
1355 | pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, |
1356 | pshared: ::c_int) -> ::c_int; | |
041b39d2 XL |
1357 | pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t, |
1358 | val: *mut ::c_int) -> ::c_int; | |
1359 | pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, | |
1360 | val: ::c_int) -> ::c_int; | |
8bb4bdeb XL |
1361 | pub fn ptsname_r(fd: ::c_int, |
1362 | buf: *mut ::c_char, | |
1363 | buflen: ::size_t) -> ::c_int; | |
1364 | pub fn clearenv() -> ::c_int; | |
1365 | pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, | |
1366 | options: ::c_int) -> ::c_int; | |
041b39d2 XL |
1367 | pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int; |
1368 | pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int; | |
1369 | pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, | |
1370 | suid: *mut ::uid_t) -> ::c_int; | |
1371 | pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, | |
1372 | sgid: *mut ::gid_t) -> ::c_int; | |
041b39d2 XL |
1373 | pub fn acct(filename: *const ::c_char) -> ::c_int; |
1374 | pub fn brk(addr: *mut ::c_void) -> ::c_int; | |
1375 | pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; | |
1376 | pub fn vfork() -> ::pid_t; | |
041b39d2 XL |
1377 | pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; |
1378 | pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; | |
1379 | pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int, | |
1380 | rusage: *mut ::rusage) -> ::pid_t; | |
1381 | pub fn openpty(amaster: *mut ::c_int, | |
1382 | aslave: *mut ::c_int, | |
1383 | name: *mut ::c_char, | |
1384 | termp: *const termios, | |
1385 | winp: *const ::winsize) -> ::c_int; | |
3b2f2976 XL |
1386 | pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char, |
1387 | envp: *const *const ::c_char) -> ::c_int; | |
ea8adc8c XL |
1388 | pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, |
1389 | envp: *const *const ::c_char) | |
1390 | -> ::c_int; | |
8faf50e0 XL |
1391 | pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; |
1392 | pub fn freeifaddrs(ifa: *mut ::ifaddrs); | |
1393 | pub fn bind(socket: ::c_int, address: *const ::sockaddr, | |
1394 | address_len: ::socklen_t) -> ::c_int; | |
1395 | ||
1396 | pub fn writev(fd: ::c_int, | |
1397 | iov: *const ::iovec, | |
1398 | iovcnt: ::c_int) -> ::ssize_t; | |
1399 | pub fn readv(fd: ::c_int, | |
1400 | iov: *const ::iovec, | |
1401 | iovcnt: ::c_int) -> ::ssize_t; | |
1402 | ||
1403 | pub fn sendmsg(fd: ::c_int, | |
1404 | msg: *const ::msghdr, | |
1405 | flags: ::c_int) -> ::ssize_t; | |
1406 | pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) | |
1407 | -> ::ssize_t; | |
532ac7d7 | 1408 | pub fn uname(buf: *mut ::utsname) -> ::c_int; |
476ff2be SL |
1409 | } |
1410 | ||
1411 | cfg_if! { | |
ea8adc8c XL |
1412 | if #[cfg(target_os = "emscripten")] { |
1413 | mod emscripten; | |
1414 | pub use self::emscripten::*; | |
69743fb6 | 1415 | } else if #[cfg(target_os = "linux")] { |
476ff2be SL |
1416 | mod linux; |
1417 | pub use self::linux::*; | |
1418 | } else if #[cfg(target_os = "android")] { | |
1419 | mod android; | |
1420 | pub use self::android::*; | |
1421 | } else { | |
1422 | // Unknown target_os | |
1423 | } | |
1424 | } | |
ea8adc8c XL |
1425 | // pub fn forkpty(amaster: *mut ::c_int, |
1426 | // name: *mut ::c_char, | |
1427 | // termp: *const termios, | |
1428 | // winp: *const ::winsize) -> ::pid_t; |