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