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