]> git.proxmox.com Git - rustc.git/blame - src/liblibc/lib.rs
Imported Upstream version 1.3.0+dfsg1
[rustc.git] / src / liblibc / lib.rs
CommitLineData
1a4d82fc
JJ
1// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
c34b1796
AL
11// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
12#![cfg_attr(stage0, feature(custom_attribute))]
1a4d82fc
JJ
13#![crate_name = "libc"]
14#![crate_type = "rlib"]
bd371182
AL
15#![cfg_attr(not(feature = "cargo-build"), unstable(feature = "libc",
16 reason = "use `libc` from crates.io"))]
c34b1796 17#![cfg_attr(not(feature = "cargo-build"), feature(staged_api, core, no_std))]
1a4d82fc 18#![cfg_attr(not(feature = "cargo-build"), staged_api)]
c34b1796 19#![cfg_attr(not(feature = "cargo-build"), no_std)]
1a4d82fc 20#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
62682a34 21 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1a4d82fc
JJ
22 html_root_url = "http://doc.rust-lang.org/nightly/",
23 html_playground_url = "http://play.rust-lang.org/")]
85aaf69f 24#![cfg_attr(test, feature(test))]
1a4d82fc
JJ
25
26//! Bindings for the C standard library and other platform libraries
27//!
28//! **NOTE:** These are *architecture and libc* specific. On Linux, these
29//! bindings are only correct for glibc.
30//!
31//! This module contains bindings to the C standard library, organized into
32//! modules by their defining standard. Additionally, it contains some assorted
33//! platform-specific definitions. For convenience, most functions and types
34//! are reexported, so `use libc::*` will import the available C bindings as
35//! appropriate for the target platform. The exact set of functions available
36//! are platform specific.
37//!
38//! *Note:* Because these definitions are platform-specific, some may not appear
39//! in the generated documentation.
40//!
41//! We consider the following specs reasonably normative with respect to
42//! interoperating with the C standard library (libc/msvcrt):
43//!
44//! * ISO 9899:1990 ('C95', 'ANSI C', 'Standard C'), NA1, 1995.
45//! * ISO 9899:1999 ('C99' or 'C9x').
46//! * ISO 9945:1988 / IEEE 1003.1-1988 ('POSIX.1').
47//! * ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
48//! * ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
49//!
50//! Note that any reference to the 1996 revision of POSIX, or any revs between
51//! 1990 (when '88 was approved at ISO) and 2001 (when the next actual
52//! revision-revision happened), are merely additions of other chapters (1b and
53//! 1c) outside the core interfaces.
54//!
55//! Despite having several names each, these are *reasonably* coherent
56//! point-in-time, list-of-definition sorts of specs. You can get each under a
57//! variety of names but will wind up with the same definition in each case.
58//!
59//! See standards(7) in linux-manpages for more details.
60//!
61//! Our interface to these libraries is complicated by the non-universality of
62//! conformance to any of them. About the only thing universally supported is
63//! the first (C95), beyond that definitions quickly become absent on various
64//! platforms.
65//!
66//! We therefore wind up dividing our module-space up (mostly for the sake of
67//! sanity while editing, filling-in-details and eliminating duplication) into
68//! definitions common-to-all (held in modules named c95, c99, posix88, posix01
69//! and posix08) and definitions that appear only on *some* platforms (named
70//! 'extra'). This would be things like significant OSX foundation kit, or Windows
71//! library kernel32.dll, or various fancy glibc, Linux or BSD extensions.
72//!
73//! In addition to the per-platform 'extra' modules, we define a module of
74//! 'common BSD' libc routines that never quite made it into POSIX but show up
75//! in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the final
76//! one from Berkeley after the lawsuits died down and the CSRG dissolved.
77
78#![allow(bad_style, raw_pointer_derive)]
c34b1796
AL
79#![cfg_attr(target_os = "nacl", allow(unused_imports))]
80#[cfg(feature = "cargo-build")] extern crate std as core;
1a4d82fc
JJ
81#[cfg(not(feature = "cargo-build"))] extern crate core;
82
83#[cfg(test)] extern crate std;
84#[cfg(test)] extern crate test;
85
86// Explicit export lists for the intersection (provided here) mean that
87// you can write more-platform-agnostic code if you stick to just these
88// symbols.
89
c34b1796
AL
90pub use types::common::c95::*;
91pub use types::common::c99::*;
92pub use types::common::posix88::*;
93pub use types::os::common::posix01::*;
94pub use types::os::common::bsd44::*;
95pub use types::os::arch::c95::*;
96pub use types::os::arch::c99::*;
97pub use types::os::arch::posix88::*;
98pub use types::os::arch::posix01::*;
99pub use types::os::arch::extra::*;
100
101pub use consts::os::c95::*;
102pub use consts::os::posix88::*;
103pub use consts::os::posix01::*;
104pub use consts::os::bsd44::*;
105pub use consts::os::extra::*;
106
107pub use funcs::c95::ctype::*;
108pub use funcs::c95::stdio::*;
109pub use funcs::c95::stdlib::*;
110pub use funcs::c95::string::*;
111pub use funcs::posix88::fcntl::*;
112pub use funcs::posix88::stat_::*;
113pub use funcs::posix88::stdio::*;
114pub use funcs::posix88::unistd::*;
115
116pub use funcs::bsd43::*;
1a4d82fc
JJ
117
118// But we also reexport most everything
119// if you're interested in writing platform-specific code.
120
121// FIXME: This is a mess, but the design of this entire module needs to be
122// reconsidered, so I'm not inclined to do better right now. As part of
123// #11870 I removed all the pub globs here, leaving explicit reexports
124// of everything that is actually used in-tree.
125//
126// So the following exports don't follow any particular plan.
127
c34b1796
AL
128#[cfg(unix)] pub use consts::os::sysconf::*;
129
130#[cfg(unix)] pub use funcs::posix88::mman::*;
131#[cfg(unix)] pub use funcs::posix88::dirent::*;
132#[cfg(unix)] pub use funcs::posix88::net::*;
133#[cfg(unix)] pub use funcs::posix01::stat_::*;
134#[cfg(unix)] pub use funcs::posix01::unistd::*;
135#[cfg(unix)] pub use funcs::posix01::resource::*;
136
137
138#[cfg(windows)] pub use funcs::extra::kernel32::*;
139#[cfg(windows)] pub use funcs::extra::winsock::*;
140#[cfg(windows)] pub use funcs::extra::msvcrt::*;
141
142// On NaCl, these libraries are static. Thus it would be a Bad Idea to link them
143// in when creating a test crate.
d9579d0f 144#[cfg(not(any(windows, target_env = "musl", all(target_os = "nacl", test))))]
1a4d82fc
JJ
145#[link(name = "c")]
146#[link(name = "m")]
147extern {}
148
62682a34
SL
149// When compiling rust with musl, statically include libc.a in liblibc.rlib.
150// A cargo build of the libc crate will therefore automatically pick up the
151// libc.a symbols because liblibc is transitively linked to by the stdlib.
152#[cfg(all(target_env = "musl", not(feature = "cargo-build"), not(test)))]
d9579d0f
AL
153#[link(name = "c", kind = "static")]
154extern {}
155
62682a34
SL
156#[cfg(all(windows, target_env = "msvc"))]
157#[link(name = "kernel32")]
158#[link(name = "shell32")]
159#[link(name = "msvcrt")]
160extern {}
161
c34b1796
AL
162// libnacl provides functions that require a trip through the IRT to work.
163// ie: _exit, mmap, nanosleep, etc. Anything that would otherwise require a trip
164// to the kernel.
165#[cfg(all(target_os = "nacl", not(feature = "cargo-build"), not(test)))]
166#[link(name = "nacl", kind = "static")]
167extern {}
168
169// pnaclmm provides a number of functions that the toolchain's Clang emits calls
170// to when codegening atomic ops. All the functions within wrap various atomic
171// operations.
172// Yes, it could be linked by rustc explicitly, however by linking it here
173// instead we save a bit of time where bins are involved (by not running the
174// optimizations on the whole pnaclmm foreach binary built).
175#[cfg(all(target_os = "nacl", not(feature = "cargo-build"), not(test)))]
176#[link(name = "pnaclmm", kind = "static")]
177extern {}
178
1a4d82fc
JJ
179pub mod types {
180
181 // Types tend to vary *per architecture* so we pull their definitions out
182 // into this module.
183
184 // Standard types that are opaque or common, so are not per-target.
185 pub mod common {
186 pub mod c95 {
187 /// Type used to construct void pointers for use with C.
188 ///
189 /// This type is only useful as a pointer target. Do not use it as a
190 /// return type for FFI functions which have the `void` return type in
191 /// C. Use the unit type `()` or omit the return type instead.
192 ///
193 /// For LLVM to recognize the void pointer type and by extension
194 /// functions like malloc(), we need to have it represented as i8* in
195 /// LLVM bitcode. The enum used here ensures this and prevents misuse
196 /// of the "raw" type by only having private variants.. We need two
197 /// variants, because the compiler complains about the repr attribute
198 /// otherwise.
199 #[repr(u8)]
1a4d82fc
JJ
200 pub enum c_void {
201 __variant1,
202 __variant2,
203 }
204
1a4d82fc 205 pub enum FILE {}
1a4d82fc
JJ
206 pub enum fpos_t {}
207 }
208 pub mod c99 {
209 pub type int8_t = i8;
210 pub type int16_t = i16;
211 pub type int32_t = i32;
212 pub type int64_t = i64;
213 pub type uint8_t = u8;
214 pub type uint16_t = u16;
215 pub type uint32_t = u32;
216 pub type uint64_t = u64;
217 }
218 pub mod posix88 {
1a4d82fc 219 pub enum DIR {}
1a4d82fc
JJ
220 pub enum dirent_t {}
221 }
222 pub mod posix01 {}
223 pub mod posix08 {}
224 pub mod bsd44 {}
225 }
226
227 // Standard types that are scalar but vary by OS and arch.
228
c34b1796 229 #[cfg(any(target_os = "linux", target_os = "android", target_os = "nacl"))]
1a4d82fc
JJ
230 pub mod os {
231 pub mod common {
232 pub mod posix01 {
233 use types::common::c95::{c_void};
234 use types::os::arch::c95::{c_char, c_ulong, size_t,
235 time_t, suseconds_t, c_long};
236
c34b1796 237 #[cfg(not(target_os = "nacl"))]
1a4d82fc 238 pub type pthread_t = c_ulong;
c34b1796
AL
239 #[cfg(target_os = "nacl")]
240 pub type pthread_t = *mut c_void;
241 pub type rlim_t = u64;
1a4d82fc
JJ
242
243 #[repr(C)]
c34b1796 244 #[derive(Copy, Clone)] pub struct glob_t {
1a4d82fc
JJ
245 pub gl_pathc: size_t,
246 pub gl_pathv: *mut *mut c_char,
247 pub gl_offs: size_t,
248
249 pub __unused1: *mut c_void,
250 pub __unused2: *mut c_void,
251 pub __unused3: *mut c_void,
252 pub __unused4: *mut c_void,
253 pub __unused5: *mut c_void,
254 }
255
256 #[repr(C)]
c34b1796 257 #[derive(Copy, Clone)] pub struct timeval {
1a4d82fc
JJ
258 pub tv_sec: time_t,
259 pub tv_usec: suseconds_t,
260 }
261
262 #[repr(C)]
c34b1796 263 #[derive(Copy, Clone)] pub struct timespec {
1a4d82fc
JJ
264 pub tv_sec: time_t,
265 pub tv_nsec: c_long,
266 }
267
c34b1796 268 pub enum timezone {}
1a4d82fc
JJ
269
270 pub type sighandler_t = size_t;
c34b1796
AL
271
272 #[repr(C)]
273 #[derive(Copy, Clone)]
274 pub struct rlimit {
275 pub rlim_cur: rlim_t,
276 pub rlim_max: rlim_t,
277 }
278 }
279
280 pub mod bsd43 {
281 use types::os::common::posix01::timeval;
282 use types::os::arch::c95::c_long;
283 // This is also specified in POSIX 2001, but only has two fields. All implementors
284 // implement BSD 4.3 version.
285 #[repr(C)]
286 #[derive(Copy, Clone)]
287 pub struct rusage {
288 pub ru_utime: timeval,
289 pub ru_stime: timeval,
290 pub ru_maxrss: c_long,
291 pub ru_ixrss: c_long,
292 pub ru_idrss: c_long,
293 pub ru_isrss: c_long,
294 pub ru_minflt: c_long,
295 pub ru_majflt: c_long,
296 pub ru_nswap: c_long,
297 pub ru_inblock: c_long,
298 pub ru_oublock: c_long,
299 pub ru_msgsnd: c_long,
300 pub ru_msgrcv: c_long,
301 pub ru_nsignals: c_long,
302 pub ru_nvcsw: c_long,
303 pub ru_nivcsw: c_long
304 }
1a4d82fc 305 }
c34b1796 306
1a4d82fc
JJ
307 pub mod bsd44 {
308 use types::common::c95::{c_void};
309 use types::os::arch::c95::{c_char, c_int, c_uint};
310
311 pub type socklen_t = u32;
312 pub type sa_family_t = u16;
313 pub type in_port_t = u16;
314 pub type in_addr_t = u32;
315 #[repr(C)]
c34b1796 316 #[derive(Copy, Clone)] pub struct sockaddr {
1a4d82fc
JJ
317 pub sa_family: sa_family_t,
318 pub sa_data: [u8; 14],
319 }
320 #[repr(C)]
321 #[derive(Copy)] pub struct sockaddr_storage {
322 pub ss_family: sa_family_t,
c34b1796
AL
323 pub __ss_align: isize,
324 #[cfg(target_pointer_width = "32")]
325 pub __ss_pad2: [u8; 128 - 2 * 4],
326 #[cfg(target_pointer_width = "64")]
327 pub __ss_pad2: [u8; 128 - 2 * 8],
328 }
329 impl ::core::clone::Clone for sockaddr_storage {
330 fn clone(&self) -> sockaddr_storage { *self }
1a4d82fc
JJ
331 }
332 #[repr(C)]
c34b1796 333 #[derive(Copy, Clone)] pub struct sockaddr_in {
1a4d82fc
JJ
334 pub sin_family: sa_family_t,
335 pub sin_port: in_port_t,
336 pub sin_addr: in_addr,
337 pub sin_zero: [u8; 8],
338 }
339 #[repr(C)]
c34b1796 340 #[derive(Copy, Clone)] pub struct in_addr {
1a4d82fc
JJ
341 pub s_addr: in_addr_t,
342 }
343 #[repr(C)]
c34b1796 344 #[derive(Copy, Clone)] pub struct sockaddr_in6 {
1a4d82fc
JJ
345 pub sin6_family: sa_family_t,
346 pub sin6_port: in_port_t,
347 pub sin6_flowinfo: u32,
348 pub sin6_addr: in6_addr,
349 pub sin6_scope_id: u32,
350 }
351 #[repr(C)]
c34b1796 352 #[derive(Copy, Clone)] pub struct in6_addr {
1a4d82fc
JJ
353 pub s6_addr: [u16; 8]
354 }
355 #[repr(C)]
c34b1796 356 #[derive(Copy, Clone)] pub struct ip_mreq {
1a4d82fc
JJ
357 pub imr_multiaddr: in_addr,
358 pub imr_interface: in_addr,
359 }
360 #[repr(C)]
c34b1796 361 #[derive(Copy, Clone)] pub struct ip6_mreq {
1a4d82fc
JJ
362 pub ipv6mr_multiaddr: in6_addr,
363 pub ipv6mr_interface: c_uint,
364 }
365 #[repr(C)]
c34b1796 366 #[derive(Copy, Clone)] pub struct addrinfo {
1a4d82fc
JJ
367 pub ai_flags: c_int,
368 pub ai_family: c_int,
369 pub ai_socktype: c_int,
370 pub ai_protocol: c_int,
371 pub ai_addrlen: socklen_t,
372
373 #[cfg(target_os = "linux")]
374 pub ai_addr: *mut sockaddr,
375
376 #[cfg(target_os = "linux")]
377 pub ai_canonname: *mut c_char,
378
c34b1796 379 #[cfg(any(target_os = "android", target_os = "nacl"))]
1a4d82fc
JJ
380 pub ai_canonname: *mut c_char,
381
c34b1796 382 #[cfg(any(target_os = "android", target_os = "nacl"))]
1a4d82fc
JJ
383 pub ai_addr: *mut sockaddr,
384
385 pub ai_next: *mut addrinfo,
386 }
387 #[repr(C)]
388 #[derive(Copy)] pub struct sockaddr_un {
389 pub sun_family: sa_family_t,
390 pub sun_path: [c_char; 108]
391 }
c34b1796
AL
392 impl ::core::clone::Clone for sockaddr_un {
393 fn clone(&self) -> sockaddr_un { *self }
394 }
1a4d82fc
JJ
395
396 #[repr(C)]
c34b1796 397 #[derive(Copy, Clone)] pub struct ifaddrs {
1a4d82fc
JJ
398 pub ifa_next: *mut ifaddrs,
399 pub ifa_name: *mut c_char,
400 pub ifa_flags: c_uint,
401 pub ifa_addr: *mut sockaddr,
402 pub ifa_netmask: *mut sockaddr,
403 pub ifa_ifu: *mut sockaddr, // FIXME This should be a union
404 pub ifa_data: *mut c_void
405 }
406
407 }
408 }
409
410 #[cfg(any(target_arch = "x86",
411 target_arch = "arm",
412 target_arch = "mips",
85aaf69f 413 target_arch = "mipsel",
c34b1796
AL
414 target_arch = "powerpc",
415 target_arch = "le32"))]
1a4d82fc
JJ
416 pub mod arch {
417 pub mod c95 {
418 pub type c_char = i8;
419 pub type c_schar = i8;
420 pub type c_uchar = u8;
421 pub type c_short = i16;
422 pub type c_ushort = u16;
423 pub type c_int = i32;
424 pub type c_uint = u32;
425 pub type c_long = i32;
426 pub type c_ulong = u32;
427 pub type c_float = f32;
428 pub type c_double = f64;
429 pub type size_t = u32;
430 pub type ptrdiff_t = i32;
431 pub type clock_t = i32;
432 pub type time_t = i32;
433 pub type suseconds_t = i32;
434 pub type wchar_t = i32;
435 }
436 pub mod c99 {
437 pub type c_longlong = i64;
438 pub type c_ulonglong = u64;
439 pub type intptr_t = i32;
440 pub type uintptr_t = u32;
441 pub type intmax_t = i64;
442 pub type uintmax_t = u64;
443 }
c1a9b12d 444 #[cfg(any(target_arch = "mips",
85aaf69f 445 target_arch = "mipsel",
c34b1796
AL
446 target_arch = "powerpc",
447 target_arch = "le32",
c1a9b12d
SL
448 all(any(target_arch = "arm", target_arch = "x86"),
449 not(target_os = "android"))))]
1a4d82fc
JJ
450 pub mod posix88 {
451 pub type off_t = i32;
452 pub type dev_t = u64;
453 pub type ino_t = u32;
454 pub type pid_t = i32;
455 pub type uid_t = u32;
456 pub type gid_t = u32;
457 pub type useconds_t = u32;
458 pub type mode_t = u32;
459 pub type ssize_t = i32;
460 }
c1a9b12d
SL
461 #[cfg(all(any(target_arch = "arm", target_arch = "x86"),
462 target_os = "android"))]
1a4d82fc
JJ
463 pub mod posix88 {
464 pub type off_t = i32;
465 pub type dev_t = u32;
466 pub type ino_t = u32;
467 pub type pid_t = i32;
468 pub type uid_t = u32;
469 pub type gid_t = u32;
470 pub type useconds_t = u32;
471 pub type mode_t = u16;
472 pub type ssize_t = i32;
473 }
85aaf69f 474 #[cfg(any(target_arch = "x86",
c34b1796
AL
475 target_arch = "le32",
476 target_arch = "powerpc",
c1a9b12d
SL
477 all(any(target_arch = "arm", target_arch = "x86"),
478 not(target_os = "android"))))]
1a4d82fc
JJ
479 pub mod posix01 {
480 use types::os::arch::c95::{c_short, c_long, time_t};
481 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
482 use types::os::arch::posix88::{mode_t, off_t};
483 use types::os::arch::posix88::{uid_t};
484
485 pub type nlink_t = u32;
486 pub type blksize_t = i32;
487 pub type blkcnt_t = i32;
488
489 #[repr(C)]
c34b1796 490 #[derive(Copy, Clone)] pub struct stat {
1a4d82fc
JJ
491 pub st_dev: dev_t,
492 pub __pad1: c_short,
493 pub st_ino: ino_t,
494 pub st_mode: mode_t,
495 pub st_nlink: nlink_t,
496 pub st_uid: uid_t,
497 pub st_gid: gid_t,
498 pub st_rdev: dev_t,
499 pub __pad2: c_short,
500 pub st_size: off_t,
501 pub st_blksize: blksize_t,
502 pub st_blocks: blkcnt_t,
503 pub st_atime: time_t,
504 pub st_atime_nsec: c_long,
505 pub st_mtime: time_t,
506 pub st_mtime_nsec: c_long,
507 pub st_ctime: time_t,
508 pub st_ctime_nsec: c_long,
509 pub __unused4: c_long,
510 pub __unused5: c_long,
511 }
512
513 #[repr(C)]
c34b1796 514 #[derive(Copy, Clone)] pub struct utimbuf {
1a4d82fc
JJ
515 pub actime: time_t,
516 pub modtime: time_t,
517 }
518
519 #[repr(C)]
c34b1796 520 #[derive(Copy, Clone)] pub struct pthread_attr_t {
1a4d82fc
JJ
521 pub __size: [u32; 9]
522 }
523 }
c1a9b12d
SL
524 #[cfg(all(any(target_arch = "arm", target_arch = "x86"),
525 target_os = "android"))]
1a4d82fc
JJ
526 pub mod posix01 {
527 use types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
528 use types::os::arch::c99::{c_longlong, c_ulonglong};
529 use types::os::arch::posix88::{uid_t, gid_t, ino_t};
530
531 pub type nlink_t = u16;
532 pub type blksize_t = u32;
533 pub type blkcnt_t = u32;
534
535 #[repr(C)]
c34b1796 536 #[derive(Copy, Clone)] pub struct stat {
1a4d82fc
JJ
537 pub st_dev: c_ulonglong,
538 pub __pad0: [c_uchar; 4],
539 pub __st_ino: ino_t,
540 pub st_mode: c_uint,
541 pub st_nlink: c_uint,
542 pub st_uid: uid_t,
543 pub st_gid: gid_t,
544 pub st_rdev: c_ulonglong,
545 pub __pad3: [c_uchar; 4],
546 pub st_size: c_longlong,
547 pub st_blksize: blksize_t,
548 pub st_blocks: c_ulonglong,
549 pub st_atime: time_t,
550 pub st_atime_nsec: c_ulong,
551 pub st_mtime: time_t,
552 pub st_mtime_nsec: c_ulong,
553 pub st_ctime: time_t,
554 pub st_ctime_nsec: c_ulong,
555 pub st_ino: c_ulonglong,
556 }
557
558 #[repr(C)]
c34b1796 559 #[derive(Copy, Clone)] pub struct utimbuf {
1a4d82fc
JJ
560 pub actime: time_t,
561 pub modtime: time_t,
562 }
563
564 #[repr(C)]
c34b1796 565 #[derive(Copy, Clone)] pub struct pthread_attr_t {
1a4d82fc
JJ
566 pub __size: [u32; 9]
567 }
568 }
85aaf69f
SL
569 #[cfg(any(target_arch = "mips",
570 target_arch = "mipsel"))]
1a4d82fc
JJ
571 pub mod posix01 {
572 use types::os::arch::c95::{c_long, c_ulong, time_t};
573 use types::os::arch::posix88::{gid_t, ino_t};
574 use types::os::arch::posix88::{mode_t, off_t};
575 use types::os::arch::posix88::{uid_t};
576
577 pub type nlink_t = u32;
578 pub type blksize_t = i32;
579 pub type blkcnt_t = i32;
580
581 #[repr(C)]
c34b1796 582 #[derive(Copy, Clone)] pub struct stat {
1a4d82fc
JJ
583 pub st_dev: c_ulong,
584 pub st_pad1: [c_long; 3],
585 pub st_ino: ino_t,
586 pub st_mode: mode_t,
587 pub st_nlink: nlink_t,
588 pub st_uid: uid_t,
589 pub st_gid: gid_t,
590 pub st_rdev: c_ulong,
591 pub st_pad2: [c_long; 2],
592 pub st_size: off_t,
593 pub st_pad3: c_long,
594 pub st_atime: time_t,
595 pub st_atime_nsec: c_long,
596 pub st_mtime: time_t,
597 pub st_mtime_nsec: c_long,
598 pub st_ctime: time_t,
599 pub st_ctime_nsec: c_long,
600 pub st_blksize: blksize_t,
601 pub st_blocks: blkcnt_t,
602 pub st_pad5: [c_long; 14],
603 }
604
605 #[repr(C)]
c34b1796 606 #[derive(Copy, Clone)] pub struct utimbuf {
1a4d82fc
JJ
607 pub actime: time_t,
608 pub modtime: time_t,
609 }
610
611 #[repr(C)]
c34b1796 612 #[derive(Copy, Clone)] pub struct pthread_attr_t {
1a4d82fc
JJ
613 pub __size: [u32; 9]
614 }
615 }
616 pub mod posix08 {}
617 pub mod bsd44 {}
618 pub mod extra {
619 use types::os::arch::c95::{c_ushort, c_int, c_uchar};
620 #[repr(C)]
c34b1796 621 #[derive(Copy, Clone)] pub struct sockaddr_ll {
1a4d82fc
JJ
622 pub sll_family: c_ushort,
623 pub sll_protocol: c_ushort,
624 pub sll_ifindex: c_int,
625 pub sll_hatype: c_ushort,
626 pub sll_pkttype: c_uchar,
627 pub sll_halen: c_uchar,
628 pub sll_addr: [c_uchar; 8]
629 }
630 }
631
632 }
633
634 #[cfg(any(target_arch = "x86_64",
635 target_arch = "aarch64"))]
636 pub mod arch {
637 pub mod c95 {
638 #[cfg(not(target_arch = "aarch64"))]
639 pub type c_char = i8;
640 #[cfg(target_arch = "aarch64")]
641 pub type c_char = u8;
642 pub type c_schar = i8;
643 pub type c_uchar = u8;
644 pub type c_short = i16;
645 pub type c_ushort = u16;
646 pub type c_int = i32;
647 pub type c_uint = u32;
648 pub type c_long = i64;
649 pub type c_ulong = u64;
650 pub type c_float = f32;
651 pub type c_double = f64;
652 pub type size_t = u64;
653 pub type ptrdiff_t = i64;
654 pub type clock_t = i64;
655 pub type time_t = i64;
656 pub type suseconds_t = i64;
657 #[cfg(not(target_arch = "aarch64"))]
658 pub type wchar_t = i32;
659 #[cfg(target_arch = "aarch64")]
660 pub type wchar_t = u32;
661 }
662 pub mod c99 {
663 pub type c_longlong = i64;
664 pub type c_ulonglong = u64;
665 pub type intptr_t = i64;
666 pub type uintptr_t = u64;
667 pub type intmax_t = i64;
668 pub type uintmax_t = u64;
669 }
670 pub mod posix88 {
671 pub type off_t = i64;
672 pub type dev_t = u64;
673 pub type ino_t = u64;
674 pub type pid_t = i32;
675 pub type uid_t = u32;
676 pub type gid_t = u32;
677 pub type useconds_t = u32;
678 pub type mode_t = u32;
679 pub type ssize_t = i64;
680 }
681 #[cfg(not(target_arch = "aarch64"))]
682 pub mod posix01 {
683 use types::os::arch::c95::{c_int, c_long, time_t};
684 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
685 use types::os::arch::posix88::{mode_t, off_t};
686 use types::os::arch::posix88::{uid_t};
687
688 pub type nlink_t = u64;
689 pub type blksize_t = i64;
690 pub type blkcnt_t = i64;
691
692 #[repr(C)]
c34b1796 693 #[derive(Copy, Clone)] pub struct stat {
1a4d82fc
JJ
694 pub st_dev: dev_t,
695 pub st_ino: ino_t,
696 pub st_nlink: nlink_t,
697 pub st_mode: mode_t,
698 pub st_uid: uid_t,
699 pub st_gid: gid_t,
700 pub __pad0: c_int,
701 pub st_rdev: dev_t,
702 pub st_size: off_t,
703 pub st_blksize: blksize_t,
704 pub st_blocks: blkcnt_t,
705 pub st_atime: time_t,
706 pub st_atime_nsec: c_long,
707 pub st_mtime: time_t,
708 pub st_mtime_nsec: c_long,
709 pub st_ctime: time_t,
710 pub st_ctime_nsec: c_long,
711 pub __unused: [c_long; 3],
712 }
713
714 #[repr(C)]
c34b1796 715 #[derive(Copy, Clone)] pub struct utimbuf {
1a4d82fc
JJ
716 pub actime: time_t,
717 pub modtime: time_t,
718 }
719
720 #[repr(C)]
c34b1796 721 #[derive(Copy, Clone)] pub struct pthread_attr_t {
1a4d82fc
JJ
722 pub __size: [u64; 7]
723 }
724 }
725 #[cfg(target_arch = "aarch64")]
726 pub mod posix01 {
727 use types::os::arch::c95::{c_int, c_long, time_t};
728 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
729 use types::os::arch::posix88::{mode_t, off_t};
730 use types::os::arch::posix88::{uid_t};
731
732 pub type nlink_t = u32;
733 pub type blksize_t = i32;
734 pub type blkcnt_t = i64;
735
736 #[repr(C)]
c34b1796 737 #[derive(Copy, Clone)] pub struct stat {
1a4d82fc
JJ
738 pub st_dev: dev_t,
739 pub st_ino: ino_t,
740 pub st_mode: mode_t,
741 pub st_nlink: nlink_t,
742 pub st_uid: uid_t,
743 pub st_gid: gid_t,
744 pub st_rdev: dev_t,
745 pub __pad1: dev_t,
746 pub st_size: off_t,
747 pub st_blksize: blksize_t,
748 pub __pad2: c_int,
749 pub st_blocks: blkcnt_t,
750 pub st_atime: time_t,
751 pub st_atime_nsec: c_long,
752 pub st_mtime: time_t,
753 pub st_mtime_nsec: c_long,
754 pub st_ctime: time_t,
755 pub st_ctime_nsec: c_long,
756 pub __unused: [c_int; 2],
757 }
758
759 #[repr(C)]
c34b1796 760 #[derive(Copy, Clone)] pub struct utimbuf {
1a4d82fc
JJ
761 pub actime: time_t,
762 pub modtime: time_t,
763 }
764
765 #[repr(C)]
c34b1796 766 #[derive(Copy, Clone)] pub struct pthread_attr_t {
1a4d82fc
JJ
767 pub __size: [u64; 8]
768 }
769 }
770 pub mod posix08 {
771 }
772 pub mod bsd44 {
773 }
774 pub mod extra {
775 use types::os::arch::c95::{c_ushort, c_int, c_uchar};
c34b1796 776 #[derive(Copy, Clone)] pub struct sockaddr_ll {
1a4d82fc
JJ
777 pub sll_family: c_ushort,
778 pub sll_protocol: c_ushort,
779 pub sll_ifindex: c_int,
780 pub sll_hatype: c_ushort,
781 pub sll_pkttype: c_uchar,
782 pub sll_halen: c_uchar,
783 pub sll_addr: [c_uchar; 8]
784 }
785
786 }
787 }
788 }
789
790 #[cfg(target_os = "freebsd")]
791 pub mod os {
792 pub mod common {
793 pub mod posix01 {
794 use types::common::c95::{c_void};
795 use types::os::arch::c95::{c_char, c_int, size_t,
796 time_t, suseconds_t, c_long};
797 use types::os::arch::c99::{uintptr_t};
798
799 pub type pthread_t = uintptr_t;
c34b1796 800 pub type rlim_t = i64;
1a4d82fc
JJ
801
802 #[repr(C)]
c34b1796 803 #[derive(Copy, Clone)] pub struct glob_t {
1a4d82fc
JJ
804 pub gl_pathc: size_t,
805 pub __unused1: size_t,
806 pub gl_offs: size_t,
807 pub __unused2: c_int,
808 pub gl_pathv: *mut *mut c_char,
809
810 pub __unused3: *mut c_void,
811
812 pub __unused4: *mut c_void,
813 pub __unused5: *mut c_void,
814 pub __unused6: *mut c_void,
815 pub __unused7: *mut c_void,
816 pub __unused8: *mut c_void,
817 }
818
819 #[repr(C)]
c34b1796 820 #[derive(Copy, Clone)] pub struct timeval {
1a4d82fc
JJ
821 pub tv_sec: time_t,
822 pub tv_usec: suseconds_t,
823 }
824
825 #[repr(C)]
c34b1796 826 #[derive(Copy, Clone)] pub struct timespec {
1a4d82fc
JJ
827 pub tv_sec: time_t,
828 pub tv_nsec: c_long,
829 }
830
c34b1796 831 pub enum timezone {}
1a4d82fc
JJ
832
833 pub type sighandler_t = size_t;
c34b1796
AL
834
835 #[repr(C)]
836 #[derive(Copy, Clone)]
837 pub struct rlimit {
838 pub rlim_cur: rlim_t,
839 pub rlim_max: rlim_t,
840 }
1a4d82fc 841 }
c34b1796
AL
842
843 pub mod bsd43 {
844 use types::os::common::posix01::timeval;
845 use types::os::arch::c95::c_long;
846 #[repr(C)]
847 #[derive(Copy, Clone)]
848 pub struct rusage {
849 pub ru_utime: timeval,
850 pub ru_stime: timeval,
851 pub ru_maxrss: c_long,
852 pub ru_ixrss: c_long,
853 pub ru_idrss: c_long,
854 pub ru_isrss: c_long,
855 pub ru_minflt: c_long,
856 pub ru_majflt: c_long,
857 pub ru_nswap: c_long,
858 pub ru_inblock: c_long,
859 pub ru_oublock: c_long,
860 pub ru_msgsnd: c_long,
861 pub ru_msgrcv: c_long,
862 pub ru_nsignals: c_long,
863 pub ru_nvcsw: c_long,
864 pub ru_nivcsw: c_long
865 }
866 }
867
1a4d82fc
JJ
868 pub mod bsd44 {
869 use types::common::c95::{c_void};
870 use types::os::arch::c95::{c_char, c_int, c_uint};
871
872 pub type socklen_t = u32;
873 pub type sa_family_t = u8;
874 pub type in_port_t = u16;
875 pub type in_addr_t = u32;
876 #[repr(C)]
c34b1796 877 #[derive(Copy, Clone)] pub struct sockaddr {
1a4d82fc
JJ
878 pub sa_len: u8,
879 pub sa_family: sa_family_t,
880 pub sa_data: [u8; 14],
881 }
882 #[repr(C)]
9346a6ac 883 #[derive(Copy)] pub struct sockaddr_storage {
1a4d82fc
JJ
884 pub ss_len: u8,
885 pub ss_family: sa_family_t,
886 pub __ss_pad1: [u8; 6],
887 pub __ss_align: i64,
888 pub __ss_pad2: [u8; 112],
889 }
9346a6ac
AL
890 impl ::core::clone::Clone for sockaddr_storage {
891 fn clone(&self) -> sockaddr_storage { *self }
892 }
1a4d82fc 893 #[repr(C)]
c34b1796 894 #[derive(Copy, Clone)] pub struct sockaddr_in {
1a4d82fc
JJ
895 pub sin_len: u8,
896 pub sin_family: sa_family_t,
897 pub sin_port: in_port_t,
898 pub sin_addr: in_addr,
899 pub sin_zero: [u8; 8],
900 }
901 #[repr(C)]
c34b1796 902 #[derive(Copy, Clone)] pub struct in_addr {
1a4d82fc
JJ
903 pub s_addr: in_addr_t,
904 }
905 #[repr(C)]
c34b1796 906 #[derive(Copy, Clone)] pub struct sockaddr_in6 {
1a4d82fc
JJ
907 pub sin6_len: u8,
908 pub sin6_family: sa_family_t,
909 pub sin6_port: in_port_t,
910 pub sin6_flowinfo: u32,
911 pub sin6_addr: in6_addr,
912 pub sin6_scope_id: u32,
913 }
914 #[repr(C)]
c34b1796 915 #[derive(Copy, Clone)] pub struct in6_addr {
1a4d82fc
JJ
916 pub s6_addr: [u16; 8]
917 }
918 #[repr(C)]
c34b1796 919 #[derive(Copy, Clone)] pub struct ip_mreq {
1a4d82fc
JJ
920 pub imr_multiaddr: in_addr,
921 pub imr_interface: in_addr,
922 }
923 #[repr(C)]
c34b1796 924 #[derive(Copy, Clone)] pub struct ip6_mreq {
1a4d82fc
JJ
925 pub ipv6mr_multiaddr: in6_addr,
926 pub ipv6mr_interface: c_uint,
927 }
928 #[repr(C)]
c34b1796 929 #[derive(Copy, Clone)] pub struct addrinfo {
1a4d82fc
JJ
930 pub ai_flags: c_int,
931 pub ai_family: c_int,
932 pub ai_socktype: c_int,
933 pub ai_protocol: c_int,
934 pub ai_addrlen: socklen_t,
935 pub ai_canonname: *mut c_char,
936 pub ai_addr: *mut sockaddr,
937 pub ai_next: *mut addrinfo,
938 }
939 #[repr(C)]
9346a6ac 940 #[derive(Copy)] pub struct sockaddr_un {
1a4d82fc
JJ
941 pub sun_len: u8,
942 pub sun_family: sa_family_t,
943 pub sun_path: [c_char; 104]
944 }
9346a6ac
AL
945 impl ::core::clone::Clone for sockaddr_un {
946 fn clone(&self) -> sockaddr_un { *self }
947 }
1a4d82fc 948 #[repr(C)]
c34b1796 949 #[derive(Copy, Clone)] pub struct ifaddrs {
1a4d82fc
JJ
950 pub ifa_next: *mut ifaddrs,
951 pub ifa_name: *mut c_char,
952 pub ifa_flags: c_uint,
953 pub ifa_addr: *mut sockaddr,
954 pub ifa_netmask: *mut sockaddr,
955 pub ifa_dstaddr: *mut sockaddr,
956 pub ifa_data: *mut c_void
957 }
958
959
960 }
961 }
962
c1a9b12d
SL
963 #[cfg(target_arch = "x86")]
964 pub mod arch {
965 pub mod c95 {
966 pub type c_char = i8;
967 pub type c_schar = i8;
968 pub type c_uchar = u8;
969 pub type c_short = i16;
970 pub type c_ushort = u16;
971 pub type c_int = i32;
972 pub type c_uint = u32;
973 pub type c_long = i32;
974 pub type c_ulong = u32;
975 pub type c_float = f32;
976 pub type c_double = f64;
977 pub type size_t = u32;
978 pub type ptrdiff_t = i32;
979 pub type clock_t = i32;
980 pub type time_t = i32;
981 pub type suseconds_t = i32;
982 pub type wchar_t = i32;
983 }
984 pub mod c99 {
985 pub type c_longlong = i64;
986 pub type c_ulonglong = u64;
987 pub type intptr_t = i32;
988 pub type uintptr_t = u32;
989 pub type intmax_t = i64;
990 pub type uintmax_t = u64;
991 }
992 pub mod posix88 {
993 pub type off_t = i64;
994 pub type dev_t = u32;
995 pub type ino_t = u32;
996 pub type pid_t = i32;
997 pub type uid_t = u32;
998 pub type gid_t = u32;
999 pub type useconds_t = u32;
1000 pub type mode_t = u16;
1001 pub type ssize_t = i32;
1002 }
1003 pub mod posix01 {
1004 use types::common::c95::{c_void};
1005 use types::common::c99::{uint32_t, int32_t};
1006 use types::os::arch::c95::{c_long, time_t};
1007 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
1008 use types::os::arch::posix88::{mode_t, off_t};
1009 use types::os::arch::posix88::{uid_t};
1010
1011 pub type nlink_t = u16;
1012 pub type blksize_t = u32;
1013 pub type blkcnt_t = i64;
1014 pub type fflags_t = u32;
1015 #[repr(C)]
1016 #[derive(Copy, Clone)] pub struct stat {
1017 pub st_dev: dev_t,
1018 pub st_ino: ino_t,
1019 pub st_mode: mode_t,
1020 pub st_nlink: nlink_t,
1021 pub st_uid: uid_t,
1022 pub st_gid: gid_t,
1023 pub st_rdev: dev_t,
1024 pub st_atime: time_t,
1025 pub st_atime_nsec: c_long,
1026 pub st_mtime: time_t,
1027 pub st_mtime_nsec: c_long,
1028 pub st_ctime: time_t,
1029 pub st_ctime_nsec: c_long,
1030 pub st_size: off_t,
1031 pub st_blocks: blkcnt_t,
1032 pub st_blksize: blksize_t,
1033 pub st_flags: fflags_t,
1034 pub st_gen: uint32_t,
1035 pub st_lspare: int32_t,
1036 pub st_birthtime: time_t,
1037 pub st_birthtime_nsec: c_long,
1038 pub __unused: [u8; 8],
1039 }
1040
1041 #[repr(C)]
1042 #[derive(Copy, Clone)] pub struct utimbuf {
1043 pub actime: time_t,
1044 pub modtime: time_t,
1045 }
1046
1047 pub type pthread_attr_t = *mut c_void;
1048 }
1049 pub mod posix08 {
1050 }
1051 pub mod bsd44 {
1052 }
1053 pub mod extra {
1054 }
1055 }
1056
1a4d82fc
JJ
1057 #[cfg(target_arch = "x86_64")]
1058 pub mod arch {
1059 pub mod c95 {
1060 pub type c_char = i8;
1061 pub type c_schar = i8;
1062 pub type c_uchar = u8;
1063 pub type c_short = i16;
1064 pub type c_ushort = u16;
1065 pub type c_int = i32;
1066 pub type c_uint = u32;
1067 pub type c_long = i64;
1068 pub type c_ulong = u64;
1069 pub type c_float = f32;
1070 pub type c_double = f64;
1071 pub type size_t = u64;
1072 pub type ptrdiff_t = i64;
1073 pub type clock_t = i32;
1074 pub type time_t = i64;
1075 pub type suseconds_t = i64;
1076 pub type wchar_t = i32;
1077 }
1078 pub mod c99 {
1079 pub type c_longlong = i64;
1080 pub type c_ulonglong = u64;
1081 pub type intptr_t = i64;
1082 pub type uintptr_t = u64;
1083 pub type intmax_t = i64;
1084 pub type uintmax_t = u64;
1085 }
1086 pub mod posix88 {
1087 pub type off_t = i64;
1088 pub type dev_t = u32;
1089 pub type ino_t = u32;
1090 pub type pid_t = i32;
1091 pub type uid_t = u32;
1092 pub type gid_t = u32;
1093 pub type useconds_t = u32;
1094 pub type mode_t = u16;
1095 pub type ssize_t = i64;
1096 }
1097 pub mod posix01 {
1098 use types::common::c95::{c_void};
c1a9b12d 1099 use types::common::c99::{uint32_t, int32_t};
1a4d82fc
JJ
1100 use types::os::arch::c95::{c_long, time_t};
1101 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
1102 use types::os::arch::posix88::{mode_t, off_t};
1103 use types::os::arch::posix88::{uid_t};
1104
1105 pub type nlink_t = u16;
c1a9b12d 1106 pub type blksize_t = u32;
1a4d82fc
JJ
1107 pub type blkcnt_t = i64;
1108 pub type fflags_t = u32;
1109 #[repr(C)]
c34b1796 1110 #[derive(Copy, Clone)] pub struct stat {
1a4d82fc
JJ
1111 pub st_dev: dev_t,
1112 pub st_ino: ino_t,
1113 pub st_mode: mode_t,
1114 pub st_nlink: nlink_t,
1115 pub st_uid: uid_t,
1116 pub st_gid: gid_t,
1117 pub st_rdev: dev_t,
1118 pub st_atime: time_t,
1119 pub st_atime_nsec: c_long,
1120 pub st_mtime: time_t,
1121 pub st_mtime_nsec: c_long,
1122 pub st_ctime: time_t,
1123 pub st_ctime_nsec: c_long,
1124 pub st_size: off_t,
1125 pub st_blocks: blkcnt_t,
1126 pub st_blksize: blksize_t,
1127 pub st_flags: fflags_t,
1128 pub st_gen: uint32_t,
1129 pub st_lspare: int32_t,
1130 pub st_birthtime: time_t,
1131 pub st_birthtime_nsec: c_long,
1a4d82fc
JJ
1132 }
1133
1134 #[repr(C)]
c34b1796 1135 #[derive(Copy, Clone)] pub struct utimbuf {
1a4d82fc
JJ
1136 pub actime: time_t,
1137 pub modtime: time_t,
1138 }
1139
1140 pub type pthread_attr_t = *mut c_void;
1141 }
1142 pub mod posix08 {
1143 }
1144 pub mod bsd44 {
1145 }
1146 pub mod extra {
1147 }
1148 }
1149 }
1150
1151 #[cfg(target_os = "dragonfly")]
1152 pub mod os {
1153 pub mod common {
1154 pub mod posix01 {
1155 use types::common::c95::{c_void};
1156 use types::os::arch::c95::{c_char, c_int, size_t,
1157 time_t, suseconds_t, c_long};
1158 use types::os::arch::c99::{uintptr_t};
1159
1160 pub type pthread_t = uintptr_t;
c34b1796 1161 pub type rlim_t = i64;
1a4d82fc
JJ
1162
1163 #[repr(C)]
c34b1796 1164 #[derive(Copy, Clone)] pub struct glob_t {
1a4d82fc
JJ
1165 pub gl_pathc: size_t,
1166 pub __unused1: size_t,
1167 pub gl_offs: size_t,
1168 pub __unused2: c_int,
1169 pub gl_pathv: *mut *mut c_char,
1170
1171 pub __unused3: *mut c_void,
1172
1173 pub __unused4: *mut c_void,
1174 pub __unused5: *mut c_void,
1175 pub __unused6: *mut c_void,
1176 pub __unused7: *mut c_void,
1177 pub __unused8: *mut c_void,
1178 }
1179
1180 #[repr(C)]
c34b1796 1181 #[derive(Copy, Clone)] pub struct timeval {
1a4d82fc
JJ
1182 pub tv_sec: time_t,
1183 pub tv_usec: suseconds_t,
1184 }
1185
1186 #[repr(C)]
c34b1796 1187 #[derive(Copy, Clone)] pub struct timespec {
1a4d82fc
JJ
1188 pub tv_sec: time_t,
1189 pub tv_nsec: c_long,
1190 }
1191
c34b1796 1192 pub enum timezone {}
1a4d82fc
JJ
1193
1194 pub type sighandler_t = size_t;
c34b1796
AL
1195
1196 #[repr(C)]
1197 #[derive(Copy, Clone)]
1198 pub struct rlimit {
1199 pub rlim_cur: rlim_t,
1200 pub rlim_max: rlim_t,
1201 }
1a4d82fc 1202 }
c34b1796
AL
1203
1204 pub mod bsd43 {
1205 use types::os::common::posix01::timeval;
1206 use types::os::arch::c95::c_long;
1207 #[repr(C)]
1208 #[derive(Copy, Clone)]
1209 pub struct rusage {
1210 pub ru_utime: timeval,
1211 pub ru_stime: timeval,
1212 pub ru_maxrss: c_long,
1213 pub ru_ixrss: c_long,
1214 pub ru_idrss: c_long,
1215 pub ru_isrss: c_long,
1216 pub ru_minflt: c_long,
1217 pub ru_majflt: c_long,
1218 pub ru_nswap: c_long,
1219 pub ru_inblock: c_long,
1220 pub ru_oublock: c_long,
1221 pub ru_msgsnd: c_long,
1222 pub ru_msgrcv: c_long,
1223 pub ru_nsignals: c_long,
1224 pub ru_nvcsw: c_long,
1225 pub ru_nivcsw: c_long
1226 }
1227 }
1228
1a4d82fc
JJ
1229 pub mod bsd44 {
1230 use types::common::c95::{c_void};
1231 use types::os::arch::c95::{c_char, c_int, c_uint};
1232
1233 pub type socklen_t = u32;
1234 pub type sa_family_t = u8;
1235 pub type in_port_t = u16;
1236 pub type in_addr_t = u32;
1237 #[repr(C)]
c34b1796 1238 #[derive(Copy, Clone)] pub struct sockaddr {
1a4d82fc
JJ
1239 pub sa_len: u8,
1240 pub sa_family: sa_family_t,
1241 pub sa_data: [u8; 14],
1242 }
1243 #[repr(C)]
9346a6ac 1244 #[derive(Copy)] pub struct sockaddr_storage {
1a4d82fc
JJ
1245 pub ss_len: u8,
1246 pub ss_family: sa_family_t,
1247 pub __ss_pad1: [u8; 6],
1248 pub __ss_align: i64,
1249 pub __ss_pad2: [u8; 112],
1250 }
9346a6ac
AL
1251 impl ::core::clone::Clone for sockaddr_storage {
1252 fn clone(&self) -> sockaddr_storage { *self }
1253 }
1a4d82fc 1254 #[repr(C)]
c34b1796 1255 #[derive(Copy, Clone)] pub struct sockaddr_in {
1a4d82fc
JJ
1256 pub sin_len: u8,
1257 pub sin_family: sa_family_t,
1258 pub sin_port: in_port_t,
1259 pub sin_addr: in_addr,
1260 pub sin_zero: [u8; 8],
1261 }
1262 #[repr(C)]
c34b1796 1263 #[derive(Copy, Clone)] pub struct in_addr {
1a4d82fc
JJ
1264 pub s_addr: in_addr_t,
1265 }
1266 #[repr(C)]
c34b1796 1267 #[derive(Copy, Clone)] pub struct sockaddr_in6 {
1a4d82fc
JJ
1268 pub sin6_len: u8,
1269 pub sin6_family: sa_family_t,
1270 pub sin6_port: in_port_t,
1271 pub sin6_flowinfo: u32,
1272 pub sin6_addr: in6_addr,
1273 pub sin6_scope_id: u32,
1274 }
1275 #[repr(C)]
c34b1796 1276 #[derive(Copy, Clone)] pub struct in6_addr {
1a4d82fc
JJ
1277 pub s6_addr: [u16; 8]
1278 }
1279 #[repr(C)]
c34b1796 1280 #[derive(Copy, Clone)] pub struct ip_mreq {
1a4d82fc
JJ
1281 pub imr_multiaddr: in_addr,
1282 pub imr_interface: in_addr,
1283 }
1284 #[repr(C)]
c34b1796 1285 #[derive(Copy, Clone)] pub struct ip6_mreq {
1a4d82fc
JJ
1286 pub ipv6mr_multiaddr: in6_addr,
1287 pub ipv6mr_interface: c_uint,
1288 }
1289 #[repr(C)]
c34b1796 1290 #[derive(Copy, Clone)] pub struct addrinfo {
1a4d82fc
JJ
1291 pub ai_flags: c_int,
1292 pub ai_family: c_int,
1293 pub ai_socktype: c_int,
1294 pub ai_protocol: c_int,
1295 pub ai_addrlen: socklen_t,
1296 pub ai_canonname: *mut c_char,
1297 pub ai_addr: *mut sockaddr,
1298 pub ai_next: *mut addrinfo,
1299 }
1300 #[repr(C)]
9346a6ac 1301 #[derive(Copy)] pub struct sockaddr_un {
1a4d82fc
JJ
1302 pub sun_len: u8,
1303 pub sun_family: sa_family_t,
1304 pub sun_path: [c_char; 104]
1305 }
9346a6ac
AL
1306 impl ::core::clone::Clone for sockaddr_un {
1307 fn clone(&self) -> sockaddr_un { *self }
1308 }
1a4d82fc 1309 #[repr(C)]
c34b1796 1310 #[derive(Copy, Clone)] pub struct ifaddrs {
1a4d82fc
JJ
1311 pub ifa_next: *mut ifaddrs,
1312 pub ifa_name: *mut c_char,
1313 pub ifa_flags: c_uint,
1314 pub ifa_addr: *mut sockaddr,
1315 pub ifa_netmask: *mut sockaddr,
1316 pub ifa_dstaddr: *mut sockaddr,
1317 pub ifa_data: *mut c_void
1318 }
1319
1320 }
1321 }
1322
1323 #[cfg(target_arch = "x86_64")]
1324 pub mod arch {
1325 pub mod c95 {
1326 pub type c_char = i8;
1327 pub type c_schar = i8;
1328 pub type c_uchar = u8;
1329 pub type c_short = i16;
1330 pub type c_ushort = u16;
1331 pub type c_int = i32;
1332 pub type c_uint = u32;
1333 pub type c_long = i64;
1334 pub type c_ulong = u64;
1335 pub type c_float = f32;
1336 pub type c_double = f64;
1337 pub type size_t = u64;
1338 pub type ptrdiff_t = i64;
1339 pub type clock_t = i32;
1340 pub type time_t = i64;
1341 pub type suseconds_t = i64;
1342 pub type wchar_t = i32;
1343 }
1344 pub mod c99 {
1345 pub type c_longlong = i64;
1346 pub type c_ulonglong = u64;
1347 pub type intptr_t = i64;
1348 pub type uintptr_t = u64;
1349 pub type intmax_t = i64;
1350 pub type uintmax_t = u64;
1351 }
1352 pub mod posix88 {
1353 pub type off_t = i64;
1354 pub type dev_t = u32;
1a4d82fc
JJ
1355 pub type pid_t = i32;
1356 pub type uid_t = u32;
1357 pub type gid_t = u32;
1358 pub type useconds_t = u32;
1359 pub type mode_t = u16;
1360 pub type ssize_t = i64;
1361 }
1362 pub mod posix01 {
1363 use types::common::c95::{c_void};
1364 use types::common::c99::{uint16_t, uint32_t, int32_t, uint64_t, int64_t};
1365 use types::os::arch::c95::{c_long, time_t};
1366 use types::os::arch::posix88::{dev_t, gid_t};
1367 use types::os::arch::posix88::{mode_t, off_t};
1368 use types::os::arch::posix88::{uid_t};
1369
1370 pub type nlink_t = u16;
1371 pub type blksize_t = uint32_t;
1372 pub type ino_t = uint64_t;
1373 pub type blkcnt_t = i64;
1374 pub type fflags_t = u32;
1375
1376 #[repr(C)]
c34b1796 1377 #[derive(Copy, Clone)] pub struct stat {
1a4d82fc
JJ
1378 pub st_ino: ino_t,
1379 pub st_nlink: nlink_t,
1380 pub st_dev: dev_t,
1381 pub st_mode: mode_t,
1382 pub st_padding1: uint16_t,
1383 pub st_uid: uid_t,
1384 pub st_gid: gid_t,
1385 pub st_rdev: dev_t,
1386 pub st_atime: time_t,
1387 pub st_atime_nsec: c_long,
1388 pub st_mtime: time_t,
1389 pub st_mtime_nsec: c_long,
1390 pub st_ctime: time_t,
1391 pub st_ctime_nsec: c_long,
1392 pub st_size: off_t,
1393 pub st_blocks: blkcnt_t,
1394 pub st_blksize: blksize_t,
1395 pub st_flags: fflags_t,
1396 pub st_gen: uint32_t,
1397 pub st_lspare: int32_t,
1398 pub st_qspare1: int64_t,
1399 pub st_qspare2: int64_t,
1400 }
1401 #[repr(C)]
c34b1796 1402 #[derive(Copy, Clone)] pub struct utimbuf {
1a4d82fc
JJ
1403 pub actime: time_t,
1404 pub modtime: time_t,
1405 }
1406
1407 pub type pthread_attr_t = *mut c_void;
1408 }
1409 pub mod posix08 {
1410 }
1411 pub mod bsd44 {
1412 }
1413 pub mod extra {
1414 }
1415 }
1416 }
1417
c1a9b12d 1418 #[cfg(any(target_os = "bitrig", target_os = "netbsd", target_os ="openbsd"))]
85aaf69f
SL
1419 pub mod os {
1420 pub mod common {
1421 pub mod posix01 {
1422 use types::common::c95::{c_void};
1423 use types::os::arch::c95::{c_char, c_int, size_t,
1424 time_t, suseconds_t, c_long};
1425 use types::os::arch::c99::{uintptr_t};
1426
1427 pub type pthread_t = uintptr_t;
c34b1796
AL
1428 pub type rlim_t = u64;
1429
1430 #[cfg(target_os = "bitrig")]
1431 #[repr(C)]
1432 #[derive(Copy, Clone)] pub struct glob_t {
1433 pub gl_pathc: c_int,
1434 pub gl_matchc: c_int,
1435 pub gl_offs: c_int,
1436 pub gl_flags: c_int,
1437 pub gl_pathv: *mut *mut c_char,
1438 pub __unused1: *mut c_void,
1439 pub __unused2: *mut c_void,
1440 pub __unused3: *mut c_void,
1441 pub __unused4: *mut c_void,
1442 pub __unused5: *mut c_void,
1443 pub __unused6: *mut c_void,
1444 pub __unused7: *mut c_void,
1445 }
85aaf69f 1446
c1a9b12d 1447 #[cfg(any(target_os = "netbsd", target_os="openbsd"))]
85aaf69f 1448 #[repr(C)]
c34b1796 1449 #[derive(Copy, Clone)] pub struct glob_t {
85aaf69f
SL
1450 pub gl_pathc: c_int,
1451 pub __unused1: c_int,
1452 pub gl_offs: c_int,
1453 pub __unused2: c_int,
1454 pub gl_pathv: *mut *mut c_char,
1455
1456 pub __unused3: *mut c_void,
1457
1458 pub __unused4: *mut c_void,
1459 pub __unused5: *mut c_void,
1460 pub __unused6: *mut c_void,
1461 pub __unused7: *mut c_void,
1462 pub __unused8: *mut c_void,
1463 pub __unused9: *mut c_void,
1464 }
1465
1466 #[repr(C)]
c34b1796 1467 #[derive(Copy, Clone)] pub struct timeval {
85aaf69f
SL
1468 pub tv_sec: time_t,
1469 pub tv_usec: suseconds_t,
1470 }
1471
1472 #[repr(C)]
c34b1796 1473 #[derive(Copy, Clone)] pub struct timespec {
85aaf69f
SL
1474 pub tv_sec: time_t,
1475 pub tv_nsec: c_long,
1476 }
1477
c34b1796 1478 pub enum timezone {}
85aaf69f
SL
1479
1480 pub type sighandler_t = size_t;
c34b1796
AL
1481
1482 #[repr(C)]
1483 #[derive(Copy, Clone)]
1484 pub struct rlimit {
1485 pub rlim_cur: rlim_t,
1486 pub rlim_max: rlim_t,
1487 }
85aaf69f 1488 }
c34b1796
AL
1489
1490 pub mod bsd43 {
1491 use types::os::common::posix01::timeval;
1492 use types::os::arch::c95::c_long;
1493 #[repr(C)]
1494 #[derive(Copy, Clone)]
1495 pub struct rusage {
1496 pub ru_utime: timeval,
1497 pub ru_stime: timeval,
1498 pub ru_maxrss: c_long,
1499 pub ru_ixrss: c_long,
1500 pub ru_idrss: c_long,
1501 pub ru_isrss: c_long,
1502 pub ru_minflt: c_long,
1503 pub ru_majflt: c_long,
1504 pub ru_nswap: c_long,
1505 pub ru_inblock: c_long,
1506 pub ru_oublock: c_long,
1507 pub ru_msgsnd: c_long,
1508 pub ru_msgrcv: c_long,
1509 pub ru_nsignals: c_long,
1510 pub ru_nvcsw: c_long,
1511 pub ru_nivcsw: c_long
1512 }
1513 }
1514
85aaf69f
SL
1515 pub mod bsd44 {
1516 use types::common::c95::{c_void};
1517 use types::os::arch::c95::{c_char, c_int, c_uint};
1518
1519 pub type socklen_t = u32;
1520 pub type sa_family_t = u8;
1521 pub type in_port_t = u16;
1522 pub type in_addr_t = u32;
1523 #[repr(C)]
c34b1796 1524 #[derive(Copy, Clone)] pub struct sockaddr {
85aaf69f
SL
1525 pub sa_len: u8,
1526 pub sa_family: sa_family_t,
1527 pub sa_data: [u8; 14],
1528 }
1529 #[repr(C)]
9346a6ac 1530 #[derive(Copy)] pub struct sockaddr_storage {
85aaf69f
SL
1531 pub ss_len: u8,
1532 pub ss_family: sa_family_t,
1533 pub __ss_pad1: [u8; 6],
1534 pub __ss_pad2: i64,
1535 pub __ss_pad3: [u8; 240],
1536 }
9346a6ac
AL
1537 impl ::core::clone::Clone for sockaddr_storage {
1538 fn clone(&self) -> sockaddr_storage { *self }
1539 }
85aaf69f 1540 #[repr(C)]
c34b1796 1541 #[derive(Copy, Clone)] pub struct sockaddr_in {
85aaf69f
SL
1542 pub sin_len: u8,
1543 pub sin_family: sa_family_t,
1544 pub sin_port: in_port_t,
1545 pub sin_addr: in_addr,
1546 pub sin_zero: [u8; 8],
1547 }
1548 #[repr(C)]
c34b1796 1549 #[derive(Copy, Clone)] pub struct in_addr {
85aaf69f
SL
1550 pub s_addr: in_addr_t,
1551 }
1552 #[repr(C)]
c34b1796 1553 #[derive(Copy, Clone)] pub struct sockaddr_in6 {
85aaf69f
SL
1554 pub sin6_len: u8,
1555 pub sin6_family: sa_family_t,
1556 pub sin6_port: in_port_t,
1557 pub sin6_flowinfo: u32,
1558 pub sin6_addr: in6_addr,
1559 pub sin6_scope_id: u32,
1560 }
1561 #[repr(C)]
c34b1796 1562 #[derive(Copy, Clone)] pub struct in6_addr {
85aaf69f
SL
1563 pub s6_addr: [u16; 8]
1564 }
1565 #[repr(C)]
c34b1796 1566 #[derive(Copy, Clone)] pub struct ip_mreq {
85aaf69f
SL
1567 pub imr_multiaddr: in_addr,
1568 pub imr_interface: in_addr,
1569 }
1570 #[repr(C)]
c34b1796 1571 #[derive(Copy, Clone)] pub struct ip6_mreq {
85aaf69f
SL
1572 pub ipv6mr_multiaddr: in6_addr,
1573 pub ipv6mr_interface: c_uint,
1574 }
1575 #[repr(C)]
c34b1796 1576 #[derive(Copy, Clone)] pub struct addrinfo {
85aaf69f
SL
1577 pub ai_flags: c_int,
1578 pub ai_family: c_int,
1579 pub ai_socktype: c_int,
1580 pub ai_protocol: c_int,
1581 pub ai_addrlen: socklen_t,
1582 pub ai_addr: *mut sockaddr,
1583 pub ai_canonname: *mut c_char,
1584 pub ai_next: *mut addrinfo,
1585 }
1586 #[repr(C)]
9346a6ac 1587 #[derive(Copy)] pub struct sockaddr_un {
85aaf69f
SL
1588 pub sun_len: u8,
1589 pub sun_family: sa_family_t,
1590 pub sun_path: [c_char; 104]
1591 }
9346a6ac
AL
1592 impl ::core::clone::Clone for sockaddr_un {
1593 fn clone(&self) -> sockaddr_un { *self }
1594 }
85aaf69f 1595 #[repr(C)]
c34b1796 1596 #[derive(Copy, Clone)] pub struct ifaddrs {
85aaf69f
SL
1597 pub ifa_next: *mut ifaddrs,
1598 pub ifa_name: *mut c_char,
1599 pub ifa_flags: c_uint,
1600 pub ifa_addr: *mut sockaddr,
1601 pub ifa_netmask: *mut sockaddr,
1602 pub ifa_dstaddr: *mut sockaddr,
1603 pub ifa_data: *mut c_void
1604 }
85aaf69f
SL
1605 }
1606 }
1607
1608 #[cfg(target_arch = "x86_64")]
1609 pub mod arch {
1610 pub mod c95 {
1611 pub type c_char = i8;
1612 pub type c_schar = i8;
1613 pub type c_uchar = u8;
1614 pub type c_short = i16;
1615 pub type c_ushort = u16;
1616 pub type c_int = i32;
1617 pub type c_uint = u32;
1618 pub type c_long = i64;
1619 pub type c_ulong = u64;
1620 pub type c_float = f32;
1621 pub type c_double = f64;
1622 pub type size_t = u64;
1623 pub type ptrdiff_t = i64;
1624 pub type clock_t = i64;
1625 pub type time_t = i64;
1626 pub type suseconds_t = i64;
1627 pub type wchar_t = i32;
1628 }
1629 pub mod c99 {
1630 pub type c_longlong = i64;
1631 pub type c_ulonglong = u64;
1632 pub type intptr_t = i64;
1633 pub type uintptr_t = u64;
1634 pub type intmax_t = i64;
1635 pub type uintmax_t = u64;
1636 }
1637 pub mod posix88 {
c34b1796 1638 use types::os::arch::c95::{c_long};
85aaf69f 1639 pub type off_t = i64;
c34b1796 1640 pub type dev_t = i32;
85aaf69f
SL
1641 pub type pid_t = i32;
1642 pub type uid_t = u32;
1643 pub type gid_t = u32;
1644 pub type useconds_t = u32;
1645 pub type mode_t = u32;
c34b1796 1646 pub type ssize_t = c_long;
85aaf69f
SL
1647 }
1648 pub mod posix01 {
1649 use types::common::c95::{c_void};
1650 use types::common::c99::{uint32_t, uint64_t};
1651 use types::os::arch::c95::{c_long, time_t};
1652 use types::os::arch::posix88::{dev_t, gid_t};
1653 use types::os::arch::posix88::{mode_t, off_t};
1654 use types::os::arch::posix88::{uid_t};
1655
c34b1796 1656 pub type nlink_t = uint32_t;
85aaf69f
SL
1657 pub type blksize_t = uint32_t;
1658 pub type ino_t = uint64_t;
1659 pub type blkcnt_t = i64;
1660 pub type fflags_t = u32; // type not declared, but struct stat have u_int32_t
1661
1662 #[repr(C)]
c34b1796 1663 #[derive(Copy, Clone)] pub struct stat {
85aaf69f
SL
1664 pub st_mode: mode_t,
1665 pub st_dev: dev_t,
1666 pub st_ino: ino_t,
1667 pub st_nlink: nlink_t,
1668 pub st_uid: uid_t,
1669 pub st_gid: gid_t,
1670 pub st_rdev: dev_t,
1671 pub st_atime: time_t,
1672 pub st_atime_nsec: c_long,
1673 pub st_mtime: time_t,
1674 pub st_mtime_nsec: c_long,
1675 pub st_ctime: time_t,
1676 pub st_ctime_nsec: c_long,
1677 pub st_size: off_t,
1678 pub st_blocks: blkcnt_t,
1679 pub st_blksize: blksize_t,
1680 pub st_flags: fflags_t,
1681 pub st_gen: uint32_t,
1682 pub st_birthtime: time_t,
1683 pub st_birthtime_nsec: c_long,
1684 }
1685 #[repr(C)]
c34b1796 1686 #[derive(Copy, Clone)] pub struct utimbuf {
85aaf69f
SL
1687 pub actime: time_t,
1688 pub modtime: time_t,
1689 }
1690
1691 pub type pthread_attr_t = *mut c_void;
1692 }
1693 pub mod posix08 {
1694 }
1695 pub mod bsd44 {
1696 }
1697 pub mod extra {
1698 }
1699 }
1700 }
1701
1a4d82fc
JJ
1702 #[cfg(target_os = "windows")]
1703 pub mod os {
1704 pub mod common {
1705 pub mod posix01 {
1706 use types::os::arch::c95::{c_short, time_t, c_long};
1707 use types::os::arch::extra::{int64, time64_t};
1708 use types::os::arch::posix88::{dev_t, ino_t};
1709
1710 // pub Note: this is the struct called stat64 in Windows. Not stat,
1711 // nor stati64.
1712 #[repr(C)]
c34b1796 1713 #[derive(Copy, Clone)] pub struct stat {
1a4d82fc
JJ
1714 pub st_dev: dev_t,
1715 pub st_ino: ino_t,
1716 pub st_mode: u16,
1717 pub st_nlink: c_short,
1718 pub st_uid: c_short,
1719 pub st_gid: c_short,
1720 pub st_rdev: dev_t,
1721 pub st_size: int64,
1722 pub st_atime: time64_t,
1723 pub st_mtime: time64_t,
1724 pub st_ctime: time64_t,
1725 }
1726
1727 // note that this is called utimbuf64 in Windows
1728 #[repr(C)]
c34b1796 1729 #[derive(Copy, Clone)] pub struct utimbuf {
1a4d82fc
JJ
1730 pub actime: time64_t,
1731 pub modtime: time64_t,
1732 }
1733
1734 #[repr(C)]
c34b1796 1735 #[derive(Copy, Clone)] pub struct timeval {
1a4d82fc
JJ
1736 pub tv_sec: c_long,
1737 pub tv_usec: c_long,
1738 }
1739
1740 #[repr(C)]
c34b1796 1741 #[derive(Copy, Clone)] pub struct timespec {
1a4d82fc
JJ
1742 pub tv_sec: time_t,
1743 pub tv_nsec: c_long,
1744 }
1745
c34b1796 1746 pub enum timezone {}
1a4d82fc
JJ
1747 }
1748
1749 pub mod bsd44 {
1750 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1751 use types::os::arch::c99::uintptr_t;
1752
1753 pub type SOCKET = uintptr_t;
1754 pub type socklen_t = c_int;
1755 pub type sa_family_t = u16;
1756 pub type in_port_t = u16;
1757 pub type in_addr_t = u32;
1758 #[repr(C)]
c34b1796 1759 #[derive(Copy, Clone)] pub struct sockaddr {
1a4d82fc
JJ
1760 pub sa_family: sa_family_t,
1761 pub sa_data: [u8; 14],
1762 }
1763 #[repr(C)]
1764 #[derive(Copy)] pub struct sockaddr_storage {
1765 pub ss_family: sa_family_t,
1766 pub __ss_pad1: [u8; 6],
1767 pub __ss_align: i64,
1768 pub __ss_pad2: [u8; 112],
1769 }
c34b1796
AL
1770 impl ::core::clone::Clone for sockaddr_storage {
1771 fn clone(&self) -> sockaddr_storage { *self }
1772 }
1a4d82fc 1773 #[repr(C)]
c34b1796 1774 #[derive(Copy, Clone)] pub struct sockaddr_in {
1a4d82fc
JJ
1775 pub sin_family: sa_family_t,
1776 pub sin_port: in_port_t,
1777 pub sin_addr: in_addr,
1778 pub sin_zero: [u8; 8],
1779 }
1780 #[repr(C)]
c34b1796 1781 #[derive(Copy, Clone)] pub struct in_addr {
1a4d82fc
JJ
1782 pub s_addr: in_addr_t,
1783 }
1784 #[repr(C)]
c34b1796 1785 #[derive(Copy, Clone)] pub struct sockaddr_in6 {
1a4d82fc
JJ
1786 pub sin6_family: sa_family_t,
1787 pub sin6_port: in_port_t,
1788 pub sin6_flowinfo: u32,
1789 pub sin6_addr: in6_addr,
1790 pub sin6_scope_id: u32,
1791 }
1792 #[repr(C)]
c34b1796 1793 #[derive(Copy, Clone)] pub struct in6_addr {
1a4d82fc
JJ
1794 pub s6_addr: [u16; 8]
1795 }
1796 #[repr(C)]
c34b1796 1797 #[derive(Copy, Clone)] pub struct ip_mreq {
1a4d82fc
JJ
1798 pub imr_multiaddr: in_addr,
1799 pub imr_interface: in_addr,
1800 }
1801 #[repr(C)]
c34b1796 1802 #[derive(Copy, Clone)] pub struct ip6_mreq {
1a4d82fc
JJ
1803 pub ipv6mr_multiaddr: in6_addr,
1804 pub ipv6mr_interface: c_uint,
1805 }
1806 #[repr(C)]
c34b1796 1807 #[derive(Copy, Clone)] pub struct addrinfo {
1a4d82fc
JJ
1808 pub ai_flags: c_int,
1809 pub ai_family: c_int,
1810 pub ai_socktype: c_int,
1811 pub ai_protocol: c_int,
1812 pub ai_addrlen: size_t,
1813 pub ai_canonname: *mut c_char,
1814 pub ai_addr: *mut sockaddr,
1815 pub ai_next: *mut addrinfo,
1816 }
1817 #[repr(C)]
1818 #[derive(Copy)] pub struct sockaddr_un {
1819 pub sun_family: sa_family_t,
1820 pub sun_path: [c_char; 108]
1821 }
c34b1796
AL
1822 impl ::core::clone::Clone for sockaddr_un {
1823 fn clone(&self) -> sockaddr_un { *self }
1824 }
1a4d82fc
JJ
1825 }
1826 }
1827
1828 pub mod arch {
1829 pub mod c95 {
1830 pub type c_char = i8;
1831 pub type c_schar = i8;
1832 pub type c_uchar = u8;
1833 pub type c_short = i16;
1834 pub type c_ushort = u16;
1835 pub type c_int = i32;
1836 pub type c_uint = u32;
1837 pub type c_long = i32;
1838 pub type c_ulong = u32;
1839 pub type c_float = f32;
1840 pub type c_double = f64;
1841
1842 #[cfg(target_arch = "x86")]
1843 pub type size_t = u32;
1844 #[cfg(target_arch = "x86_64")]
1845 pub type size_t = u64;
1846
1847 #[cfg(target_arch = "x86")]
1848 pub type ptrdiff_t = i32;
1849 #[cfg(target_arch = "x86_64")]
1850 pub type ptrdiff_t = i64;
1851
1852 pub type clock_t = i32;
1853
1854 #[cfg(target_arch = "x86")]
1855 pub type time_t = i32;
1856 #[cfg(target_arch = "x86_64")]
1857 pub type time_t = i64;
1858
1859 #[cfg(target_arch = "x86")]
1860 pub type suseconds_t = i32;
1861 #[cfg(target_arch = "x86_64")]
1862 pub type suseconds_t = i64;
1863
1864 pub type wchar_t = u16;
1865 }
1866
1867 pub mod c99 {
1868 pub type c_longlong = i64;
1869 pub type c_ulonglong = u64;
1870
1871 #[cfg(target_arch = "x86")]
1872 pub type intptr_t = i32;
1873 #[cfg(target_arch = "x86_64")]
1874 pub type intptr_t = i64;
1875
1876 #[cfg(target_arch = "x86")]
1877 pub type uintptr_t = u32;
1878 #[cfg(target_arch = "x86_64")]
1879 pub type uintptr_t = u64;
1880
1881 pub type intmax_t = i64;
1882 pub type uintmax_t = u64;
1883 }
1884
1885 pub mod posix88 {
1886 pub type off_t = i32;
1887 pub type dev_t = u32;
1888 pub type ino_t = u16;
1889
1890 pub type pid_t = u32;
1891
1892 pub type useconds_t = u32;
1893 pub type mode_t = u16;
1894
1895 #[cfg(target_arch = "x86")]
1896 pub type ssize_t = i32;
1897 #[cfg(target_arch = "x86_64")]
1898 pub type ssize_t = i64;
1899 }
1900
1901 pub mod posix01 {
1902 }
1903 pub mod posix08 {
1904 }
1905 pub mod bsd44 {
1906 }
1907 pub mod extra {
1908 use consts::os::extra::{MAX_PROTOCOL_CHAIN,
1909 WSAPROTOCOL_LEN};
1910 use types::common::c95::c_void;
1911 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1912 use types::os::arch::c95::{c_long, c_ulong};
1913 use types::os::arch::c95::{wchar_t};
1914 use types::os::arch::c99::{c_ulonglong, c_longlong, uintptr_t};
1915
1916 pub type BOOL = c_int;
1917 pub type BYTE = u8;
1918 pub type BOOLEAN = BYTE;
1919 pub type CCHAR = c_char;
1920 pub type CHAR = c_char;
1921
1922 pub type DWORD = c_ulong;
1923 pub type DWORDLONG = c_ulonglong;
1924
1925 pub type HANDLE = LPVOID;
85aaf69f
SL
1926 pub type HINSTANCE = HANDLE;
1927 pub type HMODULE = HINSTANCE;
1a4d82fc
JJ
1928
1929 pub type LONG = c_long;
1930 pub type PLONG = *mut c_long;
1931
1932 #[cfg(target_arch = "x86")]
1933 pub type LONG_PTR = c_long;
1934 #[cfg(target_arch = "x86_64")]
1935 pub type LONG_PTR = i64;
1936
1937 pub type LARGE_INTEGER = c_longlong;
1938 pub type PLARGE_INTEGER = *mut c_longlong;
1939
1940 pub type LPCWSTR = *const WCHAR;
1941 pub type LPCSTR = *const CHAR;
1942
1943 pub type LPWSTR = *mut WCHAR;
1944 pub type LPSTR = *mut CHAR;
1945
1946 pub type LPWCH = *mut WCHAR;
1947 pub type LPCH = *mut CHAR;
1948
1949 #[repr(C)]
c34b1796 1950 #[derive(Copy, Clone)] pub struct SECURITY_ATTRIBUTES {
1a4d82fc
JJ
1951 pub nLength: DWORD,
1952 pub lpSecurityDescriptor: LPVOID,
1953 pub bInheritHandle: BOOL,
1954 }
1955 pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
1956
1957 pub type LPVOID = *mut c_void;
1958 pub type LPCVOID = *const c_void;
1959 pub type LPBYTE = *mut BYTE;
1960 pub type LPWORD = *mut WORD;
1961 pub type LPDWORD = *mut DWORD;
1962 pub type LPHANDLE = *mut HANDLE;
1963
1964 pub type LRESULT = LONG_PTR;
1965 pub type PBOOL = *mut BOOL;
1966 pub type WCHAR = wchar_t;
1967 pub type WORD = u16;
1968 pub type SIZE_T = size_t;
1969
1970 pub type time64_t = i64;
1971 pub type int64 = i64;
1972
1973 #[repr(C)]
c34b1796 1974 #[derive(Copy, Clone)] pub struct STARTUPINFO {
1a4d82fc
JJ
1975 pub cb: DWORD,
1976 pub lpReserved: LPWSTR,
1977 pub lpDesktop: LPWSTR,
1978 pub lpTitle: LPWSTR,
1979 pub dwX: DWORD,
1980 pub dwY: DWORD,
1981 pub dwXSize: DWORD,
1982 pub dwYSize: DWORD,
1983 pub dwXCountChars: DWORD,
1984 pub dwYCountCharts: DWORD,
1985 pub dwFillAttribute: DWORD,
1986 pub dwFlags: DWORD,
1987 pub wShowWindow: WORD,
1988 pub cbReserved2: WORD,
1989 pub lpReserved2: LPBYTE,
1990 pub hStdInput: HANDLE,
1991 pub hStdOutput: HANDLE,
1992 pub hStdError: HANDLE,
1993 }
1994 pub type LPSTARTUPINFO = *mut STARTUPINFO;
1995
1996 #[repr(C)]
c34b1796 1997 #[derive(Copy, Clone)] pub struct PROCESS_INFORMATION {
1a4d82fc
JJ
1998 pub hProcess: HANDLE,
1999 pub hThread: HANDLE,
2000 pub dwProcessId: DWORD,
2001 pub dwThreadId: DWORD,
2002 }
2003 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
2004
2005 #[repr(C)]
c34b1796 2006 #[derive(Copy, Clone)] pub struct SYSTEM_INFO {
1a4d82fc
JJ
2007 pub wProcessorArchitecture: WORD,
2008 pub wReserved: WORD,
2009 pub dwPageSize: DWORD,
2010 pub lpMinimumApplicationAddress: LPVOID,
2011 pub lpMaximumApplicationAddress: LPVOID,
2012 pub dwActiveProcessorMask: uintptr_t,
2013 pub dwNumberOfProcessors: DWORD,
2014 pub dwProcessorType: DWORD,
2015 pub dwAllocationGranularity: DWORD,
2016 pub wProcessorLevel: WORD,
2017 pub wProcessorRevision: WORD,
2018 }
2019 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
2020
2021 #[repr(C)]
c34b1796 2022 #[derive(Copy, Clone)] pub struct MEMORY_BASIC_INFORMATION {
1a4d82fc
JJ
2023 pub BaseAddress: LPVOID,
2024 pub AllocationBase: LPVOID,
2025 pub AllocationProtect: DWORD,
2026 pub RegionSize: SIZE_T,
2027 pub State: DWORD,
2028 pub Protect: DWORD,
2029 pub Type: DWORD,
2030 }
2031 pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
2032
2033 #[repr(C)]
c34b1796 2034 #[derive(Copy, Clone)] pub struct OVERLAPPED {
1a4d82fc
JJ
2035 pub Internal: *mut c_ulong,
2036 pub InternalHigh: *mut c_ulong,
2037 pub Offset: DWORD,
2038 pub OffsetHigh: DWORD,
2039 pub hEvent: HANDLE,
2040 }
2041
2042 pub type LPOVERLAPPED = *mut OVERLAPPED;
2043
2044 #[repr(C)]
c34b1796 2045 #[derive(Copy, Clone)] pub struct FILETIME {
1a4d82fc
JJ
2046 pub dwLowDateTime: DWORD,
2047 pub dwHighDateTime: DWORD,
2048 }
2049
2050 pub type LPFILETIME = *mut FILETIME;
2051
2052 #[repr(C)]
c34b1796 2053 #[derive(Copy, Clone)] pub struct GUID {
1a4d82fc
JJ
2054 pub Data1: DWORD,
2055 pub Data2: WORD,
2056 pub Data3: WORD,
2057 pub Data4: [BYTE; 8],
2058 }
2059
2060 #[repr(C)]
c34b1796 2061 #[derive(Copy, Clone)] pub struct WSAPROTOCOLCHAIN {
1a4d82fc 2062 pub ChainLen: c_int,
85aaf69f 2063 pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as usize],
1a4d82fc
JJ
2064 }
2065
2066 pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
2067
2068 #[repr(C)]
2069 #[derive(Copy)] pub struct WSAPROTOCOL_INFO {
2070 pub dwServiceFlags1: DWORD,
2071 pub dwServiceFlags2: DWORD,
2072 pub dwServiceFlags3: DWORD,
2073 pub dwServiceFlags4: DWORD,
2074 pub dwProviderFlags: DWORD,
2075 pub ProviderId: GUID,
2076 pub dwCatalogEntryId: DWORD,
2077 pub ProtocolChain: WSAPROTOCOLCHAIN,
2078 pub iVersion: c_int,
2079 pub iAddressFamily: c_int,
2080 pub iMaxSockAddr: c_int,
2081 pub iMinSockAddr: c_int,
2082 pub iSocketType: c_int,
2083 pub iProtocol: c_int,
2084 pub iProtocolMaxOffset: c_int,
2085 pub iNetworkByteOrder: c_int,
2086 pub iSecurityScheme: c_int,
2087 pub dwMessageSize: DWORD,
2088 pub dwProviderReserved: DWORD,
85aaf69f 2089 pub szProtocol: [u8; WSAPROTOCOL_LEN as usize + 1],
1a4d82fc 2090 }
c34b1796
AL
2091 impl ::core::clone::Clone for WSAPROTOCOL_INFO {
2092 fn clone(&self) -> WSAPROTOCOL_INFO { *self }
2093 }
1a4d82fc
JJ
2094
2095 pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
2096
2097 pub type GROUP = c_uint;
2098
2099 #[repr(C)]
2100 #[derive(Copy)] pub struct WIN32_FIND_DATAW {
2101 pub dwFileAttributes: DWORD,
2102 pub ftCreationTime: FILETIME,
2103 pub ftLastAccessTime: FILETIME,
2104 pub ftLastWriteTime: FILETIME,
2105 pub nFileSizeHigh: DWORD,
2106 pub nFileSizeLow: DWORD,
2107 pub dwReserved0: DWORD,
2108 pub dwReserved1: DWORD,
2109 pub cFileName: [wchar_t; 260], // #define MAX_PATH 260
2110 pub cAlternateFileName: [wchar_t; 14],
2111 }
c34b1796
AL
2112 impl ::core::clone::Clone for WIN32_FIND_DATAW {
2113 fn clone(&self) -> WIN32_FIND_DATAW { *self }
2114 }
1a4d82fc
JJ
2115
2116 pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
2117 }
2118 }
2119 }
2120
2121 #[cfg(any(target_os = "macos", target_os = "ios"))]
2122 pub mod os {
2123 pub mod common {
2124 pub mod posix01 {
2125 use types::common::c95::c_void;
2126 use types::os::arch::c95::{c_char, c_int, size_t, time_t};
2127 use types::os::arch::c95::{suseconds_t, c_long};
2128 use types::os::arch::c99::{uintptr_t};
2129
2130 pub type pthread_t = uintptr_t;
c34b1796 2131 pub type rlim_t = u64;
1a4d82fc
JJ
2132
2133 #[repr(C)]
c34b1796 2134 #[derive(Copy, Clone)] pub struct glob_t {
1a4d82fc
JJ
2135 pub gl_pathc: size_t,
2136 pub __unused1: c_int,
2137 pub gl_offs: size_t,
2138 pub __unused2: c_int,
2139 pub gl_pathv: *mut *mut c_char,
2140
2141 pub __unused3: *mut c_void,
2142
2143 pub __unused4: *mut c_void,
2144 pub __unused5: *mut c_void,
2145 pub __unused6: *mut c_void,
2146 pub __unused7: *mut c_void,
2147 pub __unused8: *mut c_void,
2148 }
2149
2150 #[repr(C)]
c34b1796 2151 #[derive(Copy, Clone)] pub struct timeval {
1a4d82fc
JJ
2152 pub tv_sec: time_t,
2153 pub tv_usec: suseconds_t,
2154 }
2155
2156 #[repr(C)]
c34b1796 2157 #[derive(Copy, Clone)] pub struct timespec {
1a4d82fc
JJ
2158 pub tv_sec: time_t,
2159 pub tv_nsec: c_long,
2160 }
2161
c34b1796 2162 pub enum timezone {}
1a4d82fc
JJ
2163
2164 pub type sighandler_t = size_t;
c34b1796
AL
2165
2166 #[repr(C)]
2167 #[derive(Copy, Clone)]
2168 pub struct rlimit {
2169 pub rlim_cur: rlim_t,
2170 pub rlim_max: rlim_t,
2171 }
2172 }
2173
2174 pub mod bsd43 {
2175 use types::os::common::posix01::timeval;
2176 use types::os::arch::c95::c_long;
2177 #[repr(C)]
2178 #[derive(Copy, Clone)]
2179 pub struct rusage {
2180 pub ru_utime: timeval,
2181 pub ru_stime: timeval,
2182 pub ru_maxrss: c_long,
2183 pub ru_ixrss: c_long,
2184 pub ru_idrss: c_long,
2185 pub ru_isrss: c_long,
2186 pub ru_minflt: c_long,
2187 pub ru_majflt: c_long,
2188 pub ru_nswap: c_long,
2189 pub ru_inblock: c_long,
2190 pub ru_oublock: c_long,
2191 pub ru_msgsnd: c_long,
2192 pub ru_msgrcv: c_long,
2193 pub ru_nsignals: c_long,
2194 pub ru_nvcsw: c_long,
2195 pub ru_nivcsw: c_long
2196 }
1a4d82fc
JJ
2197 }
2198
2199 pub mod bsd44 {
2200 use types::common::c95::{c_void};
2201 use types::os::arch::c95::{c_char, c_int, c_uint};
2202
85aaf69f 2203 pub type socklen_t = u32;
1a4d82fc
JJ
2204 pub type sa_family_t = u8;
2205 pub type in_port_t = u16;
2206 pub type in_addr_t = u32;
2207 #[repr(C)]
c34b1796 2208 #[derive(Copy, Clone)] pub struct sockaddr {
1a4d82fc
JJ
2209 pub sa_len: u8,
2210 pub sa_family: sa_family_t,
2211 pub sa_data: [u8; 14],
2212 }
2213
2214 #[repr(C)]
2215 #[derive(Copy)] pub struct sockaddr_storage {
2216 pub ss_len: u8,
2217 pub ss_family: sa_family_t,
2218 pub __ss_pad1: [u8; 6],
2219 pub __ss_align: i64,
2220 pub __ss_pad2: [u8; 112],
2221 }
c34b1796
AL
2222 impl ::core::clone::Clone for sockaddr_storage {
2223 fn clone(&self) -> sockaddr_storage { *self }
2224 }
1a4d82fc
JJ
2225
2226 #[repr(C)]
c34b1796 2227 #[derive(Copy, Clone)] pub struct sockaddr_in {
1a4d82fc
JJ
2228 pub sin_len: u8,
2229 pub sin_family: sa_family_t,
2230 pub sin_port: in_port_t,
2231 pub sin_addr: in_addr,
2232 pub sin_zero: [u8; 8],
2233 }
2234
2235 #[repr(C)]
c34b1796 2236 #[derive(Copy, Clone)] pub struct in_addr {
1a4d82fc
JJ
2237 pub s_addr: in_addr_t,
2238 }
2239
2240 #[repr(C)]
c34b1796 2241 #[derive(Copy, Clone)] pub struct sockaddr_in6 {
1a4d82fc
JJ
2242 pub sin6_len: u8,
2243 pub sin6_family: sa_family_t,
2244 pub sin6_port: in_port_t,
2245 pub sin6_flowinfo: u32,
2246 pub sin6_addr: in6_addr,
2247 pub sin6_scope_id: u32,
2248 }
2249
2250 #[repr(C)]
c34b1796 2251 #[derive(Copy, Clone)] pub struct in6_addr {
1a4d82fc
JJ
2252 pub s6_addr: [u16; 8]
2253 }
2254
2255 #[repr(C)]
c34b1796 2256 #[derive(Copy, Clone)] pub struct ip_mreq {
1a4d82fc
JJ
2257 pub imr_multiaddr: in_addr,
2258 pub imr_interface: in_addr,
2259 }
2260
2261 #[repr(C)]
c34b1796 2262 #[derive(Copy, Clone)] pub struct ip6_mreq {
1a4d82fc
JJ
2263 pub ipv6mr_multiaddr: in6_addr,
2264 pub ipv6mr_interface: c_uint,
2265 }
2266
2267 #[repr(C)]
c34b1796 2268 #[derive(Copy, Clone)] pub struct addrinfo {
1a4d82fc
JJ
2269 pub ai_flags: c_int,
2270 pub ai_family: c_int,
2271 pub ai_socktype: c_int,
2272 pub ai_protocol: c_int,
2273 pub ai_addrlen: socklen_t,
2274 pub ai_canonname: *mut c_char,
2275 pub ai_addr: *mut sockaddr,
2276 pub ai_next: *mut addrinfo,
2277 }
2278
2279 #[repr(C)]
2280 #[derive(Copy)] pub struct sockaddr_un {
2281 pub sun_len: u8,
2282 pub sun_family: sa_family_t,
2283 pub sun_path: [c_char; 104]
2284 }
c34b1796
AL
2285 impl ::core::clone::Clone for sockaddr_un {
2286 fn clone(&self) -> sockaddr_un { *self }
2287 }
1a4d82fc
JJ
2288
2289 #[repr(C)]
c34b1796 2290 #[derive(Copy, Clone)] pub struct ifaddrs {
1a4d82fc
JJ
2291 pub ifa_next: *mut ifaddrs,
2292 pub ifa_name: *mut c_char,
2293 pub ifa_flags: c_uint,
2294 pub ifa_addr: *mut sockaddr,
2295 pub ifa_netmask: *mut sockaddr,
2296 pub ifa_dstaddr: *mut sockaddr,
2297 pub ifa_data: *mut c_void
2298 }
2299 }
2300 }
2301
2302 #[cfg(any(target_arch = "arm", target_arch = "x86"))]
2303 pub mod arch {
2304 pub mod c95 {
2305 pub type c_char = i8;
2306 pub type c_schar = i8;
2307 pub type c_uchar = u8;
2308 pub type c_short = i16;
2309 pub type c_ushort = u16;
2310 pub type c_int = i32;
2311 pub type c_uint = u32;
2312 pub type c_long = i32;
2313 pub type c_ulong = u32;
2314 pub type c_float = f32;
2315 pub type c_double = f64;
2316 pub type size_t = u32;
2317 pub type ptrdiff_t = i32;
85aaf69f
SL
2318 pub type clock_t = c_ulong;
2319 pub type time_t = c_long;
1a4d82fc
JJ
2320 pub type suseconds_t = i32;
2321 pub type wchar_t = i32;
2322 }
2323 pub mod c99 {
2324 pub type c_longlong = i64;
2325 pub type c_ulonglong = u64;
2326 pub type intptr_t = i32;
2327 pub type uintptr_t = u32;
2328 pub type intmax_t = i64;
2329 pub type uintmax_t = u64;
2330 }
2331 pub mod posix88 {
85aaf69f
SL
2332 use types::os::arch::c95::c_long;
2333
1a4d82fc
JJ
2334 pub type off_t = i64;
2335 pub type dev_t = i32;
2336 pub type ino_t = u64;
2337 pub type pid_t = i32;
2338 pub type uid_t = u32;
2339 pub type gid_t = u32;
2340 pub type useconds_t = u32;
2341 pub type mode_t = u16;
85aaf69f 2342 pub type ssize_t = c_long;
1a4d82fc
JJ
2343 }
2344 pub mod posix01 {
2345 use types::common::c99::{int32_t, int64_t, uint32_t};
2346 use types::os::arch::c95::{c_char, c_long, time_t};
2347 use types::os::arch::posix88::{dev_t, gid_t, ino_t,
2348 mode_t, off_t, uid_t};
2349
2350 pub type nlink_t = u16;
85aaf69f
SL
2351 pub type blksize_t = i32;
2352 pub type blkcnt_t = i64;
1a4d82fc
JJ
2353
2354 #[repr(C)]
c34b1796 2355 #[derive(Copy, Clone)] pub struct stat {
1a4d82fc
JJ
2356 pub st_dev: dev_t,
2357 pub st_mode: mode_t,
2358 pub st_nlink: nlink_t,
2359 pub st_ino: ino_t,
2360 pub st_uid: uid_t,
2361 pub st_gid: gid_t,
2362 pub st_rdev: dev_t,
2363 pub st_atime: time_t,
2364 pub st_atime_nsec: c_long,
2365 pub st_mtime: time_t,
2366 pub st_mtime_nsec: c_long,
2367 pub st_ctime: time_t,
2368 pub st_ctime_nsec: c_long,
2369 pub st_birthtime: time_t,
2370 pub st_birthtime_nsec: c_long,
2371 pub st_size: off_t,
2372 pub st_blocks: blkcnt_t,
2373 pub st_blksize: blksize_t,
2374 pub st_flags: uint32_t,
2375 pub st_gen: uint32_t,
2376 pub st_lspare: int32_t,
2377 pub st_qspare: [int64_t; 2],
2378 }
2379
2380 #[repr(C)]
c34b1796 2381 #[derive(Copy, Clone)] pub struct utimbuf {
1a4d82fc
JJ
2382 pub actime: time_t,
2383 pub modtime: time_t,
2384 }
2385
2386 #[repr(C)]
2387 #[derive(Copy)] pub struct pthread_attr_t {
2388 pub __sig: c_long,
2389 pub __opaque: [c_char; 36]
2390 }
c34b1796
AL
2391 impl ::core::clone::Clone for pthread_attr_t {
2392 fn clone(&self) -> pthread_attr_t { *self }
2393 }
1a4d82fc
JJ
2394 }
2395 pub mod posix08 {
2396 }
2397 pub mod bsd44 {
2398 }
2399 pub mod extra {
2400 #[repr(C)]
c34b1796 2401 #[derive(Copy, Clone)] pub struct mach_timebase_info {
1a4d82fc
JJ
2402 pub numer: u32,
2403 pub denom: u32,
2404 }
2405
2406 pub type mach_timebase_info_data_t = mach_timebase_info;
2407 }
2408 }
2409
85aaf69f 2410 #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
1a4d82fc
JJ
2411 pub mod arch {
2412 pub mod c95 {
2413 pub type c_char = i8;
2414 pub type c_schar = i8;
2415 pub type c_uchar = u8;
2416 pub type c_short = i16;
2417 pub type c_ushort = u16;
2418 pub type c_int = i32;
2419 pub type c_uint = u32;
2420 pub type c_long = i64;
2421 pub type c_ulong = u64;
2422 pub type c_float = f32;
2423 pub type c_double = f64;
2424 pub type size_t = u64;
2425 pub type ptrdiff_t = i64;
85aaf69f
SL
2426 pub type clock_t = c_ulong;
2427 pub type time_t = c_long;
1a4d82fc
JJ
2428 pub type suseconds_t = i32;
2429 pub type wchar_t = i32;
2430 }
2431 pub mod c99 {
2432 pub type c_longlong = i64;
2433 pub type c_ulonglong = u64;
2434 pub type intptr_t = i64;
2435 pub type uintptr_t = u64;
2436 pub type intmax_t = i64;
2437 pub type uintmax_t = u64;
2438 }
2439 pub mod posix88 {
85aaf69f
SL
2440 use types::os::arch::c95::c_long;
2441
1a4d82fc
JJ
2442 pub type off_t = i64;
2443 pub type dev_t = i32;
2444 pub type ino_t = u64;
2445 pub type pid_t = i32;
2446 pub type uid_t = u32;
2447 pub type gid_t = u32;
2448 pub type useconds_t = u32;
2449 pub type mode_t = u16;
85aaf69f 2450 pub type ssize_t = c_long;
1a4d82fc
JJ
2451 }
2452 pub mod posix01 {
2453 use types::common::c99::{int32_t, int64_t};
2454 use types::common::c99::{uint32_t};
2455 use types::os::arch::c95::{c_char, c_long, time_t};
2456 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
2457 use types::os::arch::posix88::{mode_t, off_t, uid_t};
2458
2459 pub type nlink_t = u16;
85aaf69f
SL
2460 pub type blksize_t = i32;
2461 pub type blkcnt_t = i64;
1a4d82fc
JJ
2462
2463 #[repr(C)]
c34b1796 2464 #[derive(Copy, Clone)] pub struct stat {
1a4d82fc
JJ
2465 pub st_dev: dev_t,
2466 pub st_mode: mode_t,
2467 pub st_nlink: nlink_t,
2468 pub st_ino: ino_t,
2469 pub st_uid: uid_t,
2470 pub st_gid: gid_t,
2471 pub st_rdev: dev_t,
2472 pub st_atime: time_t,
2473 pub st_atime_nsec: c_long,
2474 pub st_mtime: time_t,
2475 pub st_mtime_nsec: c_long,
2476 pub st_ctime: time_t,
2477 pub st_ctime_nsec: c_long,
2478 pub st_birthtime: time_t,
2479 pub st_birthtime_nsec: c_long,
2480 pub st_size: off_t,
2481 pub st_blocks: blkcnt_t,
2482 pub st_blksize: blksize_t,
2483 pub st_flags: uint32_t,
2484 pub st_gen: uint32_t,
2485 pub st_lspare: int32_t,
2486 pub st_qspare: [int64_t; 2],
2487 }
2488
2489 #[repr(C)]
c34b1796 2490 #[derive(Copy, Clone)] pub struct utimbuf {
1a4d82fc
JJ
2491 pub actime: time_t,
2492 pub modtime: time_t,
2493 }
2494
2495 #[repr(C)]
2496 #[derive(Copy)] pub struct pthread_attr_t {
2497 pub __sig: c_long,
2498 pub __opaque: [c_char; 56]
2499 }
c34b1796
AL
2500 impl ::core::clone::Clone for pthread_attr_t {
2501 fn clone(&self) -> pthread_attr_t { *self }
2502 }
1a4d82fc
JJ
2503 }
2504 pub mod posix08 {
2505 }
2506 pub mod bsd44 {
2507 }
2508 pub mod extra {
2509 #[repr(C)]
c34b1796 2510 #[derive(Copy, Clone)] pub struct mach_timebase_info {
1a4d82fc
JJ
2511 pub numer: u32,
2512 pub denom: u32,
2513 }
2514
2515 pub type mach_timebase_info_data_t = mach_timebase_info;
2516 }
2517 }
2518 }
2519}
2520
2521pub mod consts {
2522 // Consts tend to vary per OS so we pull their definitions out
2523 // into this module.
2524
2525 #[cfg(target_os = "windows")]
2526 pub mod os {
2527 pub mod c95 {
2528 use types::os::arch::c95::{c_int, c_uint};
2529
2530 pub const EXIT_FAILURE : c_int = 1;
2531 pub const EXIT_SUCCESS : c_int = 0;
2532 pub const RAND_MAX : c_int = 32767;
2533 pub const EOF : c_int = -1;
2534 pub const SEEK_SET : c_int = 0;
2535 pub const SEEK_CUR : c_int = 1;
2536 pub const SEEK_END : c_int = 2;
2537 pub const _IOFBF : c_int = 0;
2538 pub const _IONBF : c_int = 4;
2539 pub const _IOLBF : c_int = 64;
c34b1796
AL
2540 pub const BUFSIZ : c_uint = 512;
2541 pub const FOPEN_MAX : c_uint = 20;
2542 pub const FILENAME_MAX : c_uint = 260;
2543 pub const L_tmpnam : c_uint = 16;
2544 pub const TMP_MAX : c_uint = 32767;
1a4d82fc
JJ
2545
2546 pub const WSAEINTR: c_int = 10004;
2547 pub const WSAEBADF: c_int = 10009;
2548 pub const WSAEACCES: c_int = 10013;
2549 pub const WSAEFAULT: c_int = 10014;
2550 pub const WSAEINVAL: c_int = 10022;
2551 pub const WSAEMFILE: c_int = 10024;
2552 pub const WSAEWOULDBLOCK: c_int = 10035;
2553 pub const WSAEINPROGRESS: c_int = 10036;
2554 pub const WSAEALREADY: c_int = 10037;
2555 pub const WSAENOTSOCK: c_int = 10038;
2556 pub const WSAEDESTADDRREQ: c_int = 10039;
2557 pub const WSAEMSGSIZE: c_int = 10040;
2558 pub const WSAEPROTOTYPE: c_int = 10041;
2559 pub const WSAENOPROTOOPT: c_int = 10042;
2560 pub const WSAEPROTONOSUPPORT: c_int = 10043;
2561 pub const WSAESOCKTNOSUPPORT: c_int = 10044;
2562 pub const WSAEOPNOTSUPP: c_int = 10045;
2563 pub const WSAEPFNOSUPPORT: c_int = 10046;
2564 pub const WSAEAFNOSUPPORT: c_int = 10047;
2565 pub const WSAEADDRINUSE: c_int = 10048;
2566 pub const WSAEADDRNOTAVAIL: c_int = 10049;
2567 pub const WSAENETDOWN: c_int = 10050;
2568 pub const WSAENETUNREACH: c_int = 10051;
2569 pub const WSAENETRESET: c_int = 10052;
2570 pub const WSAECONNABORTED: c_int = 10053;
2571 pub const WSAECONNRESET: c_int = 10054;
2572 pub const WSAENOBUFS: c_int = 10055;
2573 pub const WSAEISCONN: c_int = 10056;
2574 pub const WSAENOTCONN: c_int = 10057;
2575 pub const WSAESHUTDOWN: c_int = 10058;
2576 pub const WSAETOOMANYREFS: c_int = 10059;
2577 pub const WSAETIMEDOUT: c_int = 10060;
2578 pub const WSAECONNREFUSED: c_int = 10061;
2579 pub const WSAELOOP: c_int = 10062;
2580 pub const WSAENAMETOOLONG: c_int = 10063;
2581 pub const WSAEHOSTDOWN: c_int = 10064;
2582 pub const WSAEHOSTUNREACH: c_int = 10065;
2583 pub const WSAENOTEMPTY: c_int = 10066;
2584 pub const WSAEPROCLIM: c_int = 10067;
2585 pub const WSAEUSERS: c_int = 10068;
2586 pub const WSAEDQUOT: c_int = 10069;
2587 pub const WSAESTALE: c_int = 10070;
2588 pub const WSAEREMOTE: c_int = 10071;
2589 pub const WSASYSNOTREADY: c_int = 10091;
2590 pub const WSAVERNOTSUPPORTED: c_int = 10092;
2591 pub const WSANOTINITIALISED: c_int = 10093;
2592 pub const WSAEDISCON: c_int = 10101;
2593 pub const WSAENOMORE: c_int = 10102;
2594 pub const WSAECANCELLED: c_int = 10103;
2595 pub const WSAEINVALIDPROCTABLE: c_int = 10104;
2596 pub const WSAEINVALIDPROVIDER: c_int = 10105;
2597 pub const WSAEPROVIDERFAILEDINIT: c_int = 10106;
2598 }
2599 pub mod c99 {
2600 }
2601 pub mod posix88 {
2602 use types::os::arch::c95::c_int;
c34b1796 2603 use types::os::arch::posix88::mode_t;
1a4d82fc
JJ
2604
2605 pub const O_RDONLY : c_int = 0;
2606 pub const O_WRONLY : c_int = 1;
2607 pub const O_RDWR : c_int = 2;
2608 pub const O_APPEND : c_int = 8;
2609 pub const O_CREAT : c_int = 256;
2610 pub const O_EXCL : c_int = 1024;
2611 pub const O_TRUNC : c_int = 512;
2612 pub const S_IFIFO : c_int = 4096;
2613 pub const S_IFCHR : c_int = 8192;
2614 pub const S_IFBLK : c_int = 12288;
2615 pub const S_IFDIR : c_int = 16384;
2616 pub const S_IFREG : c_int = 32768;
2617 pub const S_IFLNK : c_int = 40960;
c1a9b12d 2618 pub const S_IFSOCK : mode_t = 49152;
1a4d82fc
JJ
2619 pub const S_IFMT : c_int = 61440;
2620 pub const S_IEXEC : c_int = 64;
2621 pub const S_IWRITE : c_int = 128;
2622 pub const S_IREAD : c_int = 256;
2623 pub const S_IRWXU : c_int = 448;
2624 pub const S_IXUSR : c_int = 64;
2625 pub const S_IWUSR : c_int = 128;
2626 pub const S_IRUSR : c_int = 256;
c34b1796
AL
2627 pub const S_IRWXG : mode_t = 56;
2628 pub const S_IXGRP : mode_t = 8;
2629 pub const S_IWGRP : mode_t = 16;
2630 pub const S_IRGRP : mode_t = 32;
2631 pub const S_IRWXO : mode_t = 7;
2632 pub const S_IXOTH : mode_t = 1;
2633 pub const S_IWOTH : mode_t = 2;
2634 pub const S_IROTH : mode_t = 4;
1a4d82fc
JJ
2635 pub const F_OK : c_int = 0;
2636 pub const R_OK : c_int = 4;
2637 pub const W_OK : c_int = 2;
2638 pub const X_OK : c_int = 1;
2639 pub const STDIN_FILENO : c_int = 0;
2640 pub const STDOUT_FILENO : c_int = 1;
2641 pub const STDERR_FILENO : c_int = 2;
2642 }
2643 pub mod posix01 {
2644 }
2645 pub mod posix08 {
2646 }
2647 pub mod bsd44 {
2648 use types::os::arch::c95::c_int;
2649
2650 pub const AF_INET: c_int = 2;
2651 pub const AF_INET6: c_int = 23;
2652 pub const SOCK_STREAM: c_int = 1;
2653 pub const SOCK_DGRAM: c_int = 2;
2654 pub const SOCK_RAW: c_int = 3;
2655 pub const IPPROTO_TCP: c_int = 6;
2656 pub const IPPROTO_IP: c_int = 0;
2657 pub const IPPROTO_IPV6: c_int = 41;
85aaf69f
SL
2658 pub const IP_MULTICAST_TTL: c_int = 10;
2659 pub const IP_MULTICAST_LOOP: c_int = 11;
2660 pub const IP_ADD_MEMBERSHIP: c_int = 12;
2661 pub const IP_DROP_MEMBERSHIP: c_int = 13;
1a4d82fc
JJ
2662 pub const IPV6_ADD_MEMBERSHIP: c_int = 5;
2663 pub const IPV6_DROP_MEMBERSHIP: c_int = 6;
2664 pub const IP_TTL: c_int = 4;
2665 pub const IP_HDRINCL: c_int = 2;
2666
2667 pub const TCP_NODELAY: c_int = 0x0001;
2668 pub const SOL_SOCKET: c_int = 0xffff;
c34b1796
AL
2669
2670 pub const SO_DEBUG: c_int = 0x0001;
2671 pub const SO_ACCEPTCONN: c_int = 0x0002;
2672 pub const SO_REUSEADDR: c_int = 0x0004;
2673 pub const SO_KEEPALIVE: c_int = 0x0008;
2674 pub const SO_DONTROUTE: c_int = 0x0010;
2675 pub const SO_BROADCAST: c_int = 0x0020;
2676 pub const SO_USELOOPBACK: c_int = 0x0040;
2677 pub const SO_LINGER: c_int = 0x0080;
2678 pub const SO_OOBINLINE: c_int = 0x0100;
2679 pub const SO_SNDBUF: c_int = 0x1001;
2680 pub const SO_RCVBUF: c_int = 0x1002;
2681 pub const SO_SNDLOWAT: c_int = 0x1003;
2682 pub const SO_RCVLOWAT: c_int = 0x1004;
2683 pub const SO_SNDTIMEO: c_int = 0x1005;
2684 pub const SO_RCVTIMEO: c_int = 0x1006;
1a4d82fc 2685 pub const SO_ERROR: c_int = 0x1007;
c34b1796 2686 pub const SO_TYPE: c_int = 0x1008;
1a4d82fc
JJ
2687
2688 pub const IFF_LOOPBACK: c_int = 4;
2689
2690 pub const SHUT_RD: c_int = 0;
2691 pub const SHUT_WR: c_int = 1;
2692 pub const SHUT_RDWR: c_int = 2;
2693 }
2694 pub mod extra {
c34b1796 2695 use types::os::common::bsd44::SOCKET;
1a4d82fc
JJ
2696 use types::os::arch::c95::{c_int, c_long};
2697 use types::os::arch::extra::{WORD, DWORD, BOOL, HANDLE};
2698
2699 pub const TRUE : BOOL = 1;
2700 pub const FALSE : BOOL = 0;
2701
2702 pub const O_TEXT : c_int = 16384;
2703 pub const O_BINARY : c_int = 32768;
2704 pub const O_NOINHERIT: c_int = 128;
2705
2706 pub const ERROR_SUCCESS : c_int = 0;
2707 pub const ERROR_INVALID_FUNCTION: c_int = 1;
2708 pub const ERROR_FILE_NOT_FOUND: c_int = 2;
2709 pub const ERROR_ACCESS_DENIED: c_int = 5;
2710 pub const ERROR_INVALID_HANDLE : c_int = 6;
2711 pub const ERROR_BROKEN_PIPE: c_int = 109;
2712 pub const ERROR_DISK_FULL : c_int = 112;
2713 pub const ERROR_CALL_NOT_IMPLEMENTED : c_int = 120;
2714 pub const ERROR_INSUFFICIENT_BUFFER : c_int = 122;
2715 pub const ERROR_INVALID_NAME : c_int = 123;
2716 pub const ERROR_ALREADY_EXISTS : c_int = 183;
2717 pub const ERROR_PIPE_BUSY: c_int = 231;
2718 pub const ERROR_NO_DATA: c_int = 232;
2719 pub const ERROR_INVALID_ADDRESS : c_int = 487;
2720 pub const ERROR_PIPE_CONNECTED: c_int = 535;
2721 pub const ERROR_NOTHING_TO_TERMINATE: c_int = 758;
2722 pub const ERROR_OPERATION_ABORTED: c_int = 995;
2723 pub const ERROR_IO_PENDING: c_int = 997;
2724 pub const ERROR_FILE_INVALID : c_int = 1006;
2725 pub const ERROR_NOT_FOUND: c_int = 1168;
c34b1796 2726 pub const INVALID_HANDLE_VALUE: HANDLE = !0 as HANDLE;
1a4d82fc
JJ
2727
2728 pub const DELETE : DWORD = 0x00010000;
2729 pub const READ_CONTROL : DWORD = 0x00020000;
2730 pub const SYNCHRONIZE : DWORD = 0x00100000;
2731 pub const WRITE_DAC : DWORD = 0x00040000;
2732 pub const WRITE_OWNER : DWORD = 0x00080000;
2733
2734 pub const PROCESS_CREATE_PROCESS : DWORD = 0x0080;
2735 pub const PROCESS_CREATE_THREAD : DWORD = 0x0002;
2736 pub const PROCESS_DUP_HANDLE : DWORD = 0x0040;
2737 pub const PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
2738 pub const PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
2739 pub const PROCESS_SET_INFORMATION : DWORD = 0x0200;
2740 pub const PROCESS_SET_QUOTA : DWORD = 0x0100;
2741 pub const PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
2742 pub const PROCESS_TERMINATE : DWORD = 0x0001;
2743 pub const PROCESS_VM_OPERATION : DWORD = 0x0008;
2744 pub const PROCESS_VM_READ : DWORD = 0x0010;
2745 pub const PROCESS_VM_WRITE : DWORD = 0x0020;
2746
2747 pub const STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
2748 pub const STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
2749 pub const STARTF_PREVENTPINNING : DWORD = 0x00002000;
2750 pub const STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
2751 pub const STARTF_TITLEISAPPID : DWORD = 0x00001000;
2752 pub const STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
2753 pub const STARTF_USECOUNTCHARS : DWORD = 0x00000008;
2754 pub const STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
2755 pub const STARTF_USEHOTKEY : DWORD = 0x00000200;
2756 pub const STARTF_USEPOSITION : DWORD = 0x00000004;
2757 pub const STARTF_USESHOWWINDOW : DWORD = 0x00000001;
2758 pub const STARTF_USESIZE : DWORD = 0x00000002;
2759 pub const STARTF_USESTDHANDLES : DWORD = 0x00000100;
2760
2761 pub const WAIT_ABANDONED : DWORD = 0x00000080;
2762 pub const WAIT_OBJECT_0 : DWORD = 0x00000000;
2763 pub const WAIT_TIMEOUT : DWORD = 0x00000102;
c34b1796 2764 pub const WAIT_FAILED : DWORD = !0;
1a4d82fc
JJ
2765
2766 pub const DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
2767 pub const DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;
2768
c34b1796 2769 pub const INFINITE : DWORD = !0;
1a4d82fc
JJ
2770 pub const STILL_ACTIVE : DWORD = 259;
2771
2772 pub const MEM_COMMIT : DWORD = 0x00001000;
2773 pub const MEM_RESERVE : DWORD = 0x00002000;
2774 pub const MEM_DECOMMIT : DWORD = 0x00004000;
2775 pub const MEM_RELEASE : DWORD = 0x00008000;
2776 pub const MEM_RESET : DWORD = 0x00080000;
2777 pub const MEM_RESET_UNDO : DWORD = 0x1000000;
2778 pub const MEM_LARGE_PAGES : DWORD = 0x20000000;
2779 pub const MEM_PHYSICAL : DWORD = 0x00400000;
2780 pub const MEM_TOP_DOWN : DWORD = 0x00100000;
2781 pub const MEM_WRITE_WATCH : DWORD = 0x00200000;
2782
2783 pub const PAGE_EXECUTE : DWORD = 0x10;
2784 pub const PAGE_EXECUTE_READ : DWORD = 0x20;
2785 pub const PAGE_EXECUTE_READWRITE : DWORD = 0x40;
2786 pub const PAGE_EXECUTE_WRITECOPY : DWORD = 0x80;
2787 pub const PAGE_NOACCESS : DWORD = 0x01;
2788 pub const PAGE_READONLY : DWORD = 0x02;
2789 pub const PAGE_READWRITE : DWORD = 0x04;
2790 pub const PAGE_WRITECOPY : DWORD = 0x08;
2791 pub const PAGE_GUARD : DWORD = 0x100;
2792 pub const PAGE_NOCACHE : DWORD = 0x200;
2793 pub const PAGE_WRITECOMBINE : DWORD = 0x400;
2794
2795 pub const SEC_COMMIT : DWORD = 0x8000000;
2796 pub const SEC_IMAGE : DWORD = 0x1000000;
2797 pub const SEC_IMAGE_NO_EXECUTE : DWORD = 0x11000000;
2798 pub const SEC_LARGE_PAGES : DWORD = 0x80000000;
2799 pub const SEC_NOCACHE : DWORD = 0x10000000;
2800 pub const SEC_RESERVE : DWORD = 0x4000000;
2801 pub const SEC_WRITECOMBINE : DWORD = 0x40000000;
2802
2803 pub const FILE_MAP_ALL_ACCESS : DWORD = 0xf001f;
2804 pub const FILE_MAP_READ : DWORD = 0x4;
2805 pub const FILE_MAP_WRITE : DWORD = 0x2;
2806 pub const FILE_MAP_COPY : DWORD = 0x1;
2807 pub const FILE_MAP_EXECUTE : DWORD = 0x20;
2808
2809 pub const PROCESSOR_ARCHITECTURE_INTEL : WORD = 0;
2810 pub const PROCESSOR_ARCHITECTURE_ARM : WORD = 5;
2811 pub const PROCESSOR_ARCHITECTURE_IA64 : WORD = 6;
2812 pub const PROCESSOR_ARCHITECTURE_AMD64 : WORD = 9;
2813 pub const PROCESSOR_ARCHITECTURE_UNKNOWN : WORD = 0xffff;
2814
2815 pub const MOVEFILE_COPY_ALLOWED: DWORD = 2;
2816 pub const MOVEFILE_CREATE_HARDLINK: DWORD = 16;
2817 pub const MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 4;
2818 pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 32;
2819 pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1;
2820 pub const MOVEFILE_WRITE_THROUGH: DWORD = 8;
2821
2822 pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 1;
2823
2824 pub const FILE_SHARE_DELETE: DWORD = 0x4;
2825 pub const FILE_SHARE_READ: DWORD = 0x1;
2826 pub const FILE_SHARE_WRITE: DWORD = 0x2;
2827
2828 pub const CREATE_ALWAYS: DWORD = 2;
2829 pub const CREATE_NEW: DWORD = 1;
2830 pub const OPEN_ALWAYS: DWORD = 4;
2831 pub const OPEN_EXISTING: DWORD = 3;
2832 pub const TRUNCATE_EXISTING: DWORD = 5;
2833
2834 pub const FILE_APPEND_DATA: DWORD = 0x00000004;
2835 pub const FILE_READ_DATA: DWORD = 0x00000001;
2836 pub const FILE_WRITE_DATA: DWORD = 0x00000002;
2837
2838 pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x20;
2839 pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x800;
2840 pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x40;
2841 pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
2842 pub const FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x4000;
2843 pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x2;
2844 pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x8000;
2845 pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x80;
2846 pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x2000;
2847 pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x20000;
2848 pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x1000;
2849 pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
2850 pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
2851 pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x200;
2852 pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x4;
2853 pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x100;
2854 pub const FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x10000;
2855
2856 pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
2857 pub const FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000;
2858 pub const FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000;
2859 pub const FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000;
2860 pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
2861 pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
2862 pub const FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x0100000;
2863 pub const FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000;
2864 pub const FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000;
2865 pub const FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000;
2866 pub const FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000;
2867 pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
2868
2869 pub const FILE_NAME_NORMALIZED: DWORD = 0x0;
2870 pub const FILE_NAME_OPENED: DWORD = 0x8;
2871
2872 pub const VOLUME_NAME_DOS: DWORD = 0x0;
2873 pub const VOLUME_NAME_GUID: DWORD = 0x1;
2874 pub const VOLUME_NAME_NONE: DWORD = 0x4;
2875 pub const VOLUME_NAME_NT: DWORD = 0x2;
2876
2877 pub const GENERIC_READ: DWORD = 0x80000000;
2878 pub const GENERIC_WRITE: DWORD = 0x40000000;
2879 pub const GENERIC_EXECUTE: DWORD = 0x20000000;
2880 pub const GENERIC_ALL: DWORD = 0x10000000;
2881 pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
2882 pub const FILE_READ_ATTRIBUTES: DWORD = 0x00000080;
2883
2884 pub const STANDARD_RIGHTS_READ: DWORD = 0x20000;
2885 pub const STANDARD_RIGHTS_WRITE: DWORD = 0x20000;
2886 pub const FILE_WRITE_EA: DWORD = 0x00000010;
2887 pub const FILE_READ_EA: DWORD = 0x00000008;
2888 pub const FILE_GENERIC_READ: DWORD =
2889 STANDARD_RIGHTS_READ | FILE_READ_DATA |
2890 FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE;
2891 pub const FILE_GENERIC_WRITE: DWORD =
2892 STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA |
2893 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA |
2894 SYNCHRONIZE;
2895
2896 pub const FILE_BEGIN: DWORD = 0;
2897 pub const FILE_CURRENT: DWORD = 1;
2898 pub const FILE_END: DWORD = 2;
2899
2900 pub const MAX_PROTOCOL_CHAIN: DWORD = 7;
2901 pub const WSAPROTOCOL_LEN: DWORD = 255;
85aaf69f 2902 pub const INVALID_SOCKET: SOCKET = !0;
1a4d82fc
JJ
2903
2904 pub const DETACHED_PROCESS: DWORD = 0x00000008;
2905 pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
2906 pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
2907
2908 pub const PIPE_ACCESS_DUPLEX: DWORD = 0x00000003;
2909 pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
2910 pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
2911 pub const PIPE_TYPE_BYTE: DWORD = 0x00000000;
2912 pub const PIPE_TYPE_MESSAGE: DWORD = 0x00000004;
2913 pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
2914 pub const PIPE_READMODE_MESSAGE: DWORD = 0x00000002;
2915 pub const PIPE_WAIT: DWORD = 0x00000000;
2916 pub const PIPE_NOWAIT: DWORD = 0x00000001;
2917 pub const PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000;
2918 pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
2919 pub const PIPE_UNLIMITED_INSTANCES: DWORD = 255;
2920
2921 pub const IPPROTO_RAW: c_int = 255;
2922
2923 pub const FIONBIO: c_long = -0x7FFB9982;
2924 }
2925 pub mod sysconf {
2926 }
2927 }
2928
2929
c34b1796 2930 #[cfg(any(target_os = "linux", target_os = "android", target_os = "nacl"))]
1a4d82fc
JJ
2931 pub mod os {
2932 pub mod c95 {
2933 use types::os::arch::c95::{c_int, c_uint};
2934
2935 pub const EXIT_FAILURE : c_int = 1;
2936 pub const EXIT_SUCCESS : c_int = 0;
2937 pub const RAND_MAX : c_int = 2147483647;
2938 pub const EOF : c_int = -1;
2939 pub const SEEK_SET : c_int = 0;
2940 pub const SEEK_CUR : c_int = 1;
2941 pub const SEEK_END : c_int = 2;
2942 pub const _IOFBF : c_int = 0;
2943 pub const _IONBF : c_int = 2;
2944 pub const _IOLBF : c_int = 1;
c34b1796
AL
2945 pub const BUFSIZ : c_uint = 8192;
2946 pub const FOPEN_MAX : c_uint = 16;
2947 pub const FILENAME_MAX : c_uint = 4096;
2948 pub const L_tmpnam : c_uint = 20;
2949 pub const TMP_MAX : c_uint = 238328;
1a4d82fc
JJ
2950 }
2951 pub mod c99 {
2952 }
2953 #[cfg(any(target_arch = "x86",
2954 target_arch = "x86_64",
2955 target_arch = "arm",
85aaf69f 2956 target_arch = "aarch64",
c34b1796 2957 target_arch = "le32",
85aaf69f 2958 target_arch = "powerpc"))]
1a4d82fc
JJ
2959 pub mod posix88 {
2960 use types::os::arch::c95::c_int;
2961 use types::common::c95::c_void;
2962 use types::os::arch::posix88::mode_t;
2963
2964 pub const O_RDONLY : c_int = 0;
2965 pub const O_WRONLY : c_int = 1;
2966 pub const O_RDWR : c_int = 2;
2967 pub const O_APPEND : c_int = 1024;
2968 pub const O_CREAT : c_int = 64;
2969 pub const O_EXCL : c_int = 128;
9346a6ac 2970 pub const O_NOCTTY : c_int = 256;
1a4d82fc
JJ
2971 pub const O_TRUNC : c_int = 512;
2972 pub const S_IFIFO : mode_t = 4096;
2973 pub const S_IFCHR : mode_t = 8192;
2974 pub const S_IFBLK : mode_t = 24576;
2975 pub const S_IFDIR : mode_t = 16384;
2976 pub const S_IFREG : mode_t = 32768;
2977 pub const S_IFLNK : mode_t = 40960;
c1a9b12d 2978 pub const S_IFSOCK : mode_t = 49152;
1a4d82fc
JJ
2979 pub const S_IFMT : mode_t = 61440;
2980 pub const S_IEXEC : mode_t = 64;
2981 pub const S_IWRITE : mode_t = 128;
2982 pub const S_IREAD : mode_t = 256;
2983 pub const S_IRWXU : mode_t = 448;
2984 pub const S_IXUSR : mode_t = 64;
2985 pub const S_IWUSR : mode_t = 128;
2986 pub const S_IRUSR : mode_t = 256;
c34b1796
AL
2987 pub const S_IRWXG : mode_t = 56;
2988 pub const S_IXGRP : mode_t = 8;
2989 pub const S_IWGRP : mode_t = 16;
2990 pub const S_IRGRP : mode_t = 32;
2991 pub const S_IRWXO : mode_t = 7;
2992 pub const S_IXOTH : mode_t = 1;
2993 pub const S_IWOTH : mode_t = 2;
2994 pub const S_IROTH : mode_t = 4;
1a4d82fc
JJ
2995 pub const F_OK : c_int = 0;
2996 pub const R_OK : c_int = 4;
2997 pub const W_OK : c_int = 2;
2998 pub const X_OK : c_int = 1;
2999 pub const STDIN_FILENO : c_int = 0;
3000 pub const STDOUT_FILENO : c_int = 1;
3001 pub const STDERR_FILENO : c_int = 2;
3002 pub const F_LOCK : c_int = 1;
3003 pub const F_TEST : c_int = 3;
3004 pub const F_TLOCK : c_int = 2;
3005 pub const F_ULOCK : c_int = 0;
3006 pub const SIGHUP : c_int = 1;
3007 pub const SIGINT : c_int = 2;
3008 pub const SIGQUIT : c_int = 3;
3009 pub const SIGILL : c_int = 4;
3010 pub const SIGABRT : c_int = 6;
3011 pub const SIGFPE : c_int = 8;
3012 pub const SIGKILL : c_int = 9;
3013 pub const SIGSEGV : c_int = 11;
3014 pub const SIGPIPE : c_int = 13;
3015 pub const SIGALRM : c_int = 14;
3016 pub const SIGTERM : c_int = 15;
3017
3018 pub const PROT_NONE : c_int = 0;
3019 pub const PROT_READ : c_int = 1;
3020 pub const PROT_WRITE : c_int = 2;
3021 pub const PROT_EXEC : c_int = 4;
3022
3023 pub const MAP_FILE : c_int = 0x0000;
3024 pub const MAP_SHARED : c_int = 0x0001;
3025 pub const MAP_PRIVATE : c_int = 0x0002;
3026 pub const MAP_FIXED : c_int = 0x0010;
3027 pub const MAP_ANON : c_int = 0x0020;
3028
c34b1796 3029 pub const MAP_FAILED : *mut c_void = !0 as *mut c_void;
1a4d82fc
JJ
3030
3031 pub const MCL_CURRENT : c_int = 0x0001;
3032 pub const MCL_FUTURE : c_int = 0x0002;
3033
3034 pub const MS_ASYNC : c_int = 0x0001;
3035 pub const MS_INVALIDATE : c_int = 0x0002;
3036 pub const MS_SYNC : c_int = 0x0004;
3037
3038 pub const EPERM : c_int = 1;
3039 pub const ENOENT : c_int = 2;
3040 pub const ESRCH : c_int = 3;
3041 pub const EINTR : c_int = 4;
3042 pub const EIO : c_int = 5;
3043 pub const ENXIO : c_int = 6;
3044 pub const E2BIG : c_int = 7;
3045 pub const ENOEXEC : c_int = 8;
3046 pub const EBADF : c_int = 9;
3047 pub const ECHILD : c_int = 10;
3048 pub const EAGAIN : c_int = 11;
3049 pub const ENOMEM : c_int = 12;
3050 pub const EACCES : c_int = 13;
3051 pub const EFAULT : c_int = 14;
3052 pub const ENOTBLK : c_int = 15;
3053 pub const EBUSY : c_int = 16;
3054 pub const EEXIST : c_int = 17;
3055 pub const EXDEV : c_int = 18;
3056 pub const ENODEV : c_int = 19;
3057 pub const ENOTDIR : c_int = 20;
3058 pub const EISDIR : c_int = 21;
3059 pub const EINVAL : c_int = 22;
3060 pub const ENFILE : c_int = 23;
3061 pub const EMFILE : c_int = 24;
3062 pub const ENOTTY : c_int = 25;
3063 pub const ETXTBSY : c_int = 26;
3064 pub const EFBIG : c_int = 27;
3065 pub const ENOSPC : c_int = 28;
3066 pub const ESPIPE : c_int = 29;
3067 pub const EROFS : c_int = 30;
3068 pub const EMLINK : c_int = 31;
3069 pub const EPIPE : c_int = 32;
3070 pub const EDOM : c_int = 33;
3071 pub const ERANGE : c_int = 34;
3072
3073 pub const EDEADLK: c_int = 35;
3074 pub const ENAMETOOLONG: c_int = 36;
3075 pub const ENOLCK: c_int = 37;
3076 pub const ENOSYS: c_int = 38;
3077 pub const ENOTEMPTY: c_int = 39;
3078 pub const ELOOP: c_int = 40;
3079 pub const EWOULDBLOCK: c_int = EAGAIN;
3080 pub const ENOMSG: c_int = 42;
3081 pub const EIDRM: c_int = 43;
3082 pub const ECHRNG: c_int = 44;
3083 pub const EL2NSYNC: c_int = 45;
3084 pub const EL3HLT: c_int = 46;
3085 pub const EL3RST: c_int = 47;
3086 pub const ELNRNG: c_int = 48;
3087 pub const EUNATCH: c_int = 49;
3088 pub const ENOCSI: c_int = 50;
3089 pub const EL2HLT: c_int = 51;
3090 pub const EBADE: c_int = 52;
3091 pub const EBADR: c_int = 53;
3092 pub const EXFULL: c_int = 54;
3093 pub const ENOANO: c_int = 55;
3094 pub const EBADRQC: c_int = 56;
3095 pub const EBADSLT: c_int = 57;
3096
3097 pub const EDEADLOCK: c_int = EDEADLK;
3098
3099 pub const EBFONT: c_int = 59;
3100 pub const ENOSTR: c_int = 60;
3101 pub const ENODATA: c_int = 61;
3102 pub const ETIME: c_int = 62;
3103 pub const ENOSR: c_int = 63;
3104 pub const ENONET: c_int = 64;
3105 pub const ENOPKG: c_int = 65;
3106 pub const EREMOTE: c_int = 66;
3107 pub const ENOLINK: c_int = 67;
3108 pub const EADV: c_int = 68;
3109 pub const ESRMNT: c_int = 69;
3110 pub const ECOMM: c_int = 70;
3111 pub const EPROTO: c_int = 71;
3112 pub const EMULTIHOP: c_int = 72;
3113 pub const EDOTDOT: c_int = 73;
3114 pub const EBADMSG: c_int = 74;
3115 pub const EOVERFLOW: c_int = 75;
3116 pub const ENOTUNIQ: c_int = 76;
3117 pub const EBADFD: c_int = 77;
3118 pub const EREMCHG: c_int = 78;
3119 pub const ELIBACC: c_int = 79;
3120 pub const ELIBBAD: c_int = 80;
3121 pub const ELIBSCN: c_int = 81;
3122 pub const ELIBMAX: c_int = 82;
3123 pub const ELIBEXEC: c_int = 83;
3124 pub const EILSEQ: c_int = 84;
3125 pub const ERESTART: c_int = 85;
3126 pub const ESTRPIPE: c_int = 86;
3127 pub const EUSERS: c_int = 87;
3128 pub const ENOTSOCK: c_int = 88;
3129 pub const EDESTADDRREQ: c_int = 89;
3130 pub const EMSGSIZE: c_int = 90;
3131 pub const EPROTOTYPE: c_int = 91;
3132 pub const ENOPROTOOPT: c_int = 92;
3133 pub const EPROTONOSUPPORT: c_int = 93;
3134 pub const ESOCKTNOSUPPORT: c_int = 94;
3135 pub const EOPNOTSUPP: c_int = 95;
3136 pub const EPFNOSUPPORT: c_int = 96;
3137 pub const EAFNOSUPPORT: c_int = 97;
3138 pub const EADDRINUSE: c_int = 98;
3139 pub const EADDRNOTAVAIL: c_int = 99;
3140 pub const ENETDOWN: c_int = 100;
3141 pub const ENETUNREACH: c_int = 101;
3142 pub const ENETRESET: c_int = 102;
3143 pub const ECONNABORTED: c_int = 103;
3144 pub const ECONNRESET: c_int = 104;
3145 pub const ENOBUFS: c_int = 105;
3146 pub const EISCONN: c_int = 106;
3147 pub const ENOTCONN: c_int = 107;
3148 pub const ESHUTDOWN: c_int = 108;
3149 pub const ETOOMANYREFS: c_int = 109;
3150 pub const ETIMEDOUT: c_int = 110;
3151 pub const ECONNREFUSED: c_int = 111;
3152 pub const EHOSTDOWN: c_int = 112;
3153 pub const EHOSTUNREACH: c_int = 113;
3154 pub const EALREADY: c_int = 114;
3155 pub const EINPROGRESS: c_int = 115;
3156 pub const ESTALE: c_int = 116;
3157 pub const EUCLEAN: c_int = 117;
3158 pub const ENOTNAM: c_int = 118;
3159 pub const ENAVAIL: c_int = 119;
3160 pub const EISNAM: c_int = 120;
3161 pub const EREMOTEIO: c_int = 121;
3162 pub const EDQUOT: c_int = 122;
3163
3164 pub const ENOMEDIUM: c_int = 123;
3165 pub const EMEDIUMTYPE: c_int = 124;
3166 pub const ECANCELED: c_int = 125;
3167 pub const ENOKEY: c_int = 126;
3168 pub const EKEYEXPIRED: c_int = 127;
3169 pub const EKEYREVOKED: c_int = 128;
3170 pub const EKEYREJECTED: c_int = 129;
3171
3172 pub const EOWNERDEAD: c_int = 130;
3173 pub const ENOTRECOVERABLE: c_int = 131;
3174
3175 pub const ERFKILL: c_int = 132;
3176
3177 pub const EHWPOISON: c_int = 133;
3178 }
3179
85aaf69f
SL
3180 #[cfg(any(target_arch = "mips",
3181 target_arch = "mipsel"))]
1a4d82fc
JJ
3182 pub mod posix88 {
3183 use types::os::arch::c95::c_int;
3184 use types::common::c95::c_void;
3185 use types::os::arch::posix88::mode_t;
3186
3187 pub const O_RDONLY : c_int = 0;
3188 pub const O_WRONLY : c_int = 1;
3189 pub const O_RDWR : c_int = 2;
3190 pub const O_APPEND : c_int = 8;
3191 pub const O_CREAT : c_int = 256;
3192 pub const O_EXCL : c_int = 1024;
9346a6ac 3193 pub const O_NOCTTY : c_int = 2048;
1a4d82fc
JJ
3194 pub const O_TRUNC : c_int = 512;
3195 pub const S_IFIFO : mode_t = 4096;
3196 pub const S_IFCHR : mode_t = 8192;
3197 pub const S_IFBLK : mode_t = 24576;
3198 pub const S_IFDIR : mode_t = 16384;
3199 pub const S_IFREG : mode_t = 32768;
3200 pub const S_IFLNK : mode_t = 40960;
c1a9b12d 3201 pub const S_IFSOCK : mode_t = 49152;
1a4d82fc
JJ
3202 pub const S_IFMT : mode_t = 61440;
3203 pub const S_IEXEC : mode_t = 64;
3204 pub const S_IWRITE : mode_t = 128;
3205 pub const S_IREAD : mode_t = 256;
3206 pub const S_IRWXU : mode_t = 448;
3207 pub const S_IXUSR : mode_t = 64;
3208 pub const S_IWUSR : mode_t = 128;
3209 pub const S_IRUSR : mode_t = 256;
c34b1796
AL
3210 pub const S_IRWXG : mode_t = 56;
3211 pub const S_IXGRP : mode_t = 8;
3212 pub const S_IWGRP : mode_t = 16;
3213 pub const S_IRGRP : mode_t = 32;
3214 pub const S_IRWXO : mode_t = 7;
3215 pub const S_IXOTH : mode_t = 1;
3216 pub const S_IWOTH : mode_t = 2;
3217 pub const S_IROTH : mode_t = 4;
1a4d82fc
JJ
3218 pub const F_OK : c_int = 0;
3219 pub const R_OK : c_int = 4;
3220 pub const W_OK : c_int = 2;
3221 pub const X_OK : c_int = 1;
3222 pub const STDIN_FILENO : c_int = 0;
3223 pub const STDOUT_FILENO : c_int = 1;
3224 pub const STDERR_FILENO : c_int = 2;
3225 pub const F_LOCK : c_int = 1;
3226 pub const F_TEST : c_int = 3;
3227 pub const F_TLOCK : c_int = 2;
3228 pub const F_ULOCK : c_int = 0;
3229 pub const SIGHUP : c_int = 1;
3230 pub const SIGINT : c_int = 2;
3231 pub const SIGQUIT : c_int = 3;
3232 pub const SIGILL : c_int = 4;
3233 pub const SIGABRT : c_int = 6;
3234 pub const SIGFPE : c_int = 8;
3235 pub const SIGKILL : c_int = 9;
3236 pub const SIGSEGV : c_int = 11;
3237 pub const SIGPIPE : c_int = 13;
3238 pub const SIGALRM : c_int = 14;
3239 pub const SIGTERM : c_int = 15;
3240
3241 pub const PROT_NONE : c_int = 0;
3242 pub const PROT_READ : c_int = 1;
3243 pub const PROT_WRITE : c_int = 2;
3244 pub const PROT_EXEC : c_int = 4;
3245
3246 pub const MAP_FILE : c_int = 0x0000;
3247 pub const MAP_SHARED : c_int = 0x0001;
3248 pub const MAP_PRIVATE : c_int = 0x0002;
3249 pub const MAP_FIXED : c_int = 0x0010;
3250 pub const MAP_ANON : c_int = 0x0800;
3251
9346a6ac 3252 pub const MAP_FAILED : *mut c_void = !0 as *mut c_void;
1a4d82fc
JJ
3253
3254 pub const MCL_CURRENT : c_int = 0x0001;
3255 pub const MCL_FUTURE : c_int = 0x0002;
3256
3257 pub const MS_ASYNC : c_int = 0x0001;
3258 pub const MS_INVALIDATE : c_int = 0x0002;
3259 pub const MS_SYNC : c_int = 0x0004;
3260
3261 pub const EPERM : c_int = 1;
3262 pub const ENOENT : c_int = 2;
3263 pub const ESRCH : c_int = 3;
3264 pub const EINTR : c_int = 4;
3265 pub const EIO : c_int = 5;
3266 pub const ENXIO : c_int = 6;
3267 pub const E2BIG : c_int = 7;
3268 pub const ENOEXEC : c_int = 8;
3269 pub const EBADF : c_int = 9;
3270 pub const ECHILD : c_int = 10;
3271 pub const EAGAIN : c_int = 11;
3272 pub const ENOMEM : c_int = 12;
3273 pub const EACCES : c_int = 13;
3274 pub const EFAULT : c_int = 14;
3275 pub const ENOTBLK : c_int = 15;
3276 pub const EBUSY : c_int = 16;
3277 pub const EEXIST : c_int = 17;
3278 pub const EXDEV : c_int = 18;
3279 pub const ENODEV : c_int = 19;
3280 pub const ENOTDIR : c_int = 20;
3281 pub const EISDIR : c_int = 21;
3282 pub const EINVAL : c_int = 22;
3283 pub const ENFILE : c_int = 23;
3284 pub const EMFILE : c_int = 24;
3285 pub const ENOTTY : c_int = 25;
3286 pub const ETXTBSY : c_int = 26;
3287 pub const EFBIG : c_int = 27;
3288 pub const ENOSPC : c_int = 28;
3289 pub const ESPIPE : c_int = 29;
3290 pub const EROFS : c_int = 30;
3291 pub const EMLINK : c_int = 31;
3292 pub const EPIPE : c_int = 32;
3293 pub const EDOM : c_int = 33;
3294 pub const ERANGE : c_int = 34;
3295
3296 pub const ENOMSG: c_int = 35;
3297 pub const EIDRM: c_int = 36;
3298 pub const ECHRNG: c_int = 37;
3299 pub const EL2NSYNC: c_int = 38;
3300 pub const EL3HLT: c_int = 39;
3301 pub const EL3RST: c_int = 40;
3302 pub const ELNRNG: c_int = 41;
3303 pub const EUNATCH: c_int = 42;
3304 pub const ENOCSI: c_int = 43;
3305 pub const EL2HLT: c_int = 44;
3306 pub const EDEADLK: c_int = 45;
3307 pub const ENOLCK: c_int = 46;
3308 pub const EBADE: c_int = 50;
3309 pub const EBADR: c_int = 51;
3310 pub const EXFULL: c_int = 52;
3311 pub const ENOANO: c_int = 53;
3312 pub const EBADRQC: c_int = 54;
3313 pub const EBADSLT: c_int = 55;
3314 pub const EDEADLOCK: c_int = 56;
3315 pub const EBFONT: c_int = 59;
3316 pub const ENOSTR: c_int = 60;
3317 pub const ENODATA: c_int = 61;
3318 pub const ETIME: c_int = 62;
3319 pub const ENOSR: c_int = 63;
3320 pub const ENONET: c_int = 64;
3321 pub const ENOPKG: c_int = 65;
3322 pub const EREMOTE: c_int = 66;
3323 pub const ENOLINK: c_int = 67;
3324 pub const EADV: c_int = 68;
3325 pub const ESRMNT: c_int = 69;
3326 pub const ECOMM: c_int = 70;
3327 pub const EPROTO: c_int = 71;
3328 pub const EDOTDOT: c_int = 73;
3329 pub const EMULTIHOP: c_int = 74;
3330 pub const EBADMSG: c_int = 77;
3331 pub const ENAMETOOLONG: c_int = 78;
3332 pub const EOVERFLOW: c_int = 79;
3333 pub const ENOTUNIQ: c_int = 80;
3334 pub const EBADFD: c_int = 81;
3335 pub const EREMCHG: c_int = 82;
3336 pub const ELIBACC: c_int = 83;
3337 pub const ELIBBAD: c_int = 84;
3338 pub const ELIBSCN: c_int = 95;
3339 pub const ELIBMAX: c_int = 86;
3340 pub const ELIBEXEC: c_int = 87;
3341 pub const EILSEQ: c_int = 88;
3342 pub const ENOSYS: c_int = 89;
3343 pub const ELOOP: c_int = 90;
3344 pub const ERESTART: c_int = 91;
3345 pub const ESTRPIPE: c_int = 92;
3346 pub const ENOTEMPTY: c_int = 93;
3347 pub const EUSERS: c_int = 94;
3348 pub const ENOTSOCK: c_int = 95;
3349 pub const EDESTADDRREQ: c_int = 96;
3350 pub const EMSGSIZE: c_int = 97;
3351 pub const EPROTOTYPE: c_int = 98;
3352 pub const ENOPROTOOPT: c_int = 99;
3353 pub const EPROTONOSUPPORT: c_int = 120;
3354 pub const ESOCKTNOSUPPORT: c_int = 121;
3355 pub const EOPNOTSUPP: c_int = 122;
3356 pub const EPFNOSUPPORT: c_int = 123;
3357 pub const EAFNOSUPPORT: c_int = 124;
3358 pub const EADDRINUSE: c_int = 125;
3359 pub const EADDRNOTAVAIL: c_int = 126;
3360 pub const ENETDOWN: c_int = 127;
3361 pub const ENETUNREACH: c_int = 128;
3362 pub const ENETRESET: c_int = 129;
3363 pub const ECONNABORTED: c_int = 130;
3364 pub const ECONNRESET: c_int = 131;
3365 pub const ENOBUFS: c_int = 132;
3366 pub const EISCONN: c_int = 133;
3367 pub const ENOTCONN: c_int = 134;
3368 pub const EUCLEAN: c_int = 135;
3369 pub const ENOTNAM: c_int = 137;
3370 pub const ENAVAIL: c_int = 138;
3371 pub const EISNAM: c_int = 139;
3372 pub const EREMOTEIO: c_int = 140;
3373 pub const ESHUTDOWN: c_int = 143;
3374 pub const ETOOMANYREFS: c_int = 144;
3375 pub const ETIMEDOUT: c_int = 145;
3376 pub const ECONNREFUSED: c_int = 146;
3377 pub const EHOSTDOWN: c_int = 147;
3378 pub const EHOSTUNREACH: c_int = 148;
3379 pub const EWOULDBLOCK: c_int = EAGAIN;
3380 pub const EALREADY: c_int = 149;
3381 pub const EINPROGRESS: c_int = 150;
3382 pub const ESTALE: c_int = 151;
3383 pub const ECANCELED: c_int = 158;
3384
3385 pub const ENOMEDIUM: c_int = 159;
3386 pub const EMEDIUMTYPE: c_int = 160;
3387 pub const ENOKEY: c_int = 161;
3388 pub const EKEYEXPIRED: c_int = 162;
3389 pub const EKEYREVOKED: c_int = 163;
3390 pub const EKEYREJECTED: c_int = 164;
3391
3392 pub const EOWNERDEAD: c_int = 165;
3393 pub const ENOTRECOVERABLE: c_int = 166;
3394
3395 pub const ERFKILL: c_int = 167;
3396
3397 pub const EHWPOISON: c_int = 168;
3398
3399 pub const EDQUOT: c_int = 1133;
3400 }
c34b1796 3401 #[cfg(not(target_os = "nacl"))]
1a4d82fc
JJ
3402 pub mod posix01 {
3403 use types::os::arch::c95::{c_int, size_t};
c34b1796 3404 use types::os::common::posix01::rlim_t;
1a4d82fc
JJ
3405
3406 pub const F_DUPFD : c_int = 0;
3407 pub const F_GETFD : c_int = 1;
3408 pub const F_SETFD : c_int = 2;
3409 pub const F_GETFL : c_int = 3;
3410 pub const F_SETFL : c_int = 4;
3411
d9579d0f
AL
3412 pub const O_ACCMODE : c_int = 3;
3413
1a4d82fc 3414 pub const SIGTRAP : c_int = 5;
1a4d82fc
JJ
3415 pub const SIG_IGN: size_t = 1;
3416
3417 pub const GLOB_ERR : c_int = 1 << 0;
3418 pub const GLOB_MARK : c_int = 1 << 1;
3419 pub const GLOB_NOSORT : c_int = 1 << 2;
3420 pub const GLOB_DOOFFS : c_int = 1 << 3;
3421 pub const GLOB_NOCHECK : c_int = 1 << 4;
3422 pub const GLOB_APPEND : c_int = 1 << 5;
3423 pub const GLOB_NOESCAPE : c_int = 1 << 6;
3424
3425 pub const GLOB_NOSPACE : c_int = 1;
3426 pub const GLOB_ABORTED : c_int = 2;
3427 pub const GLOB_NOMATCH : c_int = 3;
3428
3429 pub const POSIX_MADV_NORMAL : c_int = 0;
3430 pub const POSIX_MADV_RANDOM : c_int = 1;
3431 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3432 pub const POSIX_MADV_WILLNEED : c_int = 3;
3433 pub const POSIX_MADV_DONTNEED : c_int = 4;
3434
3435 pub const _SC_MQ_PRIO_MAX : c_int = 28;
3436 pub const _SC_IOV_MAX : c_int = 60;
3437 pub const _SC_GETGR_R_SIZE_MAX : c_int = 69;
3438 pub const _SC_GETPW_R_SIZE_MAX : c_int = 70;
3439 pub const _SC_LOGIN_NAME_MAX : c_int = 71;
3440 pub const _SC_TTY_NAME_MAX : c_int = 72;
3441 pub const _SC_THREADS : c_int = 67;
3442 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
3443 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
3444 pub const _SC_THREAD_KEYS_MAX : c_int = 74;
3445 pub const _SC_THREAD_STACK_MIN : c_int = 75;
3446 pub const _SC_THREAD_THREADS_MAX : c_int = 76;
3447 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
3448 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
3449 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
3450 pub const _SC_THREAD_PRIO_INHERIT : c_int = 80;
3451 pub const _SC_THREAD_PRIO_PROTECT : c_int = 81;
3452 pub const _SC_THREAD_PROCESS_SHARED : c_int = 82;
3453 pub const _SC_ATEXIT_MAX : c_int = 87;
3454 pub const _SC_XOPEN_VERSION : c_int = 89;
3455 pub const _SC_XOPEN_XCU_VERSION : c_int = 90;
3456 pub const _SC_XOPEN_UNIX : c_int = 91;
3457 pub const _SC_XOPEN_CRYPT : c_int = 92;
3458 pub const _SC_XOPEN_ENH_I18N : c_int = 93;
3459 pub const _SC_XOPEN_SHM : c_int = 94;
3460 pub const _SC_XOPEN_LEGACY : c_int = 129;
3461 pub const _SC_XOPEN_REALTIME : c_int = 130;
3462 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 131;
3463
9346a6ac
AL
3464
3465
1a4d82fc
JJ
3466 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
3467 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
3468
3469 #[cfg(target_os = "android")]
3470 pub const PTHREAD_STACK_MIN: size_t = 8192;
3471
3472 #[cfg(all(target_os = "linux",
3473 any(target_arch = "arm",
3474 target_arch = "x86",
3475 target_arch = "x86_64")))]
3476 pub const PTHREAD_STACK_MIN: size_t = 16384;
3477
3478 #[cfg(all(target_os = "linux",
3479 any(target_arch = "mips",
3480 target_arch = "mipsel",
85aaf69f
SL
3481 target_arch = "aarch64",
3482 target_arch = "powerpc")))]
1a4d82fc
JJ
3483 pub const PTHREAD_STACK_MIN: size_t = 131072;
3484
3485 pub const CLOCK_REALTIME: c_int = 0;
3486 pub const CLOCK_MONOTONIC: c_int = 1;
c34b1796
AL
3487
3488 pub const RLIMIT_CPU: c_int = 0;
3489 pub const RLIMIT_FSIZE: c_int = 1;
3490 pub const RLIMIT_DATA: c_int = 2;
3491 pub const RLIMIT_STACK: c_int = 3;
3492 pub const RLIMIT_CORE: c_int = 4;
3493 pub const RLIMIT_RSS: c_int = 5;
3494 pub const RLIMIT_NOFILE: c_int = 7;
3495 pub const RLIMIT_AS: c_int = 9;
3496 pub const RLIMIT_NPROC: c_int = 6;
3497 pub const RLIMIT_MEMLOCK: c_int = 8;
3498 pub const RLIMIT_LOCKS: c_int = 10;
3499 pub const RLIMIT_SIGPENDING: c_int = 11;
3500 pub const RLIMIT_MSGQUEUE: c_int = 12;
3501 pub const RLIMIT_NICE: c_int = 13;
3502 pub const RLIMIT_RTPRIO: c_int = 14;
3503 pub const RLIMIT_RTTIME: c_int = 15;
3504 pub const RLIMIT_NLIMITS: c_int = 16;
3505 pub const RLIM_INFINITY: rlim_t = 0xffff_ffff_ffff_ffff;
3506 pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY;
3507 pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY;
3508
3509 pub const RUSAGE_SELF: c_int = 0;
3510 pub const RUSAGE_CHILDREN: c_int = -1;
3511 pub const RUSAGE_THREAD: c_int = 1;
3512 }
3513 #[cfg(target_os = "nacl")]
3514 pub mod posix01 {
3515 use types::os::arch::c95::{c_int, size_t};
3516 use types::os::common::posix01::rlim_t;
3517
3518 pub const F_DUPFD : c_int = 0;
3519 pub const F_GETFD : c_int = 1;
3520 pub const F_SETFD : c_int = 2;
3521 pub const F_GETFL : c_int = 3;
3522 pub const F_SETFL : c_int = 4;
3523
3524 pub const SIGTRAP : c_int = 5;
3525 pub const SIG_IGN: size_t = 1;
3526
3527 pub const GLOB_ERR : c_int = 1 << 0;
3528 pub const GLOB_MARK : c_int = 1 << 1;
3529 pub const GLOB_NOSORT : c_int = 1 << 2;
3530 pub const GLOB_DOOFFS : c_int = 1 << 3;
3531 pub const GLOB_NOCHECK : c_int = 1 << 4;
3532 pub const GLOB_APPEND : c_int = 1 << 5;
3533 pub const GLOB_NOESCAPE : c_int = 1 << 6;
3534
3535 pub const GLOB_NOSPACE : c_int = 1;
3536 pub const GLOB_ABORTED : c_int = 2;
3537 pub const GLOB_NOMATCH : c_int = 3;
3538
3539 pub const POSIX_MADV_NORMAL : c_int = 0;
3540 pub const POSIX_MADV_RANDOM : c_int = 1;
3541 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3542 pub const POSIX_MADV_WILLNEED : c_int = 3;
3543 pub const POSIX_MADV_DONTNEED : c_int = 4;
3544
3545 pub const _SC_MQ_PRIO_MAX : c_int = 28;
3546 pub const _SC_IOV_MAX : c_int = 60;
3547 pub const _SC_GETGR_R_SIZE_MAX : c_int = 69;
3548 pub const _SC_GETPW_R_SIZE_MAX : c_int = 70;
3549 pub const _SC_LOGIN_NAME_MAX : c_int = 71;
3550 pub const _SC_TTY_NAME_MAX : c_int = 72;
3551 pub const _SC_THREADS : c_int = 67;
3552 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
3553 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
3554 pub const _SC_THREAD_KEYS_MAX : c_int = 74;
3555 pub const _SC_THREAD_STACK_MIN : c_int = 75;
3556 pub const _SC_THREAD_THREADS_MAX : c_int = 76;
3557 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
3558 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
3559 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
3560 pub const _SC_THREAD_PRIO_INHERIT : c_int = 80;
3561 pub const _SC_THREAD_PRIO_PROTECT : c_int = 81;
3562 pub const _SC_THREAD_PROCESS_SHARED : c_int = 82;
3563 pub const _SC_ATEXIT_MAX : c_int = 87;
3564 pub const _SC_XOPEN_VERSION : c_int = 89;
3565 pub const _SC_XOPEN_XCU_VERSION : c_int = 90;
3566 pub const _SC_XOPEN_UNIX : c_int = 91;
3567 pub const _SC_XOPEN_CRYPT : c_int = 92;
3568 pub const _SC_XOPEN_ENH_I18N : c_int = 93;
3569 pub const _SC_XOPEN_SHM : c_int = 94;
3570 pub const _SC_XOPEN_LEGACY : c_int = 129;
3571 pub const _SC_XOPEN_REALTIME : c_int = 130;
3572 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 131;
3573
3574 pub const PTHREAD_CREATE_JOINABLE: c_int = 1;
3575 pub const PTHREAD_CREATE_DETACHED: c_int = 0;
3576
3577 pub const PTHREAD_STACK_MIN: size_t = 1024;
3578
3579 pub const CLOCK_REALTIME: c_int = 0;
3580 pub const CLOCK_MONOTONIC: c_int = 1;
3581
3582 pub const RLIMIT_CPU: c_int = 0;
3583 pub const RLIMIT_FSIZE: c_int = 1;
3584 pub const RLIMIT_DATA: c_int = 2;
3585 pub const RLIMIT_STACK: c_int = 3;
3586 pub const RLIMIT_CORE: c_int = 4;
3587 pub const RLIMIT_RSS: c_int = 5;
3588 pub const RLIMIT_NOFILE: c_int = 7;
3589 pub const RLIMIT_AS: c_int = 9;
3590 pub const RLIMIT_NPROC: c_int = 6;
3591 pub const RLIMIT_MEMLOCK: c_int = 8;
3592 pub const RLIMIT_LOCKS: c_int = 10;
3593 pub const RLIMIT_SIGPENDING: c_int = 11;
3594 pub const RLIMIT_MSGQUEUE: c_int = 12;
3595 pub const RLIMIT_NICE: c_int = 13;
3596 pub const RLIMIT_RTPRIO: c_int = 14;
3597 pub const RLIMIT_RTTIME: c_int = 15;
3598 pub const RLIMIT_NLIMITS: c_int = 16;
3599
3600 pub const RLIM_INFINITY: rlim_t = 0xffff_ffff_ffff_ffff;
3601 pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY;
3602 pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY;
3603
3604 pub const RUSAGE_SELF: c_int = 0;
3605 pub const RUSAGE_CHILDREN: c_int = -1;
3606 pub const RUSAGE_THREAD: c_int = 1;
1a4d82fc
JJ
3607 }
3608 pub mod posix08 {
3609 }
3610 #[cfg(any(target_arch = "arm",
3611 target_arch = "aarch64",
3612 target_arch = "x86",
85aaf69f 3613 target_arch = "x86_64",
c34b1796 3614 target_arch = "le32",
85aaf69f 3615 target_arch = "powerpc"))]
1a4d82fc
JJ
3616 pub mod bsd44 {
3617 use types::os::arch::c95::c_int;
3618
3619 pub const MADV_NORMAL : c_int = 0;
3620 pub const MADV_RANDOM : c_int = 1;
3621 pub const MADV_SEQUENTIAL : c_int = 2;
3622 pub const MADV_WILLNEED : c_int = 3;
3623 pub const MADV_DONTNEED : c_int = 4;
3624 pub const MADV_REMOVE : c_int = 9;
3625 pub const MADV_DONTFORK : c_int = 10;
3626 pub const MADV_DOFORK : c_int = 11;
3627 pub const MADV_MERGEABLE : c_int = 12;
3628 pub const MADV_UNMERGEABLE : c_int = 13;
3629 pub const MADV_HWPOISON : c_int = 100;
3630
3631 pub const IFF_LOOPBACK: c_int = 0x8;
3632
3633 pub const AF_UNIX: c_int = 1;
3634 pub const AF_INET: c_int = 2;
3635 pub const AF_INET6: c_int = 10;
3636 pub const SOCK_STREAM: c_int = 1;
3637 pub const SOCK_DGRAM: c_int = 2;
3638 pub const SOCK_RAW: c_int = 3;
3639 pub const IPPROTO_TCP: c_int = 6;
3640 pub const IPPROTO_IP: c_int = 0;
3641 pub const IPPROTO_IPV6: c_int = 41;
3642 pub const IP_MULTICAST_TTL: c_int = 33;
3643 pub const IP_MULTICAST_LOOP: c_int = 34;
3644 pub const IP_TTL: c_int = 2;
3645 pub const IP_HDRINCL: c_int = 3;
3646 pub const IP_ADD_MEMBERSHIP: c_int = 35;
3647 pub const IP_DROP_MEMBERSHIP: c_int = 36;
3648 pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
3649 pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
3650
3651 pub const TCP_NODELAY: c_int = 1;
d9579d0f
AL
3652 pub const TCP_MAXSEG: c_int = 2;
3653 pub const TCP_CORK: c_int = 3;
3654 pub const TCP_KEEPIDLE: c_int = 4;
3655 pub const TCP_KEEPINTVL: c_int = 5;
3656 pub const TCP_KEEPCNT: c_int = 6;
3657 pub const TCP_SYNCNT: c_int = 7;
3658 pub const TCP_LINGER2: c_int = 8;
3659 pub const TCP_DEFER_ACCEPT: c_int = 9;
3660 pub const TCP_WINDOW_CLAMP: c_int = 10;
3661 pub const TCP_INFO: c_int = 11;
3662 pub const TCP_QUICKACK: c_int = 12;
3663 pub const TCP_CONGESTION: c_int = 13;
3664 pub const TCP_MD5SIG: c_int = 14;
3665 pub const TCP_COOKIE_TRANSACTIONS: c_int = 15;
3666 pub const TCP_THIN_LINEAR_TIMEOUTS: c_int = 16;
3667 pub const TCP_THIN_DUPACK: c_int = 17;
3668 pub const TCP_USER_TIMEOUT: c_int = 18;
3669 pub const TCP_REPAIR: c_int = 19;
3670 pub const TCP_REPAIR_QUEUE: c_int = 20;
3671 pub const TCP_QUEUE_SEQ: c_int = 21;
3672 pub const TCP_REPAIR_OPTIONS: c_int = 22;
3673 pub const TCP_FASTOPEN: c_int = 23;
3674 pub const TCP_TIMESTAMP: c_int = 24;
3675
1a4d82fc 3676 pub const SOL_SOCKET: c_int = 1;
c34b1796
AL
3677
3678 pub const SO_DEBUG: c_int = 1;
1a4d82fc 3679 pub const SO_REUSEADDR: c_int = 2;
c34b1796 3680 pub const SO_TYPE: c_int = 3;
1a4d82fc 3681 pub const SO_ERROR: c_int = 4;
c34b1796
AL
3682 pub const SO_DONTROUTE: c_int = 5;
3683 pub const SO_BROADCAST: c_int = 6;
3684 pub const SO_SNDBUF: c_int = 7;
3685 pub const SO_RCVBUF: c_int = 8;
3686 pub const SO_KEEPALIVE: c_int = 9;
3687 pub const SO_OOBINLINE: c_int = 10;
3688 pub const SO_LINGER: c_int = 13;
3689 pub const SO_REUSEPORT: c_int = 15;
3690 pub const SO_RCVLOWAT: c_int = 18;
3691 pub const SO_SNDLOWAT: c_int = 19;
3692 pub const SO_RCVTIMEO: c_int = 20;
3693 pub const SO_SNDTIMEO: c_int = 21;
3694 pub const SO_ACCEPTCONN: c_int = 30;
1a4d82fc
JJ
3695
3696 pub const SHUT_RD: c_int = 0;
3697 pub const SHUT_WR: c_int = 1;
3698 pub const SHUT_RDWR: c_int = 2;
c1a9b12d
SL
3699
3700 pub const LOCK_SH: c_int = 1;
3701 pub const LOCK_EX: c_int = 2;
3702 pub const LOCK_NB: c_int = 4;
3703 pub const LOCK_UN: c_int = 8;
1a4d82fc 3704 }
85aaf69f
SL
3705 #[cfg(any(target_arch = "mips",
3706 target_arch = "mipsel"))]
1a4d82fc
JJ
3707 pub mod bsd44 {
3708 use types::os::arch::c95::c_int;
3709
3710 pub const MADV_NORMAL : c_int = 0;
3711 pub const MADV_RANDOM : c_int = 1;
3712 pub const MADV_SEQUENTIAL : c_int = 2;
3713 pub const MADV_WILLNEED : c_int = 3;
3714 pub const MADV_DONTNEED : c_int = 4;
3715 pub const MADV_REMOVE : c_int = 9;
3716 pub const MADV_DONTFORK : c_int = 10;
3717 pub const MADV_DOFORK : c_int = 11;
3718 pub const MADV_MERGEABLE : c_int = 12;
3719 pub const MADV_UNMERGEABLE : c_int = 13;
3720 pub const MADV_HWPOISON : c_int = 100;
3721
3722 pub const AF_UNIX: c_int = 1;
3723 pub const AF_INET: c_int = 2;
3724 pub const AF_INET6: c_int = 10;
3725 pub const SOCK_STREAM: c_int = 2;
3726 pub const SOCK_DGRAM: c_int = 1;
3727 pub const SOCK_RAW: c_int = 3;
3728 pub const IPPROTO_TCP: c_int = 6;
3729 pub const IPPROTO_IP: c_int = 0;
3730 pub const IPPROTO_IPV6: c_int = 41;
3731 pub const IP_MULTICAST_TTL: c_int = 33;
3732 pub const IP_MULTICAST_LOOP: c_int = 34;
3733 pub const IP_TTL: c_int = 2;
3734 pub const IP_HDRINCL: c_int = 3;
3735 pub const IP_ADD_MEMBERSHIP: c_int = 35;
3736 pub const IP_DROP_MEMBERSHIP: c_int = 36;
3737 pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
3738 pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
3739
3740 pub const TCP_NODELAY: c_int = 1;
d9579d0f
AL
3741 pub const TCP_MAXSEG: c_int = 2;
3742 pub const TCP_CORK: c_int = 3;
3743 pub const TCP_KEEPIDLE: c_int = 4;
3744 pub const TCP_KEEPINTVL: c_int = 5;
3745 pub const TCP_KEEPCNT: c_int = 6;
3746 pub const TCP_SYNCNT: c_int = 7;
3747 pub const TCP_LINGER2: c_int = 8;
3748 pub const TCP_DEFER_ACCEPT: c_int = 9;
3749 pub const TCP_WINDOW_CLAMP: c_int = 10;
3750 pub const TCP_INFO: c_int = 11;
3751 pub const TCP_QUICKACK: c_int = 12;
3752 pub const TCP_CONGESTION: c_int = 13;
3753 pub const TCP_MD5SIG: c_int = 14;
3754 pub const TCP_COOKIE_TRANSACTIONS: c_int = 15;
3755 pub const TCP_THIN_LINEAR_TIMEOUTS: c_int = 16;
3756 pub const TCP_THIN_DUPACK: c_int = 17;
3757 pub const TCP_USER_TIMEOUT: c_int = 18;
3758 pub const TCP_REPAIR: c_int = 19;
3759 pub const TCP_REPAIR_QUEUE: c_int = 20;
3760 pub const TCP_QUEUE_SEQ: c_int = 21;
3761 pub const TCP_REPAIR_OPTIONS: c_int = 22;
3762 pub const TCP_FASTOPEN: c_int = 23;
3763 pub const TCP_TIMESTAMP: c_int = 24;
3764
1a4d82fc 3765 pub const SOL_SOCKET: c_int = 65535;
c34b1796
AL
3766
3767 pub const SO_DEBUG: c_int = 0x0001;
3768 pub const SO_REUSEADDR: c_int = 0x0004;
3769 pub const SO_KEEPALIVE: c_int = 0x0008;
3770 pub const SO_DONTROUTE: c_int = 0x0010;
3771 pub const SO_BROADCAST: c_int = 0x0020;
3772 pub const SO_LINGER: c_int = 0x0080;
3773 pub const SO_OOBINLINE: c_int = 0x100;
3774 pub const SO_REUSEPORT: c_int = 0x0200;
3775 pub const SO_SNDBUF: c_int = 0x1001;
3776 pub const SO_RCVBUF: c_int = 0x1002;
3777 pub const SO_SNDLOWAT: c_int = 0x1003;
3778 pub const SO_RCVLOWAT: c_int = 0x1004;
3779 pub const SO_SNDTIMEO: c_int = 0x1005;
3780 pub const SO_RCVTIMEO: c_int = 0x1006;
3781 pub const SO_ERROR: c_int = 0x1007;
3782 pub const SO_TYPE: c_int = 0x1008;
3783 pub const SO_ACCEPTCONN: c_int = 0x1009;
1a4d82fc
JJ
3784
3785 pub const SHUT_RD: c_int = 0;
3786 pub const SHUT_WR: c_int = 1;
3787 pub const SHUT_RDWR: c_int = 2;
c1a9b12d
SL
3788
3789 pub const LOCK_SH: c_int = 1;
3790 pub const LOCK_EX: c_int = 2;
3791 pub const LOCK_NB: c_int = 4;
3792 pub const LOCK_UN: c_int = 8;
1a4d82fc
JJ
3793 }
3794 #[cfg(any(target_arch = "x86",
3795 target_arch = "x86_64",
3796 target_arch = "arm",
85aaf69f 3797 target_arch = "aarch64",
c34b1796 3798 target_arch = "le32",
85aaf69f 3799 target_arch = "powerpc"))]
1a4d82fc
JJ
3800 pub mod extra {
3801 use types::os::arch::c95::c_int;
3802
3803 pub const AF_PACKET : c_int = 17;
3804 pub const IPPROTO_RAW : c_int = 255;
3805
3806 pub const O_RSYNC : c_int = 1052672;
3807 pub const O_DSYNC : c_int = 4096;
3808 pub const O_NONBLOCK : c_int = 2048;
3809 pub const O_SYNC : c_int = 1052672;
3810
3811 pub const PROT_GROWSDOWN : c_int = 0x010000000;
3812 pub const PROT_GROWSUP : c_int = 0x020000000;
3813
3814 pub const MAP_TYPE : c_int = 0x000f;
3815 pub const MAP_ANONYMOUS : c_int = 0x0020;
3816 pub const MAP_32BIT : c_int = 0x0040;
3817 pub const MAP_GROWSDOWN : c_int = 0x0100;
3818 pub const MAP_DENYWRITE : c_int = 0x0800;
3819 pub const MAP_EXECUTABLE : c_int = 0x01000;
3820 pub const MAP_LOCKED : c_int = 0x02000;
c34b1796 3821 pub const MAP_NORESERVE : c_int = 0x04000;
1a4d82fc
JJ
3822 pub const MAP_POPULATE : c_int = 0x08000;
3823 pub const MAP_NONBLOCK : c_int = 0x010000;
3824 pub const MAP_STACK : c_int = 0x020000;
3825 }
85aaf69f
SL
3826 #[cfg(any(target_arch = "mips",
3827 target_arch = "mipsel"))]
1a4d82fc
JJ
3828 pub mod extra {
3829 use types::os::arch::c95::c_int;
3830
3831 pub const AF_PACKET : c_int = 17;
3832 pub const IPPROTO_RAW : c_int = 255;
3833
3834 pub const O_RSYNC : c_int = 16400;
3835 pub const O_DSYNC : c_int = 16;
3836 pub const O_NONBLOCK : c_int = 128;
3837 pub const O_SYNC : c_int = 16400;
3838
3839 pub const PROT_GROWSDOWN : c_int = 0x01000000;
3840 pub const PROT_GROWSUP : c_int = 0x02000000;
3841
3842 pub const MAP_TYPE : c_int = 0x000f;
3843 pub const MAP_ANONYMOUS : c_int = 0x0800;
3844 pub const MAP_GROWSDOWN : c_int = 0x01000;
3845 pub const MAP_DENYWRITE : c_int = 0x02000;
3846 pub const MAP_EXECUTABLE : c_int = 0x04000;
3847 pub const MAP_LOCKED : c_int = 0x08000;
c34b1796 3848 pub const MAP_NORESERVE : c_int = 0x0400;
1a4d82fc
JJ
3849 pub const MAP_POPULATE : c_int = 0x010000;
3850 pub const MAP_NONBLOCK : c_int = 0x020000;
3851 pub const MAP_STACK : c_int = 0x040000;
3852 }
3853 #[cfg(target_os = "linux")]
3854 pub mod sysconf {
3855 use types::os::arch::c95::c_int;
3856
3857 pub const _SC_ARG_MAX : c_int = 0;
3858 pub const _SC_CHILD_MAX : c_int = 1;
3859 pub const _SC_CLK_TCK : c_int = 2;
3860 pub const _SC_NGROUPS_MAX : c_int = 3;
3861 pub const _SC_OPEN_MAX : c_int = 4;
3862 pub const _SC_STREAM_MAX : c_int = 5;
3863 pub const _SC_TZNAME_MAX : c_int = 6;
3864 pub const _SC_JOB_CONTROL : c_int = 7;
3865 pub const _SC_SAVED_IDS : c_int = 8;
3866 pub const _SC_REALTIME_SIGNALS : c_int = 9;
3867 pub const _SC_PRIORITY_SCHEDULING : c_int = 10;
3868 pub const _SC_TIMERS : c_int = 11;
3869 pub const _SC_ASYNCHRONOUS_IO : c_int = 12;
3870 pub const _SC_PRIORITIZED_IO : c_int = 13;
3871 pub const _SC_SYNCHRONIZED_IO : c_int = 14;
3872 pub const _SC_FSYNC : c_int = 15;
3873 pub const _SC_MAPPED_FILES : c_int = 16;
3874 pub const _SC_MEMLOCK : c_int = 17;
3875 pub const _SC_MEMLOCK_RANGE : c_int = 18;
3876 pub const _SC_MEMORY_PROTECTION : c_int = 19;
3877 pub const _SC_MESSAGE_PASSING : c_int = 20;
3878 pub const _SC_SEMAPHORES : c_int = 21;
3879 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 22;
3880 pub const _SC_AIO_LISTIO_MAX : c_int = 23;
3881 pub const _SC_AIO_MAX : c_int = 24;
3882 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 25;
3883 pub const _SC_DELAYTIMER_MAX : c_int = 26;
3884 pub const _SC_MQ_OPEN_MAX : c_int = 27;
3885 pub const _SC_VERSION : c_int = 29;
3886 pub const _SC_PAGESIZE : c_int = 30;
3887 pub const _SC_RTSIG_MAX : c_int = 31;
3888 pub const _SC_SEM_NSEMS_MAX : c_int = 32;
3889 pub const _SC_SEM_VALUE_MAX : c_int = 33;
3890 pub const _SC_SIGQUEUE_MAX : c_int = 34;
3891 pub const _SC_TIMER_MAX : c_int = 35;
3892 pub const _SC_BC_BASE_MAX : c_int = 36;
3893 pub const _SC_BC_DIM_MAX : c_int = 37;
3894 pub const _SC_BC_SCALE_MAX : c_int = 38;
3895 pub const _SC_BC_STRING_MAX : c_int = 39;
3896 pub const _SC_COLL_WEIGHTS_MAX : c_int = 40;
3897 pub const _SC_EXPR_NEST_MAX : c_int = 42;
3898 pub const _SC_LINE_MAX : c_int = 43;
3899 pub const _SC_RE_DUP_MAX : c_int = 44;
3900 pub const _SC_2_VERSION : c_int = 46;
3901 pub const _SC_2_C_BIND : c_int = 47;
3902 pub const _SC_2_C_DEV : c_int = 48;
3903 pub const _SC_2_FORT_DEV : c_int = 49;
3904 pub const _SC_2_FORT_RUN : c_int = 50;
3905 pub const _SC_2_SW_DEV : c_int = 51;
3906 pub const _SC_2_LOCALEDEF : c_int = 52;
9346a6ac 3907 pub const _SC_NPROCESSORS_ONLN : c_int = 84;
1a4d82fc
JJ
3908 pub const _SC_2_CHAR_TERM : c_int = 95;
3909 pub const _SC_2_C_VERSION : c_int = 96;
3910 pub const _SC_2_UPE : c_int = 97;
3911 pub const _SC_XBS5_ILP32_OFF32 : c_int = 125;
3912 pub const _SC_XBS5_ILP32_OFFBIG : c_int = 126;
3913 pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 128;
9346a6ac 3914
1a4d82fc 3915 }
c34b1796
AL
3916 #[cfg(target_os = "nacl")]
3917 pub mod sysconf {
3918 use types::os::arch::c95::c_int;
3919
3920 pub static _SC_SENDMSG_MAX_SIZE : c_int = 0;
3921 pub static _SC_NPROCESSORS_ONLN : c_int = 1;
3922 pub static _SC_PAGESIZE : c_int = 2;
3923 }
9346a6ac 3924
1a4d82fc
JJ
3925 #[cfg(target_os = "android")]
3926 pub mod sysconf {
3927 use types::os::arch::c95::c_int;
3928
3929 pub const _SC_ARG_MAX : c_int = 0;
3930 pub const _SC_BC_BASE_MAX : c_int = 1;
3931 pub const _SC_BC_DIM_MAX : c_int = 2;
3932 pub const _SC_BC_SCALE_MAX : c_int = 3;
3933 pub const _SC_BC_STRING_MAX : c_int = 4;
3934 pub const _SC_CHILD_MAX : c_int = 5;
3935 pub const _SC_CLK_TCK : c_int = 6;
3936 pub const _SC_COLL_WEIGHTS_MAX : c_int = 7;
3937 pub const _SC_EXPR_NEST_MAX : c_int = 8;
3938 pub const _SC_LINE_MAX : c_int = 9;
3939 pub const _SC_NGROUPS_MAX : c_int = 10;
3940 pub const _SC_OPEN_MAX : c_int = 11;
3941 pub const _SC_2_C_BIND : c_int = 13;
3942 pub const _SC_2_C_DEV : c_int = 14;
3943 pub const _SC_2_C_VERSION : c_int = 15;
3944 pub const _SC_2_CHAR_TERM : c_int = 16;
3945 pub const _SC_2_FORT_DEV : c_int = 17;
3946 pub const _SC_2_FORT_RUN : c_int = 18;
3947 pub const _SC_2_LOCALEDEF : c_int = 19;
3948 pub const _SC_2_SW_DEV : c_int = 20;
3949 pub const _SC_2_UPE : c_int = 21;
3950 pub const _SC_2_VERSION : c_int = 22;
3951 pub const _SC_JOB_CONTROL : c_int = 23;
3952 pub const _SC_SAVED_IDS : c_int = 24;
3953 pub const _SC_VERSION : c_int = 25;
3954 pub const _SC_RE_DUP_MAX : c_int = 26;
3955 pub const _SC_STREAM_MAX : c_int = 27;
3956 pub const _SC_TZNAME_MAX : c_int = 28;
3957 pub const _SC_PAGESIZE : c_int = 39;
3958 }
3959 }
3960
85aaf69f
SL
3961 #[cfg(any(target_os = "freebsd",
3962 target_os = "dragonfly"))]
1a4d82fc
JJ
3963 pub mod os {
3964 pub mod c95 {
3965 use types::os::arch::c95::{c_int, c_uint};
3966
3967 pub const EXIT_FAILURE : c_int = 1;
3968 pub const EXIT_SUCCESS : c_int = 0;
3969 pub const RAND_MAX : c_int = 2147483647;
3970 pub const EOF : c_int = -1;
3971 pub const SEEK_SET : c_int = 0;
3972 pub const SEEK_CUR : c_int = 1;
3973 pub const SEEK_END : c_int = 2;
3974 pub const _IOFBF : c_int = 0;
3975 pub const _IONBF : c_int = 2;
3976 pub const _IOLBF : c_int = 1;
c34b1796
AL
3977 pub const BUFSIZ : c_uint = 1024;
3978 pub const FOPEN_MAX : c_uint = 20;
3979 pub const FILENAME_MAX : c_uint = 1024;
3980 pub const L_tmpnam : c_uint = 1024;
3981 pub const TMP_MAX : c_uint = 308915776;
1a4d82fc
JJ
3982 }
3983 pub mod c99 {
3984 }
3985 pub mod posix88 {
3986 use types::common::c95::c_void;
3987 use types::os::arch::c95::c_int;
3988 use types::os::arch::posix88::mode_t;
3989
3990 pub const O_RDONLY : c_int = 0;
3991 pub const O_WRONLY : c_int = 1;
3992 pub const O_RDWR : c_int = 2;
3993 pub const O_APPEND : c_int = 8;
3994 pub const O_CREAT : c_int = 512;
3995 pub const O_EXCL : c_int = 2048;
9346a6ac 3996 pub const O_NOCTTY : c_int = 32768;
1a4d82fc
JJ
3997 pub const O_TRUNC : c_int = 1024;
3998 pub const S_IFIFO : mode_t = 4096;
3999 pub const S_IFCHR : mode_t = 8192;
4000 pub const S_IFBLK : mode_t = 24576;
4001 pub const S_IFDIR : mode_t = 16384;
4002 pub const S_IFREG : mode_t = 32768;
4003 pub const S_IFLNK : mode_t = 40960;
c1a9b12d 4004 pub const S_IFSOCK : mode_t = 49152;
1a4d82fc
JJ
4005 pub const S_IFMT : mode_t = 61440;
4006 pub const S_IEXEC : mode_t = 64;
4007 pub const S_IWRITE : mode_t = 128;
4008 pub const S_IREAD : mode_t = 256;
4009 pub const S_IRWXU : mode_t = 448;
4010 pub const S_IXUSR : mode_t = 64;
4011 pub const S_IWUSR : mode_t = 128;
4012 pub const S_IRUSR : mode_t = 256;
c34b1796
AL
4013 pub const S_IRWXG : mode_t = 56;
4014 pub const S_IXGRP : mode_t = 8;
4015 pub const S_IWGRP : mode_t = 16;
4016 pub const S_IRGRP : mode_t = 32;
4017 pub const S_IRWXO : mode_t = 7;
4018 pub const S_IXOTH : mode_t = 1;
4019 pub const S_IWOTH : mode_t = 2;
4020 pub const S_IROTH : mode_t = 4;
1a4d82fc
JJ
4021 pub const F_OK : c_int = 0;
4022 pub const R_OK : c_int = 4;
4023 pub const W_OK : c_int = 2;
4024 pub const X_OK : c_int = 1;
4025 pub const STDIN_FILENO : c_int = 0;
4026 pub const STDOUT_FILENO : c_int = 1;
4027 pub const STDERR_FILENO : c_int = 2;
4028 pub const F_LOCK : c_int = 1;
4029 pub const F_TEST : c_int = 3;
4030 pub const F_TLOCK : c_int = 2;
4031 pub const F_ULOCK : c_int = 0;
4032 pub const SIGHUP : c_int = 1;
4033 pub const SIGINT : c_int = 2;
4034 pub const SIGQUIT : c_int = 3;
4035 pub const SIGILL : c_int = 4;
4036 pub const SIGABRT : c_int = 6;
4037 pub const SIGFPE : c_int = 8;
4038 pub const SIGKILL : c_int = 9;
4039 pub const SIGSEGV : c_int = 11;
4040 pub const SIGPIPE : c_int = 13;
4041 pub const SIGALRM : c_int = 14;
4042 pub const SIGTERM : c_int = 15;
4043
4044 pub const PROT_NONE : c_int = 0;
4045 pub const PROT_READ : c_int = 1;
4046 pub const PROT_WRITE : c_int = 2;
4047 pub const PROT_EXEC : c_int = 4;
4048
4049 pub const MAP_FILE : c_int = 0x0000;
4050 pub const MAP_SHARED : c_int = 0x0001;
4051 pub const MAP_PRIVATE : c_int = 0x0002;
4052 pub const MAP_FIXED : c_int = 0x0010;
4053 pub const MAP_ANON : c_int = 0x1000;
4054
9346a6ac 4055 pub const MAP_FAILED : *mut c_void = !0 as *mut c_void;
1a4d82fc
JJ
4056
4057 pub const MCL_CURRENT : c_int = 0x0001;
4058 pub const MCL_FUTURE : c_int = 0x0002;
4059
4060 pub const MS_SYNC : c_int = 0x0000;
4061 pub const MS_ASYNC : c_int = 0x0001;
4062 pub const MS_INVALIDATE : c_int = 0x0002;
4063
4064 pub const EPERM : c_int = 1;
4065 pub const ENOENT : c_int = 2;
4066 pub const ESRCH : c_int = 3;
4067 pub const EINTR : c_int = 4;
4068 pub const EIO : c_int = 5;
4069 pub const ENXIO : c_int = 6;
4070 pub const E2BIG : c_int = 7;
4071 pub const ENOEXEC : c_int = 8;
4072 pub const EBADF : c_int = 9;
4073 pub const ECHILD : c_int = 10;
4074 pub const EDEADLK : c_int = 11;
4075 pub const ENOMEM : c_int = 12;
4076 pub const EACCES : c_int = 13;
4077 pub const EFAULT : c_int = 14;
4078 pub const ENOTBLK : c_int = 15;
4079 pub const EBUSY : c_int = 16;
4080 pub const EEXIST : c_int = 17;
4081 pub const EXDEV : c_int = 18;
4082 pub const ENODEV : c_int = 19;
4083 pub const ENOTDIR : c_int = 20;
4084 pub const EISDIR : c_int = 21;
4085 pub const EINVAL : c_int = 22;
4086 pub const ENFILE : c_int = 23;
4087 pub const EMFILE : c_int = 24;
4088 pub const ENOTTY : c_int = 25;
4089 pub const ETXTBSY : c_int = 26;
4090 pub const EFBIG : c_int = 27;
4091 pub const ENOSPC : c_int = 28;
4092 pub const ESPIPE : c_int = 29;
4093 pub const EROFS : c_int = 30;
4094 pub const EMLINK : c_int = 31;
4095 pub const EPIPE : c_int = 32;
4096 pub const EDOM : c_int = 33;
4097 pub const ERANGE : c_int = 34;
4098 pub const EAGAIN : c_int = 35;
4099 pub const EWOULDBLOCK : c_int = 35;
4100 pub const EINPROGRESS : c_int = 36;
4101 pub const EALREADY : c_int = 37;
4102 pub const ENOTSOCK : c_int = 38;
4103 pub const EDESTADDRREQ : c_int = 39;
4104 pub const EMSGSIZE : c_int = 40;
4105 pub const EPROTOTYPE : c_int = 41;
4106 pub const ENOPROTOOPT : c_int = 42;
4107 pub const EPROTONOSUPPORT : c_int = 43;
4108 pub const ESOCKTNOSUPPORT : c_int = 44;
4109 pub const EOPNOTSUPP : c_int = 45;
4110 pub const EPFNOSUPPORT : c_int = 46;
4111 pub const EAFNOSUPPORT : c_int = 47;
4112 pub const EADDRINUSE : c_int = 48;
4113 pub const EADDRNOTAVAIL : c_int = 49;
4114 pub const ENETDOWN : c_int = 50;
4115 pub const ENETUNREACH : c_int = 51;
4116 pub const ENETRESET : c_int = 52;
4117 pub const ECONNABORTED : c_int = 53;
4118 pub const ECONNRESET : c_int = 54;
4119 pub const ENOBUFS : c_int = 55;
4120 pub const EISCONN : c_int = 56;
4121 pub const ENOTCONN : c_int = 57;
4122 pub const ESHUTDOWN : c_int = 58;
4123 pub const ETOOMANYREFS : c_int = 59;
4124 pub const ETIMEDOUT : c_int = 60;
4125 pub const ECONNREFUSED : c_int = 61;
4126 pub const ELOOP : c_int = 62;
4127 pub const ENAMETOOLONG : c_int = 63;
4128 pub const EHOSTDOWN : c_int = 64;
4129 pub const EHOSTUNREACH : c_int = 65;
4130 pub const ENOTEMPTY : c_int = 66;
4131 pub const EPROCLIM : c_int = 67;
4132 pub const EUSERS : c_int = 68;
4133 pub const EDQUOT : c_int = 69;
4134 pub const ESTALE : c_int = 70;
4135 pub const EREMOTE : c_int = 71;
4136 pub const EBADRPC : c_int = 72;
4137 pub const ERPCMISMATCH : c_int = 73;
4138 pub const EPROGUNAVAIL : c_int = 74;
4139 pub const EPROGMISMATCH : c_int = 75;
4140 pub const EPROCUNAVAIL : c_int = 76;
4141 pub const ENOLCK : c_int = 77;
4142 pub const ENOSYS : c_int = 78;
4143 pub const EFTYPE : c_int = 79;
4144 pub const EAUTH : c_int = 80;
4145 pub const ENEEDAUTH : c_int = 81;
4146 pub const EIDRM : c_int = 82;
4147 pub const ENOMSG : c_int = 83;
4148 pub const EOVERFLOW : c_int = 84;
4149 pub const ECANCELED : c_int = 85;
4150 pub const EILSEQ : c_int = 86;
4151 pub const ENOATTR : c_int = 87;
4152 pub const EDOOFUS : c_int = 88;
4153 pub const EBADMSG : c_int = 89;
4154 pub const EMULTIHOP : c_int = 90;
4155 pub const ENOLINK : c_int = 91;
4156 pub const EPROTO : c_int = 92;
4157 pub const ENOMEDIUM : c_int = 93;
4158 pub const EUNUSED94 : c_int = 94;
4159 pub const EUNUSED95 : c_int = 95;
4160 pub const EUNUSED96 : c_int = 96;
4161 pub const EUNUSED97 : c_int = 97;
4162 pub const EUNUSED98 : c_int = 98;
4163 pub const EASYNC : c_int = 99;
4164 pub const ELAST : c_int = 99;
4165 }
4166 pub mod posix01 {
4167 use types::os::arch::c95::{c_int, size_t};
c34b1796 4168 use types::os::common::posix01::rlim_t;
1a4d82fc
JJ
4169
4170 pub const F_DUPFD : c_int = 0;
4171 pub const F_GETFD : c_int = 1;
4172 pub const F_SETFD : c_int = 2;
4173 pub const F_GETFL : c_int = 3;
4174 pub const F_SETFL : c_int = 4;
4175
4176 pub const SIGTRAP : c_int = 5;
1a4d82fc
JJ
4177 pub const SIG_IGN: size_t = 1;
4178
4179 pub const GLOB_APPEND : c_int = 0x0001;
4180 pub const GLOB_DOOFFS : c_int = 0x0002;
4181 pub const GLOB_ERR : c_int = 0x0004;
4182 pub const GLOB_MARK : c_int = 0x0008;
4183 pub const GLOB_NOCHECK : c_int = 0x0010;
4184 pub const GLOB_NOSORT : c_int = 0x0020;
4185 pub const GLOB_NOESCAPE : c_int = 0x2000;
4186
4187 pub const GLOB_NOSPACE : c_int = -1;
4188 pub const GLOB_ABORTED : c_int = -2;
4189 pub const GLOB_NOMATCH : c_int = -3;
4190
4191 pub const POSIX_MADV_NORMAL : c_int = 0;
4192 pub const POSIX_MADV_RANDOM : c_int = 1;
4193 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
4194 pub const POSIX_MADV_WILLNEED : c_int = 3;
4195 pub const POSIX_MADV_DONTNEED : c_int = 4;
4196
4197 pub const _SC_IOV_MAX : c_int = 56;
4198 pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
4199 pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
4200 pub const _SC_LOGIN_NAME_MAX : c_int = 73;
4201 pub const _SC_MQ_PRIO_MAX : c_int = 75;
4202 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
4203 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
4204 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
4205 pub const _SC_THREAD_KEYS_MAX : c_int = 86;
4206 pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
4207 pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
4208 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
4209 pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
4210 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
4211 pub const _SC_THREAD_STACK_MIN : c_int = 93;
4212 pub const _SC_THREAD_THREADS_MAX : c_int = 94;
4213 pub const _SC_THREADS : c_int = 96;
4214 pub const _SC_TTY_NAME_MAX : c_int = 101;
4215 pub const _SC_ATEXIT_MAX : c_int = 107;
4216 pub const _SC_XOPEN_CRYPT : c_int = 108;
4217 pub const _SC_XOPEN_ENH_I18N : c_int = 109;
4218 pub const _SC_XOPEN_LEGACY : c_int = 110;
4219 pub const _SC_XOPEN_REALTIME : c_int = 111;
4220 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
4221 pub const _SC_XOPEN_SHM : c_int = 113;
4222 pub const _SC_XOPEN_UNIX : c_int = 115;
4223 pub const _SC_XOPEN_VERSION : c_int = 116;
4224 pub const _SC_XOPEN_XCU_VERSION : c_int = 117;
4225
4226 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
4227 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
4228
4229 #[cfg(target_arch = "arm")]
4230 pub const PTHREAD_STACK_MIN: size_t = 4096;
4231
4232 #[cfg(all(target_os = "freebsd",
4233 any(target_arch = "mips",
4234 target_arch = "mipsel",
4235 target_arch = "x86",
4236 target_arch = "x86_64")))]
4237 pub const PTHREAD_STACK_MIN: size_t = 2048;
4238
4239 #[cfg(target_os = "dragonfly")]
4240 pub const PTHREAD_STACK_MIN: size_t = 1024;
4241
4242 pub const CLOCK_REALTIME: c_int = 0;
4243 pub const CLOCK_MONOTONIC: c_int = 4;
c34b1796
AL
4244
4245 pub const RLIMIT_CPU: c_int = 0;
4246 pub const RLIMIT_FSIZE: c_int = 1;
4247 pub const RLIMIT_DATA: c_int = 2;
4248 pub const RLIMIT_STACK: c_int = 3;
4249 pub const RLIMIT_CORE: c_int = 4;
4250 pub const RLIMIT_RSS: c_int = 5;
4251 pub const RLIMIT_MEMLOCK: c_int = 6;
4252 pub const RLIMIT_NPROC: c_int = 7;
4253 pub const RLIMIT_NOFILE: c_int = 8;
4254 pub const RLIMIT_SBSIZE: c_int = 9;
4255 pub const RLIMIT_VMEM: c_int = 10;
4256 pub const RLIMIT_AS: c_int = RLIMIT_VMEM;
4257 pub const RLIMIT_NPTS: c_int = 11;
4258 pub const RLIMIT_SWAP: c_int = 12;
4259 pub const RLIMIT_KQUEUES: c_int = 13;
4260
4261 pub const RLIM_NLIMITS: rlim_t = 14;
4262 pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
4263
4264 pub const RUSAGE_SELF: c_int = 0;
4265 pub const RUSAGE_CHILDREN: c_int = -1;
4266 pub const RUSAGE_THREAD: c_int = 1;
1a4d82fc
JJ
4267 }
4268 pub mod posix08 {
4269 }
4270 pub mod bsd44 {
4271 use types::os::arch::c95::c_int;
4272
4273 pub const MADV_NORMAL : c_int = 0;
4274 pub const MADV_RANDOM : c_int = 1;
4275 pub const MADV_SEQUENTIAL : c_int = 2;
4276 pub const MADV_WILLNEED : c_int = 3;
4277 pub const MADV_DONTNEED : c_int = 4;
4278 pub const MADV_FREE : c_int = 5;
4279 pub const MADV_NOSYNC : c_int = 6;
4280 pub const MADV_AUTOSYNC : c_int = 7;
4281 pub const MADV_NOCORE : c_int = 8;
4282 pub const MADV_CORE : c_int = 9;
4283 pub const MADV_PROTECT : c_int = 10;
4284
4285 pub const MINCORE_INCORE : c_int = 0x1;
4286 pub const MINCORE_REFERENCED : c_int = 0x2;
4287 pub const MINCORE_MODIFIED : c_int = 0x4;
4288 pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
4289 pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
4290 pub const MINCORE_SUPER : c_int = 0x20;
4291
4292 pub const AF_INET: c_int = 2;
4293 pub const AF_INET6: c_int = 28;
4294 pub const AF_UNIX: c_int = 1;
4295 pub const SOCK_STREAM: c_int = 1;
4296 pub const SOCK_DGRAM: c_int = 2;
4297 pub const SOCK_RAW: c_int = 3;
4298 pub const IPPROTO_TCP: c_int = 6;
4299 pub const IPPROTO_IP: c_int = 0;
4300 pub const IPPROTO_IPV6: c_int = 41;
4301 pub const IP_MULTICAST_TTL: c_int = 10;
4302 pub const IP_MULTICAST_LOOP: c_int = 11;
4303 pub const IP_TTL: c_int = 4;
4304 pub const IP_HDRINCL: c_int = 2;
4305 pub const IP_ADD_MEMBERSHIP: c_int = 12;
4306 pub const IP_DROP_MEMBERSHIP: c_int = 13;
4307 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
4308 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
4309
4310 pub const TCP_NODELAY: c_int = 1;
4311 pub const TCP_KEEPIDLE: c_int = 256;
4312 pub const SOL_SOCKET: c_int = 0xffff;
c34b1796
AL
4313 pub const SO_DEBUG: c_int = 0x01;
4314 pub const SO_ACCEPTCONN: c_int = 0x0002;
4315 pub const SO_REUSEADDR: c_int = 0x0004;
1a4d82fc 4316 pub const SO_KEEPALIVE: c_int = 0x0008;
c34b1796 4317 pub const SO_DONTROUTE: c_int = 0x0010;
1a4d82fc 4318 pub const SO_BROADCAST: c_int = 0x0020;
c34b1796
AL
4319 pub const SO_USELOOPBACK: c_int = 0x0040;
4320 pub const SO_LINGER: c_int = 0x0080;
4321 pub const SO_OOBINLINE: c_int = 0x0100;
4322 pub const SO_REUSEPORT: c_int = 0x0200;
4323 pub const SO_SNDBUF: c_int = 0x1001;
4324 pub const SO_RCVBUF: c_int = 0x1002;
4325 pub const SO_SNDLOWAT: c_int = 0x1003;
4326 pub const SO_RCVLOWAT: c_int = 0x1004;
4327 pub const SO_SNDTIMEO: c_int = 0x1005;
4328 pub const SO_RCVTIMEO: c_int = 0x1006;
1a4d82fc 4329 pub const SO_ERROR: c_int = 0x1007;
c34b1796 4330 pub const SO_TYPE: c_int = 0x1008;
1a4d82fc
JJ
4331
4332 pub const IFF_LOOPBACK: c_int = 0x8;
4333
4334 pub const SHUT_RD: c_int = 0;
4335 pub const SHUT_WR: c_int = 1;
4336 pub const SHUT_RDWR: c_int = 2;
c1a9b12d
SL
4337
4338 pub const LOCK_SH: c_int = 1;
4339 pub const LOCK_EX: c_int = 2;
4340 pub const LOCK_NB: c_int = 4;
4341 pub const LOCK_UN: c_int = 8;
1a4d82fc
JJ
4342 }
4343 pub mod extra {
4344 use types::os::arch::c95::c_int;
4345
4346 pub const O_SYNC : c_int = 128;
4347 pub const O_NONBLOCK : c_int = 4;
4348 pub const CTL_KERN: c_int = 1;
4349 pub const KERN_PROC: c_int = 14;
4350 #[cfg(target_os = "freebsd")]
4351 pub const KERN_PROC_PATHNAME: c_int = 12;
4352 #[cfg(target_os = "dragonfly")]
4353 pub const KERN_PROC_PATHNAME: c_int = 9;
4354
4355 pub const MAP_COPY : c_int = 0x0002;
4356 pub const MAP_RENAME : c_int = 0x0020;
4357 pub const MAP_NORESERVE : c_int = 0x0040;
4358 pub const MAP_HASSEMAPHORE : c_int = 0x0200;
4359 pub const MAP_STACK : c_int = 0x0400;
4360 pub const MAP_NOSYNC : c_int = 0x0800;
4361 pub const MAP_NOCORE : c_int = 0x020000;
4362
4363 pub const IPPROTO_RAW : c_int = 255;
4364 }
4365 pub mod sysconf {
4366 use types::os::arch::c95::c_int;
4367
4368 pub const _SC_ARG_MAX : c_int = 1;
4369 pub const _SC_CHILD_MAX : c_int = 2;
4370 pub const _SC_CLK_TCK : c_int = 3;
4371 pub const _SC_NGROUPS_MAX : c_int = 4;
4372 pub const _SC_OPEN_MAX : c_int = 5;
4373 pub const _SC_JOB_CONTROL : c_int = 6;
4374 pub const _SC_SAVED_IDS : c_int = 7;
4375 pub const _SC_VERSION : c_int = 8;
4376 pub const _SC_BC_BASE_MAX : c_int = 9;
4377 pub const _SC_BC_DIM_MAX : c_int = 10;
4378 pub const _SC_BC_SCALE_MAX : c_int = 11;
4379 pub const _SC_BC_STRING_MAX : c_int = 12;
4380 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
4381 pub const _SC_EXPR_NEST_MAX : c_int = 14;
4382 pub const _SC_LINE_MAX : c_int = 15;
4383 pub const _SC_RE_DUP_MAX : c_int = 16;
4384 pub const _SC_2_VERSION : c_int = 17;
4385 pub const _SC_2_C_BIND : c_int = 18;
4386 pub const _SC_2_C_DEV : c_int = 19;
4387 pub const _SC_2_CHAR_TERM : c_int = 20;
4388 pub const _SC_2_FORT_DEV : c_int = 21;
4389 pub const _SC_2_FORT_RUN : c_int = 22;
4390 pub const _SC_2_LOCALEDEF : c_int = 23;
4391 pub const _SC_2_SW_DEV : c_int = 24;
4392 pub const _SC_2_UPE : c_int = 25;
4393 pub const _SC_STREAM_MAX : c_int = 26;
4394 pub const _SC_TZNAME_MAX : c_int = 27;
4395 pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
4396 pub const _SC_MAPPED_FILES : c_int = 29;
4397 pub const _SC_MEMLOCK : c_int = 30;
4398 pub const _SC_MEMLOCK_RANGE : c_int = 31;
4399 pub const _SC_MEMORY_PROTECTION : c_int = 32;
4400 pub const _SC_MESSAGE_PASSING : c_int = 33;
4401 pub const _SC_PRIORITIZED_IO : c_int = 34;
4402 pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
4403 pub const _SC_REALTIME_SIGNALS : c_int = 36;
4404 pub const _SC_SEMAPHORES : c_int = 37;
4405 pub const _SC_FSYNC : c_int = 38;
4406 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
4407 pub const _SC_SYNCHRONIZED_IO : c_int = 40;
4408 pub const _SC_TIMERS : c_int = 41;
4409 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
4410 pub const _SC_AIO_MAX : c_int = 43;
4411 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
4412 pub const _SC_DELAYTIMER_MAX : c_int = 45;
4413 pub const _SC_MQ_OPEN_MAX : c_int = 46;
4414 pub const _SC_PAGESIZE : c_int = 47;
4415 pub const _SC_RTSIG_MAX : c_int = 48;
4416 pub const _SC_SEM_NSEMS_MAX : c_int = 49;
4417 pub const _SC_SEM_VALUE_MAX : c_int = 50;
4418 pub const _SC_SIGQUEUE_MAX : c_int = 51;
4419 pub const _SC_TIMER_MAX : c_int = 52;
4420 }
4421 }
4422
c1a9b12d 4423 #[cfg(any(target_os = "bitrig", target_os = "netbsd", target_os = "openbsd"))]
1a4d82fc
JJ
4424 pub mod os {
4425 pub mod c95 {
4426 use types::os::arch::c95::{c_int, c_uint};
4427
4428 pub const EXIT_FAILURE : c_int = 1;
4429 pub const EXIT_SUCCESS : c_int = 0;
4430 pub const RAND_MAX : c_int = 2147483647;
4431 pub const EOF : c_int = -1;
4432 pub const SEEK_SET : c_int = 0;
4433 pub const SEEK_CUR : c_int = 1;
4434 pub const SEEK_END : c_int = 2;
4435 pub const _IOFBF : c_int = 0;
4436 pub const _IONBF : c_int = 2;
4437 pub const _IOLBF : c_int = 1;
c34b1796
AL
4438 pub const BUFSIZ : c_uint = 1024;
4439 pub const FOPEN_MAX : c_uint = 20;
4440 pub const FILENAME_MAX : c_uint = 1024;
4441 pub const L_tmpnam : c_uint = 1024;
4442 pub const TMP_MAX : c_uint = 308915776;
1a4d82fc
JJ
4443 }
4444 pub mod c99 {
4445 }
4446 pub mod posix88 {
4447 use types::common::c95::c_void;
4448 use types::os::arch::c95::c_int;
4449 use types::os::arch::posix88::mode_t;
4450
4451 pub const O_RDONLY : c_int = 0;
4452 pub const O_WRONLY : c_int = 1;
4453 pub const O_RDWR : c_int = 2;
4454 pub const O_APPEND : c_int = 8;
4455 pub const O_CREAT : c_int = 512;
4456 pub const O_EXCL : c_int = 2048;
9346a6ac 4457 pub const O_NOCTTY : c_int = 32768;
1a4d82fc
JJ
4458 pub const O_TRUNC : c_int = 1024;
4459 pub const S_IFIFO : mode_t = 4096;
4460 pub const S_IFCHR : mode_t = 8192;
4461 pub const S_IFBLK : mode_t = 24576;
4462 pub const S_IFDIR : mode_t = 16384;
4463 pub const S_IFREG : mode_t = 32768;
4464 pub const S_IFLNK : mode_t = 40960;
c1a9b12d 4465 pub const S_IFSOCK : mode_t = 49152;
1a4d82fc
JJ
4466 pub const S_IFMT : mode_t = 61440;
4467 pub const S_IEXEC : mode_t = 64;
4468 pub const S_IWRITE : mode_t = 128;
4469 pub const S_IREAD : mode_t = 256;
4470 pub const S_IRWXU : mode_t = 448;
4471 pub const S_IXUSR : mode_t = 64;
4472 pub const S_IWUSR : mode_t = 128;
4473 pub const S_IRUSR : mode_t = 256;
c34b1796
AL
4474 pub const S_IRWXG : mode_t = 56;
4475 pub const S_IXGRP : mode_t = 8;
4476 pub const S_IWGRP : mode_t = 16;
4477 pub const S_IRGRP : mode_t = 32;
4478 pub const S_IRWXO : mode_t = 7;
4479 pub const S_IXOTH : mode_t = 1;
4480 pub const S_IWOTH : mode_t = 2;
4481 pub const S_IROTH : mode_t = 4;
1a4d82fc
JJ
4482 pub const F_OK : c_int = 0;
4483 pub const R_OK : c_int = 4;
4484 pub const W_OK : c_int = 2;
4485 pub const X_OK : c_int = 1;
4486 pub const STDIN_FILENO : c_int = 0;
4487 pub const STDOUT_FILENO : c_int = 1;
4488 pub const STDERR_FILENO : c_int = 2;
4489 pub const F_LOCK : c_int = 1;
4490 pub const F_TEST : c_int = 3;
4491 pub const F_TLOCK : c_int = 2;
4492 pub const F_ULOCK : c_int = 0;
4493 pub const SIGHUP : c_int = 1;
4494 pub const SIGINT : c_int = 2;
4495 pub const SIGQUIT : c_int = 3;
4496 pub const SIGILL : c_int = 4;
4497 pub const SIGABRT : c_int = 6;
4498 pub const SIGFPE : c_int = 8;
4499 pub const SIGKILL : c_int = 9;
4500 pub const SIGSEGV : c_int = 11;
4501 pub const SIGPIPE : c_int = 13;
4502 pub const SIGALRM : c_int = 14;
4503 pub const SIGTERM : c_int = 15;
4504
4505 pub const PROT_NONE : c_int = 0;
4506 pub const PROT_READ : c_int = 1;
4507 pub const PROT_WRITE : c_int = 2;
4508 pub const PROT_EXEC : c_int = 4;
4509
4510 pub const MAP_FILE : c_int = 0x0000;
4511 pub const MAP_SHARED : c_int = 0x0001;
4512 pub const MAP_PRIVATE : c_int = 0x0002;
4513 pub const MAP_FIXED : c_int = 0x0010;
4514 pub const MAP_ANON : c_int = 0x1000;
4515
9346a6ac 4516 pub const MAP_FAILED : *mut c_void = !0 as *mut c_void;
1a4d82fc
JJ
4517
4518 pub const MCL_CURRENT : c_int = 0x0001;
4519 pub const MCL_FUTURE : c_int = 0x0002;
4520
4521 pub const MS_ASYNC : c_int = 0x0001;
c34b1796
AL
4522 pub const MS_SYNC : c_int = 0x0002;
4523 pub const MS_INVALIDATE : c_int = 0x0004;
85aaf69f 4524
c34b1796 4525 pub const EPERM : c_int = 1;
85aaf69f
SL
4526 pub const ENOENT : c_int = 2;
4527 pub const ESRCH : c_int = 3;
4528 pub const EINTR : c_int = 4;
4529 pub const EIO : c_int = 5;
4530 pub const ENXIO : c_int = 6;
4531 pub const E2BIG : c_int = 7;
4532 pub const ENOEXEC : c_int = 8;
4533 pub const EBADF : c_int = 9;
4534 pub const ECHILD : c_int = 10;
4535 pub const EDEADLK : c_int = 11;
4536 pub const ENOMEM : c_int = 12;
4537 pub const EACCES : c_int = 13;
4538 pub const EFAULT : c_int = 14;
4539 pub const ENOTBLK : c_int = 15;
4540 pub const EBUSY : c_int = 16;
4541 pub const EEXIST : c_int = 17;
4542 pub const EXDEV : c_int = 18;
4543 pub const ENODEV : c_int = 19;
4544 pub const ENOTDIR : c_int = 20;
4545 pub const EISDIR : c_int = 21;
4546 pub const EINVAL : c_int = 22;
4547 pub const ENFILE : c_int = 23;
4548 pub const EMFILE : c_int = 24;
4549 pub const ENOTTY : c_int = 25;
4550 pub const ETXTBSY : c_int = 26;
4551 pub const EFBIG : c_int = 27;
4552 pub const ENOSPC : c_int = 28;
4553 pub const ESPIPE : c_int = 29;
4554 pub const EROFS : c_int = 30;
4555 pub const EMLINK : c_int = 31;
4556 pub const EPIPE : c_int = 32;
4557 pub const EDOM : c_int = 33;
4558 pub const ERANGE : c_int = 34;
4559 pub const EAGAIN : c_int = 35;
4560 pub const EWOULDBLOCK : c_int = 35;
4561 pub const EINPROGRESS : c_int = 36;
4562 pub const EALREADY : c_int = 37;
4563 pub const ENOTSOCK : c_int = 38;
4564 pub const EDESTADDRREQ : c_int = 39;
4565 pub const EMSGSIZE : c_int = 40;
4566 pub const EPROTOTYPE : c_int = 41;
4567 pub const ENOPROTOOPT : c_int = 42;
4568 pub const EPROTONOSUPPORT : c_int = 43;
4569 pub const ESOCKTNOSUPPORT : c_int = 44;
4570 pub const EOPNOTSUPP : c_int = 45;
4571 pub const EPFNOSUPPORT : c_int = 46;
4572 pub const EAFNOSUPPORT : c_int = 47;
4573 pub const EADDRINUSE : c_int = 48;
4574 pub const EADDRNOTAVAIL : c_int = 49;
4575 pub const ENETDOWN : c_int = 50;
4576 pub const ENETUNREACH : c_int = 51;
4577 pub const ENETRESET : c_int = 52;
4578 pub const ECONNABORTED : c_int = 53;
4579 pub const ECONNRESET : c_int = 54;
4580 pub const ENOBUFS : c_int = 55;
4581 pub const EISCONN : c_int = 56;
4582 pub const ENOTCONN : c_int = 57;
4583 pub const ESHUTDOWN : c_int = 58;
4584 pub const ETOOMANYREFS : c_int = 59;
4585 pub const ETIMEDOUT : c_int = 60;
4586 pub const ECONNREFUSED : c_int = 61;
4587 pub const ELOOP : c_int = 62;
4588 pub const ENAMETOOLONG : c_int = 63;
4589 pub const EHOSTDOWN : c_int = 64;
4590 pub const EHOSTUNREACH : c_int = 65;
4591 pub const ENOTEMPTY : c_int = 66;
4592 pub const EPROCLIM : c_int = 67;
4593 pub const EUSERS : c_int = 68;
4594 pub const EDQUOT : c_int = 69;
4595 pub const ESTALE : c_int = 70;
4596 pub const EREMOTE : c_int = 71;
4597 pub const EBADRPC : c_int = 72;
4598 pub const ERPCMISMATCH : c_int = 73;
4599 pub const EPROGUNAVAIL : c_int = 74;
4600 pub const EPROGMISMATCH : c_int = 75;
4601 pub const EPROCUNAVAIL : c_int = 76;
4602 pub const ENOLCK : c_int = 77;
4603 pub const ENOSYS : c_int = 78;
4604 pub const EFTYPE : c_int = 79;
4605 pub const EAUTH : c_int = 80;
4606 pub const ENEEDAUTH : c_int = 81;
c34b1796
AL
4607 pub const EIPSEC : c_int = 82;
4608 pub const ENOATTR : c_int = 83;
4609 pub const EILSEQ : c_int = 84;
4610 pub const ENOMEDIUM : c_int = 85;
4611 pub const EMEDIUMTYPE : c_int = 86;
4612 pub const EOVERFLOW : c_int = 87;
4613 pub const ECANCELED : c_int = 88;
4614 pub const EIDRM : c_int = 89;
4615 pub const ENOMSG : c_int = 90;
4616 pub const ENOTSUP : c_int = 91;
4617 pub const ELAST : c_int = 91; // must be equal to largest errno
85aaf69f
SL
4618 }
4619 pub mod posix01 {
4620 use types::os::arch::c95::{c_int, size_t};
c34b1796 4621 use types::os::common::posix01::rlim_t;
85aaf69f
SL
4622
4623 pub const F_DUPFD : c_int = 0;
4624 pub const F_GETFD : c_int = 1;
4625 pub const F_SETFD : c_int = 2;
4626 pub const F_GETFL : c_int = 3;
4627 pub const F_SETFL : c_int = 4;
c34b1796
AL
4628 pub const F_GETOWN : c_int = 5;
4629 pub const F_SETOWN : c_int = 6;
4630 pub const F_GETLK : c_int = 7;
4631 pub const F_SETLK : c_int = 8;
4632 pub const F_SETLKW : c_int = 9;
4633 pub const F_DUPFD_CLOEXEC : c_int = 10;
85aaf69f
SL
4634
4635 pub const SIGTRAP : c_int = 5;
85aaf69f
SL
4636 pub const SIG_IGN: size_t = 1;
4637
4638 pub const GLOB_APPEND : c_int = 0x0001;
4639 pub const GLOB_DOOFFS : c_int = 0x0002;
4640 pub const GLOB_ERR : c_int = 0x0004;
4641 pub const GLOB_MARK : c_int = 0x0008;
4642 pub const GLOB_NOCHECK : c_int = 0x0010;
4643 pub const GLOB_NOSORT : c_int = 0x0020;
c34b1796 4644 pub const GLOB_NOESCAPE : c_int = 0x1000;
85aaf69f
SL
4645
4646 pub const GLOB_NOSPACE : c_int = -1;
4647 pub const GLOB_ABORTED : c_int = -2;
4648 pub const GLOB_NOMATCH : c_int = -3;
c34b1796 4649 pub const GLOB_NOSYS : c_int = -4;
85aaf69f
SL
4650
4651 pub const POSIX_MADV_NORMAL : c_int = 0;
4652 pub const POSIX_MADV_RANDOM : c_int = 1;
4653 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
4654 pub const POSIX_MADV_WILLNEED : c_int = 3;
4655 pub const POSIX_MADV_DONTNEED : c_int = 4;
4656
c34b1796 4657 pub const _SC_IOV_MAX : c_int = 51;
85aaf69f
SL
4658 pub const _SC_GETGR_R_SIZE_MAX : c_int = 100;
4659 pub const _SC_GETPW_R_SIZE_MAX : c_int = 101;
4660 pub const _SC_LOGIN_NAME_MAX : c_int = 102;
4661 pub const _SC_MQ_PRIO_MAX : c_int = 59;
4662 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
4663 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
4664 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 80;
4665 pub const _SC_THREAD_KEYS_MAX : c_int = 81;
4666 pub const _SC_THREAD_PRIO_INHERIT : c_int = 82;
4667 pub const _SC_THREAD_PRIO_PROTECT : c_int = 83;
4668 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 84;
4669 pub const _SC_THREAD_PROCESS_SHARED : c_int = 85;
4670 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 103;
4671 pub const _SC_THREAD_STACK_MIN : c_int = 89;
4672 pub const _SC_THREAD_THREADS_MAX : c_int = 90;
4673 pub const _SC_THREADS : c_int = 91;
4674 pub const _SC_TTY_NAME_MAX : c_int = 107;
4675 pub const _SC_ATEXIT_MAX : c_int = 46;
4676 pub const _SC_XOPEN_CRYPT : c_int = 117;
4677 pub const _SC_XOPEN_ENH_I18N : c_int = 118;
4678 pub const _SC_XOPEN_LEGACY : c_int = 119;
4679 pub const _SC_XOPEN_REALTIME : c_int = 120;
4680 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 121;
4681 pub const _SC_XOPEN_SHM : c_int = 30;
4682 pub const _SC_XOPEN_UNIX : c_int = 123;
4683 pub const _SC_XOPEN_VERSION : c_int = 125;
85aaf69f 4684
c34b1796
AL
4685 pub const PTHREAD_CREATE_JOINABLE : c_int = 0;
4686 pub const PTHREAD_CREATE_DETACHED : c_int = 1;
4687 pub const PTHREAD_STACK_MIN : size_t = 2048;
4688
4689 pub const CLOCK_REALTIME : c_int = 0;
4690 pub const CLOCK_MONOTONIC : c_int = 3;
4691
4692 pub const RLIMIT_CPU: c_int = 0;
4693 pub const RLIMIT_FSIZE: c_int = 1;
4694 pub const RLIMIT_DATA: c_int = 2;
4695 pub const RLIMIT_STACK: c_int = 3;
4696 pub const RLIMIT_CORE: c_int = 4;
4697 pub const RLIMIT_RSS: c_int = 5;
4698 pub const RLIMIT_MEMLOCK: c_int = 6;
4699 pub const RLIMIT_NPROC: c_int = 7;
4700 pub const RLIMIT_NOFILE: c_int = 8;
4701 pub const RLIM_NLIMITS: c_int = 9;
4702
4703 pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
4704 pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY;
4705 pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY;
4706
4707 pub const RUSAGE_SELF: c_int = 0;
4708 pub const RUSAGE_CHILDREN: c_int = -1;
4709 pub const RUSAGE_THREAD: c_int = 1;
85aaf69f
SL
4710 }
4711 pub mod posix08 {
4712 }
4713 pub mod bsd44 {
4714 use types::os::arch::c95::c_int;
4715
4716 pub const MADV_NORMAL : c_int = 0;
4717 pub const MADV_RANDOM : c_int = 1;
4718 pub const MADV_SEQUENTIAL : c_int = 2;
4719 pub const MADV_WILLNEED : c_int = 3;
4720 pub const MADV_DONTNEED : c_int = 4;
c34b1796 4721 pub const MADV_FREE : c_int = 6;
85aaf69f 4722
85aaf69f 4723 pub const AF_UNIX: c_int = 1;
c34b1796
AL
4724 pub const AF_INET: c_int = 2;
4725 pub const AF_INET6: c_int = 24;
85aaf69f
SL
4726 pub const SOCK_STREAM: c_int = 1;
4727 pub const SOCK_DGRAM: c_int = 2;
4728 pub const SOCK_RAW: c_int = 3;
4729 pub const IPPROTO_TCP: c_int = 6;
4730 pub const IPPROTO_IP: c_int = 0;
4731 pub const IPPROTO_IPV6: c_int = 41;
4732 pub const IP_MULTICAST_TTL: c_int = 10;
4733 pub const IP_MULTICAST_LOOP: c_int = 11;
4734 pub const IP_TTL: c_int = 4;
4735 pub const IP_HDRINCL: c_int = 2;
4736 pub const IP_ADD_MEMBERSHIP: c_int = 12;
4737 pub const IP_DROP_MEMBERSHIP: c_int = 13;
c34b1796
AL
4738 pub const IPV6_ADD_MEMBERSHIP: c_int = 12; // don't exist
4739 pub const IPV6_DROP_MEMBERSHIP: c_int = 13; // don't exist
85aaf69f 4740
c34b1796 4741 pub const TCP_NODELAY: c_int = 0x01;
85aaf69f 4742 pub const SOL_SOCKET: c_int = 0xffff;
c34b1796
AL
4743 pub const SO_DEBUG: c_int = 0x01;
4744 pub const SO_ACCEPTCONN: c_int = 0x0002;
4745 pub const SO_REUSEADDR: c_int = 0x0004;
85aaf69f 4746 pub const SO_KEEPALIVE: c_int = 0x0008;
c34b1796 4747 pub const SO_DONTROUTE: c_int = 0x0010;
85aaf69f 4748 pub const SO_BROADCAST: c_int = 0x0020;
c34b1796
AL
4749 pub const SO_USELOOPBACK: c_int = 0x0040;
4750 pub const SO_LINGER: c_int = 0x0080;
4751 pub const SO_OOBINLINE: c_int = 0x0100;
4752 pub const SO_REUSEPORT: c_int = 0x0200;
4753 pub const SO_SNDBUF: c_int = 0x1001;
4754 pub const SO_RCVBUF: c_int = 0x1002;
4755 pub const SO_SNDLOWAT: c_int = 0x1003;
4756 pub const SO_RCVLOWAT: c_int = 0x1004;
4757 pub const SO_SNDTIMEO: c_int = 0x1005;
4758 pub const SO_RCVTIMEO: c_int = 0x1006;
85aaf69f 4759 pub const SO_ERROR: c_int = 0x1007;
c34b1796 4760 pub const SO_TYPE: c_int = 0x1008;
85aaf69f
SL
4761
4762 pub const IFF_LOOPBACK: c_int = 0x8;
4763
4764 pub const SHUT_RD: c_int = 0;
4765 pub const SHUT_WR: c_int = 1;
4766 pub const SHUT_RDWR: c_int = 2;
c1a9b12d
SL
4767
4768 pub const LOCK_SH: c_int = 1;
4769 pub const LOCK_EX: c_int = 2;
4770 pub const LOCK_NB: c_int = 4;
4771 pub const LOCK_UN: c_int = 8;
85aaf69f
SL
4772 }
4773 pub mod extra {
4774 use types::os::arch::c95::c_int;
4775
c34b1796 4776 pub const O_DSYNC : c_int = 128; // same as SYNC
85aaf69f
SL
4777 pub const O_SYNC : c_int = 128;
4778 pub const O_NONBLOCK : c_int = 4;
c34b1796
AL
4779 pub const CTL_KERN : c_int = 1;
4780 pub const KERN_PROC : c_int = 66;
85aaf69f
SL
4781
4782 pub const MAP_COPY : c_int = 0x0002;
c34b1796
AL
4783 pub const MAP_RENAME : c_int = 0x0000;
4784 pub const MAP_NORESERVE : c_int = 0x0000;
4785 pub const MAP_NOEXTEND : c_int = 0x0000;
4786 pub const MAP_HASSEMAPHORE : c_int = 0x0000;
85aaf69f
SL
4787
4788 pub const IPPROTO_RAW : c_int = 255;
c34b1796
AL
4789
4790 pub const PATH_MAX: c_int = 1024;
85aaf69f
SL
4791 }
4792 pub mod sysconf {
4793 use types::os::arch::c95::c_int;
4794
4795 pub const _SC_ARG_MAX : c_int = 1;
4796 pub const _SC_CHILD_MAX : c_int = 2;
4797 pub const _SC_CLK_TCK : c_int = 3;
4798 pub const _SC_NGROUPS_MAX : c_int = 4;
4799 pub const _SC_OPEN_MAX : c_int = 5;
4800 pub const _SC_JOB_CONTROL : c_int = 6;
4801 pub const _SC_SAVED_IDS : c_int = 7;
4802 pub const _SC_VERSION : c_int = 8;
4803 pub const _SC_BC_BASE_MAX : c_int = 9;
4804 pub const _SC_BC_DIM_MAX : c_int = 10;
4805 pub const _SC_BC_SCALE_MAX : c_int = 11;
4806 pub const _SC_BC_STRING_MAX : c_int = 12;
4807 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
4808 pub const _SC_EXPR_NEST_MAX : c_int = 14;
4809 pub const _SC_LINE_MAX : c_int = 15;
4810 pub const _SC_RE_DUP_MAX : c_int = 16;
4811 pub const _SC_2_VERSION : c_int = 17;
4812 pub const _SC_2_C_BIND : c_int = 18;
4813 pub const _SC_2_C_DEV : c_int = 19;
4814 pub const _SC_2_CHAR_TERM : c_int = 20;
4815 pub const _SC_2_FORT_DEV : c_int = 21;
4816 pub const _SC_2_FORT_RUN : c_int = 22;
4817 pub const _SC_2_LOCALEDEF : c_int = 23;
4818 pub const _SC_2_SW_DEV : c_int = 24;
4819 pub const _SC_2_UPE : c_int = 25;
4820 pub const _SC_STREAM_MAX : c_int = 26;
4821 pub const _SC_TZNAME_MAX : c_int = 27;
c34b1796
AL
4822 pub const _SC_PAGESIZE : c_int = 28;
4823 pub const _SC_FSYNC : c_int = 29;
4824 pub const _SC_SEM_NSEMS_MAX : c_int = 31;
4825 pub const _SC_SEM_VALUE_MAX : c_int = 32;
4826 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
4827 pub const _SC_AIO_MAX : c_int = 43;
4828 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
4829 pub const _SC_ASYNCHRONOUS_IO : c_int = 45;
4830 pub const _SC_DELAYTIMER_MAX : c_int = 50;
85aaf69f
SL
4831 pub const _SC_MAPPED_FILES : c_int = 53;
4832 pub const _SC_MEMLOCK : c_int = 54;
4833 pub const _SC_MEMLOCK_RANGE : c_int = 55;
4834 pub const _SC_MEMORY_PROTECTION : c_int = 56;
4835 pub const _SC_MESSAGE_PASSING : c_int = 57;
c34b1796 4836 pub const _SC_MQ_OPEN_MAX : c_int = 58;
85aaf69f
SL
4837 pub const _SC_PRIORITIZED_IO : c_int = 60;
4838 pub const _SC_PRIORITY_SCHEDULING : c_int = 61;
4839 pub const _SC_REALTIME_SIGNALS : c_int = 64;
c34b1796 4840 pub const _SC_RTSIG_MAX : c_int = 66;
85aaf69f 4841 pub const _SC_SEMAPHORES : c_int = 67;
85aaf69f 4842 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 68;
85aaf69f 4843 pub const _SC_SIGQUEUE_MAX : c_int = 70;
c34b1796 4844 pub const _SC_SYNCHRONIZED_IO : c_int = 75;
85aaf69f 4845 pub const _SC_TIMER_MAX : c_int = 93;
c34b1796 4846 pub const _SC_TIMERS : c_int = 94;
85aaf69f
SL
4847 }
4848 }
4849
4850 #[cfg(any(target_os = "macos", target_os = "ios"))]
4851 pub mod os {
4852 pub mod c95 {
4853 use types::os::arch::c95::{c_int, c_uint};
4854
4855 pub const EXIT_FAILURE : c_int = 1;
4856 pub const EXIT_SUCCESS : c_int = 0;
4857 pub const RAND_MAX : c_int = 2147483647;
4858 pub const EOF : c_int = -1;
4859 pub const SEEK_SET : c_int = 0;
4860 pub const SEEK_CUR : c_int = 1;
4861 pub const SEEK_END : c_int = 2;
4862 pub const _IOFBF : c_int = 0;
4863 pub const _IONBF : c_int = 2;
4864 pub const _IOLBF : c_int = 1;
c34b1796
AL
4865 pub const BUFSIZ : c_uint = 1024;
4866 pub const FOPEN_MAX : c_uint = 20;
4867 pub const FILENAME_MAX : c_uint = 1024;
4868 pub const L_tmpnam : c_uint = 1024;
4869 pub const TMP_MAX : c_uint = 308915776;
85aaf69f
SL
4870 }
4871 pub mod c99 {
4872 }
4873 pub mod posix88 {
4874 use types::common::c95::c_void;
4875 use types::os::arch::c95::c_int;
4876 use types::os::arch::posix88::mode_t;
4877
4878 pub const O_RDONLY : c_int = 0;
4879 pub const O_WRONLY : c_int = 1;
4880 pub const O_RDWR : c_int = 2;
4881 pub const O_APPEND : c_int = 8;
4882 pub const O_CREAT : c_int = 512;
4883 pub const O_EXCL : c_int = 2048;
9346a6ac 4884 pub const O_NOCTTY : c_int = 131072;
85aaf69f
SL
4885 pub const O_TRUNC : c_int = 1024;
4886 pub const S_IFIFO : mode_t = 4096;
4887 pub const S_IFCHR : mode_t = 8192;
4888 pub const S_IFBLK : mode_t = 24576;
4889 pub const S_IFDIR : mode_t = 16384;
4890 pub const S_IFREG : mode_t = 32768;
4891 pub const S_IFLNK : mode_t = 40960;
c1a9b12d 4892 pub const S_IFSOCK : mode_t = 49152;
85aaf69f
SL
4893 pub const S_IFMT : mode_t = 61440;
4894 pub const S_IEXEC : mode_t = 64;
4895 pub const S_IWRITE : mode_t = 128;
4896 pub const S_IREAD : mode_t = 256;
4897 pub const S_IRWXU : mode_t = 448;
4898 pub const S_IXUSR : mode_t = 64;
4899 pub const S_IWUSR : mode_t = 128;
4900 pub const S_IRUSR : mode_t = 256;
c34b1796
AL
4901 pub const S_IRWXG : mode_t = 56;
4902 pub const S_IXGRP : mode_t = 8;
4903 pub const S_IWGRP : mode_t = 16;
4904 pub const S_IRGRP : mode_t = 32;
4905 pub const S_IRWXO : mode_t = 7;
4906 pub const S_IXOTH : mode_t = 1;
4907 pub const S_IWOTH : mode_t = 2;
4908 pub const S_IROTH : mode_t = 4;
85aaf69f
SL
4909 pub const F_OK : c_int = 0;
4910 pub const R_OK : c_int = 4;
4911 pub const W_OK : c_int = 2;
4912 pub const X_OK : c_int = 1;
4913 pub const STDIN_FILENO : c_int = 0;
4914 pub const STDOUT_FILENO : c_int = 1;
4915 pub const STDERR_FILENO : c_int = 2;
4916 pub const F_LOCK : c_int = 1;
4917 pub const F_TEST : c_int = 3;
4918 pub const F_TLOCK : c_int = 2;
4919 pub const F_ULOCK : c_int = 0;
4920 pub const SIGHUP : c_int = 1;
4921 pub const SIGINT : c_int = 2;
4922 pub const SIGQUIT : c_int = 3;
4923 pub const SIGILL : c_int = 4;
4924 pub const SIGABRT : c_int = 6;
4925 pub const SIGFPE : c_int = 8;
4926 pub const SIGKILL : c_int = 9;
4927 pub const SIGSEGV : c_int = 11;
4928 pub const SIGPIPE : c_int = 13;
4929 pub const SIGALRM : c_int = 14;
4930 pub const SIGTERM : c_int = 15;
4931
4932 pub const PROT_NONE : c_int = 0;
4933 pub const PROT_READ : c_int = 1;
4934 pub const PROT_WRITE : c_int = 2;
4935 pub const PROT_EXEC : c_int = 4;
4936
4937 pub const MAP_FILE : c_int = 0x0000;
4938 pub const MAP_SHARED : c_int = 0x0001;
4939 pub const MAP_PRIVATE : c_int = 0x0002;
4940 pub const MAP_FIXED : c_int = 0x0010;
4941 pub const MAP_ANON : c_int = 0x1000;
4942
c34b1796 4943 pub const MAP_FAILED : *mut c_void = !0 as *mut c_void;
85aaf69f
SL
4944
4945 pub const MCL_CURRENT : c_int = 0x0001;
4946 pub const MCL_FUTURE : c_int = 0x0002;
4947
4948 pub const MS_ASYNC : c_int = 0x0001;
4949 pub const MS_INVALIDATE : c_int = 0x0002;
1a4d82fc
JJ
4950 pub const MS_SYNC : c_int = 0x0010;
4951
4952 pub const MS_KILLPAGES : c_int = 0x0004;
4953 pub const MS_DEACTIVATE : c_int = 0x0008;
4954
4955 pub const EPERM : c_int = 1;
4956 pub const ENOENT : c_int = 2;
4957 pub const ESRCH : c_int = 3;
4958 pub const EINTR : c_int = 4;
4959 pub const EIO : c_int = 5;
4960 pub const ENXIO : c_int = 6;
4961 pub const E2BIG : c_int = 7;
4962 pub const ENOEXEC : c_int = 8;
4963 pub const EBADF : c_int = 9;
4964 pub const ECHILD : c_int = 10;
4965 pub const EDEADLK : c_int = 11;
4966 pub const ENOMEM : c_int = 12;
4967 pub const EACCES : c_int = 13;
4968 pub const EFAULT : c_int = 14;
4969 pub const ENOTBLK : c_int = 15;
4970 pub const EBUSY : c_int = 16;
4971 pub const EEXIST : c_int = 17;
4972 pub const EXDEV : c_int = 18;
4973 pub const ENODEV : c_int = 19;
4974 pub const ENOTDIR : c_int = 20;
4975 pub const EISDIR : c_int = 21;
4976 pub const EINVAL : c_int = 22;
4977 pub const ENFILE : c_int = 23;
4978 pub const EMFILE : c_int = 24;
4979 pub const ENOTTY : c_int = 25;
4980 pub const ETXTBSY : c_int = 26;
4981 pub const EFBIG : c_int = 27;
4982 pub const ENOSPC : c_int = 28;
4983 pub const ESPIPE : c_int = 29;
4984 pub const EROFS : c_int = 30;
4985 pub const EMLINK : c_int = 31;
4986 pub const EPIPE : c_int = 32;
4987 pub const EDOM : c_int = 33;
4988 pub const ERANGE : c_int = 34;
4989 pub const EAGAIN : c_int = 35;
4990 pub const EWOULDBLOCK : c_int = EAGAIN;
4991 pub const EINPROGRESS : c_int = 36;
4992 pub const EALREADY : c_int = 37;
4993 pub const ENOTSOCK : c_int = 38;
4994 pub const EDESTADDRREQ : c_int = 39;
4995 pub const EMSGSIZE : c_int = 40;
4996 pub const EPROTOTYPE : c_int = 41;
4997 pub const ENOPROTOOPT : c_int = 42;
4998 pub const EPROTONOSUPPORT : c_int = 43;
4999 pub const ESOCKTNOSUPPORT : c_int = 44;
5000 pub const ENOTSUP : c_int = 45;
5001 pub const EPFNOSUPPORT : c_int = 46;
5002 pub const EAFNOSUPPORT : c_int = 47;
5003 pub const EADDRINUSE : c_int = 48;
5004 pub const EADDRNOTAVAIL : c_int = 49;
5005 pub const ENETDOWN : c_int = 50;
5006 pub const ENETUNREACH : c_int = 51;
5007 pub const ENETRESET : c_int = 52;
5008 pub const ECONNABORTED : c_int = 53;
5009 pub const ECONNRESET : c_int = 54;
5010 pub const ENOBUFS : c_int = 55;
5011 pub const EISCONN : c_int = 56;
5012 pub const ENOTCONN : c_int = 57;
5013 pub const ESHUTDOWN : c_int = 58;
5014 pub const ETOOMANYREFS : c_int = 59;
5015 pub const ETIMEDOUT : c_int = 60;
5016 pub const ECONNREFUSED : c_int = 61;
5017 pub const ELOOP : c_int = 62;
5018 pub const ENAMETOOLONG : c_int = 63;
5019 pub const EHOSTDOWN : c_int = 64;
5020 pub const EHOSTUNREACH : c_int = 65;
5021 pub const ENOTEMPTY : c_int = 66;
5022 pub const EPROCLIM : c_int = 67;
5023 pub const EUSERS : c_int = 68;
5024 pub const EDQUOT : c_int = 69;
5025 pub const ESTALE : c_int = 70;
5026 pub const EREMOTE : c_int = 71;
5027 pub const EBADRPC : c_int = 72;
5028 pub const ERPCMISMATCH : c_int = 73;
5029 pub const EPROGUNAVAIL : c_int = 74;
5030 pub const EPROGMISMATCH : c_int = 75;
5031 pub const EPROCUNAVAIL : c_int = 76;
5032 pub const ENOLCK : c_int = 77;
5033 pub const ENOSYS : c_int = 78;
5034 pub const EFTYPE : c_int = 79;
5035 pub const EAUTH : c_int = 80;
5036 pub const ENEEDAUTH : c_int = 81;
5037 pub const EPWROFF : c_int = 82;
5038 pub const EDEVERR : c_int = 83;
5039 pub const EOVERFLOW : c_int = 84;
5040 pub const EBADEXEC : c_int = 85;
5041 pub const EBADARCH : c_int = 86;
5042 pub const ESHLIBVERS : c_int = 87;
5043 pub const EBADMACHO : c_int = 88;
5044 pub const ECANCELED : c_int = 89;
5045 pub const EIDRM : c_int = 90;
5046 pub const ENOMSG : c_int = 91;
5047 pub const EILSEQ : c_int = 92;
5048 pub const ENOATTR : c_int = 93;
5049 pub const EBADMSG : c_int = 94;
5050 pub const EMULTIHOP : c_int = 95;
5051 pub const ENODATA : c_int = 96;
5052 pub const ENOLINK : c_int = 97;
5053 pub const ENOSR : c_int = 98;
5054 pub const ENOSTR : c_int = 99;
5055 pub const EPROTO : c_int = 100;
5056 pub const ETIME : c_int = 101;
5057 pub const EOPNOTSUPP : c_int = 102;
5058 pub const ENOPOLICY : c_int = 103;
5059 pub const ENOTRECOVERABLE : c_int = 104;
5060 pub const EOWNERDEAD : c_int = 105;
5061 pub const EQFULL : c_int = 106;
5062 pub const ELAST : c_int = 106;
5063 }
5064 pub mod posix01 {
5065 use types::os::arch::c95::{c_int, size_t};
c34b1796 5066 use types::os::common::posix01::rlim_t;
1a4d82fc
JJ
5067
5068 pub const F_DUPFD : c_int = 0;
5069 pub const F_GETFD : c_int = 1;
5070 pub const F_SETFD : c_int = 2;
5071 pub const F_GETFL : c_int = 3;
5072 pub const F_SETFL : c_int = 4;
5073
c1a9b12d
SL
5074 pub const O_ACCMODE : c_int = 3;
5075
1a4d82fc 5076 pub const SIGTRAP : c_int = 5;
1a4d82fc
JJ
5077 pub const SIG_IGN: size_t = 1;
5078
5079 pub const GLOB_APPEND : c_int = 0x0001;
5080 pub const GLOB_DOOFFS : c_int = 0x0002;
5081 pub const GLOB_ERR : c_int = 0x0004;
5082 pub const GLOB_MARK : c_int = 0x0008;
5083 pub const GLOB_NOCHECK : c_int = 0x0010;
5084 pub const GLOB_NOSORT : c_int = 0x0020;
5085 pub const GLOB_NOESCAPE : c_int = 0x2000;
5086
5087 pub const GLOB_NOSPACE : c_int = -1;
5088 pub const GLOB_ABORTED : c_int = -2;
5089 pub const GLOB_NOMATCH : c_int = -3;
5090
5091 pub const POSIX_MADV_NORMAL : c_int = 0;
5092 pub const POSIX_MADV_RANDOM : c_int = 1;
5093 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
5094 pub const POSIX_MADV_WILLNEED : c_int = 3;
5095 pub const POSIX_MADV_DONTNEED : c_int = 4;
5096
5097 pub const _SC_IOV_MAX : c_int = 56;
5098 pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
5099 pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
5100 pub const _SC_LOGIN_NAME_MAX : c_int = 73;
5101 pub const _SC_MQ_PRIO_MAX : c_int = 75;
5102 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
5103 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
5104 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
5105 pub const _SC_THREAD_KEYS_MAX : c_int = 86;
5106 pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
5107 pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
5108 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
5109 pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
5110 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
5111 pub const _SC_THREAD_STACK_MIN : c_int = 93;
5112 pub const _SC_THREAD_THREADS_MAX : c_int = 94;
5113 pub const _SC_THREADS : c_int = 96;
5114 pub const _SC_TTY_NAME_MAX : c_int = 101;
5115 pub const _SC_ATEXIT_MAX : c_int = 107;
5116 pub const _SC_XOPEN_CRYPT : c_int = 108;
5117 pub const _SC_XOPEN_ENH_I18N : c_int = 109;
5118 pub const _SC_XOPEN_LEGACY : c_int = 110;
5119 pub const _SC_XOPEN_REALTIME : c_int = 111;
5120 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
5121 pub const _SC_XOPEN_SHM : c_int = 113;
5122 pub const _SC_XOPEN_UNIX : c_int = 115;
5123 pub const _SC_XOPEN_VERSION : c_int = 116;
5124 pub const _SC_XOPEN_XCU_VERSION : c_int = 121;
5125
5126 pub const PTHREAD_CREATE_JOINABLE: c_int = 1;
5127 pub const PTHREAD_CREATE_DETACHED: c_int = 2;
5128 pub const PTHREAD_STACK_MIN: size_t = 8192;
c34b1796
AL
5129
5130 pub const RLIMIT_CPU: c_int = 0;
5131 pub const RLIMIT_FSIZE: c_int = 1;
5132 pub const RLIMIT_DATA: c_int = 2;
5133 pub const RLIMIT_STACK: c_int = 3;
5134 pub const RLIMIT_CORE: c_int = 4;
5135 pub const RLIMIT_AS: c_int = 5;
5136 pub const RLIMIT_MEMLOCK: c_int = 6;
5137 pub const RLIMIT_NPROC: c_int = 7;
5138 pub const RLIMIT_NOFILE: c_int = 8;
5139 pub const RLIM_NLIMITS: c_int = 9;
5140 pub const _RLIMIT_POSIX_FLAG: c_int = 0x1000;
5141
5142 pub const RLIM_INFINITY: rlim_t = 0xffff_ffff_ffff_ffff;
5143
5144 pub const RUSAGE_SELF: c_int = 0;
5145 pub const RUSAGE_CHILDREN: c_int = -1;
5146 pub const RUSAGE_THREAD: c_int = 1;
1a4d82fc
JJ
5147 }
5148 pub mod posix08 {
5149 }
5150 pub mod bsd44 {
5151 use types::os::arch::c95::c_int;
5152
5153 pub const MADV_NORMAL : c_int = 0;
5154 pub const MADV_RANDOM : c_int = 1;
5155 pub const MADV_SEQUENTIAL : c_int = 2;
5156 pub const MADV_WILLNEED : c_int = 3;
5157 pub const MADV_DONTNEED : c_int = 4;
5158 pub const MADV_FREE : c_int = 5;
5159 pub const MADV_ZERO_WIRED_PAGES : c_int = 6;
5160 pub const MADV_FREE_REUSABLE : c_int = 7;
5161 pub const MADV_FREE_REUSE : c_int = 8;
5162 pub const MADV_CAN_REUSE : c_int = 9;
5163
5164 pub const MINCORE_INCORE : c_int = 0x1;
5165 pub const MINCORE_REFERENCED : c_int = 0x2;
5166 pub const MINCORE_MODIFIED : c_int = 0x4;
5167 pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
5168 pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
5169
5170 pub const AF_UNIX: c_int = 1;
5171 pub const AF_INET: c_int = 2;
5172 pub const AF_INET6: c_int = 30;
5173 pub const SOCK_STREAM: c_int = 1;
5174 pub const SOCK_DGRAM: c_int = 2;
5175 pub const SOCK_RAW: c_int = 3;
5176 pub const IPPROTO_TCP: c_int = 6;
5177 pub const IPPROTO_IP: c_int = 0;
5178 pub const IPPROTO_IPV6: c_int = 41;
5179 pub const IP_MULTICAST_TTL: c_int = 10;
5180 pub const IP_MULTICAST_LOOP: c_int = 11;
5181 pub const IP_TTL: c_int = 4;
5182 pub const IP_HDRINCL: c_int = 2;
5183 pub const IP_ADD_MEMBERSHIP: c_int = 12;
5184 pub const IP_DROP_MEMBERSHIP: c_int = 13;
5185 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
5186 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
5187
5188 pub const TCP_NODELAY: c_int = 0x01;
5189 pub const TCP_KEEPALIVE: c_int = 0x10;
5190 pub const SOL_SOCKET: c_int = 0xffff;
c34b1796
AL
5191
5192 pub const SO_DEBUG: c_int = 0x01;
5193 pub const SO_ACCEPTCONN: c_int = 0x0002;
5194 pub const SO_REUSEADDR: c_int = 0x0004;
1a4d82fc 5195 pub const SO_KEEPALIVE: c_int = 0x0008;
c34b1796 5196 pub const SO_DONTROUTE: c_int = 0x0010;
1a4d82fc 5197 pub const SO_BROADCAST: c_int = 0x0020;
c34b1796
AL
5198 pub const SO_USELOOPBACK: c_int = 0x0040;
5199 pub const SO_LINGER: c_int = 0x0080;
5200 pub const SO_OOBINLINE: c_int = 0x0100;
5201 pub const SO_REUSEPORT: c_int = 0x0200;
5202 pub const SO_SNDBUF: c_int = 0x1001;
5203 pub const SO_RCVBUF: c_int = 0x1002;
5204 pub const SO_SNDLOWAT: c_int = 0x1003;
5205 pub const SO_RCVLOWAT: c_int = 0x1004;
5206 pub const SO_SNDTIMEO: c_int = 0x1005;
5207 pub const SO_RCVTIMEO: c_int = 0x1006;
1a4d82fc 5208 pub const SO_ERROR: c_int = 0x1007;
c34b1796 5209 pub const SO_TYPE: c_int = 0x1008;
1a4d82fc
JJ
5210
5211 pub const IFF_LOOPBACK: c_int = 0x8;
5212
5213 pub const SHUT_RD: c_int = 0;
5214 pub const SHUT_WR: c_int = 1;
5215 pub const SHUT_RDWR: c_int = 2;
c1a9b12d
SL
5216
5217 pub const LOCK_SH: c_int = 1;
5218 pub const LOCK_EX: c_int = 2;
5219 pub const LOCK_NB: c_int = 4;
5220 pub const LOCK_UN: c_int = 8;
1a4d82fc
JJ
5221 }
5222 pub mod extra {
5223 use types::os::arch::c95::c_int;
5224
5225 pub const O_DSYNC : c_int = 4194304;
5226 pub const O_SYNC : c_int = 128;
5227 pub const O_NONBLOCK : c_int = 4;
c1a9b12d 5228 pub const F_GETPATH : c_int = 50;
1a4d82fc
JJ
5229 pub const F_FULLFSYNC : c_int = 51;
5230
5231 pub const MAP_COPY : c_int = 0x0002;
5232 pub const MAP_RENAME : c_int = 0x0020;
5233 pub const MAP_NORESERVE : c_int = 0x0040;
5234 pub const MAP_NOEXTEND : c_int = 0x0100;
5235 pub const MAP_HASSEMAPHORE : c_int = 0x0200;
5236 pub const MAP_NOCACHE : c_int = 0x0400;
5237 pub const MAP_JIT : c_int = 0x0800;
5238 pub const MAP_STACK : c_int = 0;
5239
5240 pub const IPPROTO_RAW : c_int = 255;
c34b1796
AL
5241
5242 pub const SO_NREAD: c_int = 0x1020;
5243 pub const SO_NKE: c_int = 0x1021;
5244 pub const SO_NOSIGPIPE: c_int = 0x1022;
5245 pub const SO_NOADDRERR: c_int = 0x1023;
5246 pub const SO_NWRITE: c_int = 0x1024;
5247 pub const SO_DONTTRUNC: c_int = 0x2000;
5248 pub const SO_WANTMORE: c_int = 0x4000;
5249 pub const SO_WANTOOBFLAG: c_int = 0x8000;
c1a9b12d
SL
5250
5251 pub const PATH_MAX: c_int = 1024;
1a4d82fc
JJ
5252 }
5253 pub mod sysconf {
5254 use types::os::arch::c95::c_int;
5255
5256 pub const _SC_ARG_MAX : c_int = 1;
5257 pub const _SC_CHILD_MAX : c_int = 2;
5258 pub const _SC_CLK_TCK : c_int = 3;
5259 pub const _SC_NGROUPS_MAX : c_int = 4;
5260 pub const _SC_OPEN_MAX : c_int = 5;
5261 pub const _SC_JOB_CONTROL : c_int = 6;
5262 pub const _SC_SAVED_IDS : c_int = 7;
5263 pub const _SC_VERSION : c_int = 8;
5264 pub const _SC_BC_BASE_MAX : c_int = 9;
5265 pub const _SC_BC_DIM_MAX : c_int = 10;
5266 pub const _SC_BC_SCALE_MAX : c_int = 11;
5267 pub const _SC_BC_STRING_MAX : c_int = 12;
5268 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
5269 pub const _SC_EXPR_NEST_MAX : c_int = 14;
5270 pub const _SC_LINE_MAX : c_int = 15;
5271 pub const _SC_RE_DUP_MAX : c_int = 16;
5272 pub const _SC_2_VERSION : c_int = 17;
5273 pub const _SC_2_C_BIND : c_int = 18;
5274 pub const _SC_2_C_DEV : c_int = 19;
5275 pub const _SC_2_CHAR_TERM : c_int = 20;
5276 pub const _SC_2_FORT_DEV : c_int = 21;
5277 pub const _SC_2_FORT_RUN : c_int = 22;
5278 pub const _SC_2_LOCALEDEF : c_int = 23;
5279 pub const _SC_2_SW_DEV : c_int = 24;
5280 pub const _SC_2_UPE : c_int = 25;
5281 pub const _SC_STREAM_MAX : c_int = 26;
5282 pub const _SC_TZNAME_MAX : c_int = 27;
5283 pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
5284 pub const _SC_PAGESIZE : c_int = 29;
5285 pub const _SC_MEMLOCK : c_int = 30;
5286 pub const _SC_MEMLOCK_RANGE : c_int = 31;
5287 pub const _SC_MEMORY_PROTECTION : c_int = 32;
5288 pub const _SC_MESSAGE_PASSING : c_int = 33;
5289 pub const _SC_PRIORITIZED_IO : c_int = 34;
5290 pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
5291 pub const _SC_REALTIME_SIGNALS : c_int = 36;
5292 pub const _SC_SEMAPHORES : c_int = 37;
5293 pub const _SC_FSYNC : c_int = 38;
5294 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
5295 pub const _SC_SYNCHRONIZED_IO : c_int = 40;
5296 pub const _SC_TIMERS : c_int = 41;
5297 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
5298 pub const _SC_AIO_MAX : c_int = 43;
5299 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
5300 pub const _SC_DELAYTIMER_MAX : c_int = 45;
5301 pub const _SC_MQ_OPEN_MAX : c_int = 46;
5302 pub const _SC_MAPPED_FILES : c_int = 47;
5303 pub const _SC_RTSIG_MAX : c_int = 48;
5304 pub const _SC_SEM_NSEMS_MAX : c_int = 49;
5305 pub const _SC_SEM_VALUE_MAX : c_int = 50;
5306 pub const _SC_SIGQUEUE_MAX : c_int = 51;
5307 pub const _SC_TIMER_MAX : c_int = 52;
d9579d0f
AL
5308 pub const _SC_NPROCESSORS_CONF : c_int = 57;
5309 pub const _SC_NPROCESSORS_ONLN : c_int = 58;
5310 pub const _SC_2_PBS : c_int = 59;
5311 pub const _SC_2_PBS_ACCOUNTING : c_int = 60;
5312 pub const _SC_2_PBS_CHECKPOINT : c_int = 61;
5313 pub const _SC_2_PBS_LOCATE : c_int = 62;
5314 pub const _SC_2_PBS_MESSAGE : c_int = 63;
5315 pub const _SC_2_PBS_TRACK : c_int = 64;
5316 pub const _SC_ADVISORY_INFO : c_int = 65;
5317 pub const _SC_BARRIERS : c_int = 66;
5318 pub const _SC_CLOCK_SELECTION : c_int = 67;
5319 pub const _SC_CPUTIME : c_int = 68;
5320 pub const _SC_FILE_LOCKING : c_int = 69;
5321 pub const _SC_HOST_NAME_MAX : c_int = 72;
5322 pub const _SC_MONOTONIC_CLOCK : c_int = 74;
5323 pub const _SC_READER_WRITER_LOCKS : c_int = 76;
5324 pub const _SC_REGEXP : c_int = 77;
5325 pub const _SC_SHELL : c_int = 78;
5326 pub const _SC_SPAWN : c_int = 79;
5327 pub const _SC_SPIN_LOCKS : c_int = 80;
5328 pub const _SC_SPORADIC_SERVER : c_int = 81;
5329 pub const _SC_THREAD_CPUTIME : c_int = 84;
5330 pub const _SC_THREAD_SPORADIC_SERVER : c_int = 92;
5331 pub const _SC_TIMEOUTS : c_int = 95;
5332 pub const _SC_TRACE : c_int = 97;
5333 pub const _SC_TRACE_EVENT_FILTER : c_int = 98;
5334 pub const _SC_TRACE_INHERIT : c_int = 99;
5335 pub const _SC_TRACE_LOG : c_int = 100;
5336 pub const _SC_TYPED_MEMORY_OBJECTS : c_int = 102;
5337 pub const _SC_V6_ILP32_OFF32 : c_int = 103;
5338 pub const _SC_V6_ILP32_OFFBIG : c_int = 104;
5339 pub const _SC_V6_LP64_OFF64 : c_int = 105;
5340 pub const _SC_V6_LPBIG_OFFBIG : c_int = 106;
5341 pub const _SC_IPV6 : c_int = 118;
5342 pub const _SC_RAW_SOCKETS : c_int = 119;
5343 pub const _SC_SYMLOOP_MAX : c_int = 120;
5344 pub const _SC_PAGE_SIZE : c_int = _SC_PAGESIZE;
5345 pub const _SC_XOPEN_STREAMS : c_int = 114;
1a4d82fc
JJ
5346 pub const _SC_XBS5_ILP32_OFF32 : c_int = 122;
5347 pub const _SC_XBS5_ILP32_OFFBIG : c_int = 123;
5348 pub const _SC_XBS5_LP64_OFF64 : c_int = 124;
5349 pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 125;
d9579d0f
AL
5350 pub const _SC_SS_REPL_MAX : c_int = 126;
5351 pub const _SC_TRACE_EVENT_NAME_MAX : c_int = 127;
5352 pub const _SC_TRACE_NAME_MAX : c_int = 128;
5353 pub const _SC_TRACE_SYS_MAX : c_int = 129;
5354 pub const _SC_TRACE_USER_EVENT_MAX : c_int = 130;
5355 pub const _SC_PASS_MAX : c_int = 131;
1a4d82fc
JJ
5356 }
5357 }
5358}
5359
5360
5361pub mod funcs {
5362 // Thankfully most of c95 is universally available and does not vary by OS
5363 // or anything. The same is not true of POSIX.
5364
5365 pub mod c95 {
5366 pub mod ctype {
5367 use types::os::arch::c95::{c_char, c_int};
5368
5369 extern {
5370 pub fn isalnum(c: c_int) -> c_int;
5371 pub fn isalpha(c: c_int) -> c_int;
5372 pub fn iscntrl(c: c_int) -> c_int;
5373 pub fn isdigit(c: c_int) -> c_int;
5374 pub fn isgraph(c: c_int) -> c_int;
5375 pub fn islower(c: c_int) -> c_int;
5376 pub fn isprint(c: c_int) -> c_int;
5377 pub fn ispunct(c: c_int) -> c_int;
5378 pub fn isspace(c: c_int) -> c_int;
5379 pub fn isupper(c: c_int) -> c_int;
5380 pub fn isxdigit(c: c_int) -> c_int;
5381 pub fn tolower(c: c_char) -> c_char;
5382 pub fn toupper(c: c_char) -> c_char;
5383 }
5384 }
5385
5386 pub mod stdio {
5387 use types::common::c95::{FILE, c_void, fpos_t};
5388 use types::os::arch::c95::{c_char, c_int, c_long, size_t};
5389
5390 extern {
5391 pub fn fopen(filename: *const c_char,
5392 mode: *const c_char) -> *mut FILE;
5393 pub fn freopen(filename: *const c_char, mode: *const c_char,
5394 file: *mut FILE)
5395 -> *mut FILE;
5396 pub fn fflush(file: *mut FILE) -> c_int;
5397 pub fn fclose(file: *mut FILE) -> c_int;
5398 pub fn remove(filename: *const c_char) -> c_int;
5399 pub fn rename(oldname: *const c_char,
5400 newname: *const c_char) -> c_int;
5401 pub fn tmpfile() -> *mut FILE;
5402 pub fn setvbuf(stream: *mut FILE,
5403 buffer: *mut c_char,
5404 mode: c_int,
5405 size: size_t)
5406 -> c_int;
5407 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
5408 // Omitted: printf and scanf variants.
5409 pub fn fgetc(stream: *mut FILE) -> c_int;
5410 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
5411 -> *mut c_char;
5412 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
5413 pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int;
5414 // Omitted: getc, getchar (might be macros).
5415
5416 // Omitted: gets, so ridiculously unsafe that it should not
5417 // survive.
5418
5419 // Omitted: putc, putchar (might be macros).
5420 pub fn puts(s: *const c_char) -> c_int;
5421 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
5422 pub fn fread(ptr: *mut c_void,
5423 size: size_t,
5424 nobj: size_t,
5425 stream: *mut FILE)
5426 -> size_t;
5427 pub fn fwrite(ptr: *const c_void,
5428 size: size_t,
5429 nobj: size_t,
5430 stream: *mut FILE)
5431 -> size_t;
5432 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int)
5433 -> c_int;
5434 pub fn ftell(stream: *mut FILE) -> c_long;
5435 pub fn rewind(stream: *mut FILE);
5436 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
5437 pub fn fsetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
5438 pub fn feof(stream: *mut FILE) -> c_int;
5439 pub fn ferror(stream: *mut FILE) -> c_int;
5440 pub fn perror(s: *const c_char);
5441 }
5442 }
5443
5444 pub mod stdlib {
5445 use types::common::c95::c_void;
5446 use types::os::arch::c95::{c_char, c_double, c_int};
5447 use types::os::arch::c95::{c_long, c_uint, c_ulong};
5448 use types::os::arch::c95::{size_t};
5449
5450 extern {
5451 pub fn abs(i: c_int) -> c_int;
5452 pub fn labs(i: c_long) -> c_long;
5453 // Omitted: div, ldiv (return pub type incomplete).
5454 pub fn atof(s: *const c_char) -> c_double;
5455 pub fn atoi(s: *const c_char) -> c_int;
5456 pub fn strtod(s: *const c_char,
5457 endp: *mut *mut c_char) -> c_double;
5458 pub fn strtol(s: *const c_char,
5459 endp: *mut *mut c_char, base: c_int) -> c_long;
5460 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
5461 base: c_int) -> c_ulong;
5462 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
5463 pub fn malloc(size: size_t) -> *mut c_void;
5464 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
5465 pub fn free(p: *mut c_void);
85aaf69f
SL
5466
5467 /// Exits the running program in a possibly dangerous manner.
5468 ///
5469 /// # Unsafety
5470 ///
5471 /// While this forces your program to exit, it does so in a way that has
5472 /// consequences. This will skip all unwinding code, which means that anything
5473 /// relying on unwinding for cleanup (such as flushing and closing a buffer to a
5474 /// file) may act in an unexpected way.
5475 ///
5476 /// # Examples
5477 ///
c34b1796 5478 /// ```no_run,ignore
85aaf69f
SL
5479 /// extern crate libc;
5480 ///
5481 /// fn main() {
5482 /// unsafe {
5483 /// libc::exit(1);
5484 /// }
5485 /// }
5486 /// ```
1a4d82fc
JJ
5487 pub fn exit(status: c_int) -> !;
5488 pub fn _exit(status: c_int) -> !;
5489 pub fn atexit(cb: extern fn()) -> c_int;
5490 pub fn system(s: *const c_char) -> c_int;
5491 pub fn getenv(s: *const c_char) -> *mut c_char;
5492 // Omitted: bsearch, qsort
5493 pub fn rand() -> c_int;
5494 pub fn srand(seed: c_uint);
5495 }
5496 }
5497
5498 pub mod string {
5499 use types::common::c95::c_void;
5500 use types::os::arch::c95::{c_char, c_int, size_t};
5501 use types::os::arch::c95::{wchar_t};
5502
5503 extern {
5504 pub fn strcpy(dst: *mut c_char,
5505 src: *const c_char) -> *mut c_char;
5506 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t)
5507 -> *mut c_char;
5508 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
5509 pub fn strncat(s: *mut c_char, ct: *const c_char,
5510 n: size_t) -> *mut c_char;
5511 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
5512 pub fn strncmp(cs: *const c_char, ct: *const c_char,
5513 n: size_t) -> c_int;
5514 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
5515 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
5516 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
5517 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
5518 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
5519 pub fn strpbrk(cs: *const c_char,
5520 ct: *const c_char) -> *mut c_char;
5521 pub fn strstr(cs: *const c_char,
5522 ct: *const c_char) -> *mut c_char;
5523 pub fn strlen(cs: *const c_char) -> size_t;
5524 pub fn strerror(n: c_int) -> *mut c_char;
5525 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
5526 pub fn strxfrm(s: *mut c_char, ct: *const c_char,
5527 n: size_t) -> size_t;
5528 pub fn wcslen(buf: *const wchar_t) -> size_t;
5529
5530 // Omitted: memcpy, memmove, memset (provided by LLVM)
5531
5532 // These are fine to execute on the Rust stack. They must be,
5533 // in fact, because LLVM generates calls to them!
5534 pub fn memcmp(cx: *const c_void, ct: *const c_void,
5535 n: size_t) -> c_int;
5536 pub fn memchr(cx: *const c_void, c: c_int,
5537 n: size_t) -> *mut c_void;
5538 }
5539 }
5540 }
5541
5542 // Microsoft helpfully underscore-qualifies all of its POSIX-like symbols
5543 // to make sure you don't use them accidentally. It also randomly deviates
5544 // from the exact signatures you might otherwise expect, and omits much,
5545 // so be careful when trying to write portable code; it won't always work
5546 // with the same POSIX functions and types as other platforms.
5547
5548 #[cfg(target_os = "windows")]
5549 pub mod posix88 {
5550 pub mod stat_ {
5551 use types::os::common::posix01::{stat, utimbuf};
5552 use types::os::arch::c95::{c_int, c_char, wchar_t};
5553
5554 extern {
5555 #[link_name = "_chmod"]
5556 pub fn chmod(path: *const c_char, mode: c_int) -> c_int;
5557 #[link_name = "_wchmod"]
5558 pub fn wchmod(path: *const wchar_t, mode: c_int) -> c_int;
5559 #[link_name = "_mkdir"]
5560 pub fn mkdir(path: *const c_char) -> c_int;
5561 #[link_name = "_wrmdir"]
5562 pub fn wrmdir(path: *const wchar_t) -> c_int;
5563 #[link_name = "_fstat64"]
5564 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
5565 #[link_name = "_stat64"]
5566 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
5567 #[link_name = "_wstat64"]
5568 pub fn wstat(path: *const wchar_t, buf: *mut stat) -> c_int;
5569 #[link_name = "_wutime64"]
5570 pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> c_int;
5571 }
5572 }
5573
5574 pub mod stdio {
5575 use types::common::c95::FILE;
5576 use types::os::arch::c95::{c_int, c_char};
5577
5578 extern {
5579 #[link_name = "_popen"]
5580 pub fn popen(command: *const c_char,
5581 mode: *const c_char) -> *mut FILE;
5582 #[link_name = "_pclose"]
5583 pub fn pclose(stream: *mut FILE) -> c_int;
5584 #[link_name = "_fdopen"]
5585 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
5586 #[link_name = "_fileno"]
5587 pub fn fileno(stream: *mut FILE) -> c_int;
5588 }
5589 }
5590
5591 pub mod fcntl {
5592 use types::os::arch::c95::{c_int, c_char, wchar_t};
5593 extern {
5594 #[link_name = "_open"]
5595 pub fn open(path: *const c_char, oflag: c_int, mode: c_int)
5596 -> c_int;
5597 #[link_name = "_wopen"]
5598 pub fn wopen(path: *const wchar_t, oflag: c_int, mode: c_int)
5599 -> c_int;
5600 #[link_name = "_creat"]
5601 pub fn creat(path: *const c_char, mode: c_int) -> c_int;
5602 }
5603 }
5604
5605 pub mod dirent {
5606 // Not supplied at all.
5607 }
5608
5609 pub mod unistd {
5610 use types::common::c95::c_void;
5611 use types::os::arch::c95::{c_int, c_uint, c_char,
5612 c_long, size_t};
5613 use types::os::arch::c99::intptr_t;
5614
5615 extern {
5616 #[link_name = "_access"]
5617 pub fn access(path: *const c_char, amode: c_int) -> c_int;
5618 #[link_name = "_chdir"]
5619 pub fn chdir(dir: *const c_char) -> c_int;
5620 #[link_name = "_close"]
5621 pub fn close(fd: c_int) -> c_int;
5622 #[link_name = "_dup"]
5623 pub fn dup(fd: c_int) -> c_int;
5624 #[link_name = "_dup2"]
5625 pub fn dup2(src: c_int, dst: c_int) -> c_int;
5626 #[link_name = "_execv"]
5627 pub fn execv(prog: *const c_char,
62682a34 5628 argv: *const *const c_char) -> intptr_t;
1a4d82fc 5629 #[link_name = "_execve"]
62682a34
SL
5630 pub fn execve(prog: *const c_char, argv: *const *const c_char,
5631 envp: *const *const c_char)
1a4d82fc
JJ
5632 -> c_int;
5633 #[link_name = "_execvp"]
5634 pub fn execvp(c: *const c_char,
62682a34 5635 argv: *const *const c_char) -> c_int;
1a4d82fc 5636 #[link_name = "_execvpe"]
62682a34
SL
5637 pub fn execvpe(c: *const c_char, argv: *const *const c_char,
5638 envp: *const *const c_char) -> c_int;
1a4d82fc
JJ
5639 #[link_name = "_getcwd"]
5640 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
5641 #[link_name = "_getpid"]
5642 pub fn getpid() -> c_int;
5643 #[link_name = "_isatty"]
5644 pub fn isatty(fd: c_int) -> c_int;
5645 #[link_name = "_lseek"]
5646 pub fn lseek(fd: c_int, offset: c_long, origin: c_int)
5647 -> c_long;
5648 #[link_name = "_pipe"]
5649 pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
5650 -> c_int;
5651 #[link_name = "_read"]
5652 pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
5653 -> c_int;
5654 #[link_name = "_rmdir"]
5655 pub fn rmdir(path: *const c_char) -> c_int;
5656 #[link_name = "_unlink"]
5657 pub fn unlink(c: *const c_char) -> c_int;
5658 #[link_name = "_write"]
5659 pub fn write(fd: c_int, buf: *const c_void,
5660 count: c_uint) -> c_int;
5661 }
5662 }
5663
5664 pub mod mman {
5665 }
5666 }
5667
5668 #[cfg(any(target_os = "linux",
5669 target_os = "android",
5670 target_os = "macos",
5671 target_os = "ios",
5672 target_os = "freebsd",
85aaf69f 5673 target_os = "dragonfly",
c34b1796 5674 target_os = "bitrig",
c1a9b12d 5675 target_os = "netbsd",
c34b1796
AL
5676 target_os = "openbsd",
5677 target_os = "nacl"))]
1a4d82fc
JJ
5678 pub mod posix88 {
5679 pub mod stat_ {
5680 use types::os::arch::c95::{c_char, c_int};
5681 use types::os::arch::posix01::stat;
5682 use types::os::arch::posix88::mode_t;
5683
5684 extern {
5685 pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
5686 pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
5687
5688 #[cfg(any(target_os = "linux",
5689 target_os = "freebsd",
5690 target_os = "dragonfly",
c34b1796 5691 target_os = "bitrig",
c1a9b12d 5692 target_os = "netbsd",
85aaf69f 5693 target_os = "openbsd",
1a4d82fc 5694 target_os = "android",
c34b1796
AL
5695 target_os = "ios",
5696 target_os = "nacl"))]
1a4d82fc
JJ
5697 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
5698
5699 #[cfg(target_os = "macos")]
5700 #[link_name = "fstat64"]
5701 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
5702
5703 pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
c34b1796 5704 #[cfg(not(target_os = "nacl"))]
1a4d82fc
JJ
5705 pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
5706
5707 #[cfg(any(target_os = "linux",
5708 target_os = "freebsd",
5709 target_os = "dragonfly",
c34b1796 5710 target_os = "bitrig",
c1a9b12d 5711 target_os = "netbsd",
85aaf69f 5712 target_os = "openbsd",
1a4d82fc 5713 target_os = "android",
c34b1796
AL
5714 target_os = "ios",
5715 target_os = "nacl"))]
1a4d82fc
JJ
5716 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
5717
5718 #[cfg(target_os = "macos")]
5719 #[link_name = "stat64"]
5720 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
5721 }
5722 }
5723
5724 pub mod stdio {
5725 use types::common::c95::FILE;
5726 use types::os::arch::c95::{c_char, c_int};
5727
5728 extern {
5729 pub fn popen(command: *const c_char,
5730 mode: *const c_char) -> *mut FILE;
5731 pub fn pclose(stream: *mut FILE) -> c_int;
5732 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
5733 pub fn fileno(stream: *mut FILE) -> c_int;
5734 }
5735 }
5736
5737 pub mod fcntl {
5738 use types::os::arch::c95::{c_char, c_int};
5739 use types::os::arch::posix88::mode_t;
5740
c34b1796
AL
5741 mod open_shim {
5742 extern {
5743 #[cfg(any(target_os = "macos",
5744 target_os = "ios"))]
5745 pub fn open(path: *const ::c_char, oflag: ::c_int, ...)
5746 -> ::c_int;
5747
5748 #[cfg(not(any(target_os = "macos",
5749 target_os = "ios")))]
5750 pub fn open(path: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
5751 -> ::c_int;
5752 }
5753 }
5754
5755 #[cfg(any(target_os = "macos",
5756 target_os = "ios"))]
5757 #[inline]
5758 pub unsafe extern fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
5759 use types::os::arch::c95::c_uint;
5760 open_shim::open(path, oflag, mode as c_uint)
5761 }
5762
5763 #[cfg(not(any(target_os = "macos",
5764 target_os = "ios")))]
5765 #[inline]
5766 pub unsafe extern fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
5767 open_shim::open(path, oflag, mode)
5768 }
5769
1a4d82fc 5770 extern {
1a4d82fc
JJ
5771 pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
5772 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
5773 }
5774 }
5775
5776 pub mod dirent {
5777 use types::common::posix88::{DIR, dirent_t};
5778 use types::os::arch::c95::{c_char, c_int, c_long};
5779
5780 // NB: On OS X opendir and readdir have two versions,
5781 // one for 32-bit kernelspace and one for 64.
5782 // We should be linking to the 64-bit ones, called
5783 // opendir$INODE64, etc. but for some reason rustc
5784 // doesn't link it correctly on i686, so we're going
5785 // through a C function that mysteriously does work.
5786
5787 extern {
5788 #[link_name="rust_opendir"]
5789 pub fn opendir(dirname: *const c_char) -> *mut DIR;
5790 #[link_name="rust_readdir_r"]
5791 pub fn readdir_r(dirp: *mut DIR, entry: *mut dirent_t,
5792 result: *mut *mut dirent_t) -> c_int;
5793 }
5794
5795 extern {
5796 pub fn closedir(dirp: *mut DIR) -> c_int;
5797 pub fn rewinddir(dirp: *mut DIR);
5798 pub fn seekdir(dirp: *mut DIR, loc: c_long);
5799 pub fn telldir(dirp: *mut DIR) -> c_long;
5800 }
5801 }
5802
5803 pub mod unistd {
5804 use types::common::c95::c_void;
5805 use types::os::arch::c95::{c_char, c_int, c_long, c_uint};
5806 use types::os::arch::c95::{size_t};
5807 use types::os::common::posix01::timespec;
5808 use types::os::arch::posix01::utimbuf;
5809 use types::os::arch::posix88::{gid_t, off_t, pid_t};
5810 use types::os::arch::posix88::{ssize_t, uid_t};
5811
5812 pub const _PC_NAME_MAX: c_int = 4;
5813
c34b1796 5814 #[cfg(not(target_os = "nacl"))]
1a4d82fc
JJ
5815 extern {
5816 pub fn access(path: *const c_char, amode: c_int) -> c_int;
5817 pub fn alarm(seconds: c_uint) -> c_uint;
5818 pub fn chdir(dir: *const c_char) -> c_int;
5819 pub fn chown(path: *const c_char, uid: uid_t,
5820 gid: gid_t) -> c_int;
5821 pub fn close(fd: c_int) -> c_int;
5822 pub fn dup(fd: c_int) -> c_int;
5823 pub fn dup2(src: c_int, dst: c_int) -> c_int;
5824 pub fn execv(prog: *const c_char,
62682a34
SL
5825 argv: *const *const c_char) -> c_int;
5826 pub fn execve(prog: *const c_char, argv: *const *const c_char,
5827 envp: *const *const c_char)
1a4d82fc
JJ
5828 -> c_int;
5829 pub fn execvp(c: *const c_char,
62682a34 5830 argv: *const *const c_char) -> c_int;
1a4d82fc
JJ
5831 pub fn fork() -> pid_t;
5832 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
5833 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
5834 pub fn getegid() -> gid_t;
5835 pub fn geteuid() -> uid_t;
c34b1796 5836 pub fn getgid() -> gid_t;
1a4d82fc
JJ
5837 pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
5838 -> c_int;
5839 pub fn getlogin() -> *mut c_char;
62682a34
SL
5840 // GNU getopt(3) modifies its arguments despite the
5841 // char * const [] prototype; see the manpage.
5842 pub fn getopt(argc: c_int, argv: *mut *mut c_char,
1a4d82fc
JJ
5843 optstr: *const c_char) -> c_int;
5844 pub fn getpgrp() -> pid_t;
5845 pub fn getpid() -> pid_t;
5846 pub fn getppid() -> pid_t;
5847 pub fn getuid() -> uid_t;
5848 pub fn getsid(pid: pid_t) -> pid_t;
5849 pub fn isatty(fd: c_int) -> c_int;
5850 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
5851 pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
5852 -> off_t;
5853 pub fn pathconf(path: *mut c_char, name: c_int) -> c_long;
5854 pub fn pause() -> c_int;
5855 pub fn pipe(fds: *mut c_int) -> c_int;
5856 pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
5857 -> ssize_t;
5858 pub fn rmdir(path: *const c_char) -> c_int;
5859 pub fn setgid(gid: gid_t) -> c_int;
5860 pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
5861 pub fn setsid() -> pid_t;
5862 pub fn setuid(uid: uid_t) -> c_int;
5863 pub fn sleep(secs: c_uint) -> c_uint;
5864 pub fn usleep(secs: c_uint) -> c_int;
5865 pub fn nanosleep(rqtp: *const timespec,
5866 rmtp: *mut timespec) -> c_int;
5867 pub fn sysconf(name: c_int) -> c_long;
5868 pub fn tcgetpgrp(fd: c_int) -> pid_t;
5869 pub fn ttyname(fd: c_int) -> *mut c_char;
5870 pub fn unlink(c: *const c_char) -> c_int;
d9579d0f
AL
5871 pub fn wait(status: *const c_int) -> pid_t;
5872 pub fn waitpid(pid: pid_t, status: *const c_int, options: c_int)
5873 -> pid_t;
1a4d82fc
JJ
5874 pub fn write(fd: c_int, buf: *const c_void, count: size_t)
5875 -> ssize_t;
5876 pub fn pread(fd: c_int, buf: *mut c_void, count: size_t,
5877 offset: off_t) -> ssize_t;
5878 pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t,
5879 offset: off_t) -> ssize_t;
5880 pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
5881 }
c34b1796
AL
5882 #[cfg(target_os = "nacl")]
5883 extern {
5884 pub fn access(path: *const c_char, amode: c_int) -> c_int;
5885 pub fn chdir(dir: *const c_char) -> c_int;
5886 pub fn chown(path: *const c_char, uid: uid_t,
5887 gid: gid_t) -> c_int;
5888 pub fn close(fd: c_int) -> c_int;
5889 pub fn dup(fd: c_int) -> c_int;
5890 pub fn dup2(src: c_int, dst: c_int) -> c_int;
5891 pub fn execv(prog: *const c_char,
62682a34
SL
5892 argv: *const *const c_char) -> c_int;
5893 pub fn execve(prog: *const c_char, argv: *const *const c_char,
5894 envp: *const *const c_char)
c34b1796
AL
5895 -> c_int;
5896 pub fn execvp(c: *const c_char,
62682a34 5897 argv: *const *const c_char) -> c_int;
c34b1796
AL
5898 pub fn fork() -> pid_t;
5899 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
5900 pub fn getegid() -> gid_t;
5901 pub fn geteuid() -> uid_t;
5902 pub fn getgid() -> gid_t;
5903 pub fn getlogin() -> *mut c_char;
62682a34 5904 pub fn getopt(argc: c_int, argv: *const *const c_char,
c34b1796
AL
5905 optstr: *const c_char) -> c_int;
5906 pub fn getuid() -> uid_t;
5907 pub fn getsid(pid: pid_t) -> pid_t;
5908 pub fn isatty(fd: c_int) -> c_int;
5909 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
5910 pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
5911 -> off_t;
5912 pub fn pipe(fds: *mut c_int) -> c_int;
5913 pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
5914 -> ssize_t;
5915 pub fn rmdir(path: *const c_char) -> c_int;
5916 pub fn setgid(gid: gid_t) -> c_int;
5917 pub fn setuid(uid: uid_t) -> c_int;
5918 pub fn sleep(secs: c_uint) -> c_uint;
5919 pub fn usleep(secs: c_uint) -> c_int;
5920 pub fn nanosleep(rqtp: *const timespec,
5921 rmtp: *mut timespec) -> c_int;
5922 pub fn sysconf(name: c_int) -> c_long;
5923 pub fn ttyname(fd: c_int) -> *mut c_char;
5924 pub fn unlink(c: *const c_char) -> c_int;
d9579d0f
AL
5925 pub fn wait(status: *const c_int) -> pid_t;
5926 pub fn waitpid(pid: pid_t, status: *const c_int, options: c_int)
5927 -> pid_t;
c34b1796
AL
5928 pub fn write(fd: c_int, buf: *const c_void, count: size_t)
5929 -> ssize_t;
5930 pub fn pread(fd: c_int, buf: *mut c_void, count: size_t,
5931 offset: off_t) -> ssize_t;
5932 pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t,
5933 offset: off_t) -> ssize_t;
5934 pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
5935 }
1a4d82fc
JJ
5936 }
5937
5938 pub mod signal {
5939 use types::os::arch::c95::{c_int};
5940 use types::os::arch::posix88::{pid_t};
5941
5942 extern {
5943 pub fn kill(pid: pid_t, sig: c_int) -> c_int;
5944 }
5945 }
5946
5947 pub mod mman {
5948 use types::common::c95::{c_void};
5949 use types::os::arch::c95::{size_t, c_int, c_char};
5950 use types::os::arch::posix88::{mode_t, off_t};
5951
c34b1796 5952 #[cfg(not(target_os = "nacl"))]
1a4d82fc
JJ
5953 extern {
5954 pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
5955 pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
5956 pub fn mlockall(flags: c_int) -> c_int;
5957 pub fn munlockall() -> c_int;
5958
c34b1796
AL
5959 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int)
5960 -> c_int;
5961
5962 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int)
5963 -> c_int;
5964 pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t)
5965 -> c_int;
5966 pub fn shm_unlink(name: *const c_char) -> c_int;
5967 }
5968
5969 extern {
1a4d82fc
JJ
5970 pub fn mmap(addr: *mut c_void,
5971 len: size_t,
5972 prot: c_int,
5973 flags: c_int,
5974 fd: c_int,
5975 offset: off_t)
5976 -> *mut c_void;
5977 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
5978
1a4d82fc
JJ
5979 }
5980 }
5981
5982 pub mod net {
5983 use types::os::arch::c95::{c_char, c_uint};
5984
5985 extern {
5986 pub fn if_nametoindex(ifname: *const c_char) -> c_uint;
5987 }
5988 }
5989
5990 }
5991
5992 #[cfg(any(target_os = "linux",
5993 target_os = "android",
5994 target_os = "macos",
5995 target_os = "ios",
5996 target_os = "freebsd",
85aaf69f 5997 target_os = "dragonfly",
c34b1796 5998 target_os = "bitrig",
c1a9b12d 5999 target_os = "netbsd",
c34b1796
AL
6000 target_os = "openbsd",
6001 target_os = "nacl"))]
1a4d82fc
JJ
6002 pub mod posix01 {
6003 pub mod stat_ {
6004 use types::os::arch::c95::{c_char, c_int};
6005 use types::os::arch::posix01::stat;
6006
6007 extern {
6008 #[cfg(any(target_os = "linux",
6009 target_os = "freebsd",
6010 target_os = "dragonfly",
c34b1796 6011 target_os = "bitrig",
c1a9b12d 6012 target_os = "netbsd",
85aaf69f 6013 target_os = "openbsd",
1a4d82fc 6014 target_os = "android",
c34b1796
AL
6015 target_os = "ios",
6016 target_os = "nacl"))]
1a4d82fc
JJ
6017 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
6018
6019 #[cfg(target_os = "macos")]
6020 #[link_name = "lstat64"]
6021 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
6022 }
6023 }
6024
6025 pub mod unistd {
6026 use types::os::arch::c95::{c_char, c_int, size_t};
6027 use types::os::arch::posix88::{ssize_t, off_t};
6028
6029 extern {
6030 pub fn readlink(path: *const c_char,
6031 buf: *mut c_char,
6032 bufsz: size_t)
6033 -> ssize_t;
6034
6035 pub fn fsync(fd: c_int) -> c_int;
6036
6037 #[cfg(any(target_os = "linux", target_os = "android"))]
6038 pub fn fdatasync(fd: c_int) -> c_int;
6039
6040 pub fn setenv(name: *const c_char, val: *const c_char,
6041 overwrite: c_int) -> c_int;
6042 pub fn unsetenv(name: *const c_char) -> c_int;
6043 pub fn putenv(string: *mut c_char) -> c_int;
6044
6045 pub fn symlink(path1: *const c_char,
6046 path2: *const c_char) -> c_int;
6047
6048 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
6049 }
6050 }
6051
6052 pub mod signal {
6053 use types::os::arch::c95::c_int;
6054 use types::os::common::posix01::sighandler_t;
6055
c1a9b12d
SL
6056 #[cfg(not(all(target_os = "android", any(target_arch = "arm",
6057 target_arch = "x86"))))]
1a4d82fc
JJ
6058 extern {
6059 pub fn signal(signum: c_int,
6060 handler: sighandler_t) -> sighandler_t;
6061 }
6062
c1a9b12d
SL
6063 #[cfg(all(target_os = "android", any(target_arch = "arm",
6064 target_arch = "x86")))]
1a4d82fc
JJ
6065 extern {
6066 #[link_name = "bsd_signal"]
6067 pub fn signal(signum: c_int,
6068 handler: sighandler_t) -> sighandler_t;
6069 }
6070 }
6071
6072 pub mod glob {
6073 use types::os::arch::c95::{c_char, c_int};
6074 use types::os::common::posix01::{glob_t};
6075
6076 extern {
6077 pub fn glob(pattern: *const c_char,
6078 flags: c_int,
6079 errfunc: ::core::option::Option<extern "C" fn(epath: *const c_char,
6080 errno: c_int) -> c_int>,
6081 pglob: *mut glob_t);
6082 pub fn globfree(pglob: *mut glob_t);
6083 }
6084 }
6085
6086 pub mod mman {
6087 use types::common::c95::{c_void};
6088 use types::os::arch::c95::{c_int, size_t};
6089
c34b1796 6090 #[cfg(not(target_os = "nacl"))]
1a4d82fc
JJ
6091 extern {
6092 pub fn posix_madvise(addr: *mut c_void,
6093 len: size_t,
6094 advice: c_int)
6095 -> c_int;
6096 }
6097 }
c34b1796
AL
6098
6099 pub mod resource {
6100 use types::os::arch::c95::c_int;
6101 use types::os::common::posix01::rlimit;
6102 use types::os::common::bsd43::rusage;
6103 extern {
6104 pub fn getrlimit(resource: c_int, rlim: *mut rlimit) -> c_int;
6105 pub fn setrlimit(resource: c_int, rlim: *const rlimit) -> c_int;
6106 pub fn getrusage(resource: c_int, usage: *mut rusage) -> c_int;
6107
6108 }
6109 }
1a4d82fc
JJ
6110 }
6111
6112 #[cfg(target_os = "windows")]
6113 pub mod posix01 {
6114 pub mod stat_ {
6115 }
6116
6117 pub mod unistd {
6118 }
6119
6120 pub mod glob {
6121 }
6122
6123 pub mod mman {
6124 }
6125
6126 pub mod net {
6127 }
6128 }
6129
6130
c1a9b12d
SL
6131 #[cfg(any(target_os = "android",
6132 target_os = "bitrig",
6133 target_os = "dragonfly",
1a4d82fc
JJ
6134 target_os = "ios",
6135 target_os = "freebsd",
c1a9b12d
SL
6136 target_os = "linux",
6137 target_os = "macos",
6138 target_os = "nacl",
6139 target_os = "netbsd",
c34b1796 6140 target_os = "openbsd",
c1a9b12d 6141 target_os = "windows"))]
1a4d82fc
JJ
6142 pub mod posix08 {
6143 pub mod unistd {
6144 }
6145 }
6146
6147 #[cfg(not(windows))]
6148 pub mod bsd43 {
6149 use types::common::c95::{c_void};
6150 use types::os::common::bsd44::{socklen_t, sockaddr, ifaddrs};
6151 use types::os::arch::c95::{c_int, size_t};
6152 use types::os::arch::posix88::ssize_t;
6153
6154 extern "system" {
6155 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int;
6156 pub fn connect(socket: c_int, address: *const sockaddr,
6157 len: socklen_t) -> c_int;
6158 pub fn bind(socket: c_int, address: *const sockaddr,
6159 address_len: socklen_t) -> c_int;
6160 pub fn listen(socket: c_int, backlog: c_int) -> c_int;
6161 pub fn accept(socket: c_int, address: *mut sockaddr,
6162 address_len: *mut socklen_t) -> c_int;
6163 pub fn getpeername(socket: c_int, address: *mut sockaddr,
6164 address_len: *mut socklen_t) -> c_int;
6165 pub fn getsockname(socket: c_int, address: *mut sockaddr,
6166 address_len: *mut socklen_t) -> c_int;
6167 pub fn setsockopt(socket: c_int, level: c_int, name: c_int,
6168 value: *const c_void,
6169 option_len: socklen_t) -> c_int;
6170 pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
6171 flags: c_int) -> ssize_t;
6172 pub fn send(socket: c_int, buf: *const c_void, len: size_t,
6173 flags: c_int) -> ssize_t;
6174 pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
6175 flags: c_int, addr: *mut sockaddr,
6176 addrlen: *mut socklen_t) -> ssize_t;
6177 pub fn sendto(socket: c_int, buf: *const c_void, len: size_t,
6178 flags: c_int, addr: *const sockaddr,
6179 addrlen: socklen_t) -> ssize_t;
6180 pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> c_int;
6181 pub fn freeifaddrs(ifa: *mut ifaddrs);
6182 pub fn shutdown(socket: c_int, how: c_int) -> c_int;
6183 }
6184 }
6185
6186 #[cfg(windows)]
6187 pub mod bsd43 {
6188 use types::common::c95::{c_void};
6189 use types::os::common::bsd44::{socklen_t, sockaddr, SOCKET};
6190 use types::os::arch::c95::c_int;
1a4d82fc
JJ
6191
6192 extern "system" {
6193 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> SOCKET;
6194 pub fn connect(socket: SOCKET, address: *const sockaddr,
6195 len: socklen_t) -> c_int;
6196 pub fn bind(socket: SOCKET, address: *const sockaddr,
6197 address_len: socklen_t) -> c_int;
6198 pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
6199 pub fn accept(socket: SOCKET, address: *mut sockaddr,
6200 address_len: *mut socklen_t) -> SOCKET;
6201 pub fn getpeername(socket: SOCKET, address: *mut sockaddr,
6202 address_len: *mut socklen_t) -> c_int;
6203 pub fn getsockname(socket: SOCKET, address: *mut sockaddr,
6204 address_len: *mut socklen_t) -> c_int;
6205 pub fn setsockopt(socket: SOCKET, level: c_int, name: c_int,
6206 value: *const c_void,
6207 option_len: socklen_t) -> c_int;
6208 pub fn closesocket(socket: SOCKET) -> c_int;
6209 pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
6210 flags: c_int) -> c_int;
6211 pub fn send(socket: SOCKET, buf: *const c_void, len: c_int,
6212 flags: c_int) -> c_int;
6213 pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
6214 flags: c_int, addr: *mut sockaddr,
d9579d0f 6215 addrlen: *mut c_int) -> c_int;
1a4d82fc
JJ
6216 pub fn sendto(socket: SOCKET, buf: *const c_void, len: c_int,
6217 flags: c_int, addr: *const sockaddr,
6218 addrlen: c_int) -> c_int;
6219 pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
6220 }
6221 }
6222
6223 #[cfg(any(target_os = "macos",
6224 target_os = "ios",
6225 target_os = "freebsd",
85aaf69f 6226 target_os = "dragonfly",
c34b1796 6227 target_os = "bitrig",
c1a9b12d 6228 target_os = "netbsd",
85aaf69f 6229 target_os = "openbsd"))]
1a4d82fc
JJ
6230 pub mod bsd44 {
6231 use types::common::c95::{c_void};
6232 use types::os::arch::c95::{c_char, c_uchar, c_int, c_uint, c_ulong, size_t};
6233
6234 extern {
c1a9b12d 6235 pub fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int;
1a4d82fc
JJ
6236 pub fn sysctl(name: *mut c_int,
6237 namelen: c_uint,
6238 oldp: *mut c_void,
6239 oldlenp: *mut size_t,
6240 newp: *mut c_void,
6241 newlen: size_t)
6242 -> c_int;
6243 pub fn sysctlbyname(name: *const c_char,
6244 oldp: *mut c_void,
6245 oldlenp: *mut size_t,
6246 newp: *mut c_void,
6247 newlen: size_t)
6248 -> c_int;
6249 pub fn sysctlnametomib(name: *const c_char,
6250 mibp: *mut c_int,
6251 sizep: *mut size_t)
6252 -> c_int;
6253 pub fn getdtablesize() -> c_int;
6254 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
6255 -> c_int;
6256 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
6257 -> c_int;
c34b1796
AL
6258 pub fn realpath(pathname: *const c_char, resolved: *mut c_char)
6259 -> *mut c_char;
c1a9b12d 6260 pub fn flock(fd: c_int, operation: c_int) -> c_int;
1a4d82fc
JJ
6261 }
6262 }
6263
1a4d82fc
JJ
6264 #[cfg(any(target_os = "linux", target_os = "android"))]
6265 pub mod bsd44 {
6266 use types::common::c95::{c_void};
c1a9b12d 6267 use types::os::arch::c95::{c_uchar, c_int, c_ulong, size_t};
1a4d82fc
JJ
6268
6269 extern {
85aaf69f 6270 #[cfg(not(all(target_os = "android", target_arch = "aarch64")))]
1a4d82fc 6271 pub fn getdtablesize() -> c_int;
c1a9b12d 6272 pub fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int;
1a4d82fc
JJ
6273 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
6274 -> c_int;
6275 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
6276 -> c_int;
c1a9b12d 6277 pub fn flock(fd: c_int, operation: c_int) -> c_int;
1a4d82fc
JJ
6278 }
6279 }
6280
c34b1796
AL
6281 #[cfg(target_os = "nacl")]
6282 pub mod bsd44 {
6283 use types::os::arch::c95::c_int;
6284 extern {
6285 pub fn getdtablesize() -> c_int;
6286 }
6287 }
1a4d82fc
JJ
6288
6289 #[cfg(target_os = "windows")]
6290 pub mod bsd44 {
6291 }
6292
6293 #[cfg(any(target_os = "macos", target_os = "ios"))]
6294 pub mod extra {
6295 use types::os::arch::c95::{c_char, c_int};
6296
6297 extern {
6298 pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32)
6299 -> c_int;
6300 }
6301 }
6302
85aaf69f
SL
6303 #[cfg(any(target_os = "freebsd",
6304 target_os = "dragonfly",
c34b1796 6305 target_os = "bitrig",
c1a9b12d 6306 target_os = "netbsd",
85aaf69f 6307 target_os = "openbsd"))]
1a4d82fc
JJ
6308 pub mod extra {
6309 }
6310
c34b1796 6311 #[cfg(any(target_os = "linux", target_os = "android", target_os = "nacl"))]
1a4d82fc
JJ
6312 pub mod extra {
6313 }
6314
6315
6316 #[cfg(target_os = "windows")]
6317 pub mod extra {
6318
6319 pub mod kernel32 {
6320 use types::os::arch::c95::{c_uint};
6321 use types::os::arch::extra::{BOOL, DWORD, SIZE_T, HMODULE,
6322 LPCWSTR, LPWSTR,
6323 LPWCH, LPDWORD, LPVOID,
6324 LPCVOID, LPOVERLAPPED,
6325 LPSECURITY_ATTRIBUTES,
6326 LPSTARTUPINFO,
6327 LPPROCESS_INFORMATION,
6328 LPMEMORY_BASIC_INFORMATION,
6329 LPSYSTEM_INFO, HANDLE, LPHANDLE,
6330 LARGE_INTEGER, PLARGE_INTEGER,
6331 LPFILETIME, LPWIN32_FIND_DATAW};
6332
6333 extern "system" {
6334 pub fn GetEnvironmentVariableW(n: LPCWSTR,
6335 v: LPWSTR,
6336 nsize: DWORD)
6337 -> DWORD;
6338 pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
6339 -> BOOL;
6340 pub fn GetEnvironmentStringsW() -> LPWCH;
6341 pub fn FreeEnvironmentStringsW(env_ptr: LPWCH) -> BOOL;
6342 pub fn GetModuleFileNameW(hModule: HMODULE,
6343 lpFilename: LPWSTR,
6344 nSize: DWORD)
6345 -> DWORD;
6346 pub fn CreateDirectoryW(lpPathName: LPCWSTR,
6347 lpSecurityAttributes:
6348 LPSECURITY_ATTRIBUTES)
6349 -> BOOL;
6350 pub fn CopyFileW(lpExistingFileName: LPCWSTR,
6351 lpNewFileName: LPCWSTR,
6352 bFailIfExists: BOOL)
6353 -> BOOL;
6354 pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
6355 pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
6356 pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
6357 lpBuffer: LPWSTR)
6358 -> DWORD;
6359 pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
6360 pub fn GetLastError() -> DWORD;
6361 pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW)
6362 -> HANDLE;
6363 pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW)
6364 -> BOOL;
6365 pub fn FindClose(findFile: HANDLE) -> BOOL;
6366 pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
6367 hSourceHandle: HANDLE,
6368 hTargetProcessHandle: HANDLE,
6369 lpTargetHandle: LPHANDLE,
6370 dwDesiredAccess: DWORD,
6371 bInheritHandle: BOOL,
6372 dwOptions: DWORD)
6373 -> BOOL;
6374 pub fn CloseHandle(hObject: HANDLE) -> BOOL;
6375 pub fn OpenProcess(dwDesiredAccess: DWORD,
6376 bInheritHandle: BOOL,
6377 dwProcessId: DWORD)
6378 -> HANDLE;
6379 pub fn GetCurrentProcess() -> HANDLE;
6380 pub fn CreateProcessW(lpApplicationName: LPCWSTR,
6381 lpCommandLine: LPWSTR,
6382 lpProcessAttributes:
6383 LPSECURITY_ATTRIBUTES,
6384 lpThreadAttributes:
6385 LPSECURITY_ATTRIBUTES,
6386 bInheritHandles: BOOL,
6387 dwCreationFlags: DWORD,
6388 lpEnvironment: LPVOID,
6389 lpCurrentDirectory: LPCWSTR,
6390 lpStartupInfo: LPSTARTUPINFO,
6391 lpProcessInformation:
6392 LPPROCESS_INFORMATION)
6393 -> BOOL;
6394 pub fn WaitForSingleObject(hHandle: HANDLE,
6395 dwMilliseconds: DWORD)
6396 -> DWORD;
6397 pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
6398 -> BOOL;
6399 pub fn GetExitCodeProcess(hProcess: HANDLE,
6400 lpExitCode: LPDWORD)
6401 -> BOOL;
6402 pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
6403 pub fn VirtualAlloc(lpAddress: LPVOID,
6404 dwSize: SIZE_T,
6405 flAllocationType: DWORD,
6406 flProtect: DWORD)
6407 -> LPVOID;
6408 pub fn VirtualFree(lpAddress: LPVOID,
6409 dwSize: SIZE_T,
6410 dwFreeType: DWORD)
6411 -> BOOL;
6412 pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
6413 pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
6414 -> BOOL;
6415 pub fn VirtualProtect(lpAddress: LPVOID,
6416 dwSize: SIZE_T,
6417 flNewProtect: DWORD,
6418 lpflOldProtect: LPDWORD)
6419 -> BOOL;
6420 pub fn VirtualQuery(lpAddress: LPCVOID,
6421 lpBuffer: LPMEMORY_BASIC_INFORMATION,
6422 dwLength: SIZE_T)
6423 -> SIZE_T;
6424 pub fn CreateFileMappingW(hFile: HANDLE,
6425 lpAttributes: LPSECURITY_ATTRIBUTES,
6426 flProtect: DWORD,
6427 dwMaximumSizeHigh: DWORD,
6428 dwMaximumSizeLow: DWORD,
6429 lpName: LPCWSTR)
6430 -> HANDLE;
6431 pub fn MapViewOfFile(hFileMappingObject: HANDLE,
6432 dwDesiredAccess: DWORD,
6433 dwFileOffsetHigh: DWORD,
6434 dwFileOffsetLow: DWORD,
6435 dwNumberOfBytesToMap: SIZE_T)
6436 -> LPVOID;
6437 pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
6438 pub fn MoveFileExW(lpExistingFileName: LPCWSTR,
6439 lpNewFileName: LPCWSTR,
6440 dwFlags: DWORD) -> BOOL;
6441 pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
6442 lpTargetFileName: LPCWSTR,
6443 lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
6444 -> BOOL;
6445 pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL;
6446 pub fn CreateFileW(lpFileName: LPCWSTR,
6447 dwDesiredAccess: DWORD,
6448 dwShareMode: DWORD,
6449 lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
6450 dwCreationDisposition: DWORD,
6451 dwFlagsAndAttributes: DWORD,
6452 hTemplateFile: HANDLE) -> HANDLE;
6453 pub fn ReadFile(hFile: HANDLE,
6454 lpBuffer: LPVOID,
6455 nNumberOfBytesToRead: DWORD,
6456 lpNumberOfBytesRead: LPDWORD,
6457 lpOverlapped: LPOVERLAPPED) -> BOOL;
6458 pub fn WriteFile(hFile: HANDLE,
6459 lpBuffer: LPVOID,
62682a34
SL
6460 nNumberOfBytesToWrite: DWORD,
6461 lpNumberOfBytesWritten: LPDWORD,
1a4d82fc
JJ
6462 lpOverlapped: LPOVERLAPPED) -> BOOL;
6463 pub fn SetFilePointerEx(hFile: HANDLE,
6464 liDistanceToMove: LARGE_INTEGER,
6465 lpNewFilePointer: PLARGE_INTEGER,
6466 dwMoveMethod: DWORD) -> BOOL;
6467 pub fn SetEndOfFile(hFile: HANDLE) -> BOOL;
6468
6469 pub fn GetSystemTimeAsFileTime(
6470 lpSystemTimeAsFileTime: LPFILETIME);
6471
6472 pub fn QueryPerformanceFrequency(
6473 lpFrequency: *mut LARGE_INTEGER) -> BOOL;
6474 pub fn QueryPerformanceCounter(
6475 lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL;
6476
6477 pub fn GetCurrentProcessId() -> DWORD;
6478 pub fn CreateNamedPipeW(
6479 lpName: LPCWSTR,
6480 dwOpenMode: DWORD,
6481 dwPipeMode: DWORD,
6482 nMaxInstances: DWORD,
6483 nOutBufferSize: DWORD,
6484 nInBufferSize: DWORD,
6485 nDefaultTimeOut: DWORD,
6486 lpSecurityAttributes: LPSECURITY_ATTRIBUTES
6487 ) -> HANDLE;
6488 pub fn ConnectNamedPipe(hNamedPipe: HANDLE,
6489 lpOverlapped: LPOVERLAPPED) -> BOOL;
6490 pub fn WaitNamedPipeW(lpNamedPipeName: LPCWSTR,
6491 nTimeOut: DWORD) -> BOOL;
6492 pub fn SetNamedPipeHandleState(hNamedPipe: HANDLE,
6493 lpMode: LPDWORD,
6494 lpMaxCollectionCount: LPDWORD,
6495 lpCollectDataTimeout: LPDWORD)
6496 -> BOOL;
6497 pub fn CreateEventW(lpEventAttributes: LPSECURITY_ATTRIBUTES,
6498 bManualReset: BOOL,
6499 bInitialState: BOOL,
6500 lpName: LPCWSTR) -> HANDLE;
6501 pub fn GetOverlappedResult(hFile: HANDLE,
6502 lpOverlapped: LPOVERLAPPED,
6503 lpNumberOfBytesTransferred: LPDWORD,
6504 bWait: BOOL) -> BOOL;
6505 pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL;
6506 }
6507 }
6508
6509 pub mod msvcrt {
6510 use types::os::arch::c95::{c_int, c_long};
6511 use types::os::arch::c99::intptr_t;
6512
6513 extern {
6514 #[link_name = "_commit"]
6515 pub fn commit(fd: c_int) -> c_int;
6516
6517 #[link_name = "_get_osfhandle"]
6518 pub fn get_osfhandle(fd: c_int) -> c_long;
6519
6520 #[link_name = "_open_osfhandle"]
6521 pub fn open_osfhandle(osfhandle: intptr_t,
6522 flags: c_int) -> c_int;
6523 }
6524 }
6525
6526 pub mod winsock {
6527 use types::os::arch::c95::{c_int, c_long, c_ulong};
6528 use types::os::common::bsd44::SOCKET;
6529
6530 extern "system" {
6531 pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int;
6532 }
6533 }
6534 }
6535}
6536
1a4d82fc 6537#[test] fn work_on_windows() { } // FIXME #10872 needed for a happy windows