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