]> git.lizzy.rs Git - rust.git/blob - src/libstd/libc.rs
Find the cratemap at runtime on windows.
[rust.git] / src / libstd / libc.rs
1 // Copyright 2012 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 /*!
12 * Bindings for the C standard library and other platform libraries
13 *
14 * This module contains bindings to the C standard library,
15 * organized into modules by their defining standard.
16 * Additionally, it contains some assorted platform-specific definitions.
17 * For convenience, most functions and types are reexported from `std::libc`,
18 * so `pub use std::libc::*` will import the available
19 * C bindings as appropriate for the target platform. The exact
20 * set of functions available are platform specific.
21 *
22 * *Note* Rustdoc does not indicate reexports currently. Also, because these
23 * definitions are platform-specific, some may not
24 * appear in the generated documentation.
25 *
26 * We consider the following specs reasonably normative with respect
27 * to interoperating with the C standard library (libc/msvcrt):
28 *
29 * * ISO 9899:1990 ('C95', 'ANSI C', 'Standard C'), NA1, 1995.
30 * * ISO 9899:1999 ('C99' or 'C9x').
31 * * ISO 9945:1988 / IEEE 1003.1-1988 ('POSIX.1').
32 * * ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
33 * * ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
34 *
35 * Note that any reference to the 1996 revision of POSIX, or any revs
36 * between 1990 (when '88 was approved at ISO) and 2001 (when the next
37 * actual revision-revision happened), are merely additions of other
38 * chapters (1b and 1c) outside the core interfaces.
39 *
40 * Despite having several names each, these are *reasonably* coherent
41 * point-in-time, list-of-definition sorts of specs. You can get each under a
42 * variety of names but will wind up with the same definition in each case.
43 *
44 * See standards(7) in linux-manpages for more details.
45 *
46 * Our interface to these libraries is complicated by the non-universality of
47 * conformance to any of them. About the only thing universally supported is
48 * the first (C95), beyond that definitions quickly become absent on various
49 * platforms.
50 *
51 * We therefore wind up dividing our module-space up (mostly for the sake of
52 * sanity while editing, filling-in-details and eliminating duplication) into
53 * definitions common-to-all (held in modules named c95, c99, posix88, posix01
54 * and posix08) and definitions that appear only on *some* platforms (named
55 * 'extra'). This would be things like significant OSX foundation kit, or
56 * win32 library kernel32.dll, or various fancy glibc, linux or BSD
57 * extensions.
58 *
59 * In addition to the per-platform 'extra' modules, we define a module of
60 * 'common BSD' libc routines that never quite made it into POSIX but show up
61 * in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the
62 * final one from Berkeley after the lawsuits died down and the CSRG
63 * dissolved.
64 */
65
66 #[allow(non_camel_case_types)];
67 #[allow(non_uppercase_statics)];
68 #[allow(missing_doc)];
69
70 // Initial glob-exports mean that all the contents of all the modules
71 // wind up exported, if you're interested in writing platform-specific code.
72
73 pub use libc::types::common::c95::*;
74 pub use libc::types::common::c99::*;
75 pub use libc::types::common::posix88::*;
76 pub use libc::types::common::posix01::*;
77 pub use libc::types::common::posix08::*;
78 pub use libc::types::common::bsd44::*;
79 pub use libc::types::os::common::posix01::*;
80 pub use libc::types::os::arch::c95::*;
81 pub use libc::types::os::arch::c99::*;
82 pub use libc::types::os::arch::posix88::*;
83 pub use libc::types::os::arch::posix01::*;
84 pub use libc::types::os::arch::posix08::*;
85 pub use libc::types::os::arch::bsd44::*;
86 pub use libc::types::os::arch::extra::*;
87
88 pub use libc::consts::os::c95::*;
89 pub use libc::consts::os::c99::*;
90 pub use libc::consts::os::posix88::*;
91 pub use libc::consts::os::posix01::*;
92 pub use libc::consts::os::posix08::*;
93 pub use libc::consts::os::bsd44::*;
94 pub use libc::consts::os::extra::*;
95 pub use libc::consts::os::sysconf::*;
96
97 pub use libc::funcs::c95::ctype::*;
98 pub use libc::funcs::c95::stdio::*;
99 pub use libc::funcs::c95::stdlib::*;
100 pub use libc::funcs::c95::string::*;
101
102 pub use libc::funcs::posix88::stat_::*;
103 pub use libc::funcs::posix88::stdio::*;
104 pub use libc::funcs::posix88::fcntl::*;
105 pub use libc::funcs::posix88::dirent::*;
106 pub use libc::funcs::posix88::unistd::*;
107 pub use libc::funcs::posix88::mman::*;
108
109 pub use libc::funcs::posix01::stat_::*;
110 pub use libc::funcs::posix01::unistd::*;
111 pub use libc::funcs::posix01::glob::*;
112 pub use libc::funcs::posix01::mman::*;
113 pub use libc::funcs::posix08::unistd::*;
114
115 pub use libc::funcs::bsd44::*;
116 pub use libc::funcs::extra::*;
117
118 #[cfg(target_os = "win32")]
119 pub use libc::funcs::extra::kernel32::*;
120 #[cfg(target_os = "win32")]
121 pub use libc::funcs::extra::msvcrt::*;
122
123 // Explicit export lists for the intersection (provided here) mean that
124 // you can write more-platform-agnostic code if you stick to just these
125 // symbols.
126
127 pub use libc::types::common::c95::{FILE, c_void, fpos_t};
128 pub use libc::types::common::posix88::{DIR, dirent_t};
129 pub use libc::types::os::arch::c95::{c_char, c_double, c_float, c_int};
130 pub use libc::types::os::arch::c95::{c_long, c_short, c_uchar, c_ulong};
131 pub use libc::types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t};
132 pub use libc::types::os::arch::c95::{size_t, time_t};
133 pub use libc::types::os::arch::c99::{c_longlong, c_ulonglong, intptr_t};
134 pub use libc::types::os::arch::c99::{uintptr_t};
135 pub use libc::types::os::arch::posix88::{dev_t, dirent_t, ino_t, mode_t};
136 pub use libc::types::os::arch::posix88::{off_t, pid_t, ssize_t};
137
138 pub use libc::consts::os::c95::{_IOFBF, _IOLBF, _IONBF, BUFSIZ, EOF};
139 pub use libc::consts::os::c95::{EXIT_FAILURE, EXIT_SUCCESS};
140 pub use libc::consts::os::c95::{FILENAME_MAX, FOPEN_MAX, L_tmpnam};
141 pub use libc::consts::os::c95::{RAND_MAX, SEEK_CUR, SEEK_END};
142 pub use libc::consts::os::c95::{SEEK_SET, TMP_MAX};
143 pub use libc::consts::os::posix88::{F_OK, O_APPEND, O_CREAT, O_EXCL};
144 pub use libc::consts::os::posix88::{O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY};
145 pub use libc::consts::os::posix88::{R_OK, S_IEXEC, S_IFBLK, S_IFCHR};
146 pub use libc::consts::os::posix88::{S_IFDIR, S_IFIFO, S_IFMT, S_IFREG};
147 pub use libc::consts::os::posix88::{S_IREAD, S_IRUSR, S_IRWXU, S_IWUSR};
148 pub use libc::consts::os::posix88::{STDERR_FILENO, STDIN_FILENO};
149 pub use libc::consts::os::posix88::{STDOUT_FILENO, W_OK, X_OK};
150
151 pub use libc::funcs::c95::ctype::{isalnum, isalpha, iscntrl, isdigit};
152 pub use libc::funcs::c95::ctype::{islower, isprint, ispunct, isspace};
153 pub use libc::funcs::c95::ctype::{isupper, isxdigit, tolower, toupper};
154
155 pub use libc::funcs::c95::stdio::{fclose, feof, ferror, fflush, fgetc};
156 pub use libc::funcs::c95::stdio::{fgetpos, fgets, fopen, fputc, fputs};
157 pub use libc::funcs::c95::stdio::{fread, freopen, fseek, fsetpos, ftell};
158 pub use libc::funcs::c95::stdio::{fwrite, perror, puts, remove, rewind};
159 pub use libc::funcs::c95::stdio::{setbuf, setvbuf, tmpfile, ungetc};
160
161 pub use libc::funcs::c95::stdlib::{abort, abs, atof, atoi, calloc, exit};
162 pub use libc::funcs::c95::stdlib::{free, getenv, labs, malloc, rand};
163 pub use libc::funcs::c95::stdlib::{realloc, srand, strtod, strtol};
164 pub use libc::funcs::c95::stdlib::{strtoul, system};
165
166 pub use libc::funcs::c95::string::{memchr, memcmp};
167 pub use libc::funcs::c95::string::{strcat, strchr, strcmp};
168 pub use libc::funcs::c95::string::{strcoll, strcpy, strcspn, strerror};
169 pub use libc::funcs::c95::string::{strlen, strncat, strncmp, strncpy};
170 pub use libc::funcs::c95::string::{strpbrk, strrchr, strspn, strstr};
171 pub use libc::funcs::c95::string::{strtok, strxfrm};
172
173 pub use libc::funcs::posix88::fcntl::{open, creat};
174 pub use libc::funcs::posix88::stat_::{chmod, fstat, mkdir, stat};
175 pub use libc::funcs::posix88::stdio::{fdopen, fileno, pclose, popen};
176 pub use libc::funcs::posix88::unistd::{access, chdir, close, dup, dup2};
177 pub use libc::funcs::posix88::unistd::{execv, execve, execvp, getcwd};
178 pub use libc::funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read};
179 pub use libc::funcs::posix88::unistd::{rmdir, unlink, write};
180
181
182 pub mod types {
183
184     // Types tend to vary *per architecture* so we pull their definitions out
185     // into this module.
186
187     // Standard types that are opaque or common, so are not per-target.
188     pub mod common {
189         pub mod c95 {
190             /**
191             Type used to construct void pointers for use with C.
192
193             This type is only useful as a pointer target. Do not use it as a
194             return type for FFI functions which have the `void` return type in
195             C. Use the unit type `()` or omit the return type instead.
196             */
197             pub enum c_void {}
198             pub enum FILE {}
199             pub enum fpos_t {}
200         }
201         pub mod c99 {
202             pub type int8_t = i8;
203             pub type int16_t = i16;
204             pub type int32_t = i32;
205             pub type int64_t = i64;
206             pub type uint8_t = u8;
207             pub type uint16_t = u16;
208             pub type uint32_t = u32;
209             pub type uint64_t = u64;
210         }
211         pub mod posix88 {
212             pub enum DIR {}
213             pub enum dirent_t {}
214         }
215         pub mod posix01 {}
216         pub mod posix08 {}
217         pub mod bsd44 {}
218     }
219
220     // Standard types that are scalar but vary by OS and arch.
221
222     #[cfg(target_os = "linux")]
223     #[cfg(target_os = "android")]
224     pub mod os {
225         pub mod common {
226             pub mod posix01 {
227                 use libc::types::common::c95::{c_void};
228                 use libc::types::os::arch::c95::{c_char, size_t};
229                 pub struct glob_t {
230                     gl_pathc: size_t,
231                     gl_pathv: **c_char,
232                     gl_offs:  size_t,
233
234                     __unused1: *c_void,
235                     __unused2: *c_void,
236                     __unused3: *c_void,
237                     __unused4: *c_void,
238                     __unused5: *c_void,
239                 }
240             }
241         }
242
243         #[cfg(target_arch = "x86")]
244         #[cfg(target_arch = "arm")]
245         #[cfg(target_arch = "mips")]
246         pub mod arch {
247             pub mod c95 {
248                 pub type c_char = i8;
249                 pub type c_schar = i8;
250                 pub type c_uchar = u8;
251                 pub type c_short = i16;
252                 pub type c_ushort = u16;
253                 pub type c_int = i32;
254                 pub type c_uint = u32;
255                 pub type c_long = i32;
256                 pub type c_ulong = u32;
257                 pub type c_float = f32;
258                 pub type c_double = f64;
259                 pub type size_t = u32;
260                 pub type ptrdiff_t = i32;
261                 pub type clock_t = i32;
262                 pub type time_t = i32;
263                 pub type wchar_t = i32;
264             }
265             pub mod c99 {
266                 pub type c_longlong = i64;
267                 pub type c_ulonglong = u64;
268                 pub type intptr_t = int;
269                 pub type uintptr_t = uint;
270             }
271             #[cfg(target_arch = "x86")]
272             #[cfg(target_arch = "mips")]
273             pub mod posix88 {
274                 pub type off_t = i32;
275                 pub type dev_t = u64;
276                 pub type ino_t = u32;
277                 pub type pid_t = i32;
278                 pub type uid_t = u32;
279                 pub type gid_t = u32;
280                 pub type useconds_t = u32;
281                 pub type mode_t = u32;
282                 pub type ssize_t = i32;
283             }
284             #[cfg(target_arch = "arm")]
285             pub mod posix88 {
286                 pub type off_t = i32;
287                 pub type dev_t = u32;
288                 pub type ino_t = u32;
289                 pub type pid_t = i32;
290                 pub type uid_t = u32;
291                 pub type gid_t = u32;
292                 pub type useconds_t = u32;
293                 pub type mode_t = u16;
294                 pub type ssize_t = i32;
295             }
296             #[cfg(target_arch = "x86")]
297             pub mod posix01 {
298                 use libc::types::os::arch::c95::{c_short, c_long, time_t};
299                 use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
300                 use libc::types::os::arch::posix88::{mode_t, off_t};
301                 use libc::types::os::arch::posix88::{uid_t};
302
303                 pub type nlink_t = u32;
304                 pub type blksize_t = i32;
305                 pub type blkcnt_t = i32;
306
307                 pub struct stat {
308                     st_dev: dev_t,
309                     __pad1: c_short,
310                     st_ino: ino_t,
311                     st_mode: mode_t,
312                     st_nlink: nlink_t,
313                     st_uid: uid_t,
314                     st_gid: gid_t,
315                     st_rdev: dev_t,
316                     __pad2: c_short,
317                     st_size: off_t,
318                     st_blksize: blksize_t,
319                     st_blocks: blkcnt_t,
320                     st_atime: time_t,
321                     st_atime_nsec: c_long,
322                     st_mtime: time_t,
323                     st_mtime_nsec: c_long,
324                     st_ctime: time_t,
325                     st_ctime_nsec: c_long,
326                     __unused4: c_long,
327                     __unused5: c_long,
328                 }
329             }
330             #[cfg(target_arch = "arm")]
331             pub mod posix01 {
332                 use libc::types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
333                 use libc::types::os::arch::c99::{c_longlong, c_ulonglong};
334                 use libc::types::os::arch::posix88::{uid_t, gid_t, ino_t};
335
336                 pub type nlink_t = u16;
337                 pub type blksize_t = u32;
338                 pub type blkcnt_t = u32;
339
340                 pub struct stat {
341                     st_dev: c_ulonglong,
342                     __pad0: [c_uchar, ..4],
343                     __st_ino: ino_t,
344                     st_mode: c_uint,
345                     st_nlink: c_uint,
346                     st_uid: uid_t,
347                     st_gid: gid_t,
348                     st_rdev: c_ulonglong,
349                     __pad3: [c_uchar, ..4],
350                     st_size: c_longlong,
351                     st_blksize: blksize_t,
352                     st_blocks: c_ulonglong,
353                     st_atime: time_t,
354                     st_atime_nsec: c_ulong,
355                     st_mtime: time_t,
356                     st_mtime_nsec: c_ulong,
357                     st_ctime: time_t,
358                     st_ctime_nsec: c_ulong,
359                     st_ino: c_ulonglong
360                 }
361             }
362             #[cfg(target_arch = "mips")]
363             pub mod posix01 {
364                 use libc::types::os::arch::c95::{c_long, c_ulong, time_t};
365                 use libc::types::os::arch::posix88::{gid_t, ino_t};
366                 use libc::types::os::arch::posix88::{mode_t, off_t};
367                 use libc::types::os::arch::posix88::{uid_t};
368
369                 pub type nlink_t = u32;
370                 pub type blksize_t = i32;
371                 pub type blkcnt_t = i32;
372
373                 pub struct stat {
374                     st_dev: c_ulong,
375                     st_pad1: [c_long, ..3],
376                     st_ino: ino_t,
377                     st_mode: mode_t,
378                     st_nlink: nlink_t,
379                     st_uid: uid_t,
380                     st_gid: gid_t,
381                     st_rdev: c_ulong,
382                     st_pad2: [c_long, ..2],
383                     st_size: off_t,
384                     st_pad3: c_long,
385                     st_atime: time_t,
386                     st_atime_nsec: c_long,
387                     st_mtime: time_t,
388                     st_mtime_nsec: c_long,
389                     st_ctime: time_t,
390                     st_ctime_nsec: c_long,
391                     st_blksize: blksize_t,
392                     st_blocks: blkcnt_t,
393                     st_pad5: [c_long, ..14],
394                 }
395             }
396             pub mod posix08 {}
397             pub mod bsd44 {}
398             pub mod extra {}
399         }
400
401         #[cfg(target_arch = "x86_64")]
402         pub mod arch {
403             pub mod c95 {
404                 pub type c_char = i8;
405                 pub type c_schar = i8;
406                 pub type c_uchar = u8;
407                 pub type c_short = i16;
408                 pub type c_ushort = u16;
409                 pub type c_int = i32;
410                 pub type c_uint = u32;
411                 pub type c_long = i64;
412                 pub type c_ulong = u64;
413                 pub type c_float = f32;
414                 pub type c_double = f64;
415                 pub type size_t = u64;
416                 pub type ptrdiff_t = i64;
417                 pub type clock_t = i64;
418                 pub type time_t = i64;
419                 pub type wchar_t = i32;
420             }
421             pub mod c99 {
422                 pub type c_longlong = i64;
423                 pub type c_ulonglong = u64;
424                 pub type intptr_t = int;
425                 pub type uintptr_t = uint;
426             }
427             pub mod posix88 {
428                 pub type off_t = i64;
429                 pub type dev_t = u64;
430                 pub type ino_t = u64;
431                 pub type pid_t = i32;
432                 pub type uid_t = u32;
433                 pub type gid_t = u32;
434                 pub type useconds_t = u32;
435                 pub type mode_t = u32;
436                 pub type ssize_t = i64;
437             }
438             pub mod posix01 {
439                 use libc::types::os::arch::c95::{c_int, c_long, time_t};
440                 use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
441                 use libc::types::os::arch::posix88::{mode_t, off_t};
442                 use libc::types::os::arch::posix88::{uid_t};
443
444                 pub type nlink_t = u64;
445                 pub type blksize_t = i64;
446                 pub type blkcnt_t = i64;
447                 pub struct stat {
448                     st_dev: dev_t,
449                     st_ino: ino_t,
450                     st_nlink: nlink_t,
451                     st_mode: mode_t,
452                     st_uid: uid_t,
453                     st_gid: gid_t,
454                     __pad0: c_int,
455                     st_rdev: dev_t,
456                     st_size: off_t,
457                     st_blksize: blksize_t,
458                     st_blocks: blkcnt_t,
459                     st_atime: time_t,
460                     st_atime_nsec: c_long,
461                     st_mtime: time_t,
462                     st_mtime_nsec: c_long,
463                     st_ctime: time_t,
464                     st_ctime_nsec: c_long,
465                     __unused: [c_long, ..3],
466                 }
467             }
468             pub mod posix08 {
469             }
470             pub mod bsd44 {
471             }
472             pub mod extra {
473             }
474         }
475     }
476
477     #[cfg(target_os = "freebsd")]
478     pub mod os {
479         pub mod common {
480             pub mod posix01 {
481                 use libc::types::common::c95::{c_void};
482                 use libc::types::os::arch::c95::{c_char, c_int, size_t};
483                 pub struct glob_t {
484                     gl_pathc:  size_t,
485                     __unused1: size_t,
486                     gl_offs:   size_t,
487                     __unused2: c_int,
488                     gl_pathv:  **c_char,
489
490                     __unused3: *c_void,
491
492                     __unused4: *c_void,
493                     __unused5: *c_void,
494                     __unused6: *c_void,
495                     __unused7: *c_void,
496                     __unused8: *c_void,
497                 }
498             }
499         }
500
501         #[cfg(target_arch = "x86_64")]
502         pub mod arch {
503             pub mod c95 {
504                 pub type c_char = i8;
505                 pub type c_schar = i8;
506                 pub type c_uchar = u8;
507                 pub type c_short = i16;
508                 pub type c_ushort = u16;
509                 pub type c_int = i32;
510                 pub type c_uint = u32;
511                 pub type c_long = i64;
512                 pub type c_ulong = u64;
513                 pub type c_float = f32;
514                 pub type c_double = f64;
515                 pub type size_t = u64;
516                 pub type ptrdiff_t = i64;
517                 pub type clock_t = i32;
518                 pub type time_t = i64;
519                 pub type wchar_t = i32;
520             }
521             pub mod c99 {
522                 pub type c_longlong = i64;
523                 pub type c_ulonglong = u64;
524                 pub type intptr_t = int;
525                 pub type uintptr_t = uint;
526             }
527             pub mod posix88 {
528                 pub type off_t = i64;
529                 pub type dev_t = u32;
530                 pub type ino_t = u32;
531                 pub type pid_t = i32;
532                 pub type uid_t = u32;
533                 pub type gid_t = u32;
534                 pub type useconds_t = u32;
535                 pub type mode_t = u16;
536                 pub type ssize_t = i64;
537             }
538             pub mod posix01 {
539                 use libc::types::common::c99::{uint8_t, uint32_t, int32_t};
540                 use libc::types::os::arch::c95::{c_long, time_t};
541                 use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
542                 use libc::types::os::arch::posix88::{mode_t, off_t};
543                 use libc::types::os::arch::posix88::{uid_t};
544
545                 pub type nlink_t = u16;
546                 pub type blksize_t = i64;
547                 pub type blkcnt_t = i64;
548                 pub type fflags_t = u32;
549                 pub struct stat {
550                     st_dev: dev_t,
551                     st_ino: ino_t,
552                     st_mode: mode_t,
553                     st_nlink: nlink_t,
554                     st_uid: uid_t,
555                     st_gid: gid_t,
556                     st_rdev: dev_t,
557                     st_atime: time_t,
558                     st_atime_nsec: c_long,
559                     st_mtime: time_t,
560                     st_mtime_nsec: c_long,
561                     st_ctime: time_t,
562                     st_ctime_nsec: c_long,
563                     st_size: off_t,
564                     st_blocks: blkcnt_t,
565                     st_blksize: blksize_t,
566                     st_flags: fflags_t,
567                     st_gen: uint32_t,
568                     st_lspare: int32_t,
569                     st_birthtime: time_t,
570                     st_birthtime_nsec: c_long,
571                     __unused: [uint8_t, ..2],
572                 }
573             }
574             pub mod posix08 {
575             }
576             pub mod bsd44 {
577             }
578             pub mod extra {
579             }
580         }
581     }
582
583     #[cfg(target_os = "win32")]
584     pub mod os {
585         pub mod common {
586             pub mod posix01 {
587                 use libc::types::os::arch::c95::c_short;
588                 use libc::types::os::arch::extra::{int64, time64_t};
589                 use libc::types::os::arch::posix88::{dev_t, ino_t};
590                 use libc::types::os::arch::posix88::mode_t;
591
592                 // Note: this is the struct called stat64 in win32. Not stat,
593                 // nor stati64.
594                 pub struct stat {
595                     st_dev: dev_t,
596                     st_ino: ino_t,
597                     st_mode: mode_t,
598                     st_nlink: c_short,
599                     st_uid: c_short,
600                     st_gid: c_short,
601                     st_rdev: dev_t,
602                     st_size: int64,
603                     st_atime: time64_t,
604                     st_mtime: time64_t,
605                     st_ctime: time64_t,
606                 }
607             }
608         }
609
610         #[cfg(target_arch = "x86")]
611         pub mod arch {
612             pub mod c95 {
613                 pub type c_char = i8;
614                 pub type c_schar = i8;
615                 pub type c_uchar = u8;
616                 pub type c_short = i16;
617                 pub type c_ushort = u16;
618                 pub type c_int = i32;
619                 pub type c_uint = u32;
620                 pub type c_long = i32;
621                 pub type c_ulong = u32;
622                 pub type c_float = f32;
623                 pub type c_double = f64;
624                 pub type size_t = u32;
625                 pub type ptrdiff_t = i32;
626                 pub type clock_t = i32;
627                 pub type time_t = i32;
628                 pub type wchar_t = u16;
629             }
630             pub mod c99 {
631                 pub type c_longlong = i64;
632                 pub type c_ulonglong = u64;
633                 pub type intptr_t = int;
634                 pub type uintptr_t = uint;
635             }
636             pub mod posix88 {
637                 pub type off_t = i32;
638                 pub type dev_t = u32;
639                 pub type ino_t = i16;
640                 pub type pid_t = i32;
641                 pub type useconds_t = u32;
642                 pub type mode_t = u16;
643                 pub type ssize_t = i32;
644             }
645             pub mod posix01 {
646             }
647             pub mod posix08 {
648             }
649             pub mod bsd44 {
650             }
651             pub mod extra {
652                 use ptr;
653                 use libc::types::common::c95::c_void;
654                 use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
655                 use libc::types::os::arch::c95::{c_long, c_ulong};
656                 use libc::types::os::arch::c95::{wchar_t};
657                 use libc::types::os::arch::c99::{c_ulonglong};
658
659                 pub type BOOL = c_int;
660                 pub type BYTE = u8;
661                 pub type CCHAR = c_char;
662                 pub type CHAR = c_char;
663
664                 pub type DWORD = c_ulong;
665                 pub type DWORDLONG = c_ulonglong;
666
667                 pub type HANDLE = LPVOID;
668                 pub type HMODULE = c_uint;
669
670                 pub type LONG_PTR = c_long;
671
672                 pub type LPCWSTR = *WCHAR;
673                 pub type LPCSTR = *CHAR;
674                 pub type LPCTSTR = *CHAR;
675                 pub type LPTCH = *CHAR;
676
677                 pub type LPWSTR = *mut WCHAR;
678                 pub type LPSTR = *mut CHAR;
679                 pub type LPTSTR = *mut CHAR;
680
681                 // Not really, but opaque to us.
682                 pub type LPSECURITY_ATTRIBUTES = LPVOID;
683
684                 pub type LPVOID = *mut c_void;
685                 pub type LPCVOID = *c_void;
686                 pub type LPBYTE = *mut BYTE;
687                 pub type LPWORD = *mut WORD;
688                 pub type LPDWORD = *mut DWORD;
689                 pub type LPHANDLE = *mut HANDLE;
690
691                 pub type LRESULT = LONG_PTR;
692                 pub type PBOOL = *mut BOOL;
693                 pub type WCHAR = wchar_t;
694                 pub type WORD = u16;
695                 pub type SIZE_T = size_t;
696
697                 pub type time64_t = i64;
698                 pub type int64 = i64;
699
700                 pub struct STARTUPINFO {
701                     cb: DWORD,
702                     lpReserved: LPTSTR,
703                     lpDesktop: LPTSTR,
704                     lpTitle: LPTSTR,
705                     dwX: DWORD,
706                     dwY: DWORD,
707                     dwXSize: DWORD,
708                     dwYSize: DWORD,
709                     dwXCountChars: DWORD,
710                     dwYCountCharts: DWORD,
711                     dwFillAttribute: DWORD,
712                     dwFlags: DWORD,
713                     wShowWindow: WORD,
714                     cbReserved2: WORD,
715                     lpReserved2: LPBYTE,
716                     hStdInput: HANDLE,
717                     hStdOutput: HANDLE,
718                     hStdError: HANDLE
719                 }
720                 pub type LPSTARTUPINFO = *mut STARTUPINFO;
721
722                 pub struct PROCESS_INFORMATION {
723                     hProcess: HANDLE,
724                     hThread: HANDLE,
725                     dwProcessId: DWORD,
726                     dwThreadId: DWORD
727                 }
728                 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
729
730                 pub struct SYSTEM_INFO {
731                     wProcessorArchitecture: WORD,
732                     wReserved: WORD,
733                     dwPageSize: DWORD,
734                     lpMinimumApplicationAddress: LPVOID,
735                     lpMaximumApplicationAddress: LPVOID,
736                     dwActiveProcessorMask: DWORD,
737                     dwNumberOfProcessors: DWORD,
738                     dwProcessorType: DWORD,
739                     dwAllocationGranularity: DWORD,
740                     wProcessorLevel: WORD,
741                     wProcessorRevision: WORD
742                 }
743                 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
744
745                 impl SYSTEM_INFO {
746                     pub fn new() -> SYSTEM_INFO {
747                         SYSTEM_INFO {
748                             wProcessorArchitecture: 0,
749                             wReserved: 0,
750                             dwPageSize: 0,
751                             lpMinimumApplicationAddress: ptr::mut_null(),
752                             lpMaximumApplicationAddress: ptr::mut_null(),
753                             dwActiveProcessorMask: 0,
754                             dwNumberOfProcessors: 0,
755                             dwProcessorType: 0,
756                             dwAllocationGranularity: 0,
757                             wProcessorLevel: 0,
758                             wProcessorRevision: 0
759                         }
760                     }
761                 }
762
763                 pub struct MEMORY_BASIC_INFORMATION {
764                     BaseAddress: LPVOID,
765                     AllocationBase: LPVOID,
766                     AllocationProtect: DWORD,
767                     RegionSize: SIZE_T,
768                     State: DWORD,
769                     Protect: DWORD,
770                     Type: DWORD
771                 }
772                 pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
773             }
774         }
775
776         #[cfg(target_arch = "x86_64")]
777         pub mod arch {
778             pub mod c95 {
779                 pub type c_char = i8;
780                 pub type c_schar = i8;
781                 pub type c_uchar = u8;
782                 pub type c_short = i16;
783                 pub type c_ushort = u16;
784                 pub type c_int = i32;
785                 pub type c_uint = u32;
786                 pub type c_long = i32;
787                 pub type c_ulong = u32;
788                 pub type c_float = f32;
789                 pub type c_double = f64;
790                 pub type size_t = u64;
791                 pub type ptrdiff_t = i64;
792                 pub type clock_t = i32;
793                 pub type time_t = i64;
794                 pub type wchar_t = u16;
795             }
796             pub mod c99 {
797                 pub type c_longlong = i64;
798                 pub type c_ulonglong = u64;
799                 pub type intptr_t = int;
800                 pub type uintptr_t = uint;
801             }
802             pub mod posix88 {
803                 pub type off_t = i32; // XXX unless _FILE_OFFSET_BITS == 64
804                 pub type dev_t = u32;
805                 pub type ino_t = i16;
806                 pub type pid_t = i64;
807                 pub type useconds_t = u32;
808                 pub type mode_t = u16;
809                 pub type ssize_t = i64;
810             }
811             pub mod posix01 {
812             }
813             pub mod posix08 {
814             }
815             pub mod bsd44 {
816             }
817             pub mod extra {
818                 use ptr;
819                 use libc::types::common::c95::c_void;
820                 use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
821                 use libc::types::os::arch::c95::{c_ulong};
822                 use libc::types::os::arch::c95::{wchar_t};
823                 use libc::types::os::arch::c99::{c_ulonglong};
824
825                 pub type BOOL = c_int;
826                 pub type BYTE = u8;
827                 pub type CCHAR = c_char;
828                 pub type CHAR = c_char;
829
830                 pub type DWORD = c_ulong;
831                 pub type DWORDLONG = c_ulonglong;
832
833                 pub type HANDLE = LPVOID;
834                 pub type HMODULE = c_uint;
835
836                 pub type LONG_PTR = i64; // changed
837
838                 pub type LPCWSTR = *WCHAR;
839                 pub type LPCSTR = *CHAR;
840                 pub type LPCTSTR = *CHAR;
841                 pub type LPTCH = *CHAR;
842
843                 pub type LPWSTR = *mut WCHAR;
844                 pub type LPSTR = *mut CHAR;
845                 pub type LPTSTR = *mut CHAR;
846
847                 // Not really, but opaque to us.
848                 pub type LPSECURITY_ATTRIBUTES = LPVOID;
849
850                 pub type LPVOID = *mut c_void;
851                 pub type LPCVOID = *c_void;
852                 pub type LPBYTE = *mut BYTE;
853                 pub type LPWORD = *mut WORD;
854                 pub type LPDWORD = *mut DWORD;
855                 pub type LPHANDLE = *mut HANDLE;
856
857                 pub type LRESULT = LONG_PTR;
858                 pub type PBOOL = *mut BOOL;
859                 pub type WCHAR = wchar_t;
860                 pub type WORD = u16;
861                 pub type SIZE_T = size_t;
862
863                 pub type time64_t = i64;
864                 pub type int64 = i64;
865
866                 pub struct STARTUPINFO {
867                     cb: DWORD,
868                     lpReserved: LPTSTR,
869                     lpDesktop: LPTSTR,
870                     lpTitle: LPTSTR,
871                     dwX: DWORD,
872                     dwY: DWORD,
873                     dwXSize: DWORD,
874                     dwYSize: DWORD,
875                     dwXCountChars: DWORD,
876                     dwYCountCharts: DWORD,
877                     dwFillAttribute: DWORD,
878                     dwFlags: DWORD,
879                     wShowWindow: WORD,
880                     cbReserved2: WORD,
881                     lpReserved2: LPBYTE,
882                     hStdInput: HANDLE,
883                     hStdOutput: HANDLE,
884                     hStdError: HANDLE
885                 }
886                 pub type LPSTARTUPINFO = *mut STARTUPINFO;
887
888                 pub struct PROCESS_INFORMATION {
889                     hProcess: HANDLE,
890                     hThread: HANDLE,
891                     dwProcessId: DWORD,
892                     dwThreadId: DWORD
893                 }
894                 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
895
896                 pub struct SYSTEM_INFO {
897                     wProcessorArchitecture: WORD,
898                     wReserved: WORD,
899                     dwPageSize: DWORD,
900                     lpMinimumApplicationAddress: LPVOID,
901                     lpMaximumApplicationAddress: LPVOID,
902                     dwActiveProcessorMask: DWORD,
903                     dwNumberOfProcessors: DWORD,
904                     dwProcessorType: DWORD,
905                     dwAllocationGranularity: DWORD,
906                     wProcessorLevel: WORD,
907                     wProcessorRevision: WORD
908                 }
909                 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
910
911                 impl SYSTEM_INFO {
912                     pub fn new() -> SYSTEM_INFO {
913                         SYSTEM_INFO {
914                             wProcessorArchitecture: 0,
915                             wReserved: 0,
916                             dwPageSize: 0,
917                             lpMinimumApplicationAddress: ptr::mut_null(),
918                             lpMaximumApplicationAddress: ptr::mut_null(),
919                             dwActiveProcessorMask: 0,
920                             dwNumberOfProcessors: 0,
921                             dwProcessorType: 0,
922                             dwAllocationGranularity: 0,
923                             wProcessorLevel: 0,
924                             wProcessorRevision: 0
925                         }
926                     }
927                 }
928
929                 pub struct MEMORY_BASIC_INFORMATION {
930                     BaseAddress: LPVOID,
931                     AllocationBase: LPVOID,
932                     AllocationProtect: DWORD,
933                     RegionSize: SIZE_T,
934                     State: DWORD,
935                     Protect: DWORD,
936                     Type: DWORD
937                 }
938                 pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
939             }
940         }
941     }
942
943     #[cfg(target_os = "macos")]
944     pub mod os {
945         pub mod common {
946             pub mod posix01 {
947                 use libc::types::common::c95::{c_void};
948                 use libc::types::os::arch::c95::{c_char, c_int, size_t};
949                 pub struct glob_t {
950                     gl_pathc:  size_t,
951                     __unused1: c_int,
952                     gl_offs:   size_t,
953                     __unused2: c_int,
954                     gl_pathv:  **c_char,
955
956                     __unused3: *c_void,
957
958                     __unused4: *c_void,
959                     __unused5: *c_void,
960                     __unused6: *c_void,
961                     __unused7: *c_void,
962                     __unused8: *c_void,
963                 }
964             }
965         }
966
967         #[cfg(target_arch = "x86")]
968         pub mod arch {
969             pub mod c95 {
970                 pub type c_char = i8;
971                 pub type c_schar = i8;
972                 pub type c_uchar = u8;
973                 pub type c_short = i16;
974                 pub type c_ushort = u16;
975                 pub type c_int = i32;
976                 pub type c_uint = u32;
977                 pub type c_long = i32;
978                 pub type c_ulong = u32;
979                 pub type c_float = f32;
980                 pub type c_double = f64;
981                 pub type size_t = u32;
982                 pub type ptrdiff_t = i32;
983                 pub type clock_t = u32;
984                 pub type time_t = i32;
985                 pub type wchar_t = i32;
986             }
987             pub mod c99 {
988                 pub type c_longlong = i64;
989                 pub type c_ulonglong = u64;
990                 pub type intptr_t = int;
991                 pub type uintptr_t = uint;
992             }
993             pub mod posix88 {
994                 pub type off_t = i64;
995                 pub type dev_t = i32;
996                 pub type ino_t = u64;
997                 pub type pid_t = i32;
998                 pub type uid_t = u32;
999                 pub type gid_t = u32;
1000                 pub type useconds_t = u32;
1001                 pub type mode_t = u16;
1002                 pub type ssize_t = i32;
1003             }
1004             pub mod posix01 {
1005                 use libc::types::common::c99::{int32_t, int64_t, uint32_t};
1006                 use libc::types::os::arch::c95::{c_long, time_t};
1007                 use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t,
1008                                                      mode_t, off_t, uid_t};
1009
1010                 pub type nlink_t = u16;
1011                 pub type blksize_t = i64;
1012                 pub type blkcnt_t = i32;
1013
1014                 pub struct stat {
1015                     st_dev: dev_t,
1016                     st_mode: mode_t,
1017                     st_nlink: nlink_t,
1018                     st_ino: ino_t,
1019                     st_uid: uid_t,
1020                     st_gid: gid_t,
1021                     st_rdev: dev_t,
1022                     st_atime: time_t,
1023                     st_atime_nsec: c_long,
1024                     st_mtime: time_t,
1025                     st_mtime_nsec: c_long,
1026                     st_ctime: time_t,
1027                     st_ctime_nsec: c_long,
1028                     st_birthtime: time_t,
1029                     st_birthtime_nsec: c_long,
1030                     st_size: off_t,
1031                     st_blocks: blkcnt_t,
1032                     st_blksize: blksize_t,
1033                     st_flags: uint32_t,
1034                     st_gen: uint32_t,
1035                     st_lspare: int32_t,
1036                     st_qspare: [int64_t, ..2],
1037                 }
1038             }
1039             pub mod posix08 {
1040             }
1041             pub mod bsd44 {
1042             }
1043             pub mod extra {
1044             }
1045         }
1046
1047         #[cfg(target_arch = "x86_64")]
1048         pub mod arch {
1049             pub mod c95 {
1050                 pub type c_char = i8;
1051                 pub type c_schar = i8;
1052                 pub type c_uchar = u8;
1053                 pub type c_short = i16;
1054                 pub type c_ushort = u16;
1055                 pub type c_int = i32;
1056                 pub type c_uint = u32;
1057                 pub type c_long = i64;
1058                 pub type c_ulong = u64;
1059                 pub type c_float = f32;
1060                 pub type c_double = f64;
1061                 pub type size_t = u64;
1062                 pub type ptrdiff_t = i64;
1063                 pub type clock_t = u64;
1064                 pub type time_t = i64;
1065                 pub type wchar_t = i32;
1066             }
1067             pub mod c99 {
1068                 pub type c_longlong = i64;
1069                 pub type c_ulonglong = u64;
1070                 pub type intptr_t = int;
1071                 pub type uintptr_t = uint;
1072             }
1073             pub mod posix88 {
1074                 pub type off_t = i64;
1075                 pub type dev_t = i32;
1076                 pub type ino_t = u64;
1077                 pub type pid_t = i32;
1078                 pub type uid_t = u32;
1079                 pub type gid_t = u32;
1080                 pub type useconds_t = u32;
1081                 pub type mode_t = u16;
1082                 pub type ssize_t = i64;
1083             }
1084             pub mod posix01 {
1085                 use libc::types::common::c99::{int32_t, int64_t};
1086                 use libc::types::common::c99::{uint32_t};
1087                 use libc::types::os::arch::c95::{c_long, time_t};
1088                 use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
1089                 use libc::types::os::arch::posix88::{mode_t, off_t, uid_t};
1090
1091                 pub type nlink_t = u16;
1092                 pub type blksize_t = i64;
1093                 pub type blkcnt_t = i32;
1094
1095                 pub struct stat {
1096                     st_dev: dev_t,
1097                     st_mode: mode_t,
1098                     st_nlink: nlink_t,
1099                     st_ino: ino_t,
1100                     st_uid: uid_t,
1101                     st_gid: gid_t,
1102                     st_rdev: dev_t,
1103                     st_atime: time_t,
1104                     st_atime_nsec: c_long,
1105                     st_mtime: time_t,
1106                     st_mtime_nsec: c_long,
1107                     st_ctime: time_t,
1108                     st_ctime_nsec: c_long,
1109                     st_birthtime: time_t,
1110                     st_birthtime_nsec: c_long,
1111                     st_size: off_t,
1112                     st_blocks: blkcnt_t,
1113                     st_blksize: blksize_t,
1114                     st_flags: uint32_t,
1115                     st_gen: uint32_t,
1116                     st_lspare: int32_t,
1117                     st_qspare: [int64_t, ..2],
1118                 }
1119             }
1120             pub mod posix08 {
1121             }
1122             pub mod bsd44 {
1123             }
1124             pub mod extra {
1125             }
1126         }
1127     }
1128 }
1129
1130 pub mod consts {
1131     // Consts tend to vary per OS so we pull their definitions out
1132     // into this module.
1133
1134     #[cfg(target_os = "win32")]
1135     pub mod os {
1136         pub mod c95 {
1137             use libc::types::os::arch::c95::{c_int, c_uint};
1138
1139             pub static EXIT_FAILURE : c_int = 1;
1140             pub static EXIT_SUCCESS : c_int = 0;
1141             pub static RAND_MAX : c_int = 32767;
1142             pub static EOF : c_int = -1;
1143             pub static SEEK_SET : c_int = 0;
1144             pub static SEEK_CUR : c_int = 1;
1145             pub static SEEK_END : c_int = 2;
1146             pub static _IOFBF : c_int = 0;
1147             pub static _IONBF : c_int = 4;
1148             pub static _IOLBF : c_int = 64;
1149             pub static BUFSIZ : c_uint = 512_u32;
1150             pub static FOPEN_MAX : c_uint = 20_u32;
1151             pub static FILENAME_MAX : c_uint = 260_u32;
1152             pub static L_tmpnam : c_uint = 16_u32;
1153             pub static TMP_MAX : c_uint = 32767_u32;
1154         }
1155         pub mod c99 {
1156         }
1157         pub mod posix88 {
1158             use libc::types::os::arch::c95::c_int;
1159
1160             pub static O_RDONLY : c_int = 0;
1161             pub static O_WRONLY : c_int = 1;
1162             pub static O_RDWR : c_int = 2;
1163             pub static O_APPEND : c_int = 8;
1164             pub static O_CREAT : c_int = 256;
1165             pub static O_EXCL : c_int = 1024;
1166             pub static O_TRUNC : c_int = 512;
1167             pub static S_IFIFO : c_int = 4096;
1168             pub static S_IFCHR : c_int = 8192;
1169             pub static S_IFBLK : c_int = 12288;
1170             pub static S_IFDIR : c_int = 16384;
1171             pub static S_IFREG : c_int = 32768;
1172             pub static S_IFMT : c_int = 61440;
1173             pub static S_IEXEC : c_int = 64;
1174             pub static S_IWRITE : c_int = 128;
1175             pub static S_IREAD : c_int = 256;
1176             pub static S_IRWXU : c_int = 448;
1177             pub static S_IXUSR : c_int = 64;
1178             pub static S_IWUSR : c_int = 128;
1179             pub static S_IRUSR : c_int = 256;
1180             pub static F_OK : c_int = 0;
1181             pub static R_OK : c_int = 4;
1182             pub static W_OK : c_int = 2;
1183             pub static X_OK : c_int = 1;
1184             pub static STDIN_FILENO : c_int = 0;
1185             pub static STDOUT_FILENO : c_int = 1;
1186             pub static STDERR_FILENO : c_int = 2;
1187         }
1188         pub mod posix01 {
1189         }
1190         pub mod posix08 {
1191         }
1192         pub mod bsd44 {
1193         }
1194         pub mod extra {
1195             use libc::types::os::arch::c95::c_int;
1196             use libc::types::os::arch::extra::{WORD, DWORD, BOOL};
1197
1198             pub static TRUE : BOOL = 1;
1199             pub static FALSE : BOOL = 0;
1200
1201             pub static O_TEXT : c_int = 16384;
1202             pub static O_BINARY : c_int = 32768;
1203             pub static O_NOINHERIT: c_int = 128;
1204
1205             pub static ERROR_SUCCESS : c_int = 0;
1206             pub static ERROR_INVALID_HANDLE : c_int = 6;
1207             pub static ERROR_DISK_FULL : c_int = 112;
1208             pub static ERROR_INSUFFICIENT_BUFFER : c_int = 122;
1209             pub static ERROR_ALREADY_EXISTS : c_int = 183;
1210             pub static ERROR_INVALID_ADDRESS : c_int = 487;
1211             pub static ERROR_FILE_INVALID : c_int = 1006;
1212             pub static INVALID_HANDLE_VALUE: c_int = -1;
1213
1214             pub static DELETE : DWORD = 0x00010000;
1215             pub static READ_CONTROL : DWORD = 0x00020000;
1216             pub static SYNCHRONIZE : DWORD = 0x00100000;
1217             pub static WRITE_DAC : DWORD = 0x00040000;
1218             pub static WRITE_OWNER : DWORD = 0x00080000;
1219
1220             pub static PROCESS_CREATE_PROCESS : DWORD = 0x0080;
1221             pub static PROCESS_CREATE_THREAD : DWORD = 0x0002;
1222             pub static PROCESS_DUP_HANDLE : DWORD = 0x0040;
1223             pub static PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
1224             pub static PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
1225             pub static PROCESS_SET_INFORMATION : DWORD = 0x0200;
1226             pub static PROCESS_SET_QUOTA : DWORD = 0x0100;
1227             pub static PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
1228             pub static PROCESS_TERMINATE : DWORD = 0x0001;
1229             pub static PROCESS_VM_OPERATION : DWORD = 0x0008;
1230             pub static PROCESS_VM_READ : DWORD = 0x0010;
1231             pub static PROCESS_VM_WRITE : DWORD = 0x0020;
1232
1233             pub static STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
1234             pub static STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
1235             pub static STARTF_PREVENTPINNING : DWORD = 0x00002000;
1236             pub static STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
1237             pub static STARTF_TITLEISAPPID : DWORD = 0x00001000;
1238             pub static STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
1239             pub static STARTF_USECOUNTCHARS : DWORD = 0x00000008;
1240             pub static STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
1241             pub static STARTF_USEHOTKEY : DWORD = 0x00000200;
1242             pub static STARTF_USEPOSITION : DWORD = 0x00000004;
1243             pub static STARTF_USESHOWWINDOW : DWORD = 0x00000001;
1244             pub static STARTF_USESIZE : DWORD = 0x00000002;
1245             pub static STARTF_USESTDHANDLES : DWORD = 0x00000100;
1246
1247             pub static WAIT_ABANDONED : DWORD = 0x00000080;
1248             pub static WAIT_OBJECT_0 : DWORD = 0x00000000;
1249             pub static WAIT_TIMEOUT : DWORD = 0x00000102;
1250             pub static WAIT_FAILED : DWORD = -1;
1251
1252             pub static DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
1253             pub static DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;
1254
1255             pub static INFINITE : DWORD = -1;
1256             pub static STILL_ACTIVE : DWORD = 259;
1257
1258             pub static MEM_COMMIT : DWORD = 0x00001000;
1259             pub static MEM_RESERVE : DWORD = 0x00002000;
1260             pub static MEM_DECOMMIT : DWORD = 0x00004000;
1261             pub static MEM_RELEASE : DWORD = 0x00008000;
1262             pub static MEM_RESET : DWORD = 0x00080000;
1263             pub static MEM_RESET_UNDO : DWORD = 0x1000000;
1264             pub static MEM_LARGE_PAGES : DWORD = 0x20000000;
1265             pub static MEM_PHYSICAL : DWORD = 0x00400000;
1266             pub static MEM_TOP_DOWN : DWORD = 0x00100000;
1267             pub static MEM_WRITE_WATCH : DWORD = 0x00200000;
1268
1269             pub static PAGE_EXECUTE : DWORD = 0x10;
1270             pub static PAGE_EXECUTE_READ : DWORD = 0x20;
1271             pub static PAGE_EXECUTE_READWRITE : DWORD = 0x40;
1272             pub static PAGE_EXECUTE_WRITECOPY : DWORD = 0x80;
1273             pub static PAGE_NOACCESS : DWORD = 0x01;
1274             pub static PAGE_READONLY : DWORD = 0x02;
1275             pub static PAGE_READWRITE : DWORD = 0x04;
1276             pub static PAGE_WRITECOPY : DWORD = 0x08;
1277             pub static PAGE_GUARD : DWORD = 0x100;
1278             pub static PAGE_NOCACHE : DWORD = 0x200;
1279             pub static PAGE_WRITECOMBINE : DWORD = 0x400;
1280
1281             pub static SEC_COMMIT : DWORD = 0x8000000;
1282             pub static SEC_IMAGE : DWORD = 0x1000000;
1283             pub static SEC_IMAGE_NO_EXECUTE : DWORD = 0x11000000;
1284             pub static SEC_LARGE_PAGES : DWORD = 0x80000000;
1285             pub static SEC_NOCACHE : DWORD = 0x10000000;
1286             pub static SEC_RESERVE : DWORD = 0x4000000;
1287             pub static SEC_WRITECOMBINE : DWORD = 0x40000000;
1288
1289             pub static FILE_MAP_ALL_ACCESS : DWORD = 0xf001f;
1290             pub static FILE_MAP_READ : DWORD = 0x4;
1291             pub static FILE_MAP_WRITE : DWORD = 0x2;
1292             pub static FILE_MAP_COPY : DWORD = 0x1;
1293             pub static FILE_MAP_EXECUTE : DWORD = 0x20;
1294
1295             pub static PROCESSOR_ARCHITECTURE_INTEL : WORD = 0;
1296             pub static PROCESSOR_ARCHITECTURE_ARM : WORD = 5;
1297             pub static PROCESSOR_ARCHITECTURE_IA64 : WORD = 6;
1298             pub static PROCESSOR_ARCHITECTURE_AMD64 : WORD = 9;
1299             pub static PROCESSOR_ARCHITECTURE_UNKNOWN : WORD = 0xffff;
1300         }
1301         pub mod sysconf {
1302         }
1303     }
1304
1305
1306     #[cfg(target_os = "linux")]
1307     #[cfg(target_os = "android")]
1308     pub mod os {
1309         pub mod c95 {
1310             use libc::types::os::arch::c95::{c_int, c_uint};
1311
1312             pub static EXIT_FAILURE : c_int = 1;
1313             pub static EXIT_SUCCESS : c_int = 0;
1314             pub static RAND_MAX : c_int = 2147483647;
1315             pub static EOF : c_int = -1;
1316             pub static SEEK_SET : c_int = 0;
1317             pub static SEEK_CUR : c_int = 1;
1318             pub static SEEK_END : c_int = 2;
1319             pub static _IOFBF : c_int = 0;
1320             pub static _IONBF : c_int = 2;
1321             pub static _IOLBF : c_int = 1;
1322             pub static BUFSIZ : c_uint = 8192_u32;
1323             pub static FOPEN_MAX : c_uint = 16_u32;
1324             pub static FILENAME_MAX : c_uint = 4096_u32;
1325             pub static L_tmpnam : c_uint = 20_u32;
1326             pub static TMP_MAX : c_uint = 238328_u32;
1327         }
1328         pub mod c99 {
1329         }
1330         #[cfg(target_arch = "x86")]
1331         #[cfg(target_arch = "x86_64")]
1332         #[cfg(target_arch = "arm")]
1333         pub mod posix88 {
1334             use libc::types::os::arch::c95::c_int;
1335             use libc::types::common::c95::c_void;
1336
1337             pub static O_RDONLY : c_int = 0;
1338             pub static O_WRONLY : c_int = 1;
1339             pub static O_RDWR : c_int = 2;
1340             pub static O_APPEND : c_int = 1024;
1341             pub static O_CREAT : c_int = 64;
1342             pub static O_EXCL : c_int = 128;
1343             pub static O_TRUNC : c_int = 512;
1344             pub static S_IFIFO : c_int = 4096;
1345             pub static S_IFCHR : c_int = 8192;
1346             pub static S_IFBLK : c_int = 24576;
1347             pub static S_IFDIR : c_int = 16384;
1348             pub static S_IFREG : c_int = 32768;
1349             pub static S_IFMT : c_int = 61440;
1350             pub static S_IEXEC : c_int = 64;
1351             pub static S_IWRITE : c_int = 128;
1352             pub static S_IREAD : c_int = 256;
1353             pub static S_IRWXU : c_int = 448;
1354             pub static S_IXUSR : c_int = 64;
1355             pub static S_IWUSR : c_int = 128;
1356             pub static S_IRUSR : c_int = 256;
1357             pub static F_OK : c_int = 0;
1358             pub static R_OK : c_int = 4;
1359             pub static W_OK : c_int = 2;
1360             pub static X_OK : c_int = 1;
1361             pub static STDIN_FILENO : c_int = 0;
1362             pub static STDOUT_FILENO : c_int = 1;
1363             pub static STDERR_FILENO : c_int = 2;
1364             pub static F_LOCK : c_int = 1;
1365             pub static F_TEST : c_int = 3;
1366             pub static F_TLOCK : c_int = 2;
1367             pub static F_ULOCK : c_int = 0;
1368             pub static SIGHUP : c_int = 1;
1369             pub static SIGINT : c_int = 2;
1370             pub static SIGQUIT : c_int = 3;
1371             pub static SIGILL : c_int = 4;
1372             pub static SIGABRT : c_int = 6;
1373             pub static SIGFPE : c_int = 8;
1374             pub static SIGKILL : c_int = 9;
1375             pub static SIGSEGV : c_int = 11;
1376             pub static SIGPIPE : c_int = 13;
1377             pub static SIGALRM : c_int = 14;
1378             pub static SIGTERM : c_int = 15;
1379
1380             pub static PROT_NONE : c_int = 0;
1381             pub static PROT_READ : c_int = 1;
1382             pub static PROT_WRITE : c_int = 2;
1383             pub static PROT_EXEC : c_int = 4;
1384
1385             pub static MAP_FILE : c_int = 0x0000;
1386             pub static MAP_SHARED : c_int = 0x0001;
1387             pub static MAP_PRIVATE : c_int = 0x0002;
1388             pub static MAP_FIXED : c_int = 0x0010;
1389             pub static MAP_ANON : c_int = 0x0020;
1390
1391             pub static MAP_FAILED : *c_void = -1 as *c_void;
1392
1393             pub static MCL_CURRENT : c_int = 0x0001;
1394             pub static MCL_FUTURE : c_int = 0x0002;
1395
1396             pub static MS_ASYNC : c_int = 0x0001;
1397             pub static MS_INVALIDATE : c_int = 0x0002;
1398             pub static MS_SYNC : c_int = 0x0004;
1399
1400             pub static EPERM : c_int = 1;
1401             pub static ENOENT : c_int = 2;
1402             pub static ESRCH : c_int = 3;
1403             pub static EINTR : c_int = 4;
1404             pub static EIO : c_int = 5;
1405             pub static ENXIO : c_int = 6;
1406             pub static E2BIG : c_int = 7;
1407             pub static ENOEXEC : c_int = 8;
1408             pub static EBADF : c_int = 9;
1409             pub static ECHILD : c_int = 10;
1410             pub static EAGAIN : c_int = 11;
1411             pub static ENOMEM : c_int = 12;
1412             pub static EACCES : c_int = 13;
1413             pub static EFAULT : c_int = 14;
1414             pub static ENOTBLK : c_int = 15;
1415             pub static EBUSY : c_int = 16;
1416             pub static EEXIST : c_int = 17;
1417             pub static EXDEV : c_int = 18;
1418             pub static ENODEV : c_int = 19;
1419             pub static ENOTDIR : c_int = 20;
1420             pub static EISDIR : c_int = 21;
1421             pub static EINVAL : c_int = 22;
1422             pub static ENFILE : c_int = 23;
1423             pub static EMFILE : c_int = 24;
1424             pub static ENOTTY : c_int = 25;
1425             pub static ETXTBSY : c_int = 26;
1426             pub static EFBIG : c_int = 27;
1427             pub static ENOSPC : c_int = 28;
1428             pub static ESPIPE : c_int = 29;
1429             pub static EROFS : c_int = 30;
1430             pub static EMLINK : c_int = 31;
1431             pub static EPIPE : c_int = 32;
1432             pub static EDOM : c_int = 33;
1433             pub static ERANGE : c_int = 34;
1434
1435             pub static EDEADLK: c_int = 35;
1436             pub static ENAMETOOLONG: c_int = 36;
1437             pub static ENOLCK: c_int = 37;
1438             pub static ENOSYS: c_int = 38;
1439             pub static ENOTEMPTY: c_int = 39;
1440             pub static ELOOP: c_int = 40;
1441             pub static EWOULDBLOCK: c_int = EAGAIN;
1442             pub static ENOMSG: c_int = 42;
1443             pub static EIDRM: c_int = 43;
1444             pub static ECHRNG: c_int = 44;
1445             pub static EL2NSYNC: c_int = 45;
1446             pub static EL3HLT: c_int = 46;
1447             pub static EL3RST: c_int = 47;
1448             pub static ELNRNG: c_int = 48;
1449             pub static EUNATCH: c_int = 49;
1450             pub static ENOCSI: c_int = 50;
1451             pub static EL2HLT: c_int = 51;
1452             pub static EBADE: c_int = 52;
1453             pub static EBADR: c_int = 53;
1454             pub static EXFULL: c_int = 54;
1455             pub static ENOANO: c_int = 55;
1456             pub static EBADRQC: c_int = 56;
1457             pub static EBADSLT: c_int = 57;
1458
1459             pub static EDEADLOCK: c_int = EDEADLK;
1460
1461             pub static EBFONT: c_int = 59;
1462             pub static ENOSTR: c_int = 60;
1463             pub static ENODATA: c_int = 61;
1464             pub static ETIME: c_int = 62;
1465             pub static ENOSR: c_int = 63;
1466             pub static ENONET: c_int = 64;
1467             pub static ENOPKG: c_int = 65;
1468             pub static EREMOTE: c_int = 66;
1469             pub static ENOLINK: c_int = 67;
1470             pub static EADV: c_int = 68;
1471             pub static ESRMNT: c_int = 69;
1472             pub static ECOMM: c_int = 70;
1473             pub static EPROTO: c_int = 71;
1474             pub static EMULTIHOP: c_int = 72;
1475             pub static EDOTDOT: c_int = 73;
1476             pub static EBADMSG: c_int = 74;
1477             pub static EOVERFLOW: c_int = 75;
1478             pub static ENOTUNIQ: c_int = 76;
1479             pub static EBADFD: c_int = 77;
1480             pub static EREMCHG: c_int = 78;
1481             pub static ELIBACC: c_int = 79;
1482             pub static ELIBBAD: c_int = 80;
1483             pub static ELIBSCN: c_int = 81;
1484             pub static ELIBMAX: c_int = 82;
1485             pub static ELIBEXEC: c_int = 83;
1486             pub static EILSEQ: c_int = 84;
1487             pub static ERESTART: c_int = 85;
1488             pub static ESTRPIPE: c_int = 86;
1489             pub static EUSERS: c_int = 87;
1490             pub static ENOTSOCK: c_int = 88;
1491             pub static EDESTADDRREQ: c_int = 89;
1492             pub static EMSGSIZE: c_int = 90;
1493             pub static EPROTOTYPE: c_int = 91;
1494             pub static ENOPROTOOPT: c_int = 92;
1495             pub static EPROTONOSUPPORT: c_int = 93;
1496             pub static ESOCKTNOSUPPORT: c_int = 94;
1497             pub static EOPNOTSUPP: c_int = 95;
1498             pub static EPFNOSUPPORT: c_int = 96;
1499             pub static EAFNOSUPPORT: c_int = 97;
1500             pub static EADDRINUSE: c_int = 98;
1501             pub static EADDRNOTAVAIL: c_int = 99;
1502             pub static ENETDOWN: c_int = 100;
1503             pub static ENETUNREACH: c_int = 101;
1504             pub static ENETRESET: c_int = 102;
1505             pub static ECONNABORTED: c_int = 103;
1506             pub static ECONNRESET: c_int = 104;
1507             pub static ENOBUFS: c_int = 105;
1508             pub static EISCONN: c_int = 106;
1509             pub static ENOTCONN: c_int = 107;
1510             pub static ESHUTDOWN: c_int = 108;
1511             pub static ETOOMANYREFS: c_int = 109;
1512             pub static ETIMEDOUT: c_int = 110;
1513             pub static ECONNREFUSED: c_int = 111;
1514             pub static EHOSTDOWN: c_int = 112;
1515             pub static EHOSTUNREACH: c_int = 113;
1516             pub static EALREADY: c_int = 114;
1517             pub static EINPROGRESS: c_int = 115;
1518             pub static ESTALE: c_int = 116;
1519             pub static EUCLEAN: c_int = 117;
1520             pub static ENOTNAM: c_int = 118;
1521             pub static ENAVAIL: c_int = 119;
1522             pub static EISNAM: c_int = 120;
1523             pub static EREMOTEIO: c_int = 121;
1524             pub static EDQUOT: c_int = 122;
1525
1526             pub static ENOMEDIUM: c_int = 123;
1527             pub static EMEDIUMTYPE: c_int = 124;
1528             pub static ECANCELED: c_int = 125;
1529             pub static ENOKEY: c_int = 126;
1530             pub static EKEYEXPIRED: c_int = 127;
1531             pub static EKEYREVOKED: c_int = 128;
1532             pub static EKEYREJECTED: c_int = 129;
1533
1534             pub static EOWNERDEAD: c_int = 130;
1535             pub static ENOTRECOVERABLE: c_int = 131;
1536
1537             pub static ERFKILL: c_int = 132;
1538
1539             pub static EHWPOISON: c_int = 133;
1540         }
1541
1542         #[cfg(target_arch = "mips")]
1543         pub mod posix88 {
1544             use libc::types::os::arch::c95::c_int;
1545             use libc::types::common::c95::c_void;
1546
1547             pub static O_RDONLY : c_int = 0;
1548             pub static O_WRONLY : c_int = 1;
1549             pub static O_RDWR : c_int = 2;
1550             pub static O_APPEND : c_int = 8;
1551             pub static O_CREAT : c_int = 256;
1552             pub static O_EXCL : c_int = 1024;
1553             pub static O_TRUNC : c_int = 512;
1554             pub static S_IFIFO : c_int = 4096;
1555             pub static S_IFCHR : c_int = 8192;
1556             pub static S_IFBLK : c_int = 24576;
1557             pub static S_IFDIR : c_int = 16384;
1558             pub static S_IFREG : c_int = 32768;
1559             pub static S_IFMT : c_int = 61440;
1560             pub static S_IEXEC : c_int = 64;
1561             pub static S_IWRITE : c_int = 128;
1562             pub static S_IREAD : c_int = 256;
1563             pub static S_IRWXU : c_int = 448;
1564             pub static S_IXUSR : c_int = 64;
1565             pub static S_IWUSR : c_int = 128;
1566             pub static S_IRUSR : c_int = 256;
1567             pub static F_OK : c_int = 0;
1568             pub static R_OK : c_int = 4;
1569             pub static W_OK : c_int = 2;
1570             pub static X_OK : c_int = 1;
1571             pub static STDIN_FILENO : c_int = 0;
1572             pub static STDOUT_FILENO : c_int = 1;
1573             pub static STDERR_FILENO : c_int = 2;
1574             pub static F_LOCK : c_int = 1;
1575             pub static F_TEST : c_int = 3;
1576             pub static F_TLOCK : c_int = 2;
1577             pub static F_ULOCK : c_int = 0;
1578             pub static SIGHUP : c_int = 1;
1579             pub static SIGINT : c_int = 2;
1580             pub static SIGQUIT : c_int = 3;
1581             pub static SIGILL : c_int = 4;
1582             pub static SIGABRT : c_int = 6;
1583             pub static SIGFPE : c_int = 8;
1584             pub static SIGKILL : c_int = 9;
1585             pub static SIGSEGV : c_int = 11;
1586             pub static SIGPIPE : c_int = 13;
1587             pub static SIGALRM : c_int = 14;
1588             pub static SIGTERM : c_int = 15;
1589
1590             pub static PROT_NONE : c_int = 0;
1591             pub static PROT_READ : c_int = 1;
1592             pub static PROT_WRITE : c_int = 2;
1593             pub static PROT_EXEC : c_int = 4;
1594
1595             pub static MAP_FILE : c_int = 0x0000;
1596             pub static MAP_SHARED : c_int = 0x0001;
1597             pub static MAP_PRIVATE : c_int = 0x0002;
1598             pub static MAP_FIXED : c_int = 0x0010;
1599             pub static MAP_ANON : c_int = 0x0020;
1600
1601             pub static MAP_FAILED : *c_void = -1 as *c_void;
1602
1603             pub static MCL_CURRENT : c_int = 0x0001;
1604             pub static MCL_FUTURE : c_int = 0x0002;
1605
1606             pub static MS_ASYNC : c_int = 0x0001;
1607             pub static MS_INVALIDATE : c_int = 0x0002;
1608             pub static MS_SYNC : c_int = 0x0004;
1609
1610             pub static EPERM : c_int = 1;
1611             pub static ENOENT : c_int = 2;
1612             pub static ESRCH : c_int = 3;
1613             pub static EINTR : c_int = 4;
1614             pub static EIO : c_int = 5;
1615             pub static ENXIO : c_int = 6;
1616             pub static E2BIG : c_int = 7;
1617             pub static ENOEXEC : c_int = 8;
1618             pub static EBADF : c_int = 9;
1619             pub static ECHILD : c_int = 10;
1620             pub static EAGAIN : c_int = 11;
1621             pub static ENOMEM : c_int = 12;
1622             pub static EACCES : c_int = 13;
1623             pub static EFAULT : c_int = 14;
1624             pub static ENOTBLK : c_int = 15;
1625             pub static EBUSY : c_int = 16;
1626             pub static EEXIST : c_int = 17;
1627             pub static EXDEV : c_int = 18;
1628             pub static ENODEV : c_int = 19;
1629             pub static ENOTDIR : c_int = 20;
1630             pub static EISDIR : c_int = 21;
1631             pub static EINVAL : c_int = 22;
1632             pub static ENFILE : c_int = 23;
1633             pub static EMFILE : c_int = 24;
1634             pub static ENOTTY : c_int = 25;
1635             pub static ETXTBSY : c_int = 26;
1636             pub static EFBIG : c_int = 27;
1637             pub static ENOSPC : c_int = 28;
1638             pub static ESPIPE : c_int = 29;
1639             pub static EROFS : c_int = 30;
1640             pub static EMLINK : c_int = 31;
1641             pub static EPIPE : c_int = 32;
1642             pub static EDOM : c_int = 33;
1643             pub static ERANGE : c_int = 34;
1644
1645             pub static ENOMSG: c_int = 35;
1646             pub static EIDRM: c_int = 36;
1647             pub static ECHRNG: c_int = 37;
1648             pub static EL2NSYNC: c_int = 38;
1649             pub static EL3HLT: c_int = 39;
1650             pub static EL3RST: c_int = 40;
1651             pub static ELNRNG: c_int = 41;
1652             pub static EUNATCH: c_int = 42;
1653             pub static ENOCSI: c_int = 43;
1654             pub static EL2HLT: c_int = 44;
1655             pub static EDEADLK: c_int = 45;
1656             pub static ENOLCK: c_int = 46;
1657             pub static EBADE: c_int = 50;
1658             pub static EBADR: c_int = 51;
1659             pub static EXFULL: c_int = 52;
1660             pub static ENOANO: c_int = 53;
1661             pub static EBADRQC: c_int = 54;
1662             pub static EBADSLT: c_int = 55;
1663             pub static EDEADLOCK: c_int = 56;
1664             pub static EBFONT: c_int = 59;
1665             pub static ENOSTR: c_int = 60;
1666             pub static ENODATA: c_int = 61;
1667             pub static ETIME: c_int = 62;
1668             pub static ENOSR: c_int = 63;
1669             pub static ENONET: c_int = 64;
1670             pub static ENOPKG: c_int = 65;
1671             pub static EREMOTE: c_int = 66;
1672             pub static ENOLINK: c_int = 67;
1673             pub static EADV: c_int = 68;
1674             pub static ESRMNT: c_int = 69;
1675             pub static ECOMM: c_int = 70;
1676             pub static EPROTO: c_int = 71;
1677             pub static EDOTDOT: c_int = 73;
1678             pub static EMULTIHOP: c_int = 74;
1679             pub static EBADMSG: c_int = 77;
1680             pub static ENAMETOOLONG: c_int = 78;
1681             pub static EOVERFLOW: c_int = 79;
1682             pub static ENOTUNIQ: c_int = 80;
1683             pub static EBADFD: c_int = 81;
1684             pub static EREMCHG: c_int = 82;
1685             pub static ELIBACC: c_int = 83;
1686             pub static ELIBBAD: c_int = 84;
1687             pub static ELIBSCN: c_int = 95;
1688             pub static ELIBMAX: c_int = 86;
1689             pub static ELIBEXEC: c_int = 87;
1690             pub static EILSEQ: c_int = 88;
1691             pub static ENOSYS: c_int = 89;
1692             pub static ELOOP: c_int = 90;
1693             pub static ERESTART: c_int = 91;
1694             pub static ESTRPIPE: c_int = 92;
1695             pub static ENOTEMPTY: c_int = 93;
1696             pub static EUSERS: c_int = 94;
1697             pub static ENOTSOCK: c_int = 95;
1698             pub static EDESTADDRREQ: c_int = 96;
1699             pub static EMSGSIZE: c_int = 97;
1700             pub static EPROTOTYPE: c_int = 98;
1701             pub static ENOPROTOOPT: c_int = 99;
1702             pub static EPROTONOSUPPORT: c_int = 120;
1703             pub static ESOCKTNOSUPPORT: c_int = 121;
1704             pub static EOPNOTSUPP: c_int = 122;
1705             pub static EPFNOSUPPORT: c_int = 123;
1706             pub static EAFNOSUPPORT: c_int = 124;
1707             pub static EADDRINUSE: c_int = 125;
1708             pub static EADDRNOTAVAIL: c_int = 126;
1709             pub static ENETDOWN: c_int = 127;
1710             pub static ENETUNREACH: c_int = 128;
1711             pub static ENETRESET: c_int = 129;
1712             pub static ECONNABORTED: c_int = 130;
1713             pub static ECONNRESET: c_int = 131;
1714             pub static ENOBUFS: c_int = 132;
1715             pub static EISCONN: c_int = 133;
1716             pub static ENOTCONN: c_int = 134;
1717             pub static EUCLEAN: c_int = 135;
1718             pub static ENOTNAM: c_int = 137;
1719             pub static ENAVAIL: c_int = 138;
1720             pub static EISNAM: c_int = 139;
1721             pub static EREMOTEIO: c_int = 140;
1722             pub static ESHUTDOWN: c_int = 143;
1723             pub static ETOOMANYREFS: c_int = 144;
1724             pub static ETIMEDOUT: c_int = 145;
1725             pub static ECONNREFUSED: c_int = 146;
1726             pub static EHOSTDOWN: c_int = 147;
1727             pub static EHOSTUNREACH: c_int = 148;
1728             pub static EWOULDBLOCK: c_int = EAGAIN;
1729             pub static EALREADY: c_int = 149;
1730             pub static EINPROGRESS: c_int = 150;
1731             pub static ESTALE: c_int = 151;
1732             pub static ECANCELED: c_int = 158;
1733
1734             pub static ENOMEDIUM: c_int = 159;
1735             pub static EMEDIUMTYPE: c_int = 160;
1736             pub static ENOKEY: c_int = 161;
1737             pub static EKEYEXPIRED: c_int = 162;
1738             pub static EKEYREVOKED: c_int = 163;
1739             pub static EKEYREJECTED: c_int = 164;
1740
1741             pub static EOWNERDEAD: c_int = 165;
1742             pub static ENOTRECOVERABLE: c_int = 166;
1743
1744             pub static ERFKILL: c_int = 167;
1745
1746             pub static EHWPOISON: c_int = 168;
1747
1748             pub static EDQUOT: c_int = 1133;
1749         }
1750         pub mod posix01 {
1751             use libc::types::os::arch::c95::c_int;
1752
1753             pub static SIGTRAP : c_int = 5;
1754
1755             pub static GLOB_ERR      : c_int = 1 << 0;
1756             pub static GLOB_MARK     : c_int = 1 << 1;
1757             pub static GLOB_NOSORT   : c_int = 1 << 2;
1758             pub static GLOB_DOOFFS   : c_int = 1 << 3;
1759             pub static GLOB_NOCHECK  : c_int = 1 << 4;
1760             pub static GLOB_APPEND   : c_int = 1 << 5;
1761             pub static GLOB_NOESCAPE : c_int = 1 << 6;
1762
1763             pub static GLOB_NOSPACE  : c_int = 1;
1764             pub static GLOB_ABORTED  : c_int = 2;
1765             pub static GLOB_NOMATCH  : c_int = 3;
1766
1767             pub static POSIX_MADV_NORMAL : c_int = 0;
1768             pub static POSIX_MADV_RANDOM : c_int = 1;
1769             pub static POSIX_MADV_SEQUENTIAL : c_int = 2;
1770             pub static POSIX_MADV_WILLNEED : c_int = 3;
1771             pub static POSIX_MADV_DONTNEED : c_int = 4;
1772
1773             pub static _SC_MQ_PRIO_MAX : c_int = 28;
1774             pub static _SC_IOV_MAX : c_int = 60;
1775             pub static _SC_GETGR_R_SIZE_MAX : c_int = 69;
1776             pub static _SC_GETPW_R_SIZE_MAX : c_int = 70;
1777             pub static _SC_LOGIN_NAME_MAX : c_int = 71;
1778             pub static _SC_TTY_NAME_MAX : c_int = 72;
1779             pub static _SC_THREADS : c_int = 67;
1780             pub static _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
1781             pub static _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
1782             pub static _SC_THREAD_KEYS_MAX : c_int = 74;
1783             pub static _SC_THREAD_STACK_MIN : c_int = 75;
1784             pub static _SC_THREAD_THREADS_MAX : c_int = 76;
1785             pub static _SC_THREAD_ATTR_STACKADDR : c_int = 77;
1786             pub static _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
1787             pub static _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
1788             pub static _SC_THREAD_PRIO_INHERIT : c_int = 80;
1789             pub static _SC_THREAD_PRIO_PROTECT : c_int = 81;
1790             pub static _SC_THREAD_PROCESS_SHARED : c_int = 82;
1791             pub static _SC_ATEXIT_MAX : c_int = 87;
1792             pub static _SC_XOPEN_VERSION : c_int = 89;
1793             pub static _SC_XOPEN_XCU_VERSION : c_int = 90;
1794             pub static _SC_XOPEN_UNIX : c_int = 91;
1795             pub static _SC_XOPEN_CRYPT : c_int = 92;
1796             pub static _SC_XOPEN_ENH_I18N : c_int = 93;
1797             pub static _SC_XOPEN_SHM : c_int = 94;
1798             pub static _SC_XOPEN_LEGACY : c_int = 129;
1799             pub static _SC_XOPEN_REALTIME : c_int = 130;
1800             pub static _SC_XOPEN_REALTIME_THREADS : c_int = 131;
1801         }
1802         pub mod posix08 {
1803         }
1804         pub mod bsd44 {
1805             use libc::types::os::arch::c95::c_int;
1806
1807             pub static MADV_NORMAL : c_int = 0;
1808             pub static MADV_RANDOM : c_int = 1;
1809             pub static MADV_SEQUENTIAL : c_int = 2;
1810             pub static MADV_WILLNEED : c_int = 3;
1811             pub static MADV_DONTNEED : c_int = 4;
1812             pub static MADV_REMOVE : c_int = 9;
1813             pub static MADV_DONTFORK : c_int = 10;
1814             pub static MADV_DOFORK : c_int = 11;
1815             pub static MADV_MERGEABLE : c_int = 12;
1816             pub static MADV_UNMERGEABLE : c_int = 13;
1817             pub static MADV_HWPOISON : c_int = 100;
1818         }
1819         #[cfg(target_arch = "x86")]
1820         #[cfg(target_arch = "x86_64")]
1821         #[cfg(target_arch = "arm")]
1822         pub mod extra {
1823             use libc::types::os::arch::c95::c_int;
1824
1825             pub static O_RSYNC : c_int = 1052672;
1826             pub static O_DSYNC : c_int = 4096;
1827             pub static O_SYNC : c_int = 1052672;
1828
1829             pub static PROT_GROWSDOWN : c_int = 0x010000000;
1830             pub static PROT_GROWSUP : c_int = 0x020000000;
1831
1832             pub static MAP_TYPE : c_int = 0x000f;
1833             pub static MAP_ANONONYMOUS : c_int = 0x0020;
1834             pub static MAP_32BIT : c_int = 0x0040;
1835             pub static MAP_GROWSDOWN : c_int = 0x0100;
1836             pub static MAP_DENYWRITE : c_int = 0x0800;
1837             pub static MAP_EXECUTABLE : c_int = 0x01000;
1838             pub static MAP_LOCKED : c_int = 0x02000;
1839             pub static MAP_NONRESERVE : c_int = 0x04000;
1840             pub static MAP_POPULATE : c_int = 0x08000;
1841             pub static MAP_NONBLOCK : c_int = 0x010000;
1842             pub static MAP_STACK : c_int = 0x020000;
1843         }
1844         #[cfg(target_arch = "mips")]
1845         pub mod extra {
1846             use libc::types::os::arch::c95::c_int;
1847
1848             pub static O_RSYNC : c_int = 16400;
1849             pub static O_DSYNC : c_int = 16;
1850             pub static O_SYNC : c_int = 16400;
1851
1852             pub static PROT_GROWSDOWN : c_int = 0x010000000;
1853             pub static PROT_GROWSUP : c_int = 0x020000000;
1854
1855             pub static MAP_TYPE : c_int = 0x000f;
1856             pub static MAP_ANONONYMOUS : c_int = 0x0020;
1857             pub static MAP_32BIT : c_int = 0x0040;
1858             pub static MAP_GROWSDOWN : c_int = 0x0100;
1859             pub static MAP_DENYWRITE : c_int = 0x0800;
1860             pub static MAP_EXECUTABLE : c_int = 0x01000;
1861             pub static MAP_LOCKED : c_int = 0x02000;
1862             pub static MAP_NONRESERVE : c_int = 0x04000;
1863             pub static MAP_POPULATE : c_int = 0x08000;
1864             pub static MAP_NONBLOCK : c_int = 0x010000;
1865             pub static MAP_STACK : c_int = 0x020000;
1866         }
1867         #[cfg(target_os = "linux")]
1868         pub mod sysconf {
1869             use libc::types::os::arch::c95::c_int;
1870
1871             pub static _SC_ARG_MAX : c_int = 0;
1872             pub static _SC_CHILD_MAX : c_int = 1;
1873             pub static _SC_CLK_TCK : c_int = 2;
1874             pub static _SC_NGROUPS_MAX : c_int = 3;
1875             pub static _SC_OPEN_MAX : c_int = 4;
1876             pub static _SC_STREAM_MAX : c_int = 5;
1877             pub static _SC_TZNAME_MAX : c_int = 6;
1878             pub static _SC_JOB_CONTROL : c_int = 7;
1879             pub static _SC_SAVED_IDS : c_int = 8;
1880             pub static _SC_REALTIME_SIGNALS : c_int = 9;
1881             pub static _SC_PRIORITY_SCHEDULING : c_int = 10;
1882             pub static _SC_TIMERS : c_int = 11;
1883             pub static _SC_ASYNCHRONOUS_IO : c_int = 12;
1884             pub static _SC_PRIORITIZED_IO : c_int = 13;
1885             pub static _SC_SYNCHRONIZED_IO : c_int = 14;
1886             pub static _SC_FSYNC : c_int = 15;
1887             pub static _SC_MAPPED_FILES : c_int = 16;
1888             pub static _SC_MEMLOCK : c_int = 17;
1889             pub static _SC_MEMLOCK_RANGE : c_int = 18;
1890             pub static _SC_MEMORY_PROTECTION : c_int = 19;
1891             pub static _SC_MESSAGE_PASSING : c_int = 20;
1892             pub static _SC_SEMAPHORES : c_int = 21;
1893             pub static _SC_SHARED_MEMORY_OBJECTS : c_int = 22;
1894             pub static _SC_AIO_LISTIO_MAX : c_int = 23;
1895             pub static _SC_AIO_MAX : c_int = 24;
1896             pub static _SC_AIO_PRIO_DELTA_MAX : c_int = 25;
1897             pub static _SC_DELAYTIMER_MAX : c_int = 26;
1898             pub static _SC_MQ_OPEN_MAX : c_int = 27;
1899             pub static _SC_VERSION : c_int = 29;
1900             pub static _SC_PAGESIZE : c_int = 30;
1901             pub static _SC_RTSIG_MAX : c_int = 31;
1902             pub static _SC_SEM_NSEMS_MAX : c_int = 32;
1903             pub static _SC_SEM_VALUE_MAX : c_int = 33;
1904             pub static _SC_SIGQUEUE_MAX : c_int = 34;
1905             pub static _SC_TIMER_MAX : c_int = 35;
1906             pub static _SC_BC_BASE_MAX : c_int = 36;
1907             pub static _SC_BC_DIM_MAX : c_int = 37;
1908             pub static _SC_BC_SCALE_MAX : c_int = 38;
1909             pub static _SC_BC_STRING_MAX : c_int = 39;
1910             pub static _SC_COLL_WEIGHTS_MAX : c_int = 40;
1911             pub static _SC_EXPR_NEST_MAX : c_int = 42;
1912             pub static _SC_LINE_MAX : c_int = 43;
1913             pub static _SC_RE_DUP_MAX : c_int = 44;
1914             pub static _SC_2_VERSION : c_int = 46;
1915             pub static _SC_2_C_BIND : c_int = 47;
1916             pub static _SC_2_C_DEV : c_int = 48;
1917             pub static _SC_2_FORT_DEV : c_int = 49;
1918             pub static _SC_2_FORT_RUN : c_int = 50;
1919             pub static _SC_2_SW_DEV : c_int = 51;
1920             pub static _SC_2_LOCALEDEF : c_int = 52;
1921             pub static _SC_2_CHAR_TERM : c_int = 95;
1922             pub static _SC_2_C_VERSION : c_int = 96;
1923             pub static _SC_2_UPE : c_int = 97;
1924             pub static _SC_XBS5_ILP32_OFF32 : c_int = 125;
1925             pub static _SC_XBS5_ILP32_OFFBIG : c_int = 126;
1926             pub static _SC_XBS5_LPBIG_OFFBIG : c_int = 128;
1927         }
1928         #[cfg(target_os = "android")]
1929         pub mod sysconf {
1930             use libc::types::os::arch::c95::c_int;
1931
1932             pub static _SC_ARG_MAX : c_int = 0;
1933             pub static _SC_BC_BASE_MAX : c_int = 1;
1934             pub static _SC_BC_DIM_MAX : c_int = 2;
1935             pub static _SC_BC_SCALE_MAX : c_int = 3;
1936             pub static _SC_BC_STRING_MAX : c_int = 4;
1937             pub static _SC_CHILD_MAX : c_int = 5;
1938             pub static _SC_CLK_TCK : c_int = 6;
1939             pub static _SC_COLL_WEIGHTS_MAX : c_int = 7;
1940             pub static _SC_EXPR_NEST_MAX : c_int = 8;
1941             pub static _SC_LINE_MAX : c_int = 9;
1942             pub static _SC_NGROUPS_MAX : c_int = 10;
1943             pub static _SC_OPEN_MAX : c_int = 11;
1944             pub static _SC_2_C_BIND : c_int = 13;
1945             pub static _SC_2_C_DEV : c_int = 14;
1946             pub static _SC_2_C_VERSION : c_int = 15;
1947             pub static _SC_2_CHAR_TERM : c_int = 16;
1948             pub static _SC_2_FORT_DEV : c_int = 17;
1949             pub static _SC_2_FORT_RUN : c_int = 18;
1950             pub static _SC_2_LOCALEDEF : c_int = 19;
1951             pub static _SC_2_SW_DEV : c_int = 20;
1952             pub static _SC_2_UPE : c_int = 21;
1953             pub static _SC_2_VERSION : c_int = 22;
1954             pub static _SC_JOB_CONTROL : c_int = 23;
1955             pub static _SC_SAVED_IDS : c_int = 24;
1956             pub static _SC_VERSION : c_int = 25;
1957             pub static _SC_RE_DUP_MAX : c_int = 26;
1958             pub static _SC_STREAM_MAX : c_int = 27;
1959             pub static _SC_TZNAME_MAX : c_int = 28;
1960             pub static _SC_PAGESIZE : c_int = 39;
1961         }
1962     }
1963
1964     #[cfg(target_os = "freebsd")]
1965     pub mod os {
1966         pub mod c95 {
1967             use libc::types::os::arch::c95::{c_int, c_uint};
1968
1969             pub static EXIT_FAILURE : c_int = 1;
1970             pub static EXIT_SUCCESS : c_int = 0;
1971             pub static RAND_MAX : c_int = 2147483647;
1972             pub static EOF : c_int = -1;
1973             pub static SEEK_SET : c_int = 0;
1974             pub static SEEK_CUR : c_int = 1;
1975             pub static SEEK_END : c_int = 2;
1976             pub static _IOFBF : c_int = 0;
1977             pub static _IONBF : c_int = 2;
1978             pub static _IOLBF : c_int = 1;
1979             pub static BUFSIZ : c_uint = 1024_u32;
1980             pub static FOPEN_MAX : c_uint = 20_u32;
1981             pub static FILENAME_MAX : c_uint = 1024_u32;
1982             pub static L_tmpnam : c_uint = 1024_u32;
1983             pub static TMP_MAX : c_uint = 308915776_u32;
1984         }
1985         pub mod c99 {
1986         }
1987         pub mod posix88 {
1988             use libc::types::common::c95::c_void;
1989             use libc::types::os::arch::c95::c_int;
1990
1991             pub static O_RDONLY : c_int = 0;
1992             pub static O_WRONLY : c_int = 1;
1993             pub static O_RDWR : c_int = 2;
1994             pub static O_APPEND : c_int = 8;
1995             pub static O_CREAT : c_int = 512;
1996             pub static O_EXCL : c_int = 2048;
1997             pub static O_TRUNC : c_int = 1024;
1998             pub static S_IFIFO : c_int = 4096;
1999             pub static S_IFCHR : c_int = 8192;
2000             pub static S_IFBLK : c_int = 24576;
2001             pub static S_IFDIR : c_int = 16384;
2002             pub static S_IFREG : c_int = 32768;
2003             pub static S_IFMT : c_int = 61440;
2004             pub static S_IEXEC : c_int = 64;
2005             pub static S_IWRITE : c_int = 128;
2006             pub static S_IREAD : c_int = 256;
2007             pub static S_IRWXU : c_int = 448;
2008             pub static S_IXUSR : c_int = 64;
2009             pub static S_IWUSR : c_int = 128;
2010             pub static S_IRUSR : c_int = 256;
2011             pub static F_OK : c_int = 0;
2012             pub static R_OK : c_int = 4;
2013             pub static W_OK : c_int = 2;
2014             pub static X_OK : c_int = 1;
2015             pub static STDIN_FILENO : c_int = 0;
2016             pub static STDOUT_FILENO : c_int = 1;
2017             pub static STDERR_FILENO : c_int = 2;
2018             pub static F_LOCK : c_int = 1;
2019             pub static F_TEST : c_int = 3;
2020             pub static F_TLOCK : c_int = 2;
2021             pub static F_ULOCK : c_int = 0;
2022             pub static SIGHUP : c_int = 1;
2023             pub static SIGINT : c_int = 2;
2024             pub static SIGQUIT : c_int = 3;
2025             pub static SIGILL : c_int = 4;
2026             pub static SIGABRT : c_int = 6;
2027             pub static SIGFPE : c_int = 8;
2028             pub static SIGKILL : c_int = 9;
2029             pub static SIGSEGV : c_int = 11;
2030             pub static SIGPIPE : c_int = 13;
2031             pub static SIGALRM : c_int = 14;
2032             pub static SIGTERM : c_int = 15;
2033
2034             pub static PROT_NONE : c_int = 0;
2035             pub static PROT_READ : c_int = 1;
2036             pub static PROT_WRITE : c_int = 2;
2037             pub static PROT_EXEC : c_int = 4;
2038
2039             pub static MAP_FILE : c_int = 0x0000;
2040             pub static MAP_SHARED : c_int = 0x0001;
2041             pub static MAP_PRIVATE : c_int = 0x0002;
2042             pub static MAP_FIXED : c_int = 0x0010;
2043             pub static MAP_ANON : c_int = 0x1000;
2044
2045             pub static MAP_FAILED : *c_void = -1 as *c_void;
2046
2047             pub static MCL_CURRENT : c_int = 0x0001;
2048             pub static MCL_FUTURE : c_int = 0x0002;
2049
2050             pub static MS_SYNC : c_int = 0x0000;
2051             pub static MS_ASYNC : c_int = 0x0001;
2052             pub static MS_INVALIDATE : c_int = 0x0002;
2053
2054             pub static EPERM : c_int = 1;
2055             pub static ENOENT : c_int = 2;
2056             pub static ESRCH : c_int = 3;
2057             pub static EINTR : c_int = 4;
2058             pub static EIO : c_int = 5;
2059             pub static ENXIO : c_int = 6;
2060             pub static E2BIG : c_int = 7;
2061             pub static ENOEXEC : c_int = 8;
2062             pub static EBADF : c_int = 9;
2063             pub static ECHILD : c_int = 10;
2064             pub static EDEADLK : c_int = 11;
2065             pub static ENOMEM : c_int = 12;
2066             pub static EACCES : c_int = 13;
2067             pub static EFAULT : c_int = 14;
2068             pub static ENOTBLK : c_int = 15;
2069             pub static EBUSY : c_int = 16;
2070             pub static EEXIST : c_int = 17;
2071             pub static EXDEV : c_int = 18;
2072             pub static ENODEV : c_int = 19;
2073             pub static ENOTDIR : c_int = 20;
2074             pub static EISDIR : c_int = 21;
2075             pub static EINVAL : c_int = 22;
2076             pub static ENFILE : c_int = 23;
2077             pub static EMFILE : c_int = 24;
2078             pub static ENOTTY : c_int = 25;
2079             pub static ETXTBSY : c_int = 26;
2080             pub static EFBIG : c_int = 27;
2081             pub static ENOSPC : c_int = 28;
2082             pub static ESPIPE : c_int = 29;
2083             pub static EROFS : c_int = 30;
2084             pub static EMLINK : c_int = 31;
2085             pub static EPIPE : c_int = 32;
2086             pub static EDOM : c_int = 33;
2087             pub static ERANGE : c_int = 34;
2088             pub static EAGAIN : c_int = 35;
2089             pub static EWOULDBLOCK : c_int = 35;
2090             pub static EINPROGRESS : c_int = 36;
2091             pub static EALREADY : c_int = 37;
2092             pub static ENOTSOCK : c_int = 38;
2093             pub static EDESTADDRREQ : c_int = 39;
2094             pub static EMSGSIZE : c_int = 40;
2095             pub static EPROTOTYPE : c_int = 41;
2096             pub static ENOPROTOOPT : c_int = 42;
2097             pub static EPROTONOSUPPORT : c_int = 43;
2098             pub static ESOCKTNOSUPPORT : c_int = 44;
2099             pub static EOPNOTSUPP : c_int = 45;
2100             pub static EPFNOSUPPORT : c_int = 46;
2101             pub static EAFNOSUPPORT : c_int = 47;
2102             pub static EADDRINUSE : c_int = 48;
2103             pub static EADDRNOTAVAIL : c_int = 49;
2104             pub static ENETDOWN : c_int = 50;
2105             pub static ENETUNREACH : c_int = 51;
2106             pub static ENETRESET : c_int = 52;
2107             pub static ECONNABORTED : c_int = 53;
2108             pub static ECONNRESET : c_int = 54;
2109             pub static ENOBUFS : c_int = 55;
2110             pub static EISCONN : c_int = 56;
2111             pub static ENOTCONN : c_int = 57;
2112             pub static ESHUTDOWN : c_int = 58;
2113             pub static ETOOMANYREFS : c_int = 59;
2114             pub static ETIMEDOUT : c_int = 60;
2115             pub static ECONNREFUSED : c_int = 61;
2116             pub static ELOOP : c_int = 62;
2117             pub static ENAMETOOLONG : c_int = 63;
2118             pub static EHOSTDOWN : c_int = 64;
2119             pub static EHOSTUNREACH : c_int = 65;
2120             pub static ENOTEMPTY : c_int = 66;
2121             pub static EPROCLIM : c_int = 67;
2122             pub static EUSERS : c_int = 68;
2123             pub static EDQUOT : c_int = 69;
2124             pub static ESTALE : c_int = 70;
2125             pub static EREMOTE : c_int = 71;
2126             pub static EBADRPC : c_int = 72;
2127             pub static ERPCMISMATCH : c_int = 73;
2128             pub static EPROGUNAVAIL : c_int = 74;
2129             pub static EPROGMISMATCH : c_int = 75;
2130             pub static EPROCUNAVAIL : c_int = 76;
2131             pub static ENOLCK : c_int = 77;
2132             pub static ENOSYS : c_int = 78;
2133             pub static EFTYPE : c_int = 79;
2134             pub static EAUTH : c_int = 80;
2135             pub static ENEEDAUTH : c_int = 81;
2136             pub static EIDRM : c_int = 82;
2137             pub static ENOMSG : c_int = 83;
2138             pub static EOVERFLOW : c_int = 84;
2139             pub static ECANCELED : c_int = 85;
2140             pub static EILSEQ : c_int = 86;
2141             pub static ENOATTR : c_int = 87;
2142             pub static EDOOFUS : c_int = 88;
2143             pub static EBADMSG : c_int = 89;
2144             pub static EMULTIHOP : c_int = 90;
2145             pub static ENOLINK : c_int = 91;
2146             pub static EPROTO : c_int = 92;
2147             pub static ENOMEDIUM : c_int = 93;
2148             pub static EUNUSED94 : c_int = 94;
2149             pub static EUNUSED95 : c_int = 95;
2150             pub static EUNUSED96 : c_int = 96;
2151             pub static EUNUSED97 : c_int = 97;
2152             pub static EUNUSED98 : c_int = 98;
2153             pub static EASYNC : c_int = 99;
2154             pub static ELAST : c_int = 99;
2155         }
2156         pub mod posix01 {
2157             use libc::types::os::arch::c95::c_int;
2158
2159             pub static SIGTRAP : c_int = 5;
2160
2161             pub static GLOB_APPEND   : c_int = 0x0001;
2162             pub static GLOB_DOOFFS   : c_int = 0x0002;
2163             pub static GLOB_ERR      : c_int = 0x0004;
2164             pub static GLOB_MARK     : c_int = 0x0008;
2165             pub static GLOB_NOCHECK  : c_int = 0x0010;
2166             pub static GLOB_NOSORT   : c_int = 0x0020;
2167             pub static GLOB_NOESCAPE : c_int = 0x2000;
2168
2169             pub static GLOB_NOSPACE  : c_int = -1;
2170             pub static GLOB_ABORTED  : c_int = -2;
2171             pub static GLOB_NOMATCH  : c_int = -3;
2172
2173             pub static POSIX_MADV_NORMAL : c_int = 0;
2174             pub static POSIX_MADV_RANDOM : c_int = 1;
2175             pub static POSIX_MADV_SEQUENTIAL : c_int = 2;
2176             pub static POSIX_MADV_WILLNEED : c_int = 3;
2177             pub static POSIX_MADV_DONTNEED : c_int = 4;
2178
2179             pub static _SC_IOV_MAX : c_int = 56;
2180             pub static _SC_GETGR_R_SIZE_MAX : c_int = 70;
2181             pub static _SC_GETPW_R_SIZE_MAX : c_int = 71;
2182             pub static _SC_LOGIN_NAME_MAX : c_int = 73;
2183             pub static _SC_MQ_PRIO_MAX : c_int = 75;
2184             pub static _SC_THREAD_ATTR_STACKADDR : c_int = 82;
2185             pub static _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
2186             pub static _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
2187             pub static _SC_THREAD_KEYS_MAX : c_int = 86;
2188             pub static _SC_THREAD_PRIO_INHERIT : c_int = 87;
2189             pub static _SC_THREAD_PRIO_PROTECT : c_int = 88;
2190             pub static _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
2191             pub static _SC_THREAD_PROCESS_SHARED : c_int = 90;
2192             pub static _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
2193             pub static _SC_THREAD_STACK_MIN : c_int = 93;
2194             pub static _SC_THREAD_THREADS_MAX : c_int = 94;
2195             pub static _SC_THREADS : c_int = 96;
2196             pub static _SC_TTY_NAME_MAX : c_int = 101;
2197             pub static _SC_ATEXIT_MAX : c_int = 107;
2198             pub static _SC_XOPEN_CRYPT : c_int = 108;
2199             pub static _SC_XOPEN_ENH_I18N : c_int = 109;
2200             pub static _SC_XOPEN_LEGACY : c_int = 110;
2201             pub static _SC_XOPEN_REALTIME : c_int = 111;
2202             pub static _SC_XOPEN_REALTIME_THREADS : c_int = 112;
2203             pub static _SC_XOPEN_SHM : c_int = 113;
2204             pub static _SC_XOPEN_UNIX : c_int = 115;
2205             pub static _SC_XOPEN_VERSION : c_int = 116;
2206             pub static _SC_XOPEN_XCU_VERSION : c_int = 117;
2207         }
2208         pub mod posix08 {
2209         }
2210         pub mod bsd44 {
2211             use libc::types::os::arch::c95::c_int;
2212
2213             pub static MADV_NORMAL : c_int = 0;
2214             pub static MADV_RANDOM : c_int = 1;
2215             pub static MADV_SEQUENTIAL : c_int = 2;
2216             pub static MADV_WILLNEED : c_int = 3;
2217             pub static MADV_DONTNEED : c_int = 4;
2218             pub static MADV_FREE : c_int = 5;
2219             pub static MADV_NOSYNC : c_int = 6;
2220             pub static MADV_AUTOSYNC : c_int = 7;
2221             pub static MADV_NOCORE : c_int = 8;
2222             pub static MADV_CORE : c_int = 9;
2223             pub static MADV_PROTECT : c_int = 10;
2224
2225             pub static MINCORE_INCORE : c_int =  0x1;
2226             pub static MINCORE_REFERENCED : c_int = 0x2;
2227             pub static MINCORE_MODIFIED : c_int = 0x4;
2228             pub static MINCORE_REFERENCED_OTHER : c_int = 0x8;
2229             pub static MINCORE_MODIFIED_OTHER : c_int = 0x10;
2230             pub static MINCORE_SUPER : c_int = 0x20;
2231         }
2232         pub mod extra {
2233             use libc::types::os::arch::c95::c_int;
2234
2235             pub static O_SYNC : c_int = 128;
2236             pub static CTL_KERN: c_int = 1;
2237             pub static KERN_PROC: c_int = 14;
2238             pub static KERN_PROC_PATHNAME: c_int = 12;
2239
2240             pub static MAP_COPY : c_int = 0x0002;
2241             pub static MAP_RENAME : c_int = 0x0020;
2242             pub static MAP_NORESERVE : c_int = 0x0040;
2243             pub static MAP_HASSEMAPHORE : c_int = 0x0200;
2244             pub static MAP_STACK : c_int = 0x0400;
2245             pub static MAP_NOSYNC : c_int = 0x0800;
2246             pub static MAP_NOCORE : c_int = 0x020000;
2247         }
2248         pub mod sysconf {
2249             use libc::types::os::arch::c95::c_int;
2250
2251             pub static _SC_ARG_MAX : c_int = 1;
2252             pub static _SC_CHILD_MAX : c_int = 2;
2253             pub static _SC_CLK_TCK : c_int = 3;
2254             pub static _SC_NGROUPS_MAX : c_int = 4;
2255             pub static _SC_OPEN_MAX : c_int = 5;
2256             pub static _SC_JOB_CONTROL : c_int = 6;
2257             pub static _SC_SAVED_IDS : c_int = 7;
2258             pub static _SC_VERSION : c_int = 8;
2259             pub static _SC_BC_BASE_MAX : c_int = 9;
2260             pub static _SC_BC_DIM_MAX : c_int = 10;
2261             pub static _SC_BC_SCALE_MAX : c_int = 11;
2262             pub static _SC_BC_STRING_MAX : c_int = 12;
2263             pub static _SC_COLL_WEIGHTS_MAX : c_int = 13;
2264             pub static _SC_EXPR_NEST_MAX : c_int = 14;
2265             pub static _SC_LINE_MAX : c_int = 15;
2266             pub static _SC_RE_DUP_MAX : c_int = 16;
2267             pub static _SC_2_VERSION : c_int = 17;
2268             pub static _SC_2_C_BIND : c_int = 18;
2269             pub static _SC_2_C_DEV : c_int = 19;
2270             pub static _SC_2_CHAR_TERM : c_int = 20;
2271             pub static _SC_2_FORT_DEV : c_int = 21;
2272             pub static _SC_2_FORT_RUN : c_int = 22;
2273             pub static _SC_2_LOCALEDEF : c_int = 23;
2274             pub static _SC_2_SW_DEV : c_int = 24;
2275             pub static _SC_2_UPE : c_int = 25;
2276             pub static _SC_STREAM_MAX : c_int = 26;
2277             pub static _SC_TZNAME_MAX : c_int = 27;
2278             pub static _SC_ASYNCHRONOUS_IO : c_int = 28;
2279             pub static _SC_MAPPED_FILES : c_int = 29;
2280             pub static _SC_MEMLOCK : c_int = 30;
2281             pub static _SC_MEMLOCK_RANGE : c_int = 31;
2282             pub static _SC_MEMORY_PROTECTION : c_int = 32;
2283             pub static _SC_MESSAGE_PASSING : c_int = 33;
2284             pub static _SC_PRIORITIZED_IO : c_int = 34;
2285             pub static _SC_PRIORITY_SCHEDULING : c_int = 35;
2286             pub static _SC_REALTIME_SIGNALS : c_int = 36;
2287             pub static _SC_SEMAPHORES : c_int = 37;
2288             pub static _SC_FSYNC : c_int = 38;
2289             pub static _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
2290             pub static _SC_SYNCHRONIZED_IO : c_int = 40;
2291             pub static _SC_TIMERS : c_int = 41;
2292             pub static _SC_AIO_LISTIO_MAX : c_int = 42;
2293             pub static _SC_AIO_MAX : c_int = 43;
2294             pub static _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
2295             pub static _SC_DELAYTIMER_MAX : c_int = 45;
2296             pub static _SC_MQ_OPEN_MAX : c_int = 46;
2297             pub static _SC_PAGESIZE : c_int = 47;
2298             pub static _SC_RTSIG_MAX : c_int = 48;
2299             pub static _SC_SEM_NSEMS_MAX : c_int = 49;
2300             pub static _SC_SEM_VALUE_MAX : c_int = 50;
2301             pub static _SC_SIGQUEUE_MAX : c_int = 51;
2302             pub static _SC_TIMER_MAX : c_int = 52;
2303         }
2304     }
2305
2306     #[cfg(target_os = "macos")]
2307     pub mod os {
2308         pub mod c95 {
2309             use libc::types::os::arch::c95::{c_int, c_uint};
2310
2311             pub static EXIT_FAILURE : c_int = 1;
2312             pub static EXIT_SUCCESS : c_int = 0;
2313             pub static RAND_MAX : c_int = 2147483647;
2314             pub static EOF : c_int = -1;
2315             pub static SEEK_SET : c_int = 0;
2316             pub static SEEK_CUR : c_int = 1;
2317             pub static SEEK_END : c_int = 2;
2318             pub static _IOFBF : c_int = 0;
2319             pub static _IONBF : c_int = 2;
2320             pub static _IOLBF : c_int = 1;
2321             pub static BUFSIZ : c_uint = 1024_u32;
2322             pub static FOPEN_MAX : c_uint = 20_u32;
2323             pub static FILENAME_MAX : c_uint = 1024_u32;
2324             pub static L_tmpnam : c_uint = 1024_u32;
2325             pub static TMP_MAX : c_uint = 308915776_u32;
2326         }
2327         pub mod c99 {
2328         }
2329         pub mod posix88 {
2330             use libc::types::common::c95::c_void;
2331             use libc::types::os::arch::c95::c_int;
2332
2333             pub static O_RDONLY : c_int = 0;
2334             pub static O_WRONLY : c_int = 1;
2335             pub static O_RDWR : c_int = 2;
2336             pub static O_APPEND : c_int = 8;
2337             pub static O_CREAT : c_int = 512;
2338             pub static O_EXCL : c_int = 2048;
2339             pub static O_TRUNC : c_int = 1024;
2340             pub static S_IFIFO : c_int = 4096;
2341             pub static S_IFCHR : c_int = 8192;
2342             pub static S_IFBLK : c_int = 24576;
2343             pub static S_IFDIR : c_int = 16384;
2344             pub static S_IFREG : c_int = 32768;
2345             pub static S_IFMT : c_int = 61440;
2346             pub static S_IEXEC : c_int = 64;
2347             pub static S_IWRITE : c_int = 128;
2348             pub static S_IREAD : c_int = 256;
2349             pub static S_IRWXU : c_int = 448;
2350             pub static S_IXUSR : c_int = 64;
2351             pub static S_IWUSR : c_int = 128;
2352             pub static S_IRUSR : c_int = 256;
2353             pub static F_OK : c_int = 0;
2354             pub static R_OK : c_int = 4;
2355             pub static W_OK : c_int = 2;
2356             pub static X_OK : c_int = 1;
2357             pub static STDIN_FILENO : c_int = 0;
2358             pub static STDOUT_FILENO : c_int = 1;
2359             pub static STDERR_FILENO : c_int = 2;
2360             pub static F_LOCK : c_int = 1;
2361             pub static F_TEST : c_int = 3;
2362             pub static F_TLOCK : c_int = 2;
2363             pub static F_ULOCK : c_int = 0;
2364             pub static SIGHUP : c_int = 1;
2365             pub static SIGINT : c_int = 2;
2366             pub static SIGQUIT : c_int = 3;
2367             pub static SIGILL : c_int = 4;
2368             pub static SIGABRT : c_int = 6;
2369             pub static SIGFPE : c_int = 8;
2370             pub static SIGKILL : c_int = 9;
2371             pub static SIGSEGV : c_int = 11;
2372             pub static SIGPIPE : c_int = 13;
2373             pub static SIGALRM : c_int = 14;
2374             pub static SIGTERM : c_int = 15;
2375
2376             pub static PROT_NONE : c_int = 0;
2377             pub static PROT_READ : c_int = 1;
2378             pub static PROT_WRITE : c_int = 2;
2379             pub static PROT_EXEC : c_int = 4;
2380
2381             pub static MAP_FILE : c_int = 0x0000;
2382             pub static MAP_SHARED : c_int = 0x0001;
2383             pub static MAP_PRIVATE : c_int = 0x0002;
2384             pub static MAP_FIXED : c_int = 0x0010;
2385             pub static MAP_ANON : c_int = 0x1000;
2386
2387             pub static MAP_FAILED : *c_void = -1 as *c_void;
2388
2389             pub static MCL_CURRENT : c_int = 0x0001;
2390             pub static MCL_FUTURE : c_int = 0x0002;
2391
2392             pub static MS_ASYNC : c_int = 0x0001;
2393             pub static MS_INVALIDATE : c_int = 0x0002;
2394             pub static MS_SYNC : c_int = 0x0010;
2395
2396             pub static MS_KILLPAGES : c_int = 0x0004;
2397             pub static MS_DEACTIVATE : c_int = 0x0008;
2398
2399             pub static EPERM : c_int = 1;
2400             pub static ENOENT : c_int = 2;
2401             pub static ESRCH : c_int = 3;
2402             pub static EINTR : c_int = 4;
2403             pub static EIO : c_int = 5;
2404             pub static ENXIO : c_int = 6;
2405             pub static E2BIG : c_int = 7;
2406             pub static ENOEXEC : c_int = 8;
2407             pub static EBADF : c_int = 9;
2408             pub static ECHILD : c_int = 10;
2409             pub static EDEADLK : c_int = 11;
2410             pub static ENOMEM : c_int = 12;
2411             pub static EACCES : c_int = 13;
2412             pub static EFAULT : c_int = 14;
2413             pub static ENOTBLK : c_int = 15;
2414             pub static EBUSY : c_int = 16;
2415             pub static EEXIST : c_int = 17;
2416             pub static EXDEV : c_int = 18;
2417             pub static ENODEV : c_int = 19;
2418             pub static ENOTDIR : c_int = 20;
2419             pub static EISDIR : c_int = 21;
2420             pub static EINVAL : c_int = 22;
2421             pub static ENFILE : c_int = 23;
2422             pub static EMFILE : c_int = 24;
2423             pub static ENOTTY : c_int = 25;
2424             pub static ETXTBSY : c_int = 26;
2425             pub static EFBIG : c_int = 27;
2426             pub static ENOSPC : c_int = 28;
2427             pub static ESPIPE : c_int = 29;
2428             pub static EROFS : c_int = 30;
2429             pub static EMLINK : c_int = 31;
2430             pub static EPIPE : c_int = 32;
2431             pub static EDOM : c_int = 33;
2432             pub static ERANGE : c_int = 34;
2433             pub static EAGAIN : c_int = 35;
2434             pub static EWOULDBLOCK : c_int = EAGAIN;
2435             pub static EINPROGRESS : c_int = 36;
2436             pub static EALREADY : c_int = 37;
2437             pub static ENOTSOCK : c_int = 38;
2438             pub static EDESTADDRREQ : c_int = 39;
2439             pub static EMSGSIZE : c_int = 40;
2440             pub static EPROTOTYPE : c_int = 41;
2441             pub static ENOPROTOOPT : c_int = 42;
2442             pub static EPROTONOSUPPORT : c_int = 43;
2443             pub static ESOCKTNOSUPPORT : c_int = 44;
2444             pub static ENOTSUP : c_int = 45;
2445             pub static EPFNOSUPPORT : c_int = 46;
2446             pub static EAFNOSUPPORT : c_int = 47;
2447             pub static EADDRINUSE : c_int = 48;
2448             pub static EADDRNOTAVAIL : c_int = 49;
2449             pub static ENETDOWN : c_int = 50;
2450             pub static ENETUNREACH : c_int = 51;
2451             pub static ENETRESET : c_int = 52;
2452             pub static ECONNABORTED : c_int = 53;
2453             pub static ECONNRESET : c_int = 54;
2454             pub static ENOBUFS : c_int = 55;
2455             pub static EISCONN : c_int = 56;
2456             pub static ENOTCONN : c_int = 57;
2457             pub static ESHUTDOWN : c_int = 58;
2458             pub static ETOOMANYREFS : c_int = 59;
2459             pub static ETIMEDOUT : c_int = 60;
2460             pub static ECONNREFUSED : c_int = 61;
2461             pub static ELOOP : c_int = 62;
2462             pub static ENAMETOOLONG : c_int = 63;
2463             pub static EHOSTDOWN : c_int = 64;
2464             pub static EHOSTUNREACH : c_int = 65;
2465             pub static ENOTEMPTY : c_int = 66;
2466             pub static EPROCLIM : c_int = 67;
2467             pub static EUSERS : c_int = 68;
2468             pub static EDQUOT : c_int = 69;
2469             pub static ESTALE : c_int = 70;
2470             pub static EREMOTE : c_int = 71;
2471             pub static EBADRPC : c_int = 72;
2472             pub static ERPCMISMATCH : c_int = 73;
2473             pub static EPROGUNAVAIL : c_int = 74;
2474             pub static EPROGMISMATCH : c_int = 75;
2475             pub static EPROCUNAVAIL : c_int = 76;
2476             pub static ENOLCK : c_int = 77;
2477             pub static ENOSYS : c_int = 78;
2478             pub static EFTYPE : c_int = 79;
2479             pub static EAUTH : c_int = 80;
2480             pub static ENEEDAUTH : c_int = 81;
2481             pub static EPWROFF : c_int = 82;
2482             pub static EDEVERR : c_int = 83;
2483             pub static EOVERFLOW : c_int = 84;
2484             pub static EBADEXEC : c_int = 85;
2485             pub static EBADARCH : c_int = 86;
2486             pub static ESHLIBVERS : c_int = 87;
2487             pub static EBADMACHO : c_int = 88;
2488             pub static ECANCELED : c_int = 89;
2489             pub static EIDRM : c_int = 90;
2490             pub static ENOMSG : c_int = 91;
2491             pub static EILSEQ : c_int = 92;
2492             pub static ENOATTR : c_int = 93;
2493             pub static EBADMSG : c_int = 94;
2494             pub static EMULTIHOP : c_int = 95;
2495             pub static ENODATA : c_int = 96;
2496             pub static ENOLINK : c_int = 97;
2497             pub static ENOSR : c_int = 98;
2498             pub static ENOSTR : c_int = 99;
2499             pub static EPROTO : c_int = 100;
2500             pub static ETIME : c_int = 101;
2501             pub static EOPNOTSUPP : c_int = 102;
2502             pub static ENOPOLICY : c_int = 103;
2503             pub static ENOTRECOVERABLE : c_int = 104;
2504             pub static EOWNERDEAD : c_int = 105;
2505             pub static EQFULL : c_int = 106;
2506             pub static ELAST : c_int = 106;
2507         }
2508         pub mod posix01 {
2509             use libc::types::os::arch::c95::c_int;
2510
2511             pub static SIGTRAP : c_int = 5;
2512
2513             pub static GLOB_APPEND   : c_int = 0x0001;
2514             pub static GLOB_DOOFFS   : c_int = 0x0002;
2515             pub static GLOB_ERR      : c_int = 0x0004;
2516             pub static GLOB_MARK     : c_int = 0x0008;
2517             pub static GLOB_NOCHECK  : c_int = 0x0010;
2518             pub static GLOB_NOSORT   : c_int = 0x0020;
2519             pub static GLOB_NOESCAPE : c_int = 0x2000;
2520
2521             pub static GLOB_NOSPACE  : c_int = -1;
2522             pub static GLOB_ABORTED  : c_int = -2;
2523             pub static GLOB_NOMATCH  : c_int = -3;
2524
2525             pub static POSIX_MADV_NORMAL : c_int = 0;
2526             pub static POSIX_MADV_RANDOM : c_int = 1;
2527             pub static POSIX_MADV_SEQUENTIAL : c_int = 2;
2528             pub static POSIX_MADV_WILLNEED : c_int = 3;
2529             pub static POSIX_MADV_DONTNEED : c_int = 4;
2530
2531             pub static _SC_IOV_MAX : c_int = 56;
2532             pub static _SC_GETGR_R_SIZE_MAX : c_int = 70;
2533             pub static _SC_GETPW_R_SIZE_MAX : c_int = 71;
2534             pub static _SC_LOGIN_NAME_MAX : c_int = 73;
2535             pub static _SC_MQ_PRIO_MAX : c_int = 75;
2536             pub static _SC_THREAD_ATTR_STACKADDR : c_int = 82;
2537             pub static _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
2538             pub static _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
2539             pub static _SC_THREAD_KEYS_MAX : c_int = 86;
2540             pub static _SC_THREAD_PRIO_INHERIT : c_int = 87;
2541             pub static _SC_THREAD_PRIO_PROTECT : c_int = 88;
2542             pub static _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
2543             pub static _SC_THREAD_PROCESS_SHARED : c_int = 90;
2544             pub static _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
2545             pub static _SC_THREAD_STACK_MIN : c_int = 93;
2546             pub static _SC_THREAD_THREADS_MAX : c_int = 94;
2547             pub static _SC_THREADS : c_int = 96;
2548             pub static _SC_TTY_NAME_MAX : c_int = 101;
2549             pub static _SC_ATEXIT_MAX : c_int = 107;
2550             pub static _SC_XOPEN_CRYPT : c_int = 108;
2551             pub static _SC_XOPEN_ENH_I18N : c_int = 109;
2552             pub static _SC_XOPEN_LEGACY : c_int = 110;
2553             pub static _SC_XOPEN_REALTIME : c_int = 111;
2554             pub static _SC_XOPEN_REALTIME_THREADS : c_int = 112;
2555             pub static _SC_XOPEN_SHM : c_int = 113;
2556             pub static _SC_XOPEN_UNIX : c_int = 115;
2557             pub static _SC_XOPEN_VERSION : c_int = 116;
2558             pub static _SC_XOPEN_XCU_VERSION : c_int = 121;
2559         }
2560         pub mod posix08 {
2561         }
2562         pub mod bsd44 {
2563             use libc::types::os::arch::c95::c_int;
2564
2565             pub static MADV_NORMAL : c_int = 0;
2566             pub static MADV_RANDOM : c_int = 1;
2567             pub static MADV_SEQUENTIAL : c_int = 2;
2568             pub static MADV_WILLNEED : c_int = 3;
2569             pub static MADV_DONTNEED : c_int = 4;
2570             pub static MADV_FREE : c_int = 5;
2571             pub static MADV_ZERO_WIRED_PAGES : c_int = 6;
2572             pub static MADV_FREE_REUSABLE : c_int = 7;
2573             pub static MADV_FREE_REUSE : c_int = 8;
2574             pub static MADV_CAN_REUSE : c_int = 9;
2575
2576             pub static MINCORE_INCORE : c_int =  0x1;
2577             pub static MINCORE_REFERENCED : c_int = 0x2;
2578             pub static MINCORE_MODIFIED : c_int = 0x4;
2579             pub static MINCORE_REFERENCED_OTHER : c_int = 0x8;
2580             pub static MINCORE_MODIFIED_OTHER : c_int = 0x10;
2581         }
2582         pub mod extra {
2583             use libc::types::os::arch::c95::c_int;
2584
2585             pub static O_DSYNC : c_int = 4194304;
2586             pub static O_SYNC : c_int = 128;
2587             pub static F_FULLFSYNC : c_int = 51;
2588
2589             pub static MAP_COPY : c_int = 0x0002;
2590             pub static MAP_RENAME : c_int = 0x0020;
2591             pub static MAP_NORESERVE : c_int = 0x0040;
2592             pub static MAP_NOEXTEND : c_int = 0x0100;
2593             pub static MAP_HASSEMAPHORE : c_int = 0x0200;
2594             pub static MAP_NOCACHE : c_int = 0x0400;
2595             pub static MAP_JIT : c_int = 0x0800;
2596         }
2597         pub mod sysconf {
2598             use libc::types::os::arch::c95::c_int;
2599
2600             pub static _SC_ARG_MAX : c_int = 1;
2601             pub static _SC_CHILD_MAX : c_int = 2;
2602             pub static _SC_CLK_TCK : c_int = 3;
2603             pub static _SC_NGROUPS_MAX : c_int = 4;
2604             pub static _SC_OPEN_MAX : c_int = 5;
2605             pub static _SC_JOB_CONTROL : c_int = 6;
2606             pub static _SC_SAVED_IDS : c_int = 7;
2607             pub static _SC_VERSION : c_int = 8;
2608             pub static _SC_BC_BASE_MAX : c_int = 9;
2609             pub static _SC_BC_DIM_MAX : c_int = 10;
2610             pub static _SC_BC_SCALE_MAX : c_int = 11;
2611             pub static _SC_BC_STRING_MAX : c_int = 12;
2612             pub static _SC_COLL_WEIGHTS_MAX : c_int = 13;
2613             pub static _SC_EXPR_NEST_MAX : c_int = 14;
2614             pub static _SC_LINE_MAX : c_int = 15;
2615             pub static _SC_RE_DUP_MAX : c_int = 16;
2616             pub static _SC_2_VERSION : c_int = 17;
2617             pub static _SC_2_C_BIND : c_int = 18;
2618             pub static _SC_2_C_DEV : c_int = 19;
2619             pub static _SC_2_CHAR_TERM : c_int = 20;
2620             pub static _SC_2_FORT_DEV : c_int = 21;
2621             pub static _SC_2_FORT_RUN : c_int = 22;
2622             pub static _SC_2_LOCALEDEF : c_int = 23;
2623             pub static _SC_2_SW_DEV : c_int = 24;
2624             pub static _SC_2_UPE : c_int = 25;
2625             pub static _SC_STREAM_MAX : c_int = 26;
2626             pub static _SC_TZNAME_MAX : c_int = 27;
2627             pub static _SC_ASYNCHRONOUS_IO : c_int = 28;
2628             pub static _SC_PAGESIZE : c_int = 29;
2629             pub static _SC_MEMLOCK : c_int = 30;
2630             pub static _SC_MEMLOCK_RANGE : c_int = 31;
2631             pub static _SC_MEMORY_PROTECTION : c_int = 32;
2632             pub static _SC_MESSAGE_PASSING : c_int = 33;
2633             pub static _SC_PRIORITIZED_IO : c_int = 34;
2634             pub static _SC_PRIORITY_SCHEDULING : c_int = 35;
2635             pub static _SC_REALTIME_SIGNALS : c_int = 36;
2636             pub static _SC_SEMAPHORES : c_int = 37;
2637             pub static _SC_FSYNC : c_int = 38;
2638             pub static _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
2639             pub static _SC_SYNCHRONIZED_IO : c_int = 40;
2640             pub static _SC_TIMERS : c_int = 41;
2641             pub static _SC_AIO_LISTIO_MAX : c_int = 42;
2642             pub static _SC_AIO_MAX : c_int = 43;
2643             pub static _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
2644             pub static _SC_DELAYTIMER_MAX : c_int = 45;
2645             pub static _SC_MQ_OPEN_MAX : c_int = 46;
2646             pub static _SC_MAPPED_FILES : c_int = 47;
2647             pub static _SC_RTSIG_MAX : c_int = 48;
2648             pub static _SC_SEM_NSEMS_MAX : c_int = 49;
2649             pub static _SC_SEM_VALUE_MAX : c_int = 50;
2650             pub static _SC_SIGQUEUE_MAX : c_int = 51;
2651             pub static _SC_TIMER_MAX : c_int = 52;
2652             pub static _SC_XBS5_ILP32_OFF32 : c_int = 122;
2653             pub static _SC_XBS5_ILP32_OFFBIG : c_int = 123;
2654             pub static _SC_XBS5_LP64_OFF64 : c_int = 124;
2655             pub static _SC_XBS5_LPBIG_OFFBIG : c_int = 125;
2656         }
2657     }
2658 }
2659
2660
2661 pub mod funcs {
2662     // Thankfull most of c95 is universally available and does not vary by OS
2663     // or anything. The same is not true of POSIX.
2664
2665     pub mod c95 {
2666         #[nolink]
2667         #[abi = "cdecl"]
2668         pub mod ctype {
2669             use libc::types::os::arch::c95::{c_char, c_int};
2670
2671             extern {
2672                 pub fn isalnum(c: c_int) -> c_int;
2673                 pub fn isalpha(c: c_int) -> c_int;
2674                 pub fn iscntrl(c: c_int) -> c_int;
2675                 pub fn isdigit(c: c_int) -> c_int;
2676                 pub fn isgraph(c: c_int) -> c_int;
2677                 pub fn islower(c: c_int) -> c_int;
2678                 pub fn isprint(c: c_int) -> c_int;
2679                 pub fn ispunct(c: c_int) -> c_int;
2680                 pub fn isspace(c: c_int) -> c_int;
2681                 pub fn isupper(c: c_int) -> c_int;
2682                 pub fn isxdigit(c: c_int) -> c_int;
2683                 pub fn tolower(c: c_char) -> c_char;
2684                 pub fn toupper(c: c_char) -> c_char;
2685             }
2686         }
2687
2688         #[nolink]
2689         #[abi = "cdecl"]
2690         pub mod stdio {
2691             use libc::types::common::c95::{FILE, c_void, fpos_t};
2692             use libc::types::os::arch::c95::{c_char, c_int, c_long, size_t};
2693
2694             extern {
2695                 pub fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
2696                 pub fn freopen(filename: *c_char, mode: *c_char, file: *FILE)
2697                                -> *FILE;
2698                 pub fn fflush(file: *FILE) -> c_int;
2699                 pub fn fclose(file: *FILE) -> c_int;
2700                 pub fn remove(filename: *c_char) -> c_int;
2701                 pub fn rename(oldname: *c_char, newname: *c_char) -> c_int;
2702                 pub fn tmpfile() -> *FILE;
2703                 pub fn setvbuf(stream: *FILE,
2704                                buffer: *c_char,
2705                                mode: c_int,
2706                                size: size_t)
2707                                -> c_int;
2708                 pub fn setbuf(stream: *FILE, buf: *c_char);
2709                 // Omitted: printf and scanf variants.
2710                 pub fn fgetc(stream: *FILE) -> c_int;
2711                 #[fast_ffi]
2712                 pub fn fgets(buf: *mut c_char, n: c_int, stream: *FILE)
2713                              -> *c_char;
2714                 #[fast_ffi]
2715                 pub fn fputc(c: c_int, stream: *FILE) -> c_int;
2716                 #[fast_ffi]
2717                 pub fn fputs(s: *c_char, stream: *FILE) -> *c_char;
2718                 // Omitted: getc, getchar (might be macros).
2719
2720                 // Omitted: gets, so ridiculously unsafe that it should not
2721                 // survive.
2722
2723                 // Omitted: putc, putchar (might be macros).
2724                 pub fn puts(s: *c_char) -> c_int;
2725                 pub fn ungetc(c: c_int, stream: *FILE) -> c_int;
2726                 #[fast_ffi]
2727                 pub fn fread(ptr: *mut c_void,
2728                              size: size_t,
2729                              nobj: size_t,
2730                              stream: *FILE)
2731                              -> size_t;
2732                 #[fast_ffi]
2733                 pub fn fwrite(ptr: *c_void,
2734                               size: size_t,
2735                               nobj: size_t,
2736                               stream: *FILE)
2737                               -> size_t;
2738                 pub fn fseek(stream: *FILE, offset: c_long, whence: c_int)
2739                              -> c_int;
2740                 pub fn ftell(stream: *FILE) -> c_long;
2741                 pub fn rewind(stream: *FILE);
2742                 pub fn fgetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
2743                 pub fn fsetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
2744                 pub fn feof(stream: *FILE) -> c_int;
2745                 pub fn ferror(stream: *FILE) -> c_int;
2746                 pub fn perror(s: *c_char);
2747             }
2748         }
2749
2750         #[nolink]
2751         #[abi = "cdecl"]
2752         pub mod stdlib {
2753             use libc::types::common::c95::c_void;
2754             use libc::types::os::arch::c95::{c_char, c_double, c_int};
2755             use libc::types::os::arch::c95::{c_long, c_uint, c_ulong};
2756             use libc::types::os::arch::c95::{size_t};
2757
2758             extern {
2759                 pub fn abs(i: c_int) -> c_int;
2760                 pub fn labs(i: c_long) -> c_long;
2761                 // Omitted: div, ldiv (return pub type incomplete).
2762                 pub fn atof(s: *c_char) -> c_double;
2763                 pub fn atoi(s: *c_char) -> c_int;
2764                 pub fn strtod(s: *c_char, endp: **c_char) -> c_double;
2765                 pub fn strtol(s: *c_char, endp: **c_char, base: c_int)
2766                               -> c_long;
2767                 pub fn strtoul(s: *c_char, endp: **c_char, base: c_int)
2768                                -> c_ulong;
2769                 #[fast_ffi]
2770                 pub fn calloc(nobj: size_t, size: size_t) -> *c_void;
2771                 #[fast_ffi]
2772                 pub fn malloc(size: size_t) -> *c_void;
2773                 #[fast_ffi]
2774                 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
2775                 #[fast_ffi]
2776                 pub fn free(p: *c_void);
2777                 pub fn abort() -> !;
2778                 pub fn exit(status: c_int) -> !;
2779                 // Omitted: atexit.
2780                 pub fn system(s: *c_char) -> c_int;
2781                 pub fn getenv(s: *c_char) -> *c_char;
2782                 // Omitted: bsearch, qsort
2783                 pub fn rand() -> c_int;
2784                 pub fn srand(seed: c_uint);
2785             }
2786         }
2787
2788         #[nolink]
2789         #[abi = "cdecl"]
2790         pub mod string {
2791             use libc::types::common::c95::c_void;
2792             use libc::types::os::arch::c95::{c_char, c_int, size_t};
2793             use libc::types::os::arch::c95::{wchar_t};
2794
2795             extern {
2796                 pub fn strcpy(dst: *c_char, src: *c_char) -> *c_char;
2797                 pub fn strncpy(dst: *c_char, src: *c_char, n: size_t)
2798                                -> *c_char;
2799                 pub fn strcat(s: *c_char, ct: *c_char) -> *c_char;
2800                 pub fn strncat(s: *c_char, ct: *c_char, n: size_t) -> *c_char;
2801                 pub fn strcmp(cs: *c_char, ct: *c_char) -> c_int;
2802                 pub fn strncmp(cs: *c_char, ct: *c_char, n: size_t) -> c_int;
2803                 pub fn strcoll(cs: *c_char, ct: *c_char) -> c_int;
2804                 pub fn strchr(cs: *c_char, c: c_int) -> *c_char;
2805                 pub fn strrchr(cs: *c_char, c: c_int) -> *c_char;
2806                 pub fn strspn(cs: *c_char, ct: *c_char) -> size_t;
2807                 pub fn strcspn(cs: *c_char, ct: *c_char) -> size_t;
2808                 pub fn strpbrk(cs: *c_char, ct: *c_char) -> *c_char;
2809                 pub fn strstr(cs: *c_char, ct: *c_char) -> *c_char;
2810                 pub fn strlen(cs: *c_char) -> size_t;
2811                 pub fn strerror(n: c_int) -> *c_char;
2812                 pub fn strtok(s: *c_char, t: *c_char) -> *c_char;
2813                 pub fn strxfrm(s: *c_char, ct: *c_char, n: size_t) -> size_t;
2814                 pub fn wcslen(buf: *wchar_t) -> size_t;
2815
2816                 // Omitted: memcpy, memmove, memset (provided by LLVM)
2817
2818                 // These are fine to execute on the Rust stack. They must be,
2819                 // in fact, because LLVM generates calls to them!
2820                 #[rust_stack]
2821                 #[inline]
2822                 pub fn memcmp(cx: *c_void, ct: *c_void, n: size_t) -> c_int;
2823                 #[rust_stack]
2824                 #[inline]
2825                 pub fn memchr(cx: *c_void, c: c_int, n: size_t) -> *c_void;
2826             }
2827         }
2828     }
2829
2830     // Microsoft helpfully underscore-qualifies all of its POSIX-like symbols
2831     // to make sure you don't use them accidentally. It also randomly deviates
2832     // from the exact signatures you might otherwise expect, and omits much,
2833     // so be careful when trying to write portable code; it won't always work
2834     // with the same POSIX functions and types as other platforms.
2835
2836     #[cfg(target_os = "win32")]
2837     pub mod posix88 {
2838         #[nolink]
2839         #[abi = "cdecl"]
2840         pub mod stat_ {
2841             use libc::types::os::common::posix01::stat;
2842             use libc::types::os::arch::c95::{c_int, c_char};
2843
2844             extern {
2845                 #[link_name = "_chmod"]
2846                 pub fn chmod(path: *c_char, mode: c_int) -> c_int;
2847                 #[link_name = "_mkdir"]
2848                 pub fn mkdir(path: *c_char) -> c_int;
2849                 #[link_name = "_fstat64"]
2850                 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
2851                 #[link_name = "_stat64"]
2852                 pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
2853             }
2854         }
2855
2856         #[nolink]
2857         #[abi = "cdecl"]
2858         pub mod stdio {
2859             use libc::types::common::c95::FILE;
2860             use libc::types::os::arch::c95::{c_int, c_char};
2861
2862             extern {
2863                 #[link_name = "_popen"]
2864                 pub fn popen(command: *c_char, mode: *c_char) -> *FILE;
2865                 #[link_name = "_pclose"]
2866                 pub fn pclose(stream: *FILE) -> c_int;
2867                 #[link_name = "_fdopen"]
2868                 #[fast_ffi]
2869                 pub fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
2870                 #[link_name = "_fileno"]
2871                 pub fn fileno(stream: *FILE) -> c_int;
2872             }
2873         }
2874
2875         #[nolink]
2876         #[abi = "cdecl"]
2877         pub mod fcntl {
2878             use libc::types::os::arch::c95::{c_int, c_char};
2879             extern {
2880                 #[link_name = "_open"]
2881                 pub fn open(path: *c_char, oflag: c_int, mode: c_int)
2882                             -> c_int;
2883                 #[link_name = "_creat"]
2884                 pub fn creat(path: *c_char, mode: c_int) -> c_int;
2885             }
2886         }
2887
2888         #[nolink]
2889         #[abi = "cdecl"]
2890         pub mod dirent {
2891             // Not supplied at all.
2892         }
2893
2894         #[nolink]
2895         #[abi = "cdecl"]
2896         pub mod unistd {
2897             use libc::types::common::c95::c_void;
2898             use libc::types::os::arch::c95::{c_int, c_uint, c_char,
2899                                              c_long, size_t};
2900             use libc::types::os::arch::c99::intptr_t;
2901
2902             extern {
2903                 #[link_name = "_access"]
2904                 pub fn access(path: *c_char, amode: c_int) -> c_int;
2905                 #[link_name = "_chdir"]
2906                 pub fn chdir(dir: *c_char) -> c_int;
2907                 #[link_name = "_close"]
2908                 pub fn close(fd: c_int) -> c_int;
2909                 #[link_name = "_dup"]
2910                 pub fn dup(fd: c_int) -> c_int;
2911                 #[link_name = "_dup2"]
2912                 pub fn dup2(src: c_int, dst: c_int) -> c_int;
2913                 #[link_name = "_execv"]
2914                 pub fn execv(prog: *c_char, argv: **c_char) -> intptr_t;
2915                 #[link_name = "_execve"]
2916                 pub fn execve(prog: *c_char, argv: **c_char, envp: **c_char)
2917                               -> c_int;
2918                 #[link_name = "_execvp"]
2919                 pub fn execvp(c: *c_char, argv: **c_char) -> c_int;
2920                 #[link_name = "_execvpe"]
2921                 pub fn execvpe(c: *c_char, argv: **c_char, envp: **c_char)
2922                                -> c_int;
2923                 #[link_name = "_getcwd"]
2924                 pub fn getcwd(buf: *mut c_char, size: size_t) -> *c_char;
2925                 #[link_name = "_getpid"]
2926                 pub fn getpid() -> c_int;
2927                 #[link_name = "_isatty"]
2928                 pub fn isatty(fd: c_int) -> c_int;
2929                 #[link_name = "_lseek"]
2930                 pub fn lseek(fd: c_int, offset: c_long, origin: c_int)
2931                              -> c_long;
2932                 #[link_name = "_pipe"]
2933                 pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
2934                             -> c_int;
2935                 #[link_name = "_read"]
2936                 #[fast_ffi]
2937                 pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
2938                             -> c_int;
2939                 #[link_name = "_rmdir"]
2940                 pub fn rmdir(path: *c_char) -> c_int;
2941                 #[link_name = "_unlink"]
2942                 pub fn unlink(c: *c_char) -> c_int;
2943                 #[link_name = "_write"]
2944                 #[fast_ffi]
2945                 pub fn write(fd: c_int, buf: *c_void, count: c_uint) -> c_int;
2946             }
2947         }
2948
2949         pub mod mman {
2950         }
2951     }
2952
2953
2954     #[cfg(target_os = "linux")]
2955     #[cfg(target_os = "android")]
2956     #[cfg(target_os = "macos")]
2957     #[cfg(target_os = "freebsd")]
2958     pub mod posix88 {
2959         pub mod stat_ {
2960             use libc::types::os::arch::c95::{c_char, c_int};
2961             use libc::types::os::arch::posix01::stat;
2962             use libc::types::os::arch::posix88::mode_t;
2963
2964             #[nolink]
2965             #[abi = "cdecl"]
2966             extern {
2967                 pub fn chmod(path: *c_char, mode: mode_t) -> c_int;
2968                 pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
2969
2970                 #[cfg(target_os = "linux")]
2971                 #[cfg(target_os = "freebsd")]
2972                 #[cfg(target_os = "android")]
2973                 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
2974
2975                 #[cfg(target_os = "macos")]
2976                 #[link_name = "fstat64"]
2977                 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
2978
2979                 pub fn mkdir(path: *c_char, mode: mode_t) -> c_int;
2980                 pub fn mkfifo(path: *c_char, mode: mode_t) -> c_int;
2981
2982                 #[cfg(target_os = "linux")]
2983                 #[cfg(target_os = "freebsd")]
2984                 #[cfg(target_os = "android")]
2985                 pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
2986
2987                 #[cfg(target_os = "macos")]
2988                 #[link_name = "stat64"]
2989                 pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
2990             }
2991         }
2992
2993         #[nolink]
2994         #[abi = "cdecl"]
2995         pub mod stdio {
2996             use libc::types::common::c95::FILE;
2997             use libc::types::os::arch::c95::{c_char, c_int};
2998
2999             extern {
3000                 pub fn popen(command: *c_char, mode: *c_char) -> *FILE;
3001                 pub fn pclose(stream: *FILE) -> c_int;
3002                 pub fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
3003                 pub fn fileno(stream: *FILE) -> c_int;
3004             }
3005         }
3006
3007         #[nolink]
3008         #[abi = "cdecl"]
3009         pub mod fcntl {
3010             use libc::types::os::arch::c95::{c_char, c_int};
3011             use libc::types::os::arch::posix88::mode_t;
3012
3013             extern {
3014                 pub fn open(path: *c_char, oflag: c_int, mode: c_int)
3015                             -> c_int;
3016                 pub fn creat(path: *c_char, mode: mode_t) -> c_int;
3017                 pub fn fcntl(fd: c_int, cmd: c_int) -> c_int;
3018             }
3019         }
3020
3021         #[nolink]
3022         #[abi = "cdecl"]
3023         pub mod dirent {
3024             use libc::types::common::posix88::{DIR, dirent_t};
3025             use libc::types::os::arch::c95::{c_char, c_int, c_long};
3026
3027             // NB: On OS X opendir and readdir have two versions,
3028             // one for 32-bit kernelspace and one for 64.
3029             // We should be linking to the 64-bit ones, called
3030             // opendir$INODE64, etc. but for some reason rustc
3031             // doesn't link it correctly on i686, so we're going
3032             // through a C function that mysteriously does work.
3033             pub unsafe fn opendir(dirname: *c_char) -> *DIR {
3034                 #[fixed_stack_segment]; #[inline(never)];
3035                 rust_opendir(dirname)
3036             }
3037             pub unsafe fn readdir(dirp: *DIR) -> *dirent_t {
3038                 #[fixed_stack_segment]; #[inline(never)];
3039                 rust_readdir(dirp)
3040             }
3041
3042             extern {
3043                 fn rust_opendir(dirname: *c_char) -> *DIR;
3044                 fn rust_readdir(dirp: *DIR) -> *dirent_t;
3045             }
3046
3047             extern {
3048                 pub fn closedir(dirp: *DIR) -> c_int;
3049                 pub fn rewinddir(dirp: *DIR);
3050                 pub fn seekdir(dirp: *DIR, loc: c_long);
3051                 pub fn telldir(dirp: *DIR) -> c_long;
3052             }
3053         }
3054
3055         #[nolink]
3056         #[abi = "cdecl"]
3057         pub mod unistd {
3058             use libc::types::common::c95::c_void;
3059             use libc::types::os::arch::c95::{c_char, c_int, c_long, c_uint};
3060             use libc::types::os::arch::c95::{size_t};
3061             use libc::types::os::arch::posix88::{gid_t, off_t, pid_t};
3062             use libc::types::os::arch::posix88::{ssize_t, uid_t};
3063
3064             extern {
3065                 pub fn access(path: *c_char, amode: c_int) -> c_int;
3066                 pub fn alarm(seconds: c_uint) -> c_uint;
3067                 pub fn chdir(dir: *c_char) -> c_int;
3068                 pub fn chown(path: *c_char, uid: uid_t, gid: gid_t) -> c_int;
3069                 pub fn close(fd: c_int) -> c_int;
3070                 pub fn dup(fd: c_int) -> c_int;
3071                 pub fn dup2(src: c_int, dst: c_int) -> c_int;
3072                 pub fn execv(prog: *c_char, argv: **c_char) -> c_int;
3073                 pub fn execve(prog: *c_char, argv: **c_char, envp: **c_char)
3074                               -> c_int;
3075                 pub fn execvp(c: *c_char, argv: **c_char) -> c_int;
3076                 pub fn fork() -> pid_t;
3077                 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
3078                 pub fn getcwd(buf: *mut c_char, size: size_t) -> *c_char;
3079                 pub fn getegid() -> gid_t;
3080                 pub fn geteuid() -> uid_t;
3081                 pub fn getgid() -> gid_t ;
3082                 pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
3083                                  -> c_int;
3084                 pub fn getlogin() -> *c_char;
3085                 pub fn getopt(argc: c_int, argv: **c_char, optstr: *c_char)
3086                               -> c_int;
3087                 pub fn getpgrp() -> pid_t;
3088                 pub fn getpid() -> pid_t;
3089                 pub fn getppid() -> pid_t;
3090                 pub fn getuid() -> uid_t;
3091                 pub fn isatty(fd: c_int) -> c_int;
3092                 pub fn link(src: *c_char, dst: *c_char) -> c_int;
3093                 pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
3094                              -> off_t;
3095                 pub fn pathconf(path: *c_char, name: c_int) -> c_long;
3096                 pub fn pause() -> c_int;
3097                 pub fn pipe(fds: *mut c_int) -> c_int;
3098                 #[fast_ffi]
3099                 pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
3100                             -> ssize_t;
3101                 pub fn rmdir(path: *c_char) -> c_int;
3102                 pub fn setgid(gid: gid_t) -> c_int;
3103                 pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
3104                 pub fn setsid() -> pid_t;
3105                 pub fn setuid(uid: uid_t) -> c_int;
3106                 pub fn sleep(secs: c_uint) -> c_uint;
3107                 pub fn sysconf(name: c_int) -> c_long;
3108                 pub fn tcgetpgrp(fd: c_int) -> pid_t;
3109                 pub fn ttyname(fd: c_int) -> *c_char;
3110                 pub fn unlink(c: *c_char) -> c_int;
3111                 #[fast_ffi]
3112                 pub fn write(fd: c_int, buf: *c_void, count: size_t)
3113                              -> ssize_t;
3114             }
3115         }
3116
3117         #[nolink]
3118         #[abi = "cdecl"]
3119         pub mod signal {
3120             use libc::types::os::arch::c95::{c_int};
3121             use libc::types::os::arch::posix88::{pid_t};
3122
3123             extern {
3124                 pub fn kill(pid: pid_t, sig: c_int) -> c_int;
3125             }
3126         }
3127
3128         #[nolink]
3129         #[abi = "cdecl"]
3130         pub mod mman {
3131             use libc::types::common::c95::{c_void};
3132             use libc::types::os::arch::c95::{size_t, c_int, c_char};
3133             use libc::types::os::arch::posix88::{mode_t, off_t};
3134
3135             extern {
3136                 pub fn mlock(addr: *c_void, len: size_t) -> c_int;
3137                 pub fn munlock(addr: *c_void, len: size_t) -> c_int;
3138                 pub fn mlockall(flags: c_int) -> c_int;
3139                 pub fn munlockall() -> c_int;
3140
3141                 pub fn mmap(addr: *c_void,
3142                             len: size_t,
3143                             prot: c_int,
3144                             flags: c_int,
3145                             fd: c_int,
3146                             offset: off_t)
3147                             -> *mut c_void;
3148                 pub fn munmap(addr: *c_void, len: size_t) -> c_int;
3149
3150                 pub fn mprotect(addr: *c_void, len: size_t, prot: c_int)
3151                                 -> c_int;
3152
3153                 pub fn msync(addr: *c_void, len: size_t, flags: c_int)
3154                              -> c_int;
3155                 pub fn shm_open(name: *c_char, oflag: c_int, mode: mode_t)
3156                                 -> c_int;
3157                 pub fn shm_unlink(name: *c_char) -> c_int;
3158             }
3159         }
3160     }
3161
3162     #[cfg(target_os = "linux")]
3163     #[cfg(target_os = "android")]
3164     #[cfg(target_os = "macos")]
3165     #[cfg(target_os = "freebsd")]
3166     pub mod posix01 {
3167         #[nolink]
3168         #[abi = "cdecl"]
3169         pub mod stat_ {
3170             use libc::types::os::arch::c95::{c_char, c_int};
3171             use libc::types::os::arch::posix01::stat;
3172
3173             extern {
3174                 #[cfg(target_os = "linux")]
3175                 #[cfg(target_os = "freebsd")]
3176                 #[cfg(target_os = "android")]
3177                 pub fn lstat(path: *c_char, buf: *mut stat) -> c_int;
3178
3179                 #[cfg(target_os = "macos")]
3180                 #[link_name = "lstat64"]
3181                 pub fn lstat(path: *c_char, buf: *mut stat) -> c_int;
3182             }
3183         }
3184
3185         #[nolink]
3186         #[abi = "cdecl"]
3187         pub mod unistd {
3188             use libc::types::os::arch::c95::{c_char, c_int, size_t};
3189             use libc::types::os::arch::posix88::{ssize_t};
3190
3191             extern {
3192                 pub fn readlink(path: *c_char,
3193                                 buf: *mut c_char,
3194                                 bufsz: size_t)
3195                                 -> ssize_t;
3196
3197                 pub fn fsync(fd: c_int) -> c_int;
3198
3199                 #[cfg(target_os = "linux")]
3200                 #[cfg(target_os = "android")]
3201                 pub fn fdatasync(fd: c_int) -> c_int;
3202
3203                 pub fn setenv(name: *c_char, val: *c_char, overwrite: c_int)
3204                               -> c_int;
3205                 pub fn unsetenv(name: *c_char) -> c_int;
3206                 pub fn putenv(string: *c_char) -> c_int;
3207
3208                 pub fn symlink(path1: *c_char, path2: *c_char) -> c_int;
3209             }
3210         }
3211
3212         #[nolink]
3213         #[abi = "cdecl"]
3214         pub mod wait {
3215             use libc::types::os::arch::c95::{c_int};
3216             use libc::types::os::arch::posix88::{pid_t};
3217
3218             extern {
3219                 pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int)
3220                                -> pid_t;
3221             }
3222         }
3223
3224         #[nolink]
3225         #[abi = "cdecl"]
3226         pub mod glob {
3227             use libc::types::common::c95::{c_void};
3228             use libc::types::os::arch::c95::{c_char, c_int};
3229             use libc::types::os::common::posix01::{glob_t};
3230
3231             extern {
3232                 pub fn glob(pattern: *c_char,
3233                             flags: c_int,
3234                             errfunc: *c_void, // XXX callback
3235                             pglob: *mut glob_t);
3236                 pub fn globfree(pglob: *mut glob_t);
3237             }
3238         }
3239
3240         #[nolink]
3241         #[abi = "cdecl"]
3242         pub mod mman {
3243             use libc::types::common::c95::{c_void};
3244             use libc::types::os::arch::c95::{c_int, size_t};
3245
3246             extern {
3247                 pub fn posix_madvise(addr: *c_void,
3248                                      len: size_t,
3249                                      advice: c_int)
3250                                      -> c_int;
3251             }
3252         }
3253     }
3254
3255     #[cfg(target_os = "win32")]
3256     pub mod posix01 {
3257         pub mod stat_ {
3258         }
3259
3260         pub mod unistd {
3261         }
3262
3263         pub mod glob {
3264         }
3265
3266         pub mod mman {
3267         }
3268     }
3269
3270
3271     #[cfg(target_os = "win32")]
3272     #[cfg(target_os = "linux")]
3273     #[cfg(target_os = "android")]
3274     #[cfg(target_os = "macos")]
3275     #[cfg(target_os = "freebsd")]
3276     pub mod posix08 {
3277         pub mod unistd {
3278         }
3279     }
3280
3281
3282     #[cfg(target_os = "macos")]
3283     #[cfg(target_os = "freebsd")]
3284     pub mod bsd44 {
3285         use libc::types::common::c95::{c_void};
3286         use libc::types::os::arch::c95::{c_char, c_uchar, c_int, c_uint,
3287                                          size_t};
3288
3289         #[abi = "cdecl"]
3290         extern {
3291             pub fn sysctl(name: *c_int,
3292                           namelen: c_uint,
3293                           oldp: *mut c_void,
3294                           oldlenp: *mut size_t,
3295                           newp: *c_void,
3296                           newlen: size_t)
3297                           -> c_int;
3298             pub fn sysctlbyname(name: *c_char,
3299                                 oldp: *mut c_void,
3300                                 oldlenp: *mut size_t,
3301                                 newp: *c_void,
3302                                 newlen: size_t)
3303                                 -> c_int;
3304             pub fn sysctlnametomib(name: *c_char,
3305                                    mibp: *mut c_int,
3306                                    sizep: *mut size_t)
3307                                    -> c_int;
3308             pub fn getdtablesize() -> c_int;
3309             pub fn madvise(addr: *c_void, len: size_t, advice: c_int)
3310                            -> c_int;
3311             pub fn mincore(addr: *c_void, len: size_t, vec: *c_uchar)
3312                            -> c_int;
3313         }
3314     }
3315
3316
3317     #[cfg(target_os = "linux")]
3318     #[cfg(target_os = "android")]
3319     pub mod bsd44 {
3320         use libc::types::common::c95::{c_void};
3321         use libc::types::os::arch::c95::{c_uchar, c_int, size_t};
3322
3323         #[abi = "cdecl"]
3324         extern {
3325             pub fn getdtablesize() -> c_int;
3326             pub fn madvise(addr: *c_void, len: size_t, advice: c_int)
3327                            -> c_int;
3328             pub fn mincore(addr: *c_void, len: size_t, vec: *c_uchar)
3329                            -> c_int;
3330         }
3331     }
3332
3333
3334     #[cfg(target_os = "win32")]
3335     pub mod bsd44 {
3336     }
3337
3338     #[cfg(target_os = "macos")]
3339     #[nolink]
3340     pub mod extra {
3341         use libc::types::os::arch::c95::{c_char, c_int};
3342
3343         #[abi = "cdecl"]
3344         extern {
3345             pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32)
3346                                         -> c_int;
3347         }
3348     }
3349
3350     #[cfg(target_os = "freebsd")]
3351     pub mod extra {
3352     }
3353
3354     #[cfg(target_os = "linux")]
3355     #[cfg(target_os = "android")]
3356     pub mod extra {
3357     }
3358
3359
3360     #[cfg(target_os = "win32")]
3361     pub mod extra {
3362
3363         pub mod kernel32 {
3364             use libc::types::os::arch::c95::{c_uint};
3365             use libc::types::os::arch::extra::{BOOL, DWORD, SIZE_T, HMODULE};
3366             use libc::types::os::arch::extra::{LPCWSTR, LPWSTR, LPCTSTR,
3367                                                LPTSTR, LPTCH, LPDWORD, LPVOID,
3368                                                LPCVOID};
3369             use libc::types::os::arch::extra::{LPSECURITY_ATTRIBUTES, LPSTARTUPINFO,
3370                                                LPPROCESS_INFORMATION,
3371                                                LPMEMORY_BASIC_INFORMATION,
3372                                                LPSYSTEM_INFO};
3373             use libc::types::os::arch::extra::{HANDLE, LPHANDLE};
3374
3375             #[cfg(target_arch = "x86")]
3376             #[abi = "stdcall"]
3377             extern "stdcall" {
3378                 pub fn GetEnvironmentVariableW(n: LPCWSTR,
3379                                                v: LPWSTR,
3380                                                nsize: DWORD)
3381                                                -> DWORD;
3382                 pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
3383                                                -> BOOL;
3384                 pub fn GetEnvironmentStringsA() -> LPTCH;
3385                 pub fn FreeEnvironmentStringsA(env_ptr: LPTCH) -> BOOL;
3386                 pub fn GetModuleFileNameW(hModule: HMODULE,
3387                                           lpFilename: LPWSTR,
3388                                           nSize: DWORD)
3389                                           -> DWORD;
3390                 pub fn CreateDirectoryW(lpPathName: LPCWSTR,
3391                                         lpSecurityAttributes:
3392                                         LPSECURITY_ATTRIBUTES)
3393                                         -> BOOL;
3394                 pub fn CopyFileW(lpExistingFileName: LPCWSTR,
3395                                         lpNewFileName: LPCWSTR,
3396                                         bFailIfExists: BOOL)
3397                                         -> BOOL;
3398                 pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
3399                 pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
3400                 pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
3401                 pub fn GetLastError() -> DWORD;
3402                 pub fn FindFirstFileW(fileName: *u16, findFileData: HANDLE)
3403                                       -> HANDLE;
3404                 pub fn FindNextFileW(findFile: HANDLE, findFileData: HANDLE)
3405                                      -> BOOL;
3406                 pub fn FindClose(findFile: HANDLE) -> BOOL;
3407                 pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
3408                                        hSourceHandle: HANDLE,
3409                                        hTargetProcessHandle: HANDLE,
3410                                        lpTargetHandle: LPHANDLE,
3411                                        dwDesiredAccess: DWORD,
3412                                        bInheritHandle: BOOL,
3413                                        dwOptions: DWORD)
3414                                        -> BOOL;
3415                 pub fn CloseHandle(hObject: HANDLE) -> BOOL;
3416                 pub fn OpenProcess(dwDesiredAccess: DWORD,
3417                                    bInheritHandle: BOOL,
3418                                    dwProcessId: DWORD)
3419                                    -> HANDLE;
3420                 pub fn GetCurrentProcess() -> HANDLE;
3421                 pub fn CreateProcessA(lpApplicationName: LPCTSTR,
3422                                       lpCommandLine: LPTSTR,
3423                                       lpProcessAttributes:
3424                                       LPSECURITY_ATTRIBUTES,
3425                                       lpThreadAttributes:
3426                                       LPSECURITY_ATTRIBUTES,
3427                                       bInheritHandles: BOOL,
3428                                       dwCreationFlags: DWORD,
3429                                       lpEnvironment: LPVOID,
3430                                       lpCurrentDirectory: LPCTSTR,
3431                                       lpStartupInfo: LPSTARTUPINFO,
3432                                       lpProcessInformation:
3433                                       LPPROCESS_INFORMATION)
3434                                       -> BOOL;
3435                 pub fn WaitForSingleObject(hHandle: HANDLE,
3436                                            dwMilliseconds: DWORD)
3437                                            -> DWORD;
3438                 pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
3439                                         -> BOOL;
3440                 pub fn GetExitCodeProcess(hProcess: HANDLE,
3441                                           lpExitCode: LPDWORD)
3442                                           -> BOOL;
3443                 pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
3444                 pub fn VirtualAlloc(lpAddress: LPVOID,
3445                                     dwSize: SIZE_T,
3446                                     flAllocationType: DWORD,
3447                                     flProtect: DWORD)
3448                                     -> LPVOID;
3449                 pub fn VirtualFree(lpAddress: LPVOID,
3450                                    dwSize: SIZE_T,
3451                                    dwFreeType: DWORD)
3452                                    -> BOOL;
3453                 pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
3454                 pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
3455                                      -> BOOL;
3456                 pub fn VirtualProtect(lpAddress: LPVOID,
3457                                       dwSize: SIZE_T,
3458                                       flNewProtect: DWORD,
3459                                       lpflOldProtect: LPDWORD)
3460                                       -> BOOL;
3461                 pub fn VirtualQuery(lpAddress: LPCVOID,
3462                                     lpBuffer: LPMEMORY_BASIC_INFORMATION,
3463                                     dwLength: SIZE_T)
3464                                     -> SIZE_T;
3465                 pub fn CreateFileMappingW(hFile: HANDLE,
3466                                           lpAttributes: LPSECURITY_ATTRIBUTES,
3467                                           flProtect: DWORD,
3468                                           dwMaximumSizeHigh: DWORD,
3469                                           dwMaximumSizeLow: DWORD,
3470                                           lpName: LPCTSTR)
3471                                           -> HANDLE;
3472                 pub fn MapViewOfFile(hFileMappingObject: HANDLE,
3473                                      dwDesiredAccess: DWORD,
3474                                      dwFileOffsetHigh: DWORD,
3475                                      dwFileOffsetLow: DWORD,
3476                                      dwNumberOfBytesToMap: SIZE_T)
3477                                      -> LPVOID;
3478                 pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
3479             }
3480
3481             #[cfg(target_arch = "x86_64")]
3482             extern {
3483                 pub fn GetEnvironmentVariableW(n: LPCWSTR,
3484                                                v: LPWSTR,
3485                                                nsize: DWORD)
3486                                                -> DWORD;
3487                 pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
3488                                                -> BOOL;
3489                 pub fn GetEnvironmentStringsA() -> LPTCH;
3490                 pub fn FreeEnvironmentStringsA(env_ptr: LPTCH) -> BOOL;
3491                 pub fn GetModuleFileNameW(hModule: HMODULE,
3492                                           lpFilename: LPWSTR,
3493                                           nSize: DWORD)
3494                                           -> DWORD;
3495                 pub fn CreateDirectoryW(lpPathName: LPCWSTR,
3496                                         lpSecurityAttributes:
3497                                         LPSECURITY_ATTRIBUTES)
3498                                         -> BOOL;
3499                 pub fn CopyFileW(lpExistingFileName: LPCWSTR,
3500                                         lpNewFileName: LPCWSTR,
3501                                         bFailIfExists: BOOL)
3502                                         -> BOOL;
3503                 pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
3504                 pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
3505                 pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
3506                 pub fn GetLastError() -> DWORD;
3507                 pub fn FindFirstFileW(fileName: *u16, findFileData: HANDLE)
3508                                       -> HANDLE;
3509                 pub fn FindNextFileW(findFile: HANDLE, findFileData: HANDLE)
3510                                      -> BOOL;
3511                 pub fn FindClose(findFile: HANDLE) -> BOOL;
3512                 pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
3513                                        hSourceHandle: HANDLE,
3514                                        hTargetProcessHandle: HANDLE,
3515                                        lpTargetHandle: LPHANDLE,
3516                                        dwDesiredAccess: DWORD,
3517                                        bInheritHandle: BOOL,
3518                                        dwOptions: DWORD)
3519                                        -> BOOL;
3520                 pub fn CloseHandle(hObject: HANDLE) -> BOOL;
3521                 pub fn OpenProcess(dwDesiredAccess: DWORD,
3522                                    bInheritHandle: BOOL,
3523                                    dwProcessId: DWORD)
3524                                    -> HANDLE;
3525                 pub fn GetCurrentProcess() -> HANDLE;
3526                 pub fn CreateProcessA(lpApplicationName: LPCTSTR,
3527                                       lpCommandLine: LPTSTR,
3528                                       lpProcessAttributes:
3529                                       LPSECURITY_ATTRIBUTES,
3530                                       lpThreadAttributes:
3531                                       LPSECURITY_ATTRIBUTES,
3532                                       bInheritHandles: BOOL,
3533                                       dwCreationFlags: DWORD,
3534                                       lpEnvironment: LPVOID,
3535                                       lpCurrentDirectory: LPCTSTR,
3536                                       lpStartupInfo: LPSTARTUPINFO,
3537                                       lpProcessInformation:
3538                                       LPPROCESS_INFORMATION)
3539                                       -> BOOL;
3540                 pub fn WaitForSingleObject(hHandle: HANDLE,
3541                                            dwMilliseconds: DWORD)
3542                                            -> DWORD;
3543                 pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
3544                                         -> BOOL;
3545                 pub fn GetExitCodeProcess(hProcess: HANDLE,
3546                                           lpExitCode: LPDWORD)
3547                                           -> BOOL;
3548                 pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
3549                 pub fn VirtualAlloc(lpAddress: LPVOID,
3550                                     dwSize: SIZE_T,
3551                                     flAllocationType: DWORD,
3552                                     flProtect: DWORD)
3553                                     -> LPVOID;
3554                 pub fn VirtualFree(lpAddress: LPVOID,
3555                                    dwSize: SIZE_T,
3556                                    dwFreeType: DWORD)
3557                                    -> BOOL;
3558                 pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
3559                 pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
3560                                      -> BOOL;
3561                 pub fn VirtualProtect(lpAddress: LPVOID,
3562                                       dwSize: SIZE_T,
3563                                       flNewProtect: DWORD,
3564                                       lpflOldProtect: LPDWORD)
3565                                       -> BOOL;
3566                 pub fn VirtualQuery(lpAddress: LPCVOID,
3567                                     lpBuffer: LPMEMORY_BASIC_INFORMATION,
3568                                     dwLength: SIZE_T)
3569                                     -> SIZE_T;
3570                 pub fn CreateFileMappingW(hFile: HANDLE,
3571                                           lpAttributes: LPSECURITY_ATTRIBUTES,
3572                                           flProtect: DWORD,
3573                                           dwMaximumSizeHigh: DWORD,
3574                                           dwMaximumSizeLow: DWORD,
3575                                           lpName: LPCTSTR)
3576                                           -> HANDLE;
3577                 pub fn MapViewOfFile(hFileMappingObject: HANDLE,
3578                                      dwDesiredAccess: DWORD,
3579                                      dwFileOffsetHigh: DWORD,
3580                                      dwFileOffsetLow: DWORD,
3581                                      dwNumberOfBytesToMap: SIZE_T)
3582                                      -> LPVOID;
3583                 pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
3584             }
3585         }
3586
3587         pub mod msvcrt {
3588             use libc::types::os::arch::c95::{c_int, c_long};
3589
3590             #[abi = "cdecl"]
3591             #[nolink]
3592             extern {
3593                 #[link_name = "_commit"]
3594                 pub fn commit(fd: c_int) -> c_int;
3595
3596                 #[link_name = "_get_osfhandle"]
3597                 pub fn get_osfhandle(fd: c_int) -> c_long;
3598             }
3599         }
3600     }
3601 }