(index<- )        ./liblibc/lib.rs

    git branch:    * master           5200215 auto merge of #14035 : alexcrichton/rust/experimental, r=huonw
    modified:    Fri May  9 13:02:28 2014
    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  #![feature(globs)]
   12  #![crate_id = "libc#0.11-pre"]
   13  #![experimental]
   14  #![no_std] // we don't need std, and we can't have std, since it doesn't exist
   15             // yet. std depends on us.
   16  #![crate_type = "rlib"]
   17  #![crate_type = "dylib"]
   18  
   19  /*!
   20  * Bindings for the C standard library and other platform libraries
   21  *
   22  * **NOTE:** These are *architecture and libc* specific. On Linux, these
   23  * bindings are only correct for glibc.
   24  *
   25  * This module contains bindings to the C standard library, organized into
   26  * modules by their defining standard.  Additionally, it contains some assorted
   27  * platform-specific definitions.  For convenience, most functions and types
   28  * are reexported, so `use libc::*` will import the available C bindings as
   29  * appropriate for the target platform. The exact set of functions available
   30  * are platform specific.
   31  *
   32  * *Note:* Because these definitions are platform-specific, some may not appear
   33  * in the generated documentation.
   34  *
   35  * We consider the following specs reasonably normative with respect to
   36  * interoperating with the C standard library (libc/msvcrt):
   37  *
   38  * * ISO 9899:1990 ('C95', 'ANSI C', 'Standard C'), NA1, 1995.
   39  * * ISO 9899:1999 ('C99' or 'C9x').
   40  * * ISO 9945:1988 / IEEE 1003.1-1988 ('POSIX.1').
   41  * * ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
   42  * * ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
   43  *
   44  * Note that any reference to the 1996 revision of POSIX, or any revs between
   45  * 1990 (when '88 was approved at ISO) and 2001 (when the next actual
   46  * revision-revision happened), are merely additions of other chapters (1b and
   47  * 1c) outside the core interfaces.
   48  *
   49  * Despite having several names each, these are *reasonably* coherent
   50  * point-in-time, list-of-definition sorts of specs. You can get each under a
   51  * variety of names but will wind up with the same definition in each case.
   52  *
   53  * See standards(7) in linux-manpages for more details.
   54  *
   55  * Our interface to these libraries is complicated by the non-universality of
   56  * conformance to any of them. About the only thing universally supported is
   57  * the first (C95), beyond that definitions quickly become absent on various
   58  * platforms.
   59  *
   60  * We therefore wind up dividing our module-space up (mostly for the sake of
   61  * sanity while editing, filling-in-details and eliminating duplication) into
   62  * definitions common-to-all (held in modules named c95, c99, posix88, posix01
   63  * and posix08) and definitions that appear only on *some* platforms (named
   64  * 'extra'). This would be things like significant OSX foundation kit, or win32
   65  * library kernel32.dll, or various fancy glibc, linux or BSD extensions.
   66  *
   67  * In addition to the per-platform 'extra' modules, we define a module of
   68  * 'common BSD' libc routines that never quite made it into POSIX but show up
   69  * in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the final
   70  * one from Berkeley after the lawsuits died down and the CSRG dissolved.
   71  */
   72  
   73  #![allow(non_camel_case_types)]
   74  #![allow(non_uppercase_statics)]
   75  #![allow(missing_doc)]
   76  #![allow(uppercase_variables)]
   77  
   78  #[cfg(test)] extern crate std;
   79  #[cfg(test)] extern crate test;
   80  #[cfg(test)] extern crate native;
   81  
   82  // Explicit export lists for the intersection (provided here) mean that
   83  // you can write more-platform-agnostic code if you stick to just these
   84  // symbols.
   85  
   86  pub use types::common::c95::{FILE, c_void, fpos_t};
   87  pub use types::common::c99::{int8_t, int16_t, int32_t, int64_t};
   88  pub use types::common::c99::{uint8_t, uint16_t, uint32_t, uint64_t};
   89  pub use types::common::posix88::{DIR, dirent_t};
   90  pub use types::os::common::posix01::{timeval};
   91  pub use types::os::common::bsd44::{addrinfo, in_addr, in6_addr, sockaddr_storage};
   92  pub use types::os::common::bsd44::{ip_mreq, ip6_mreq, sockaddr, sockaddr_un};
   93  pub use types::os::common::bsd44::{sa_family_t, sockaddr_in, sockaddr_in6, socklen_t};
   94  pub use types::os::arch::c95::{c_char, c_double, c_float, c_int, c_uint};
   95  pub use types::os::arch::c95::{c_long, c_short, c_uchar, c_ulong};
   96  pub use types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t};
   97  pub use types::os::arch::c95::{size_t, time_t, suseconds_t};
   98  pub use types::os::arch::c99::{c_longlong, c_ulonglong};
   99  pub use types::os::arch::c99::{intptr_t, uintptr_t};
  100  pub use types::os::arch::posix88::{dev_t, ino_t, mode_t};
  101  pub use types::os::arch::posix88::{off_t, pid_t, ssize_t};
  102  
  103  pub use consts::os::c95::{_IOFBF, _IOLBF, _IONBF, BUFSIZ, EOF};
  104  pub use consts::os::c95::{EXIT_FAILURE, EXIT_SUCCESS};
  105  pub use consts::os::c95::{FILENAME_MAX, FOPEN_MAX, L_tmpnam};
  106  pub use consts::os::c95::{RAND_MAX, SEEK_CUR, SEEK_END};
  107  pub use consts::os::c95::{SEEK_SET, TMP_MAX};
  108  pub use consts::os::posix88::{F_OK, O_APPEND, O_CREAT, O_EXCL};
  109  pub use consts::os::posix88::{O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY};
  110  pub use consts::os::posix88::{R_OK, S_IEXEC, S_IFBLK, S_IFCHR};
  111  pub use consts::os::posix88::{S_IFDIR, S_IFIFO, S_IFMT, S_IFREG, S_IFLNK};
  112  pub use consts::os::posix88::{S_IREAD, S_IRUSR, S_IRWXU, S_IWUSR};
  113  pub use consts::os::posix88::{STDERR_FILENO, STDIN_FILENO, S_IXUSR};
  114  pub use consts::os::posix88::{STDOUT_FILENO, W_OK, X_OK};
  115  pub use consts::os::bsd44::{AF_INET, AF_INET6, SOCK_STREAM, SOCK_DGRAM};
  116  pub use consts::os::bsd44::{IPPROTO_IP, IPPROTO_IPV6, IPPROTO_TCP, TCP_NODELAY};
  117  pub use consts::os::bsd44::{SOL_SOCKET, SO_KEEPALIVE, SO_ERROR};
  118  pub use consts::os::bsd44::{SO_REUSEADDR, SO_BROADCAST, SHUT_WR, IP_MULTICAST_LOOP};
  119  pub use consts::os::bsd44::{IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP};
  120  pub use consts::os::bsd44::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP};
  121  pub use consts::os::bsd44::{IP_MULTICAST_TTL, IP_TTL, SHUT_RD};
  122  
  123  pub use funcs::c95::ctype::{isalnum, isalpha, iscntrl, isdigit};
  124  pub use funcs::c95::ctype::{islower, isprint, ispunct, isspace};
  125  pub use funcs::c95::ctype::{isupper, isxdigit, tolower, toupper};
  126  
  127  pub use funcs::c95::stdio::{fclose, feof, ferror, fflush, fgetc};
  128  pub use funcs::c95::stdio::{fgetpos, fgets, fopen, fputc, fputs};
  129  pub use funcs::c95::stdio::{fread, freopen, fseek, fsetpos, ftell};
  130  pub use funcs::c95::stdio::{fwrite, perror, puts, remove, rename, rewind};
  131  pub use funcs::c95::stdio::{setbuf, setvbuf, tmpfile, ungetc};
  132  
  133  pub use funcs::c95::stdlib::{abs, atof, atoi, calloc, exit, _exit};
  134  pub use funcs::c95::stdlib::{free, getenv, labs, malloc, rand};
  135  pub use funcs::c95::stdlib::{realloc, srand, strtod, strtol};
  136  pub use funcs::c95::stdlib::{strtoul, system};
  137  
  138  pub use funcs::c95::string::{memchr, memcmp};
  139  pub use funcs::c95::string::{strcat, strchr, strcmp};
  140  pub use funcs::c95::string::{strcoll, strcpy, strcspn, strerror};
  141  pub use funcs::c95::string::{strlen, strncat, strncmp, strncpy};
  142  pub use funcs::c95::string::{strpbrk, strrchr, strspn, strstr};
  143  pub use funcs::c95::string::{strtok, strxfrm};
  144  
  145  pub use funcs::posix88::fcntl::{open, creat};
  146  pub use funcs::posix88::stat_::{chmod, fstat, mkdir, stat};
  147  pub use funcs::posix88::stdio::{fdopen, fileno, pclose, popen};
  148  pub use funcs::posix88::unistd::{access, chdir, close, dup, dup2};
  149  pub use funcs::posix88::unistd::{execv, execve, execvp, getcwd};
  150  pub use funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read};
  151  pub use funcs::posix88::unistd::{rmdir, unlink, write};
  152  
  153  pub use funcs::bsd43::{socket, setsockopt, bind, send, recv, recvfrom};
  154  pub use funcs::bsd43::{listen, sendto, accept, connect, getpeername, getsockname};
  155  pub use funcs::bsd43::{shutdown};
  156  
  157  // But we also reexport most everything
  158  // if you're interested in writing platform-specific code.
  159  
  160  // FIXME: This is a mess, but the design of this entire module needs to be
  161  // reconsidered, so I'm not inclined to do better right now. As part of
  162  // #11870 I removed all the pub globs here, leaving explicit reexports
  163  // of everything that is actually used in-tree.
  164  //
  165  // So the following exports don't follow any particular plan.
  166  
  167  #[cfg(unix)] pub use consts::os::sysconf::{_SC_PAGESIZE};
  168  #[cfg(unix)] pub use consts::os::posix88::{PROT_READ, PROT_WRITE, PROT_EXEC};
  169  #[cfg(unix)] pub use consts::os::posix88::{MAP_FIXED, MAP_FILE, MAP_ANON, MAP_PRIVATE, MAP_FAILED};
  170  #[cfg(unix)] pub use consts::os::posix88::{EACCES, EBADF, EINVAL, ENODEV, ENOMEM};
  171  #[cfg(unix)] pub use consts::os::posix88::{ECONNREFUSED, ECONNRESET, EPERM, EPIPE};
  172  #[cfg(unix)] pub use consts::os::posix88::{ENOTCONN, ECONNABORTED, EADDRNOTAVAIL, EINTR};
  173  #[cfg(unix)] pub use consts::os::posix88::{EADDRINUSE, ENOENT, EISDIR, EAGAIN, EWOULDBLOCK};
  174  #[cfg(unix)] pub use consts::os::posix88::{ECANCELED, SIGINT, EINPROGRESS};
  175  #[cfg(unix)] pub use consts::os::posix88::{SIGTERM, SIGKILL, SIGPIPE, PROT_NONE};
  176  #[cfg(unix)] pub use consts::os::posix01::{SIG_IGN, WNOHANG};
  177  #[cfg(unix)] pub use consts::os::bsd44::{AF_UNIX};
  178  
  179  #[cfg(unix)] pub use types::os::common::posix01::{pthread_t, timespec, timezone};
  180  
  181  #[cfg(unix)] pub use types::os::arch::posix88::{uid_t, gid_t};
  182  #[cfg(unix)] pub use types::os::arch::posix01::{pthread_attr_t};
  183  #[cfg(unix)] pub use types::os::arch::posix01::{stat, utimbuf};
  184  #[cfg(unix)] pub use funcs::posix88::unistd::{sysconf, setgid, setsid, setuid, pread, pwrite};
  185  #[cfg(unix)] pub use funcs::posix88::unistd::{getgid, getuid};
  186  #[cfg(unix)] pub use funcs::posix88::unistd::{_PC_NAME_MAX, utime, nanosleep, pathconf, link};
  187  #[cfg(unix)] pub use funcs::posix88::unistd::{chown};
  188  #[cfg(unix)] pub use funcs::posix88::mman::{mmap, munmap, mprotect};
  189  #[cfg(unix)] pub use funcs::posix88::dirent::{opendir, readdir_r, closedir};
  190  #[cfg(unix)] pub use funcs::posix88::fcntl::{fcntl};
  191  #[cfg(unix)] pub use funcs::posix01::stat_::{lstat};
  192  #[cfg(unix)] pub use funcs::posix01::unistd::{fsync, ftruncate};
  193  #[cfg(unix)] pub use funcs::posix01::unistd::{readlink, symlink};
  194  
  195  #[cfg(windows)] pub use consts::os::c95::{WSAECONNREFUSED, WSAECONNRESET, WSAEACCES};
  196  #[cfg(windows)] pub use consts::os::c95::{WSAEWOULDBLOCK, WSAENOTCONN, WSAECONNABORTED};
  197  #[cfg(windows)] pub use consts::os::c95::{WSAEADDRNOTAVAIL, WSAEADDRINUSE, WSAEINTR};
  198  #[cfg(windows)] pub use consts::os::c95::{WSAEINPROGRESS};
  199  #[cfg(windows)] pub use consts::os::extra::{ERROR_INSUFFICIENT_BUFFER};
  200  #[cfg(windows)] pub use consts::os::extra::{O_BINARY, O_NOINHERIT, PAGE_NOACCESS};
  201  #[cfg(windows)] pub use consts::os::extra::{PAGE_READONLY, PAGE_READWRITE, PAGE_EXECUTE};
  202  #[cfg(windows)] pub use consts::os::extra::{PAGE_EXECUTE_READ, PAGE_EXECUTE_READWRITE};
  203  #[cfg(windows)] pub use consts::os::extra::{MEM_COMMIT, MEM_RESERVE, MEM_RELEASE};
  204  #[cfg(windows)] pub use consts::os::extra::{FILE_MAP_READ, FILE_MAP_WRITE, FILE_MAP_EXECUTE};
  205  #[cfg(windows)] pub use consts::os::extra::{ERROR_ALREADY_EXISTS, ERROR_NO_DATA};
  206  #[cfg(windows)] pub use consts::os::extra::{ERROR_FILE_NOT_FOUND, ERROR_INVALID_NAME};
  207  #[cfg(windows)] pub use consts::os::extra::{ERROR_BROKEN_PIPE, ERROR_INVALID_FUNCTION};
  208  #[cfg(windows)] pub use consts::os::extra::{TRUE, FALSE, INFINITE};
  209  #[cfg(windows)] pub use consts::os::extra::{PROCESS_TERMINATE, PROCESS_QUERY_INFORMATION};
  210  #[cfg(windows)] pub use consts::os::extra::{STILL_ACTIVE, DETACHED_PROCESS};
  211  #[cfg(windows)] pub use consts::os::extra::{CREATE_NEW_PROCESS_GROUP};
  212  #[cfg(windows)] pub use consts::os::extra::{FILE_BEGIN, FILE_END, FILE_CURRENT};
  213  #[cfg(windows)] pub use consts::os::extra::{FILE_GENERIC_READ, FILE_GENERIC_WRITE};
  214  #[cfg(windows)] pub use consts::os::extra::{FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_DELETE};
  215  #[cfg(windows)] pub use consts::os::extra::{TRUNCATE_EXISTING, CREATE_ALWAYS, OPEN_EXISTING};
  216  #[cfg(windows)] pub use consts::os::extra::{CREATE_NEW, FILE_APPEND_DATA, FILE_WRITE_DATA};
  217  #[cfg(windows)] pub use consts::os::extra::{OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL};
  218  #[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_BACKUP_SEMANTICS, INVALID_HANDLE_VALUE};
  219  #[cfg(windows)] pub use consts::os::extra::{MOVEFILE_REPLACE_EXISTING};
  220  #[cfg(windows)] pub use consts::os::extra::{GENERIC_READ, GENERIC_WRITE};
  221  #[cfg(windows)] pub use consts::os::extra::{VOLUME_NAME_DOS, FILE_ATTRIBUTE_NORMAL};
  222  #[cfg(windows)] pub use consts::os::extra::{PIPE_ACCESS_DUPLEX, FILE_FLAG_FIRST_PIPE_INSTANCE};
  223  #[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE};
  224  #[cfg(windows)] pub use consts::os::extra::{PIPE_READMODE_BYTE, PIPE_WAIT};
  225  #[cfg(windows)] pub use consts::os::extra::{PIPE_UNLIMITED_INSTANCES, ERROR_ACCESS_DENIED};
  226  #[cfg(windows)] pub use consts::os::extra::{FILE_WRITE_ATTRIBUTES, FILE_READ_ATTRIBUTES};
  227  #[cfg(windows)] pub use consts::os::extra::{ERROR_PIPE_BUSY, ERROR_IO_PENDING};
  228  #[cfg(windows)] pub use consts::os::extra::{ERROR_PIPE_CONNECTED, WAIT_OBJECT_0};
  229  #[cfg(windows)] pub use consts::os::extra::{ERROR_NOT_FOUND};
  230  #[cfg(windows)] pub use consts::os::extra::{ERROR_OPERATION_ABORTED};
  231  #[cfg(windows)] pub use types::os::common::bsd44::{SOCKET};
  232  #[cfg(windows)] pub use types::os::common::posix01::{stat, utimbuf};
  233  #[cfg(windows)] pub use types::os::arch::extra::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES};
  234  #[cfg(windows)] pub use types::os::arch::extra::{LPCSTR, WORD, DWORD, BYTE, FILETIME};
  235  #[cfg(windows)] pub use types::os::arch::extra::{LARGE_INTEGER, LPVOID, LONG};
  236  #[cfg(windows)] pub use types::os::arch::extra::{time64_t, OVERLAPPED, LPCWSTR};
  237  #[cfg(windows)] pub use types::os::arch::extra::{LPOVERLAPPED, SIZE_T, LPDWORD};
  238  #[cfg(windows)] pub use funcs::c95::string::{wcslen};
  239  #[cfg(windows)] pub use funcs::posix88::stat_::{wstat, wutime, wchmod, wrmdir};
  240  #[cfg(windows)] pub use funcs::bsd43::{closesocket};
  241  #[cfg(windows)] pub use funcs::extra::kernel32::{GetCurrentDirectoryW, GetLastError};
  242  #[cfg(windows)] pub use funcs::extra::kernel32::{GetEnvironmentVariableW, SetEnvironmentVariableW};
  243  #[cfg(windows)] pub use funcs::extra::kernel32::{GetModuleFileNameW, SetCurrentDirectoryW};
  244  #[cfg(windows)] pub use funcs::extra::kernel32::{GetSystemInfo, VirtualAlloc, VirtualFree};
  245  #[cfg(windows)] pub use funcs::extra::kernel32::{CreateFileMappingW, MapViewOfFile};
  246  #[cfg(windows)] pub use funcs::extra::kernel32::{UnmapViewOfFile, CloseHandle};
  247  #[cfg(windows)] pub use funcs::extra::kernel32::{WaitForSingleObject, GetSystemTimeAsFileTime};
  248  #[cfg(windows)] pub use funcs::extra::kernel32::{QueryPerformanceCounter};
  249  #[cfg(windows)] pub use funcs::extra::kernel32::{WaitForSingleObject, QueryPerformanceFrequency};
  250  #[cfg(windows)] pub use funcs::extra::kernel32::{GetExitCodeProcess, TerminateProcess};
  251  #[cfg(windows)] pub use funcs::extra::kernel32::{ReadFile, WriteFile, SetFilePointerEx};
  252  #[cfg(windows)] pub use funcs::extra::kernel32::{FlushFileBuffers, SetEndOfFile, CreateFileW};
  253  #[cfg(windows)] pub use funcs::extra::kernel32::{CreateDirectoryW, FindFirstFileW};
  254  #[cfg(windows)] pub use funcs::extra::kernel32::{FindNextFileW, FindClose, DeleteFileW};
  255  #[cfg(windows)] pub use funcs::extra::kernel32::{GetFinalPathNameByHandleW, CreateSymbolicLinkW};
  256  #[cfg(windows)] pub use funcs::extra::kernel32::{CreateHardLinkW, CreateEventW};
  257  #[cfg(windows)] pub use funcs::extra::kernel32::{FlushFileBuffers, CreateNamedPipeW};
  258  #[cfg(windows)] pub use funcs::extra::kernel32::{SetNamedPipeHandleState, WaitNamedPipeW};
  259  #[cfg(windows)] pub use funcs::extra::kernel32::{GetOverlappedResult, ConnectNamedPipe};
  260  #[cfg(windows)] pub use funcs::extra::kernel32::{DisconnectNamedPipe, OpenProcess};
  261  #[cfg(windows)] pub use funcs::extra::kernel32::{MoveFileExW, VirtualProtect};
  262  #[cfg(windows)] pub use funcs::extra::msvcrt::{get_osfhandle, open_osfhandle};
  263  
  264  #[cfg(target_os = "linux")] #[cfg(target_os = "android")] #[cfg(target_os = "freebsd")]
  265  pub use consts::os::posix01::{CLOCK_REALTIME, CLOCK_MONOTONIC};
  266  
  267  #[cfg(target_os = "linux")] #[cfg(target_os = "android")]
  268  pub use funcs::posix01::unistd::{fdatasync};
  269  
  270  #[cfg(unix, not(target_os = "freebsd"))]
  271  pub use consts::os::extra::{MAP_STACK};
  272  
  273  #[cfg(target_os = "freebsd")]
  274  pub use consts::os::bsd44::{TCP_KEEPIDLE};
  275  
  276  #[cfg(target_os = "macos")]
  277  pub use consts::os::bsd44::{TCP_KEEPALIVE};
  278  #[cfg(target_os = "macos")]
  279  pub use consts::os::extra::{F_FULLFSYNC};
  280  #[cfg(target_os = "macos")]
  281  pub use types::os::arch::extra::{mach_timebase_info};
  282  
  283  
  284  #[cfg(not(windows))]
  285  #[link(name = "c")]
  286  #[link(name = "m")]
  287  extern {}
  288  
  289  /// A wrapper for a nullable pointer. Don't use this except for interacting
  290  /// with libc. Basically Option, but without the dependance on libstd.
  291  // If/when libprim happens, this can be removed in favor of that
  292  pub enum Nullable<T> {
  293      Null,
  294      Some(T)
  295  }
  296  
  297  pub mod types {
  298  
  299      // Types tend to vary *per architecture* so we pull their definitions out
  300      // into this module.
  301  
  302      // Standard types that are opaque or common, so are not per-target.
  303      pub mod common {
  304          pub mod c95 {
  305              /**
  306              Type used to construct void pointers for use with C.
  307  
  308              This type is only useful as a pointer target. Do not use it as a
  309              return type for FFI functions which have the `void` return type in
  310              C. Use the unit type `()` or omit the return type instead.
  311  
  312              For LLVM to recognize the void pointer type and by extension
  313              functions like malloc(), we need to have it represented as i8* in
  314              LLVM bitcode. The enum used here ensures this and prevents misuse
  315              of the "raw" type by only having private variants.. We need two
  316              variants, because the compiler complains about the repr attribute
  317              otherwise.
  318              */
  319              #[repr(u8)]
  320              pub enum c_void {
  321                  __variant1,
  322                  __variant2,
  323              }
  324              pub enum FILE {}
  325              pub enum fpos_t {}
  326          }
  327          pub mod c99 {
  328              pub type int8_t = i8;
  329              pub type int16_t = i16;
  330              pub type int32_t = i32;
  331              pub type int64_t = i64;
  332              pub type uint8_t = u8;
  333              pub type uint16_t = u16;
  334              pub type uint32_t = u32;
  335              pub type uint64_t = u64;
  336          }
  337          pub mod posix88 {
  338              pub enum DIR {}
  339              pub enum dirent_t {}
  340          }
  341          pub mod posix01 {}
  342          pub mod posix08 {}
  343          pub mod bsd44 {}
  344      }
  345  
  346      // Standard types that are scalar but vary by OS and arch.
  347  
  348      #[cfg(target_os = "linux")]
  349      #[cfg(target_os = "android")]
  350      pub mod os {
  351          pub mod common {
  352              pub mod posix01 {
  353                  use types::common::c95::{c_void};
  354                  use types::os::arch::c95::{c_char, c_ulong, size_t,
  355                                                   time_t, suseconds_t, c_long};
  356  
  357                  pub type pthread_t = c_ulong;
  358  
  359                  pub struct glob_t {
  360                      pub gl_pathc: size_t,
  361                      pub gl_pathv: **c_char,
  362                      pub gl_offs:  size_t,
  363  
  364                      pub __unused1: *c_void,
  365                      pub __unused2: *c_void,
  366                      pub __unused3: *c_void,
  367                      pub __unused4: *c_void,
  368                      pub __unused5: *c_void,
  369                  }
  370  
  371                  pub struct timeval {
  372                      pub tv_sec: time_t,
  373                      pub tv_usec: suseconds_t,
  374                  }
  375  
  376                  pub struct timespec {
  377                      pub tv_sec: time_t,
  378                      pub tv_nsec: c_long,
  379                  }
  380  
  381                  pub enum timezone {}
  382  
  383                  pub type sighandler_t = size_t;
  384              }
  385              pub mod bsd44 {
  386                  use types::os::arch::c95::{c_char, c_int, c_uint};
  387  
  388                  pub type socklen_t = u32;
  389                  pub type sa_family_t = u16;
  390                  pub type in_port_t = u16;
  391                  pub type in_addr_t = u32;
  392                  pub struct sockaddr {
  393                      pub sa_family: sa_family_t,
  394                      pub sa_data: [u8, ..14],
  395                  }
  396                  pub struct sockaddr_storage {
  397                      pub ss_family: sa_family_t,
  398                      pub __ss_align: i64,
  399                      pub __ss_pad2: [u8, ..112],
  400                  }
  401                  pub struct sockaddr_in {
  402                      pub sin_family: sa_family_t,
  403                      pub sin_port: in_port_t,
  404                      pub sin_addr: in_addr,
  405                      pub sin_zero: [u8, ..8],
  406                  }
  407                  pub struct in_addr {
  408                      pub s_addr: in_addr_t,
  409                  }
  410                  pub struct sockaddr_in6 {
  411                      pub sin6_family: sa_family_t,
  412                      pub sin6_port: in_port_t,
  413                      pub sin6_flowinfo: u32,
  414                      pub sin6_addr: in6_addr,
  415                      pub sin6_scope_id: u32,
  416                  }
  417                  pub struct in6_addr {
  418                      pub s6_addr: [u16, ..8]
  419                  }
  420                  pub struct ip_mreq {
  421                      pub imr_multiaddr: in_addr,
  422                      pub imr_interface: in_addr,
  423                  }
  424                  pub struct ip6_mreq {
  425                      pub ipv6mr_multiaddr: in6_addr,
  426                      pub ipv6mr_interface: c_uint,
  427                  }
  428                  pub struct addrinfo {
  429                      pub ai_flags: c_int,
  430                      pub ai_family: c_int,
  431                      pub ai_socktype: c_int,
  432                      pub ai_protocol: c_int,
  433                      pub ai_addrlen: socklen_t,
  434                      pub ai_addr: *sockaddr,
  435                      pub ai_canonname: *c_char,
  436                      pub ai_next: *addrinfo,
  437                  }
  438                  pub struct sockaddr_un {
  439                      pub sun_family: sa_family_t,
  440                      pub sun_path: [c_char, ..108]
  441                  }
  442              }
  443          }
  444  
  445          #[cfg(target_arch = "x86")]
  446          #[cfg(target_arch = "arm")]
  447          #[cfg(target_arch = "mips")]
  448          pub mod arch {
  449              pub mod c95 {
  450                  pub type c_char = i8;
  451                  pub type c_schar = i8;
  452                  pub type c_uchar = u8;
  453                  pub type c_short = i16;
  454                  pub type c_ushort = u16;
  455                  pub type c_int = i32;
  456                  pub type c_uint = u32;
  457                  pub type c_long = i32;
  458                  pub type c_ulong = u32;
  459                  pub type c_float = f32;
  460                  pub type c_double = f64;
  461                  pub type size_t = u32;
  462                  pub type ptrdiff_t = i32;
  463                  pub type clock_t = i32;
  464                  pub type time_t = i32;
  465                  pub type suseconds_t = i32;
  466                  pub type wchar_t = i32;
  467              }
  468              pub mod c99 {
  469                  pub type c_longlong = i64;
  470                  pub type c_ulonglong = u64;
  471                  pub type intptr_t = int;
  472                  pub type uintptr_t = uint;
  473              }
  474              #[cfg(target_arch = "x86")]
  475              #[cfg(target_arch = "mips")]
  476              pub mod posix88 {
  477                  pub type off_t = i32;
  478                  pub type dev_t = u64;
  479                  pub type ino_t = u32;
  480                  pub type pid_t = i32;
  481                  pub type uid_t = u32;
  482                  pub type gid_t = u32;
  483                  pub type useconds_t = u32;
  484                  pub type mode_t = u32;
  485                  pub type ssize_t = i32;
  486              }
  487              #[cfg(target_arch = "arm")]
  488              pub mod posix88 {
  489                  pub type off_t = i32;
  490                  pub type dev_t = u32;
  491                  pub type ino_t = u32;
  492                  pub type pid_t = i32;
  493                  pub type uid_t = u32;
  494                  pub type gid_t = u32;
  495                  pub type useconds_t = u32;
  496                  pub type mode_t = u16;
  497                  pub type ssize_t = i32;
  498              }
  499              #[cfg(target_arch = "x86")]
  500              pub mod posix01 {
  501                  use types::os::arch::c95::{c_short, c_long, time_t};
  502                  use types::os::arch::posix88::{dev_t, gid_t, ino_t};
  503                  use types::os::arch::posix88::{mode_t, off_t};
  504                  use types::os::arch::posix88::{uid_t};
  505  
  506                  pub type nlink_t = u32;
  507                  pub type blksize_t = i32;
  508                  pub type blkcnt_t = i32;
  509  
  510                  pub struct stat {
  511                      pub st_dev: dev_t,
  512                      pub __pad1: c_short,
  513                      pub st_ino: ino_t,
  514                      pub st_mode: mode_t,
  515                      pub st_nlink: nlink_t,
  516                      pub st_uid: uid_t,
  517                      pub st_gid: gid_t,
  518                      pub st_rdev: dev_t,
  519                      pub __pad2: c_short,
  520                      pub st_size: off_t,
  521                      pub st_blksize: blksize_t,
  522                      pub st_blocks: blkcnt_t,
  523                      pub st_atime: time_t,
  524                      pub st_atime_nsec: c_long,
  525                      pub st_mtime: time_t,
  526                      pub st_mtime_nsec: c_long,
  527                      pub st_ctime: time_t,
  528                      pub st_ctime_nsec: c_long,
  529                      pub __unused4: c_long,
  530                      pub __unused5: c_long,
  531                  }
  532  
  533                  pub struct utimbuf {
  534                      pub actime: time_t,
  535                      pub modtime: time_t,
  536                  }
  537  
  538                  pub struct pthread_attr_t {
  539                      pub __size: [u32, ..9]
  540                  }
  541              }
  542              #[cfg(target_arch = "arm")]
  543              pub mod posix01 {
  544                  use types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
  545                  use types::os::arch::c99::{c_longlong, c_ulonglong};
  546                  use types::os::arch::posix88::{uid_t, gid_t, ino_t};
  547  
  548                  pub type nlink_t = u16;
  549                  pub type blksize_t = u32;
  550                  pub type blkcnt_t = u32;
  551  
  552                  pub struct stat {
  553                      pub st_dev: c_ulonglong,
  554                      pub __pad0: [c_uchar, ..4],
  555                      pub __st_ino: ino_t,
  556                      pub st_mode: c_uint,
  557                      pub st_nlink: c_uint,
  558                      pub st_uid: uid_t,
  559                      pub st_gid: gid_t,
  560                      pub st_rdev: c_ulonglong,
  561                      pub __pad3: [c_uchar, ..4],
  562                      pub st_size: c_longlong,
  563                      pub st_blksize: blksize_t,
  564                      pub st_blocks: c_ulonglong,
  565                      pub st_atime: time_t,
  566                      pub st_atime_nsec: c_ulong,
  567                      pub st_mtime: time_t,
  568                      pub st_mtime_nsec: c_ulong,
  569                      pub st_ctime: time_t,
  570                      pub st_ctime_nsec: c_ulong,
  571                      pub st_ino: c_ulonglong,
  572                  }
  573  
  574                  pub struct utimbuf {
  575                      pub actime: time_t,
  576                      pub modtime: time_t,
  577                  }
  578  
  579                  pub struct pthread_attr_t {
  580                      pub __size: [u32, ..9]
  581                  }
  582              }
  583              #[cfg(target_arch = "mips")]
  584              pub mod posix01 {
  585                  use types::os::arch::c95::{c_long, c_ulong, time_t};
  586                  use types::os::arch::posix88::{gid_t, ino_t};
  587                  use types::os::arch::posix88::{mode_t, off_t};
  588                  use types::os::arch::posix88::{uid_t};
  589  
  590                  pub type nlink_t = u32;
  591                  pub type blksize_t = i32;
  592                  pub type blkcnt_t = i32;
  593  
  594                  pub struct stat {
  595                      pub st_dev: c_ulong,
  596                      pub st_pad1: [c_long, ..3],
  597                      pub st_ino: ino_t,
  598                      pub st_mode: mode_t,
  599                      pub st_nlink: nlink_t,
  600                      pub st_uid: uid_t,
  601                      pub st_gid: gid_t,
  602                      pub st_rdev: c_ulong,
  603                      pub st_pad2: [c_long, ..2],
  604                      pub st_size: off_t,
  605                      pub st_pad3: c_long,
  606                      pub st_atime: time_t,
  607                      pub st_atime_nsec: c_long,
  608                      pub st_mtime: time_t,
  609                      pub st_mtime_nsec: c_long,
  610                      pub st_ctime: time_t,
  611                      pub st_ctime_nsec: c_long,
  612                      pub st_blksize: blksize_t,
  613                      pub st_blocks: blkcnt_t,
  614                      pub st_pad5: [c_long, ..14],
  615                  }
  616  
  617                  pub struct utimbuf {
  618                      pub actime: time_t,
  619                      pub modtime: time_t,
  620                  }
  621  
  622                  pub struct pthread_attr_t {
  623                      pub __size: [u32, ..9]
  624                  }
  625              }
  626              pub mod posix08 {}
  627              pub mod bsd44 {}
  628              pub mod extra {}
  629          }
  630  
  631          #[cfg(target_arch = "x86_64")]
  632          pub mod arch {
  633              pub mod c95 {
  634                  pub type c_char = i8;
  635                  pub type c_schar = i8;
  636                  pub type c_uchar = u8;
  637                  pub type c_short = i16;
  638                  pub type c_ushort = u16;
  639                  pub type c_int = i32;
  640                  pub type c_uint = u32;
  641                  pub type c_long = i64;
  642                  pub type c_ulong = u64;
  643                  pub type c_float = f32;
  644                  pub type c_double = f64;
  645                  pub type size_t = u64;
  646                  pub type ptrdiff_t = i64;
  647                  pub type clock_t = i64;
  648                  pub type time_t = i64;
  649                  pub type suseconds_t = i64;
  650                  pub type wchar_t = i32;
  651              }
  652              pub mod c99 {
  653                  pub type c_longlong = i64;
  654                  pub type c_ulonglong = u64;
  655                  pub type intptr_t = int;
  656                  pub type uintptr_t = uint;
  657              }
  658              pub mod posix88 {
  659                  pub type off_t = i64;
  660                  pub type dev_t = u64;
  661                  pub type ino_t = u64;
  662                  pub type pid_t = i32;
  663                  pub type uid_t = u32;
  664                  pub type gid_t = u32;
  665                  pub type useconds_t = u32;
  666                  pub type mode_t = u32;
  667                  pub type ssize_t = i64;
  668              }
  669              pub mod posix01 {
  670                  use types::os::arch::c95::{c_int, c_long, time_t};
  671                  use types::os::arch::posix88::{dev_t, gid_t, ino_t};
  672                  use types::os::arch::posix88::{mode_t, off_t};
  673                  use types::os::arch::posix88::{uid_t};
  674  
  675                  pub type nlink_t = u64;
  676                  pub type blksize_t = i64;
  677                  pub type blkcnt_t = i64;
  678                  pub struct stat {
  679                      pub st_dev: dev_t,
  680                      pub st_ino: ino_t,
  681                      pub st_nlink: nlink_t,
  682                      pub st_mode: mode_t,
  683                      pub st_uid: uid_t,
  684                      pub st_gid: gid_t,
  685                      pub __pad0: c_int,
  686                      pub st_rdev: dev_t,
  687                      pub st_size: off_t,
  688                      pub st_blksize: blksize_t,
  689                      pub st_blocks: blkcnt_t,
  690                      pub st_atime: time_t,
  691                      pub st_atime_nsec: c_long,
  692                      pub st_mtime: time_t,
  693                      pub st_mtime_nsec: c_long,
  694                      pub st_ctime: time_t,
  695                      pub st_ctime_nsec: c_long,
  696                      pub __unused: [c_long, ..3],
  697                  }
  698  
  699                  pub struct utimbuf {
  700                      pub actime: time_t,
  701                      pub modtime: time_t,
  702                  }
  703  
  704                  pub struct pthread_attr_t {
  705                      pub __size: [u64, ..7]
  706                  }
  707              }
  708              pub mod posix08 {
  709              }
  710              pub mod bsd44 {
  711              }
  712              pub mod extra {
  713              }
  714          }
  715      }
  716  
  717      #[cfg(target_os = "freebsd")]
  718      pub mod os {
  719          pub mod common {
  720              pub mod posix01 {
  721                  use types::common::c95::{c_void};
  722                  use types::os::arch::c95::{c_char, c_int, size_t,
  723                                                   time_t, suseconds_t, c_long};
  724                  use types::os::arch::c99::{uintptr_t};
  725  
  726                  pub type pthread_t = uintptr_t;
  727  
  728                  pub struct glob_t {
  729                      pub gl_pathc:  size_t,
  730                      pub __unused1: size_t,
  731                      pub gl_offs:   size_t,
  732                      pub __unused2: c_int,
  733                      pub gl_pathv:  **c_char,
  734  
  735                      pub __unused3: *c_void,
  736  
  737                      pub __unused4: *c_void,
  738                      pub __unused5: *c_void,
  739                      pub __unused6: *c_void,
  740                      pub __unused7: *c_void,
  741                      pub __unused8: *c_void,
  742                  }
  743  
  744                  pub struct timeval {
  745                      pub tv_sec: time_t,
  746                      pub tv_usec: suseconds_t,
  747                  }
  748  
  749                  pub struct timespec {
  750                      pub tv_sec: time_t,
  751                      pub tv_nsec: c_long,
  752                  }
  753  
  754                  pub enum timezone {}
  755  
  756                  pub type sighandler_t = size_t;
  757              }
  758              pub mod bsd44 {
  759                  use types::os::arch::c95::{c_char, c_int, c_uint};
  760  
  761                  pub type socklen_t = u32;
  762                  pub type sa_family_t = u8;
  763                  pub type in_port_t = u16;
  764                  pub type in_addr_t = u32;
  765                  pub struct sockaddr {
  766                      pub sa_len: u8,
  767                      pub sa_family: sa_family_t,
  768                      pub sa_data: [u8, ..14],
  769                  }
  770                  pub struct sockaddr_storage {
  771                      pub ss_len: u8,
  772                      pub ss_family: sa_family_t,
  773                      pub __ss_pad1: [u8, ..6],
  774                      pub __ss_align: i64,
  775                      pub __ss_pad2: [u8, ..112],
  776                  }
  777                  pub struct sockaddr_in {
  778                      pub sin_len: u8,
  779                      pub sin_family: sa_family_t,
  780                      pub sin_port: in_port_t,
  781                      pub sin_addr: in_addr,
  782                      pub sin_zero: [u8, ..8],
  783                  }
  784                  pub struct in_addr {
  785                      pub s_addr: in_addr_t,
  786                  }
  787                  pub struct sockaddr_in6 {
  788                      pub sin6_len: u8,
  789                      pub sin6_family: sa_family_t,
  790                      pub sin6_port: in_port_t,
  791                      pub sin6_flowinfo: u32,
  792                      pub sin6_addr: in6_addr,
  793                      pub sin6_scope_id: u32,
  794                  }
  795                  pub struct in6_addr {
  796                      pub s6_addr: [u16, ..8]
  797                  }
  798                  pub struct ip_mreq {
  799                      pub imr_multiaddr: in_addr,
  800                      pub imr_interface: in_addr,
  801                  }
  802                  pub struct ip6_mreq {
  803                      pub ipv6mr_multiaddr: in6_addr,
  804                      pub ipv6mr_interface: c_uint,
  805                  }
  806                  pub struct addrinfo {
  807                      pub ai_flags: c_int,
  808                      pub ai_family: c_int,
  809                      pub ai_socktype: c_int,
  810                      pub ai_protocol: c_int,
  811                      pub ai_addrlen: socklen_t,
  812                      pub ai_canonname: *c_char,
  813                      pub ai_addr: *sockaddr,
  814                      pub ai_next: *addrinfo,
  815                  }
  816                  pub struct sockaddr_un {
  817                      pub sun_len: u8,
  818                      pub sun_family: sa_family_t,
  819                      pub sun_path: [c_char, ..104]
  820                  }
  821              }
  822          }
  823  
  824          #[cfg(target_arch = "x86_64")]
  825          pub mod arch {
  826              pub mod c95 {
  827                  pub type c_char = i8;
  828                  pub type c_schar = i8;
  829                  pub type c_uchar = u8;
  830                  pub type c_short = i16;
  831                  pub type c_ushort = u16;
  832                  pub type c_int = i32;
  833                  pub type c_uint = u32;
  834                  pub type c_long = i64;
  835                  pub type c_ulong = u64;
  836                  pub type c_float = f32;
  837                  pub type c_double = f64;
  838                  pub type size_t = u64;
  839                  pub type ptrdiff_t = i64;
  840                  pub type clock_t = i32;
  841                  pub type time_t = i64;
  842                  pub type suseconds_t = i64;
  843                  pub type wchar_t = i32;
  844              }
  845              pub mod c99 {
  846                  pub type c_longlong = i64;
  847                  pub type c_ulonglong = u64;
  848                  pub type intptr_t = int;
  849                  pub type uintptr_t = uint;
  850              }
  851              pub mod posix88 {
  852                  pub type off_t = i64;
  853                  pub type dev_t = u32;
  854                  pub type ino_t = u32;
  855                  pub type pid_t = i32;
  856                  pub type uid_t = u32;
  857                  pub type gid_t = u32;
  858                  pub type useconds_t = u32;
  859                  pub type mode_t = u16;
  860                  pub type ssize_t = i64;
  861              }
  862              pub mod posix01 {
  863                  use types::common::c95::{c_void};
  864                  use types::common::c99::{uint8_t, uint32_t, int32_t};
  865                  use types::os::arch::c95::{c_long, time_t};
  866                  use types::os::arch::posix88::{dev_t, gid_t, ino_t};
  867                  use types::os::arch::posix88::{mode_t, off_t};
  868                  use types::os::arch::posix88::{uid_t};
  869  
  870                  pub type nlink_t = u16;
  871                  pub type blksize_t = i64;
  872                  pub type blkcnt_t = i64;
  873                  pub type fflags_t = u32;
  874                  pub struct stat {
  875                      pub st_dev: dev_t,
  876                      pub st_ino: ino_t,
  877                      pub st_mode: mode_t,
  878                      pub st_nlink: nlink_t,
  879                      pub st_uid: uid_t,
  880                      pub st_gid: gid_t,
  881                      pub st_rdev: dev_t,
  882                      pub st_atime: time_t,
  883                      pub st_atime_nsec: c_long,
  884                      pub st_mtime: time_t,
  885                      pub st_mtime_nsec: c_long,
  886                      pub st_ctime: time_t,
  887                      pub st_ctime_nsec: c_long,
  888                      pub st_size: off_t,
  889                      pub st_blocks: blkcnt_t,
  890                      pub st_blksize: blksize_t,
  891                      pub st_flags: fflags_t,
  892                      pub st_gen: uint32_t,
  893                      pub st_lspare: int32_t,
  894                      pub st_birthtime: time_t,
  895                      pub st_birthtime_nsec: c_long,
  896                      pub __unused: [uint8_t, ..2],
  897                  }
  898  
  899                  pub struct utimbuf {
  900                      pub actime: time_t,
  901                      pub modtime: time_t,
  902                  }
  903  
  904                  pub type pthread_attr_t = *c_void;
  905              }
  906              pub mod posix08 {
  907              }
  908              pub mod bsd44 {
  909              }
  910              pub mod extra {
  911              }
  912          }
  913      }
  914  
  915      #[cfg(target_os = "win32")]
  916      pub mod os {
  917          pub mod common {
  918              pub mod posix01 {
  919                  use types::os::arch::c95::{c_short, time_t, suseconds_t,
  920                                                   c_long};
  921                  use types::os::arch::extra::{int64, time64_t};
  922                  use types::os::arch::posix88::{dev_t, ino_t};
  923                  use types::os::arch::posix88::mode_t;
  924  
  925                  // pub Note: this is the struct called stat64 in win32. Not stat,
  926                  // nor stati64.
  927                  pub struct stat {
  928                      pub st_dev: dev_t,
  929                      pub st_ino: ino_t,
  930                      pub st_mode: mode_t,
  931                      pub st_nlink: c_short,
  932                      pub st_uid: c_short,
  933                      pub st_gid: c_short,
  934                      pub st_rdev: dev_t,
  935                      pub st_size: int64,
  936                      pub st_atime: time64_t,
  937                      pub st_mtime: time64_t,
  938                      pub st_ctime: time64_t,
  939                  }
  940  
  941                  // note that this is called utimbuf64 in win32
  942                  pub struct utimbuf {
  943                      pub actime: time64_t,
  944                      pub modtime: time64_t,
  945                  }
  946  
  947                  pub struct timeval {
  948                      pub tv_sec: time_t,
  949                      pub tv_usec: suseconds_t,
  950                  }
  951  
  952                  pub struct timespec {
  953                      pub tv_sec: time_t,
  954                      pub tv_nsec: c_long,
  955                  }
  956  
  957                  pub enum timezone {}
  958              }
  959  
  960              pub mod bsd44 {
  961                  use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
  962  
  963                  pub type SOCKET = c_uint;
  964                  pub type socklen_t = c_int;
  965                  pub type sa_family_t = u16;
  966                  pub type in_port_t = u16;
  967                  pub type in_addr_t = u32;
  968                  pub struct sockaddr {
  969                      pub sa_family: sa_family_t,
  970                      pub sa_data: [u8, ..14],
  971                  }
  972                  pub struct sockaddr_storage {
  973                      pub ss_family: sa_family_t,
  974                      pub __ss_align: i64,
  975                      pub __ss_pad2: [u8, ..112],
  976                  }
  977                  pub struct sockaddr_in {
  978                      pub sin_family: sa_family_t,
  979                      pub sin_port: in_port_t,
  980                      pub sin_addr: in_addr,
  981                      pub sin_zero: [u8, ..8],
  982                  }
  983                  pub struct in_addr {
  984                      pub s_addr: in_addr_t,
  985                  }
  986                  pub struct sockaddr_in6 {
  987                      pub sin6_family: sa_family_t,
  988                      pub sin6_port: in_port_t,
  989                      pub sin6_flowinfo: u32,
  990                      pub sin6_addr: in6_addr,
  991                      pub sin6_scope_id: u32,
  992                  }
  993                  pub struct in6_addr {
  994                      pub s6_addr: [u16, ..8]
  995                  }
  996                  pub struct ip_mreq {
  997                      pub imr_multiaddr: in_addr,
  998                      pub imr_interface: in_addr,
  999                  }
 1000                  pub struct ip6_mreq {
 1001                      pub ipv6mr_multiaddr: in6_addr,
 1002                      pub ipv6mr_interface: c_uint,
 1003                  }
 1004                  pub struct addrinfo {
 1005                      pub ai_flags: c_int,
 1006                      pub ai_family: c_int,
 1007                      pub ai_socktype: c_int,
 1008                      pub ai_protocol: c_int,
 1009                      pub ai_addrlen: size_t,
 1010                      pub ai_canonname: *c_char,
 1011                      pub ai_addr: *sockaddr,
 1012                      pub ai_next: *addrinfo,
 1013                  }
 1014                  pub struct sockaddr_un {
 1015                      pub sun_family: sa_family_t,
 1016                      pub sun_path: [c_char, ..108]
 1017                  }
 1018              }
 1019          }
 1020  
 1021          pub mod arch {
 1022              pub mod c95 {
 1023                  pub type c_char = i8;
 1024                  pub type c_schar = i8;
 1025                  pub type c_uchar = u8;
 1026                  pub type c_short = i16;
 1027                  pub type c_ushort = u16;
 1028                  pub type c_int = i32;
 1029                  pub type c_uint = u32;
 1030                  pub type c_long = i32;
 1031                  pub type c_ulong = u32;
 1032                  pub type c_float = f32;
 1033                  pub type c_double = f64;
 1034  
 1035                  #[cfg(target_arch = "x86")]
 1036                  pub type size_t = u32;
 1037                  #[cfg(target_arch = "x86_64")]
 1038                  pub type size_t = u64;
 1039  
 1040                  #[cfg(target_arch = "x86")]
 1041                  pub type ptrdiff_t = i32;
 1042                  #[cfg(target_arch = "x86_64")]
 1043                  pub type ptrdiff_t = i64;
 1044  
 1045                  pub type clock_t = i32;
 1046  
 1047                  #[cfg(target_arch = "x86")]
 1048                  pub type time_t = i32;
 1049                  #[cfg(target_arch = "x86_64")]
 1050                  pub type time_t = i64;
 1051  
 1052                  #[cfg(target_arch = "x86")]
 1053                  pub type suseconds_t = i32;
 1054                  #[cfg(target_arch = "x86_64")]
 1055                  pub type suseconds_t = i64;
 1056  
 1057                  pub type wchar_t = u16;
 1058              }
 1059  
 1060              pub mod c99 {
 1061                  pub type c_longlong = i64;
 1062                  pub type c_ulonglong = u64;
 1063                  pub type intptr_t = int;
 1064                  pub type uintptr_t = uint;
 1065              }
 1066  
 1067              pub mod posix88 {
 1068                  pub type off_t = i32;
 1069                  pub type dev_t = u32;
 1070                  pub type ino_t = i16;
 1071  
 1072                  #[cfg(target_arch = "x86")]
 1073                  pub type pid_t = i32;
 1074                  #[cfg(target_arch = "x86_64")]
 1075                  pub type pid_t = i64;
 1076  
 1077                  pub type useconds_t = u32;
 1078                  pub type mode_t = u16;
 1079  
 1080                  #[cfg(target_arch = "x86")]
 1081                  pub type ssize_t = i32;
 1082                  #[cfg(target_arch = "x86_64")]
 1083                  pub type ssize_t = i64;
 1084              }
 1085  
 1086              pub mod posix01 {
 1087              }
 1088              pub mod posix08 {
 1089              }
 1090              pub mod bsd44 {
 1091              }
 1092              pub mod extra {
 1093                  use consts::os::extra::{MAX_PROTOCOL_CHAIN,
 1094                                                WSAPROTOCOL_LEN};
 1095                  use types::common::c95::c_void;
 1096                  use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
 1097                  use types::os::arch::c95::{c_long, c_ulong};
 1098                  use types::os::arch::c95::{wchar_t};
 1099                  use types::os::arch::c99::{c_ulonglong, c_longlong};
 1100  
 1101                  pub type BOOL = c_int;
 1102                  pub type BYTE = u8;
 1103                  pub type BOOLEAN = BYTE;
 1104                  pub type CCHAR = c_char;
 1105                  pub type CHAR = c_char;
 1106  
 1107                  pub type DWORD = c_ulong;
 1108                  pub type DWORDLONG = c_ulonglong;
 1109  
 1110                  pub type HANDLE = LPVOID;
 1111                  pub type HMODULE = c_uint;
 1112  
 1113                  pub type LONG = c_long;
 1114                  pub type PLONG = *mut c_long;
 1115  
 1116                  #[cfg(target_arch = "x86")]
 1117                  pub type LONG_PTR = c_long;
 1118                  #[cfg(target_arch = "x86_64")]
 1119                  pub type LONG_PTR = i64;
 1120  
 1121                  pub type LARGE_INTEGER = c_longlong;
 1122                  pub type PLARGE_INTEGER = *mut c_longlong;
 1123  
 1124                  pub type LPCWSTR = *WCHAR;
 1125                  pub type LPCSTR = *CHAR;
 1126  
 1127                  pub type LPWSTR = *mut WCHAR;
 1128                  pub type LPSTR = *mut CHAR;
 1129  
 1130                  pub type LPWCH = *mut WCHAR;
 1131                  pub type LPCH = *mut CHAR;
 1132  
 1133                  // Not really, but opaque to us.
 1134                  pub type LPSECURITY_ATTRIBUTES = LPVOID;
 1135  
 1136                  pub type LPVOID = *mut c_void;
 1137                  pub type LPCVOID = *c_void;
 1138                  pub type LPBYTE = *mut BYTE;
 1139                  pub type LPWORD = *mut WORD;
 1140                  pub type LPDWORD = *mut DWORD;
 1141                  pub type LPHANDLE = *mut HANDLE;
 1142  
 1143                  pub type LRESULT = LONG_PTR;
 1144                  pub type PBOOL = *mut BOOL;
 1145                  pub type WCHAR = wchar_t;
 1146                  pub type WORD = u16;
 1147                  pub type SIZE_T = size_t;
 1148  
 1149                  pub type time64_t = i64;
 1150                  pub type int64 = i64;
 1151  
 1152                  pub struct STARTUPINFO {
 1153                      pub cb: DWORD,
 1154                      pub lpReserved: LPWSTR,
 1155                      pub lpDesktop: LPWSTR,
 1156                      pub lpTitle: LPWSTR,
 1157                      pub dwX: DWORD,
 1158                      pub dwY: DWORD,
 1159                      pub dwXSize: DWORD,
 1160                      pub dwYSize: DWORD,
 1161                      pub dwXCountChars: DWORD,
 1162                      pub dwYCountCharts: DWORD,
 1163                      pub dwFillAttribute: DWORD,
 1164                      pub dwFlags: DWORD,
 1165                      pub wShowWindow: WORD,
 1166                      pub cbReserved2: WORD,
 1167                      pub lpReserved2: LPBYTE,
 1168                      pub hStdInput: HANDLE,
 1169                      pub hStdOutput: HANDLE,
 1170                      pub hStdError: HANDLE,
 1171                  }
 1172                  pub type LPSTARTUPINFO = *mut STARTUPINFO;
 1173  
 1174                  pub struct PROCESS_INFORMATION {
 1175                      pub hProcess: HANDLE,
 1176                      pub hThread: HANDLE,
 1177                      pub dwProcessId: DWORD,
 1178                      pub dwThreadId: DWORD,
 1179                  }
 1180                  pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
 1181  
 1182                  pub struct SYSTEM_INFO {
 1183                      pub wProcessorArchitecture: WORD,
 1184                      pub wReserved: WORD,
 1185                      pub dwPageSize: DWORD,
 1186                      pub lpMinimumApplicationAddress: LPVOID,
 1187                      pub lpMaximumApplicationAddress: LPVOID,
 1188                      pub dwActiveProcessorMask: DWORD,
 1189                      pub dwNumberOfProcessors: DWORD,
 1190                      pub dwProcessorType: DWORD,
 1191                      pub dwAllocationGranularity: DWORD,
 1192                      pub wProcessorLevel: WORD,
 1193                      pub wProcessorRevision: WORD,
 1194                  }
 1195                  pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
 1196  
 1197                  pub struct MEMORY_BASIC_INFORMATION {
 1198                      pub BaseAddress: LPVOID,
 1199                      pub AllocationBase: LPVOID,
 1200                      pub AllocationProtect: DWORD,
 1201                      pub RegionSize: SIZE_T,
 1202                      pub State: DWORD,
 1203                      pub Protect: DWORD,
 1204                      pub Type: DWORD,
 1205                  }
 1206                  pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
 1207  
 1208                  pub struct OVERLAPPED {
 1209                      pub Internal: *c_ulong,
 1210                      pub InternalHigh: *c_ulong,
 1211                      pub Offset: DWORD,
 1212                      pub OffsetHigh: DWORD,
 1213                      pub hEvent: HANDLE,
 1214                  }
 1215  
 1216                  pub type LPOVERLAPPED = *mut OVERLAPPED;
 1217  
 1218                  pub struct FILETIME {
 1219                      pub dwLowDateTime: DWORD,
 1220                      pub dwHighDateTime: DWORD,
 1221                  }
 1222  
 1223                  pub type LPFILETIME = *mut FILETIME;
 1224  
 1225                  pub struct GUID {
 1226                      pub Data1: DWORD,
 1227                      pub Data2: WORD,
 1228                      pub Data3: WORD,
 1229                      pub Data4: [BYTE, ..8],
 1230                  }
 1231  
 1232                  pub struct WSAPROTOCOLCHAIN {
 1233                      pub ChainLen: c_int,
 1234                      pub ChainEntries: [DWORD, ..MAX_PROTOCOL_CHAIN],
 1235                  }
 1236  
 1237                  pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
 1238  
 1239                  pub struct WSAPROTOCOL_INFO {
 1240                      pub dwServiceFlags1: DWORD,
 1241                      pub dwServiceFlags2: DWORD,
 1242                      pub dwServiceFlags3: DWORD,
 1243                      pub dwServiceFlags4: DWORD,
 1244                      pub dwProviderFlags: DWORD,
 1245                      pub ProviderId: GUID,
 1246                      pub dwCatalogEntryId: DWORD,
 1247                      pub ProtocolChain: WSAPROTOCOLCHAIN,
 1248                      pub iVersion: c_int,
 1249                      pub iAddressFamily: c_int,
 1250                      pub iMaxSockAddr: c_int,
 1251                      pub iMinSockAddr: c_int,
 1252                      pub iSocketType: c_int,
 1253                      pub iProtocol: c_int,
 1254                      pub iProtocolMaxOffset: c_int,
 1255                      pub iNetworkByteOrder: c_int,
 1256                      pub iSecurityScheme: c_int,
 1257                      pub dwMessageSize: DWORD,
 1258                      pub dwProviderReserved: DWORD,
 1259                      pub szProtocol: [u8, ..WSAPROTOCOL_LEN+1],
 1260                  }
 1261  
 1262                  pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
 1263  
 1264                  pub type GROUP = c_uint;
 1265              }
 1266          }
 1267      }
 1268  
 1269      #[cfg(target_os = "macos")]
 1270      pub mod os {
 1271          pub mod common {
 1272              pub mod posix01 {
 1273                  use types::common::c95::c_void;
 1274                  use types::os::arch::c95::{c_char, c_int, size_t,
 1275                                                   time_t, suseconds_t, c_long};
 1276                  use types::os::arch::c99::{uintptr_t};
 1277  
 1278                  pub type pthread_t = uintptr_t;
 1279  
 1280                  pub struct glob_t {
 1281                      pub gl_pathc:  size_t,
 1282                      pub __unused1: c_int,
 1283                      pub gl_offs:   size_t,
 1284                      pub __unused2: c_int,
 1285                      pub gl_pathv:  **c_char,
 1286  
 1287                      pub __unused3: *c_void,
 1288  
 1289                      pub __unused4: *c_void,
 1290                      pub __unused5: *c_void,
 1291                      pub __unused6: *c_void,
 1292                      pub __unused7: *c_void,
 1293                      pub __unused8: *c_void,
 1294                  }
 1295  
 1296                  pub struct timeval {
 1297                      pub tv_sec: time_t,
 1298                      pub tv_usec: suseconds_t,
 1299                  }
 1300  
 1301                  pub struct timespec {
 1302                      pub tv_sec: time_t,
 1303                      pub tv_nsec: c_long,
 1304                  }
 1305  
 1306                  pub enum timezone {}
 1307  
 1308                  pub type sighandler_t = size_t;
 1309              }
 1310  
 1311              pub mod bsd44 {
 1312                  use types::os::arch::c95::{c_char, c_int, c_uint};
 1313  
 1314                  pub type socklen_t = c_int;
 1315                  pub type sa_family_t = u8;
 1316                  pub type in_port_t = u16;
 1317                  pub type in_addr_t = u32;
 1318                  pub struct sockaddr {
 1319                      pub sa_len: u8,
 1320                      pub sa_family: sa_family_t,
 1321                      pub sa_data: [u8, ..14],
 1322                  }
 1323                  pub struct sockaddr_storage {
 1324                      pub ss_len: u8,
 1325                      pub ss_family: sa_family_t,
 1326                      pub __ss_pad1: [u8, ..6],
 1327                      pub __ss_align: i64,
 1328                      pub __ss_pad2: [u8, ..112],
 1329                  }
 1330                  pub struct sockaddr_in {
 1331                      pub sin_len: u8,
 1332                      pub sin_family: sa_family_t,
 1333                      pub sin_port: in_port_t,
 1334                      pub sin_addr: in_addr,
 1335                      pub sin_zero: [u8, ..8],
 1336                  }
 1337                  pub struct in_addr {
 1338                      pub s_addr: in_addr_t,
 1339                  }
 1340                  pub struct sockaddr_in6 {
 1341                      pub sin6_len: u8,
 1342                      pub sin6_family: sa_family_t,
 1343                      pub sin6_port: in_port_t,
 1344                      pub sin6_flowinfo: u32,
 1345                      pub sin6_addr: in6_addr,
 1346                      pub sin6_scope_id: u32,
 1347                  }
 1348                  pub struct in6_addr {
 1349                      pub s6_addr: [u16, ..8]
 1350                  }
 1351                  pub struct ip_mreq {
 1352                      pub imr_multiaddr: in_addr,
 1353                      pub imr_interface: in_addr,
 1354                  }
 1355                  pub struct ip6_mreq {
 1356                      pub ipv6mr_multiaddr: in6_addr,
 1357                      pub ipv6mr_interface: c_uint,
 1358                  }
 1359                  pub struct addrinfo {
 1360                      pub ai_flags: c_int,
 1361                      pub ai_family: c_int,
 1362                      pub ai_socktype: c_int,
 1363                      pub ai_protocol: c_int,
 1364                      pub ai_addrlen: socklen_t,
 1365                      pub ai_canonname: *c_char,
 1366                      pub ai_addr: *sockaddr,
 1367                      pub ai_next: *addrinfo,
 1368                  }
 1369                  pub struct sockaddr_un {
 1370                      pub sun_len: u8,
 1371                      pub sun_family: sa_family_t,
 1372                      pub sun_path: [c_char, ..104]
 1373                  }
 1374              }
 1375          }
 1376  
 1377          #[cfg(target_arch = "arm")]
 1378          #[cfg(target_arch = "x86")]
 1379          pub mod arch {
 1380              pub mod c95 {
 1381                  pub type c_char = i8;
 1382                  pub type c_schar = i8;
 1383                  pub type c_uchar = u8;
 1384                  pub type c_short = i16;
 1385                  pub type c_ushort = u16;
 1386                  pub type c_int = i32;
 1387                  pub type c_uint = u32;
 1388                  pub type c_long = i32;
 1389                  pub type c_ulong = u32;
 1390                  pub type c_float = f32;
 1391                  pub type c_double = f64;
 1392                  pub type size_t = u32;
 1393                  pub type ptrdiff_t = i32;
 1394                  pub type clock_t = u32;
 1395                  pub type time_t = i32;
 1396                  pub type suseconds_t = i32;
 1397                  pub type wchar_t = i32;
 1398              }
 1399              pub mod c99 {
 1400                  pub type c_longlong = i64;
 1401                  pub type c_ulonglong = u64;
 1402                  pub type intptr_t = int;
 1403                  pub type uintptr_t = uint;
 1404              }
 1405              pub mod posix88 {
 1406                  pub type off_t = i64;
 1407                  pub type dev_t = i32;
 1408                  pub type ino_t = u64;
 1409                  pub type pid_t = i32;
 1410                  pub type uid_t = u32;
 1411                  pub type gid_t = u32;
 1412                  pub type useconds_t = u32;
 1413                  pub type mode_t = u16;
 1414                  pub type ssize_t = i32;
 1415              }
 1416              pub mod posix01 {
 1417                  use types::common::c99::{int32_t, int64_t, uint32_t};
 1418                  use types::os::arch::c95::{c_char, c_long, time_t};
 1419                  use types::os::arch::posix88::{dev_t, gid_t, ino_t,
 1420                                                       mode_t, off_t, uid_t};
 1421  
 1422                  pub type nlink_t = u16;
 1423                  pub type blksize_t = i64;
 1424                  pub type blkcnt_t = i32;
 1425  
 1426                  pub struct stat {
 1427                      pub st_dev: dev_t,
 1428                      pub st_mode: mode_t,
 1429                      pub st_nlink: nlink_t,
 1430                      pub st_ino: ino_t,
 1431                      pub st_uid: uid_t,
 1432                      pub st_gid: gid_t,
 1433                      pub st_rdev: dev_t,
 1434                      pub st_atime: time_t,
 1435                      pub st_atime_nsec: c_long,
 1436                      pub st_mtime: time_t,
 1437                      pub st_mtime_nsec: c_long,
 1438                      pub st_ctime: time_t,
 1439                      pub st_ctime_nsec: c_long,
 1440                      pub st_birthtime: time_t,
 1441                      pub st_birthtime_nsec: c_long,
 1442                      pub st_size: off_t,
 1443                      pub st_blocks: blkcnt_t,
 1444                      pub st_blksize: blksize_t,
 1445                      pub st_flags: uint32_t,
 1446                      pub st_gen: uint32_t,
 1447                      pub st_lspare: int32_t,
 1448                      pub st_qspare: [int64_t, ..2],
 1449                  }
 1450  
 1451                  pub struct utimbuf {
 1452                      pub actime: time_t,
 1453                      pub modtime: time_t,
 1454                  }
 1455  
 1456                  pub struct pthread_attr_t {
 1457                      pub __sig: c_long,
 1458                      pub __opaque: [c_char, ..36]
 1459                  }
 1460              }
 1461              pub mod posix08 {
 1462              }
 1463              pub mod bsd44 {
 1464              }
 1465              pub mod extra {
 1466                  pub struct mach_timebase_info {
 1467                      pub numer: u32,
 1468                      pub denom: u32,
 1469                  }
 1470  
 1471                  pub type mach_timebase_info_data_t = mach_timebase_info;
 1472              }
 1473          }
 1474  
 1475          #[cfg(target_arch = "x86_64")]
 1476          pub mod arch {
 1477              pub mod c95 {
 1478                  pub type c_char = i8;
 1479                  pub type c_schar = i8;
 1480                  pub type c_uchar = u8;
 1481                  pub type c_short = i16;
 1482                  pub type c_ushort = u16;
 1483                  pub type c_int = i32;
 1484                  pub type c_uint = u32;
 1485                  pub type c_long = i64;
 1486                  pub type c_ulong = u64;
 1487                  pub type c_float = f32;
 1488                  pub type c_double = f64;
 1489                  pub type size_t = u64;
 1490                  pub type ptrdiff_t = i64;
 1491                  pub type clock_t = u64;
 1492                  pub type time_t = i64;
 1493                  pub type suseconds_t = i32;
 1494                  pub type wchar_t = i32;
 1495              }
 1496              pub mod c99 {
 1497                  pub type c_longlong = i64;
 1498                  pub type c_ulonglong = u64;
 1499                  pub type intptr_t = int;
 1500                  pub type uintptr_t = uint;
 1501              }
 1502              pub mod posix88 {
 1503                  pub type off_t = i64;
 1504                  pub type dev_t = i32;
 1505                  pub type ino_t = u64;
 1506                  pub type pid_t = i32;
 1507                  pub type uid_t = u32;
 1508                  pub type gid_t = u32;
 1509                  pub type useconds_t = u32;
 1510                  pub type mode_t = u16;
 1511                  pub type ssize_t = i64;
 1512              }
 1513              pub mod posix01 {
 1514                  use types::common::c99::{int32_t, int64_t};
 1515                  use types::common::c99::{uint32_t};
 1516                  use types::os::arch::c95::{c_char, c_long, time_t};
 1517                  use types::os::arch::posix88::{dev_t, gid_t, ino_t};
 1518                  use types::os::arch::posix88::{mode_t, off_t, uid_t};
 1519  
 1520                  pub type nlink_t = u16;
 1521                  pub type blksize_t = i64;
 1522                  pub type blkcnt_t = i32;
 1523  
 1524                  pub struct stat {
 1525                      pub st_dev: dev_t,
 1526                      pub st_mode: mode_t,
 1527                      pub st_nlink: nlink_t,
 1528                      pub st_ino: ino_t,
 1529                      pub st_uid: uid_t,
 1530                      pub st_gid: gid_t,
 1531                      pub st_rdev: dev_t,
 1532                      pub st_atime: time_t,
 1533                      pub st_atime_nsec: c_long,
 1534                      pub st_mtime: time_t,
 1535                      pub st_mtime_nsec: c_long,
 1536                      pub st_ctime: time_t,
 1537                      pub st_ctime_nsec: c_long,
 1538                      pub st_birthtime: time_t,
 1539                      pub st_birthtime_nsec: c_long,
 1540                      pub st_size: off_t,
 1541                      pub st_blocks: blkcnt_t,
 1542                      pub st_blksize: blksize_t,
 1543                      pub st_flags: uint32_t,
 1544                      pub st_gen: uint32_t,
 1545                      pub st_lspare: int32_t,
 1546                      pub st_qspare: [int64_t, ..2],
 1547                  }
 1548  
 1549                  pub struct utimbuf {
 1550                      pub actime: time_t,
 1551                      pub modtime: time_t,
 1552                  }
 1553  
 1554                  pub struct pthread_attr_t {
 1555                      pub __sig: c_long,
 1556                      pub __opaque: [c_char, ..56]
 1557                  }
 1558              }
 1559              pub mod posix08 {
 1560              }
 1561              pub mod bsd44 {
 1562              }
 1563              pub mod extra {
 1564                  pub struct mach_timebase_info {
 1565                      pub numer: u32,
 1566                      pub denom: u32,
 1567                  }
 1568  
 1569                  pub type mach_timebase_info_data_t = mach_timebase_info;
 1570              }
 1571          }
 1572      }
 1573  }
 1574  
 1575  pub mod consts {
 1576      // Consts tend to vary per OS so we pull their definitions out
 1577      // into this module.
 1578  
 1579      #[cfg(target_os = "win32")]
 1580      pub mod os {
 1581          pub mod c95 {
 1582              use types::os::arch::c95::{c_int, c_uint};
 1583  
 1584              pub static EXIT_FAILURE : c_int = 1;
 1585              pub static EXIT_SUCCESS : c_int = 0;
 1586              pub static RAND_MAX : c_int = 32767;
 1587              pub static EOF : c_int = -1;
 1588              pub static SEEK_SET : c_int = 0;
 1589              pub static SEEK_CUR : c_int = 1;
 1590              pub static SEEK_END : c_int = 2;
 1591              pub static _IOFBF : c_int = 0;
 1592              pub static _IONBF : c_int = 4;
 1593              pub static _IOLBF : c_int = 64;
 1594              pub static BUFSIZ : c_uint = 512_u32;
 1595              pub static FOPEN_MAX : c_uint = 20_u32;
 1596              pub static FILENAME_MAX : c_uint = 260_u32;
 1597              pub static L_tmpnam : c_uint = 16_u32;
 1598              pub static TMP_MAX : c_uint = 32767_u32;
 1599  
 1600              pub static WSAEINTR: c_int = 10004;
 1601              pub static WSAEBADF: c_int = 10009;
 1602              pub static WSAEACCES: c_int = 10013;
 1603              pub static WSAEFAULT: c_int = 10014;
 1604              pub static WSAEINVAL: c_int = 10022;
 1605              pub static WSAEMFILE: c_int = 10024;
 1606              pub static WSAEWOULDBLOCK: c_int = 10035;
 1607              pub static WSAEINPROGRESS: c_int = 10036;
 1608              pub static WSAEALREADY: c_int = 10037;
 1609              pub static WSAENOTSOCK: c_int = 10038;
 1610              pub static WSAEDESTADDRREQ: c_int = 10039;
 1611              pub static WSAEMSGSIZE: c_int = 10040;
 1612              pub static WSAEPROTOTYPE: c_int = 10041;
 1613              pub static WSAENOPROTOOPT: c_int = 10042;
 1614              pub static WSAEPROTONOSUPPORT: c_int = 10043;
 1615              pub static WSAESOCKTNOSUPPORT: c_int = 10044;
 1616              pub static WSAEOPNOTSUPP: c_int = 10045;
 1617              pub static WSAEPFNOSUPPORT: c_int = 10046;
 1618              pub static WSAEAFNOSUPPORT: c_int = 10047;
 1619              pub static WSAEADDRINUSE: c_int = 10048;
 1620              pub static WSAEADDRNOTAVAIL: c_int = 10049;
 1621              pub static WSAENETDOWN: c_int = 10050;
 1622              pub static WSAENETUNREACH: c_int = 10051;
 1623              pub static WSAENETRESET: c_int = 10052;
 1624              pub static WSAECONNABORTED: c_int = 10053;
 1625              pub static WSAECONNRESET: c_int = 10054;
 1626              pub static WSAENOBUFS: c_int = 10055;
 1627              pub static WSAEISCONN: c_int = 10056;
 1628              pub static WSAENOTCONN: c_int = 10057;
 1629              pub static WSAESHUTDOWN: c_int = 10058;
 1630              pub static WSAETOOMANYREFS: c_int = 10059;
 1631              pub static WSAETIMEDOUT: c_int = 10060;
 1632              pub static WSAECONNREFUSED: c_int = 10061;
 1633              pub static WSAELOOP: c_int = 10062;
 1634              pub static WSAENAMETOOLONG: c_int = 10063;
 1635              pub static WSAEHOSTDOWN: c_int = 10064;
 1636              pub static WSAEHOSTUNREACH: c_int = 10065;
 1637              pub static WSAENOTEMPTY: c_int = 10066;
 1638              pub static WSAEPROCLIM: c_int = 10067;
 1639              pub static WSAEUSERS: c_int = 10068;
 1640              pub static WSAEDQUOT: c_int = 10069;
 1641              pub static WSAESTALE: c_int = 10070;
 1642              pub static WSAEREMOTE: c_int = 10071;
 1643              pub static WSASYSNOTREADY: c_int = 10091;
 1644              pub static WSAVERNOTSUPPORTED: c_int = 10092;
 1645              pub static WSANOTINITIALISED: c_int = 10093;
 1646              pub static WSAEDISCON: c_int = 10101;
 1647              pub static WSAENOMORE: c_int = 10102;
 1648              pub static WSAECANCELLED: c_int = 10103;
 1649              pub static WSAEINVALIDPROCTABLE: c_int = 10104;
 1650              pub static WSAEINVALIDPROVIDER: c_int = 10105;
 1651              pub static WSAEPROVIDERFAILEDINIT: c_int = 10106;
 1652          }
 1653          pub mod c99 {
 1654          }
 1655          pub mod posix88 {
 1656              use types::os::arch::c95::c_int;
 1657  
 1658              pub static O_RDONLY : c_int = 0;
 1659              pub static O_WRONLY : c_int = 1;
 1660              pub static O_RDWR : c_int = 2;
 1661              pub static O_APPEND : c_int = 8;
 1662              pub static O_CREAT : c_int = 256;
 1663              pub static O_EXCL : c_int = 1024;
 1664              pub static O_TRUNC : c_int = 512;
 1665              pub static S_IFIFO : c_int = 4096;
 1666              pub static S_IFCHR : c_int = 8192;
 1667              pub static S_IFBLK : c_int = 12288;
 1668              pub static S_IFDIR : c_int = 16384;
 1669              pub static S_IFREG : c_int = 32768;
 1670              pub static S_IFLNK : c_int = 40960;
 1671              pub static S_IFMT : c_int = 61440;
 1672              pub static S_IEXEC : c_int = 64;
 1673              pub static S_IWRITE : c_int = 128;
 1674              pub static S_IREAD : c_int = 256;
 1675              pub static S_IRWXU : c_int = 448;
 1676              pub static S_IXUSR : c_int = 64;
 1677              pub static S_IWUSR : c_int = 128;
 1678              pub static S_IRUSR : c_int = 256;
 1679              pub static F_OK : c_int = 0;
 1680              pub static R_OK : c_int = 4;
 1681              pub static W_OK : c_int = 2;
 1682              pub static X_OK : c_int = 1;
 1683              pub static STDIN_FILENO : c_int = 0;
 1684              pub static STDOUT_FILENO : c_int = 1;
 1685              pub static STDERR_FILENO : c_int = 2;
 1686          }
 1687          pub mod posix01 {
 1688          }
 1689          pub mod posix08 {
 1690          }
 1691          pub mod bsd44 {
 1692              use types::os::arch::c95::c_int;
 1693  
 1694              pub static AF_INET: c_int = 2;
 1695              pub static AF_INET6: c_int = 23;
 1696              pub static SOCK_STREAM: c_int = 1;
 1697              pub static SOCK_DGRAM: c_int = 2;
 1698              pub static IPPROTO_TCP: c_int = 6;
 1699              pub static IPPROTO_IP: c_int = 0;
 1700              pub static IPPROTO_IPV6: c_int = 41;
 1701              pub static IP_MULTICAST_TTL: c_int = 3;
 1702              pub static IP_MULTICAST_LOOP: c_int = 4;
 1703              pub static IP_ADD_MEMBERSHIP: c_int = 5;
 1704              pub static IP_DROP_MEMBERSHIP: c_int = 6;
 1705              pub static IPV6_ADD_MEMBERSHIP: c_int = 5;
 1706              pub static IPV6_DROP_MEMBERSHIP: c_int = 6;
 1707              pub static IP_TTL: c_int = 4;
 1708  
 1709              pub static TCP_NODELAY: c_int = 0x0001;
 1710              pub static SOL_SOCKET: c_int = 0xffff;
 1711              pub static SO_KEEPALIVE: c_int = 8;
 1712              pub static SO_BROADCAST: c_int = 32;
 1713              pub static SO_REUSEADDR: c_int = 4;
 1714              pub static SO_ERROR: c_int = 0x1007;
 1715  
 1716              pub static SHUT_RD: c_int = 0;
 1717              pub static SHUT_WR: c_int = 1;
 1718              pub static SHUT_RDWR: c_int = 2;
 1719          }
 1720          pub mod extra {
 1721              use types::os::arch::c95::c_int;
 1722              use types::os::arch::extra::{WORD, DWORD, BOOL};
 1723  
 1724              pub static TRUE : BOOL = 1;
 1725              pub static FALSE : BOOL = 0;
 1726  
 1727              pub static O_TEXT : c_int = 16384;
 1728              pub static O_BINARY : c_int = 32768;
 1729              pub static O_NOINHERIT: c_int = 128;
 1730  
 1731              pub static ERROR_SUCCESS : c_int = 0;
 1732              pub static ERROR_INVALID_FUNCTION: c_int = 1;
 1733              pub static ERROR_FILE_NOT_FOUND: c_int = 2;
 1734              pub static ERROR_ACCESS_DENIED: c_int = 5;
 1735              pub static ERROR_INVALID_HANDLE : c_int = 6;
 1736              pub static ERROR_BROKEN_PIPE: c_int = 109;
 1737              pub static ERROR_DISK_FULL : c_int = 112;
 1738              pub static ERROR_INSUFFICIENT_BUFFER : c_int = 122;
 1739              pub static ERROR_INVALID_NAME : c_int = 123;
 1740              pub static ERROR_ALREADY_EXISTS : c_int = 183;
 1741              pub static ERROR_PIPE_BUSY: c_int = 231;
 1742              pub static ERROR_NO_DATA: c_int = 232;
 1743              pub static ERROR_INVALID_ADDRESS : c_int = 487;
 1744              pub static ERROR_PIPE_CONNECTED: c_int = 535;
 1745              pub static ERROR_OPERATION_ABORTED: c_int = 995;
 1746              pub static ERROR_IO_PENDING: c_int = 997;
 1747              pub static ERROR_FILE_INVALID : c_int = 1006;
 1748              pub static ERROR_NOT_FOUND: c_int = 1168;
 1749              pub static INVALID_HANDLE_VALUE : c_int = -1;
 1750  
 1751              pub static DELETE : DWORD = 0x00010000;
 1752              pub static READ_CONTROL : DWORD = 0x00020000;
 1753              pub static SYNCHRONIZE : DWORD = 0x00100000;
 1754              pub static WRITE_DAC : DWORD = 0x00040000;
 1755              pub static WRITE_OWNER : DWORD = 0x00080000;
 1756  
 1757              pub static PROCESS_CREATE_PROCESS : DWORD = 0x0080;
 1758              pub static PROCESS_CREATE_THREAD : DWORD = 0x0002;
 1759              pub static PROCESS_DUP_HANDLE : DWORD = 0x0040;
 1760              pub static PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
 1761              pub static PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
 1762              pub static PROCESS_SET_INFORMATION : DWORD = 0x0200;
 1763              pub static PROCESS_SET_QUOTA : DWORD = 0x0100;
 1764              pub static PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
 1765              pub static PROCESS_TERMINATE : DWORD = 0x0001;
 1766              pub static PROCESS_VM_OPERATION : DWORD = 0x0008;
 1767              pub static PROCESS_VM_READ : DWORD = 0x0010;
 1768              pub static PROCESS_VM_WRITE : DWORD = 0x0020;
 1769  
 1770              pub static STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
 1771              pub static STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
 1772              pub static STARTF_PREVENTPINNING : DWORD = 0x00002000;
 1773              pub static STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
 1774              pub static STARTF_TITLEISAPPID : DWORD = 0x00001000;
 1775              pub static STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
 1776              pub static STARTF_USECOUNTCHARS : DWORD = 0x00000008;
 1777              pub static STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
 1778              pub static STARTF_USEHOTKEY : DWORD = 0x00000200;
 1779              pub static STARTF_USEPOSITION : DWORD = 0x00000004;
 1780              pub static STARTF_USESHOWWINDOW : DWORD = 0x00000001;
 1781              pub static STARTF_USESIZE : DWORD = 0x00000002;
 1782              pub static STARTF_USESTDHANDLES : DWORD = 0x00000100;
 1783  
 1784              pub static WAIT_ABANDONED : DWORD = 0x00000080;
 1785              pub static WAIT_OBJECT_0 : DWORD = 0x00000000;
 1786              pub static WAIT_TIMEOUT : DWORD = 0x00000102;
 1787              pub static WAIT_FAILED : DWORD = -1;
 1788  
 1789              pub static DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
 1790              pub static DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;
 1791  
 1792              pub static INFINITE : DWORD = -1;
 1793              pub static STILL_ACTIVE : DWORD = 259;
 1794  
 1795              pub static MEM_COMMIT : DWORD = 0x00001000;
 1796              pub static MEM_RESERVE : DWORD = 0x00002000;
 1797              pub static MEM_DECOMMIT : DWORD = 0x00004000;
 1798              pub static MEM_RELEASE : DWORD = 0x00008000;
 1799              pub static MEM_RESET : DWORD = 0x00080000;
 1800              pub static MEM_RESET_UNDO : DWORD = 0x1000000;
 1801              pub static MEM_LARGE_PAGES : DWORD = 0x20000000;
 1802              pub static MEM_PHYSICAL : DWORD = 0x00400000;
 1803              pub static MEM_TOP_DOWN : DWORD = 0x00100000;
 1804              pub static MEM_WRITE_WATCH : DWORD = 0x00200000;
 1805  
 1806              pub static PAGE_EXECUTE : DWORD = 0x10;
 1807              pub static PAGE_EXECUTE_READ : DWORD = 0x20;
 1808              pub static PAGE_EXECUTE_READWRITE : DWORD = 0x40;
 1809              pub static PAGE_EXECUTE_WRITECOPY : DWORD = 0x80;
 1810              pub static PAGE_NOACCESS : DWORD = 0x01;
 1811              pub static PAGE_READONLY : DWORD = 0x02;
 1812              pub static PAGE_READWRITE : DWORD = 0x04;
 1813              pub static PAGE_WRITECOPY : DWORD = 0x08;
 1814              pub static PAGE_GUARD : DWORD = 0x100;
 1815              pub static PAGE_NOCACHE : DWORD = 0x200;
 1816              pub static PAGE_WRITECOMBINE : DWORD = 0x400;
 1817  
 1818              pub static SEC_COMMIT : DWORD = 0x8000000;
 1819              pub static SEC_IMAGE : DWORD = 0x1000000;
 1820              pub static SEC_IMAGE_NO_EXECUTE : DWORD = 0x11000000;
 1821              pub static SEC_LARGE_PAGES : DWORD = 0x80000000;
 1822              pub static SEC_NOCACHE : DWORD = 0x10000000;
 1823              pub static SEC_RESERVE : DWORD = 0x4000000;
 1824              pub static SEC_WRITECOMBINE : DWORD = 0x40000000;
 1825  
 1826              pub static FILE_MAP_ALL_ACCESS : DWORD = 0xf001f;
 1827              pub static FILE_MAP_READ : DWORD = 0x4;
 1828              pub static FILE_MAP_WRITE : DWORD = 0x2;
 1829              pub static FILE_MAP_COPY : DWORD = 0x1;
 1830              pub static FILE_MAP_EXECUTE : DWORD = 0x20;
 1831  
 1832              pub static PROCESSOR_ARCHITECTURE_INTEL : WORD = 0;
 1833              pub static PROCESSOR_ARCHITECTURE_ARM : WORD = 5;
 1834              pub static PROCESSOR_ARCHITECTURE_IA64 : WORD = 6;
 1835              pub static PROCESSOR_ARCHITECTURE_AMD64 : WORD = 9;
 1836              pub static PROCESSOR_ARCHITECTURE_UNKNOWN : WORD = 0xffff;
 1837  
 1838              pub static MOVEFILE_COPY_ALLOWED: DWORD = 2;
 1839              pub static MOVEFILE_CREATE_HARDLINK: DWORD = 16;
 1840              pub static MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 4;
 1841              pub static MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 32;
 1842              pub static MOVEFILE_REPLACE_EXISTING: DWORD = 1;
 1843              pub static MOVEFILE_WRITE_THROUGH: DWORD = 8;
 1844  
 1845              pub static SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 1;
 1846  
 1847              pub static FILE_SHARE_DELETE: DWORD = 0x4;
 1848              pub static FILE_SHARE_READ: DWORD = 0x1;
 1849              pub static FILE_SHARE_WRITE: DWORD = 0x2;
 1850  
 1851              pub static CREATE_ALWAYS: DWORD = 2;
 1852              pub static CREATE_NEW: DWORD = 1;
 1853              pub static OPEN_ALWAYS: DWORD = 4;
 1854              pub static OPEN_EXISTING: DWORD = 3;
 1855              pub static TRUNCATE_EXISTING: DWORD = 5;
 1856  
 1857              pub static FILE_APPEND_DATA: DWORD = 0x00000004;
 1858              pub static FILE_READ_DATA: DWORD = 0x00000001;
 1859              pub static FILE_WRITE_DATA: DWORD = 0x00000002;
 1860  
 1861              pub static FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x20;
 1862              pub static FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x800;
 1863              pub static FILE_ATTRIBUTE_DEVICE: DWORD = 0x40;
 1864              pub static FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
 1865              pub static FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x4000;
 1866              pub static FILE_ATTRIBUTE_HIDDEN: DWORD = 0x2;
 1867              pub static FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x8000;
 1868              pub static FILE_ATTRIBUTE_NORMAL: DWORD = 0x80;
 1869              pub static FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x2000;
 1870              pub static FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x20000;
 1871              pub static FILE_ATTRIBUTE_OFFLINE: DWORD = 0x1000;
 1872              pub static FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
 1873              pub static FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
 1874              pub static FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x200;
 1875              pub static FILE_ATTRIBUTE_SYSTEM: DWORD = 0x4;
 1876              pub static FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x100;
 1877              pub static FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x10000;
 1878  
 1879              pub static FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
 1880              pub static FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000;
 1881              pub static FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000;
 1882              pub static FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000;
 1883              pub static FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
 1884              pub static FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
 1885              pub static FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x0100000;
 1886              pub static FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000;
 1887              pub static FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000;
 1888              pub static FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000;
 1889              pub static FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000;
 1890              pub static FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
 1891  
 1892              pub static FILE_NAME_NORMALIZED: DWORD = 0x0;
 1893              pub static FILE_NAME_OPENED: DWORD = 0x8;
 1894  
 1895              pub static VOLUME_NAME_DOS: DWORD = 0x0;
 1896              pub static VOLUME_NAME_GUID: DWORD = 0x1;
 1897              pub static VOLUME_NAME_NONE: DWORD = 0x4;
 1898              pub static VOLUME_NAME_NT: DWORD = 0x2;
 1899  
 1900              pub static GENERIC_READ: DWORD = 0x80000000;
 1901              pub static GENERIC_WRITE: DWORD = 0x40000000;
 1902              pub static GENERIC_EXECUTE: DWORD = 0x20000000;
 1903              pub static GENERIC_ALL: DWORD = 0x10000000;
 1904              pub static FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
 1905              pub static FILE_READ_ATTRIBUTES: DWORD = 0x00000080;
 1906  
 1907              pub static STANDARD_RIGHTS_READ: DWORD = 0x20000;
 1908              pub static STANDARD_RIGHTS_WRITE: DWORD = 0x20000;
 1909              pub static FILE_WRITE_EA: DWORD = 0x00000010;
 1910              pub static FILE_READ_EA: DWORD = 0x00000008;
 1911              pub static FILE_GENERIC_READ: DWORD =
 1912                  STANDARD_RIGHTS_READ | FILE_READ_DATA |
 1913                  FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE;
 1914              pub static FILE_GENERIC_WRITE: DWORD =
 1915                  STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA |
 1916                  FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA |
 1917                  SYNCHRONIZE;
 1918  
 1919              pub static FILE_BEGIN: DWORD = 0;
 1920              pub static FILE_CURRENT: DWORD = 1;
 1921              pub static FILE_END: DWORD = 2;
 1922  
 1923              pub static MAX_PROTOCOL_CHAIN: DWORD = 7;
 1924              pub static WSAPROTOCOL_LEN: DWORD = 255;
 1925              pub static INVALID_SOCKET: DWORD = !0;
 1926  
 1927              pub static DETACHED_PROCESS: DWORD = 0x00000008;
 1928              pub static CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
 1929  
 1930              pub static PIPE_ACCESS_DUPLEX: DWORD = 0x00000003;
 1931              pub static PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
 1932              pub static PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
 1933              pub static PIPE_TYPE_BYTE: DWORD = 0x00000000;
 1934              pub static PIPE_TYPE_MESSAGE: DWORD = 0x00000004;
 1935              pub static PIPE_READMODE_BYTE: DWORD = 0x00000000;
 1936              pub static PIPE_READMODE_MESSAGE: DWORD = 0x00000002;
 1937              pub static PIPE_WAIT: DWORD = 0x00000000;
 1938              pub static PIPE_NOWAIT: DWORD = 0x00000001;
 1939              pub static PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000;
 1940              pub static PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
 1941              pub static PIPE_UNLIMITED_INSTANCES: DWORD = 255;
 1942          }
 1943          pub mod sysconf {
 1944          }
 1945      }
 1946  
 1947  
 1948      #[cfg(target_os = "linux")]
 1949      #[cfg(target_os = "android")]
 1950      pub mod os {
 1951          pub mod c95 {
 1952              use types::os::arch::c95::{c_int, c_uint};
 1953  
 1954              pub static EXIT_FAILURE : c_int = 1;
 1955              pub static EXIT_SUCCESS : c_int = 0;
 1956              pub static RAND_MAX : c_int = 2147483647;
 1957              pub static EOF : c_int = -1;
 1958              pub static SEEK_SET : c_int = 0;
 1959              pub static SEEK_CUR : c_int = 1;
 1960              pub static SEEK_END : c_int = 2;
 1961              pub static _IOFBF : c_int = 0;
 1962              pub static _IONBF : c_int = 2;
 1963              pub static _IOLBF : c_int = 1;
 1964              pub static BUFSIZ : c_uint = 8192_u32;
 1965              pub static FOPEN_MAX : c_uint = 16_u32;
 1966              pub static FILENAME_MAX : c_uint = 4096_u32;
 1967              pub static L_tmpnam : c_uint = 20_u32;
 1968              pub static TMP_MAX : c_uint = 238328_u32;
 1969          }
 1970          pub mod c99 {
 1971          }
 1972          #[cfg(target_arch = "x86")]
 1973          #[cfg(target_arch = "x86_64")]
 1974          #[cfg(target_arch = "arm")]
 1975          pub mod posix88 {
 1976              use types::os::arch::c95::c_int;
 1977              use types::common::c95::c_void;
 1978  
 1979              pub static O_RDONLY : c_int = 0;
 1980              pub static O_WRONLY : c_int = 1;
 1981              pub static O_RDWR : c_int = 2;
 1982              pub static O_APPEND : c_int = 1024;
 1983              pub static O_CREAT : c_int = 64;
 1984              pub static O_EXCL : c_int = 128;
 1985              pub static O_TRUNC : c_int = 512;
 1986              pub static S_IFIFO : c_int = 4096;
 1987              pub static S_IFCHR : c_int = 8192;
 1988              pub static S_IFBLK : c_int = 24576;
 1989              pub static S_IFDIR : c_int = 16384;
 1990              pub static S_IFREG : c_int = 32768;
 1991              pub static S_IFLNK : c_int = 40960;
 1992              pub static S_IFMT : c_int = 61440;
 1993              pub static S_IEXEC : c_int = 64;
 1994              pub static S_IWRITE : c_int = 128;
 1995              pub static S_IREAD : c_int = 256;
 1996              pub static S_IRWXU : c_int = 448;
 1997              pub static S_IXUSR : c_int = 64;
 1998              pub static S_IWUSR : c_int = 128;
 1999              pub static S_IRUSR : c_int = 256;
 2000              pub static F_OK : c_int = 0;
 2001              pub static R_OK : c_int = 4;
 2002              pub static W_OK : c_int = 2;
 2003              pub static X_OK : c_int = 1;
 2004              pub static STDIN_FILENO : c_int = 0;
 2005              pub static STDOUT_FILENO : c_int = 1;
 2006              pub static STDERR_FILENO : c_int = 2;
 2007              pub static F_LOCK : c_int = 1;
 2008              pub static F_TEST : c_int = 3;
 2009              pub static F_TLOCK : c_int = 2;
 2010              pub static F_ULOCK : c_int = 0;
 2011              pub static SIGHUP : c_int = 1;
 2012              pub static SIGINT : c_int = 2;
 2013              pub static SIGQUIT : c_int = 3;
 2014              pub static SIGILL : c_int = 4;
 2015              pub static SIGABRT : c_int = 6;
 2016              pub static SIGFPE : c_int = 8;
 2017              pub static SIGKILL : c_int = 9;
 2018              pub static SIGSEGV : c_int = 11;
 2019              pub static SIGPIPE : c_int = 13;
 2020              pub static SIGALRM : c_int = 14;
 2021              pub static SIGTERM : c_int = 15;
 2022  
 2023              pub static PROT_NONE : c_int = 0;
 2024              pub static PROT_READ : c_int = 1;
 2025              pub static PROT_WRITE : c_int = 2;
 2026              pub static PROT_EXEC : c_int = 4;
 2027  
 2028              pub static MAP_FILE : c_int = 0x0000;
 2029              pub static MAP_SHARED : c_int = 0x0001;
 2030              pub static MAP_PRIVATE : c_int = 0x0002;
 2031              pub static MAP_FIXED : c_int = 0x0010;
 2032              pub static MAP_ANON : c_int = 0x0020;
 2033  
 2034              pub static MAP_FAILED : *c_void = -1 as *c_void;
 2035  
 2036              pub static MCL_CURRENT : c_int = 0x0001;
 2037              pub static MCL_FUTURE : c_int = 0x0002;
 2038  
 2039              pub static MS_ASYNC : c_int = 0x0001;
 2040              pub static MS_INVALIDATE : c_int = 0x0002;
 2041              pub static MS_SYNC : c_int = 0x0004;
 2042  
 2043              pub static EPERM : c_int = 1;
 2044              pub static ENOENT : c_int = 2;
 2045              pub static ESRCH : c_int = 3;
 2046              pub static EINTR : c_int = 4;
 2047              pub static EIO : c_int = 5;
 2048              pub static ENXIO : c_int = 6;
 2049              pub static E2BIG : c_int = 7;
 2050              pub static ENOEXEC : c_int = 8;
 2051              pub static EBADF : c_int = 9;
 2052              pub static ECHILD : c_int = 10;
 2053              pub static EAGAIN : c_int = 11;
 2054              pub static ENOMEM : c_int = 12;
 2055              pub static EACCES : c_int = 13;
 2056              pub static EFAULT : c_int = 14;
 2057              pub static ENOTBLK : c_int = 15;
 2058              pub static EBUSY : c_int = 16;
 2059              pub static EEXIST : c_int = 17;
 2060              pub static EXDEV : c_int = 18;
 2061              pub static ENODEV : c_int = 19;
 2062              pub static ENOTDIR : c_int = 20;
 2063              pub static EISDIR : c_int = 21;
 2064              pub static EINVAL : c_int = 22;
 2065              pub static ENFILE : c_int = 23;
 2066              pub static EMFILE : c_int = 24;
 2067              pub static ENOTTY : c_int = 25;
 2068              pub static ETXTBSY : c_int = 26;
 2069              pub static EFBIG : c_int = 27;
 2070              pub static ENOSPC : c_int = 28;
 2071              pub static ESPIPE : c_int = 29;
 2072              pub static EROFS : c_int = 30;
 2073              pub static EMLINK : c_int = 31;
 2074              pub static EPIPE : c_int = 32;
 2075              pub static EDOM : c_int = 33;
 2076              pub static ERANGE : c_int = 34;
 2077  
 2078              pub static EDEADLK: c_int = 35;
 2079              pub static ENAMETOOLONG: c_int = 36;
 2080              pub static ENOLCK: c_int = 37;
 2081              pub static ENOSYS: c_int = 38;
 2082              pub static ENOTEMPTY: c_int = 39;
 2083              pub static ELOOP: c_int = 40;
 2084              pub static EWOULDBLOCK: c_int = EAGAIN;
 2085              pub static ENOMSG: c_int = 42;
 2086              pub static EIDRM: c_int = 43;
 2087              pub static ECHRNG: c_int = 44;
 2088              pub static EL2NSYNC: c_int = 45;
 2089              pub static EL3HLT: c_int = 46;
 2090              pub static EL3RST: c_int = 47;
 2091              pub static ELNRNG: c_int = 48;
 2092              pub static EUNATCH: c_int = 49;
 2093              pub static ENOCSI: c_int = 50;
 2094              pub static EL2HLT: c_int = 51;
 2095              pub static EBADE: c_int = 52;
 2096              pub static EBADR: c_int = 53;
 2097              pub static EXFULL: c_int = 54;
 2098              pub static ENOANO: c_int = 55;
 2099              pub static EBADRQC: c_int = 56;
 2100              pub static EBADSLT: c_int = 57;
 2101  
 2102              pub static EDEADLOCK: c_int = EDEADLK;
 2103  
 2104              pub static EBFONT: c_int = 59;
 2105              pub static ENOSTR: c_int = 60;
 2106              pub static ENODATA: c_int = 61;
 2107              pub static ETIME: c_int = 62;
 2108              pub static ENOSR: c_int = 63;
 2109              pub static ENONET: c_int = 64;
 2110              pub static ENOPKG: c_int = 65;
 2111              pub static EREMOTE: c_int = 66;
 2112              pub static ENOLINK: c_int = 67;
 2113              pub static EADV: c_int = 68;
 2114              pub static ESRMNT: c_int = 69;
 2115              pub static ECOMM: c_int = 70;
 2116              pub static EPROTO: c_int = 71;
 2117              pub static EMULTIHOP: c_int = 72;
 2118              pub static EDOTDOT: c_int = 73;
 2119              pub static EBADMSG: c_int = 74;
 2120              pub static EOVERFLOW: c_int = 75;
 2121              pub static ENOTUNIQ: c_int = 76;
 2122              pub static EBADFD: c_int = 77;
 2123              pub static EREMCHG: c_int = 78;
 2124              pub static ELIBACC: c_int = 79;
 2125              pub static ELIBBAD: c_int = 80;
 2126              pub static ELIBSCN: c_int = 81;
 2127              pub static ELIBMAX: c_int = 82;
 2128              pub static ELIBEXEC: c_int = 83;
 2129              pub static EILSEQ: c_int = 84;
 2130              pub static ERESTART: c_int = 85;
 2131              pub static ESTRPIPE: c_int = 86;
 2132              pub static EUSERS: c_int = 87;
 2133              pub static ENOTSOCK: c_int = 88;
 2134              pub static EDESTADDRREQ: c_int = 89;
 2135              pub static EMSGSIZE: c_int = 90;
 2136              pub static EPROTOTYPE: c_int = 91;
 2137              pub static ENOPROTOOPT: c_int = 92;
 2138              pub static EPROTONOSUPPORT: c_int = 93;
 2139              pub static ESOCKTNOSUPPORT: c_int = 94;
 2140              pub static EOPNOTSUPP: c_int = 95;
 2141              pub static EPFNOSUPPORT: c_int = 96;
 2142              pub static EAFNOSUPPORT: c_int = 97;
 2143              pub static EADDRINUSE: c_int = 98;
 2144              pub static EADDRNOTAVAIL: c_int = 99;
 2145              pub static ENETDOWN: c_int = 100;
 2146              pub static ENETUNREACH: c_int = 101;
 2147              pub static ENETRESET: c_int = 102;
 2148              pub static ECONNABORTED: c_int = 103;
 2149              pub static ECONNRESET: c_int = 104;
 2150              pub static ENOBUFS: c_int = 105;
 2151              pub static EISCONN: c_int = 106;
 2152              pub static ENOTCONN: c_int = 107;
 2153              pub static ESHUTDOWN: c_int = 108;
 2154              pub static ETOOMANYREFS: c_int = 109;
 2155              pub static ETIMEDOUT: c_int = 110;
 2156              pub static ECONNREFUSED: c_int = 111;
 2157              pub static EHOSTDOWN: c_int = 112;
 2158              pub static EHOSTUNREACH: c_int = 113;
 2159              pub static EALREADY: c_int = 114;
 2160              pub static EINPROGRESS: c_int = 115;
 2161              pub static ESTALE: c_int = 116;
 2162              pub static EUCLEAN: c_int = 117;
 2163              pub static ENOTNAM: c_int = 118;
 2164              pub static ENAVAIL: c_int = 119;
 2165              pub static EISNAM: c_int = 120;
 2166              pub static EREMOTEIO: c_int = 121;
 2167              pub static EDQUOT: c_int = 122;
 2168  
 2169              pub static ENOMEDIUM: c_int = 123;
 2170              pub static EMEDIUMTYPE: c_int = 124;
 2171              pub static ECANCELED: c_int = 125;
 2172              pub static ENOKEY: c_int = 126;
 2173              pub static EKEYEXPIRED: c_int = 127;
 2174              pub static EKEYREVOKED: c_int = 128;
 2175              pub static EKEYREJECTED: c_int = 129;
 2176  
 2177              pub static EOWNERDEAD: c_int = 130;
 2178              pub static ENOTRECOVERABLE: c_int = 131;
 2179  
 2180              pub static ERFKILL: c_int = 132;
 2181  
 2182              pub static EHWPOISON: c_int = 133;
 2183          }
 2184  
 2185          #[cfg(target_arch = "mips")]
 2186          pub mod posix88 {
 2187              use types::os::arch::c95::c_int;
 2188              use types::common::c95::c_void;
 2189  
 2190              pub static O_RDONLY : c_int = 0;
 2191              pub static O_WRONLY : c_int = 1;
 2192              pub static O_RDWR : c_int = 2;
 2193              pub static O_APPEND : c_int = 8;
 2194              pub static O_CREAT : c_int = 256;
 2195              pub static O_EXCL : c_int = 1024;
 2196              pub static O_TRUNC : c_int = 512;
 2197              pub static S_IFIFO : c_int = 4096;
 2198              pub static S_IFCHR : c_int = 8192;
 2199              pub static S_IFBLK : c_int = 24576;
 2200              pub static S_IFDIR : c_int = 16384;
 2201              pub static S_IFREG : c_int = 32768;
 2202              pub static S_IFLNK : c_int = 40960;
 2203              pub static S_IFMT : c_int = 61440;
 2204              pub static S_IEXEC : c_int = 64;
 2205              pub static S_IWRITE : c_int = 128;
 2206              pub static S_IREAD : c_int = 256;
 2207              pub static S_IRWXU : c_int = 448;
 2208              pub static S_IXUSR : c_int = 64;
 2209              pub static S_IWUSR : c_int = 128;
 2210              pub static S_IRUSR : c_int = 256;
 2211              pub static F_OK : c_int = 0;
 2212              pub static R_OK : c_int = 4;
 2213              pub static W_OK : c_int = 2;
 2214              pub static X_OK : c_int = 1;
 2215              pub static STDIN_FILENO : c_int = 0;
 2216              pub static STDOUT_FILENO : c_int = 1;
 2217              pub static STDERR_FILENO : c_int = 2;
 2218              pub static F_LOCK : c_int = 1;
 2219              pub static F_TEST : c_int = 3;
 2220              pub static F_TLOCK : c_int = 2;
 2221              pub static F_ULOCK : c_int = 0;
 2222              pub static SIGHUP : c_int = 1;
 2223              pub static SIGINT : c_int = 2;
 2224              pub static SIGQUIT : c_int = 3;
 2225              pub static SIGILL : c_int = 4;
 2226              pub static SIGABRT : c_int = 6;
 2227              pub static SIGFPE : c_int = 8;
 2228              pub static SIGKILL : c_int = 9;
 2229              pub static SIGSEGV : c_int = 11;
 2230              pub static SIGPIPE : c_int = 13;
 2231              pub static SIGALRM : c_int = 14;
 2232              pub static SIGTERM : c_int = 15;
 2233  
 2234              pub static PROT_NONE : c_int = 0;
 2235              pub static PROT_READ : c_int = 1;
 2236              pub static PROT_WRITE : c_int = 2;
 2237              pub static PROT_EXEC : c_int = 4;
 2238  
 2239              pub static MAP_FILE : c_int = 0x0000;
 2240              pub static MAP_SHARED : c_int = 0x0001;
 2241              pub static MAP_PRIVATE : c_int = 0x0002;
 2242              pub static MAP_FIXED : c_int = 0x0010;
 2243              pub static MAP_ANON : c_int = 0x0800;
 2244  
 2245              pub static MAP_FAILED : *c_void = -1 as *c_void;
 2246  
 2247              pub static MCL_CURRENT : c_int = 0x0001;
 2248              pub static MCL_FUTURE : c_int = 0x0002;
 2249  
 2250              pub static MS_ASYNC : c_int = 0x0001;
 2251              pub static MS_INVALIDATE : c_int = 0x0002;
 2252              pub static MS_SYNC : c_int = 0x0004;
 2253  
 2254              pub static EPERM : c_int = 1;
 2255              pub static ENOENT : c_int = 2;
 2256              pub static ESRCH : c_int = 3;
 2257              pub static EINTR : c_int = 4;
 2258              pub static EIO : c_int = 5;
 2259              pub static ENXIO : c_int = 6;
 2260              pub static E2BIG : c_int = 7;
 2261              pub static ENOEXEC : c_int = 8;
 2262              pub static EBADF : c_int = 9;
 2263              pub static ECHILD : c_int = 10;
 2264              pub static EAGAIN : c_int = 11;
 2265              pub static ENOMEM : c_int = 12;
 2266              pub static EACCES : c_int = 13;
 2267              pub static EFAULT : c_int = 14;
 2268              pub static ENOTBLK : c_int = 15;
 2269              pub static EBUSY : c_int = 16;
 2270              pub static EEXIST : c_int = 17;
 2271              pub static EXDEV : c_int = 18;
 2272              pub static ENODEV : c_int = 19;
 2273              pub static ENOTDIR : c_int = 20;
 2274              pub static EISDIR : c_int = 21;
 2275              pub static EINVAL : c_int = 22;
 2276              pub static ENFILE : c_int = 23;
 2277              pub static EMFILE : c_int = 24;
 2278              pub static ENOTTY : c_int = 25;
 2279              pub static ETXTBSY : c_int = 26;
 2280              pub static EFBIG : c_int = 27;
 2281              pub static ENOSPC : c_int = 28;
 2282              pub static ESPIPE : c_int = 29;
 2283              pub static EROFS : c_int = 30;
 2284              pub static EMLINK : c_int = 31;
 2285              pub static EPIPE : c_int = 32;
 2286              pub static EDOM : c_int = 33;
 2287              pub static ERANGE : c_int = 34;
 2288  
 2289              pub static ENOMSG: c_int = 35;
 2290              pub static EIDRM: c_int = 36;
 2291              pub static ECHRNG: c_int = 37;
 2292              pub static EL2NSYNC: c_int = 38;
 2293              pub static EL3HLT: c_int = 39;
 2294              pub static EL3RST: c_int = 40;
 2295              pub static ELNRNG: c_int = 41;
 2296              pub static EUNATCH: c_int = 42;
 2297              pub static ENOCSI: c_int = 43;
 2298              pub static EL2HLT: c_int = 44;
 2299              pub static EDEADLK: c_int = 45;
 2300              pub static ENOLCK: c_int = 46;
 2301              pub static EBADE: c_int = 50;
 2302              pub static EBADR: c_int = 51;
 2303              pub static EXFULL: c_int = 52;
 2304              pub static ENOANO: c_int = 53;
 2305              pub static EBADRQC: c_int = 54;
 2306              pub static EBADSLT: c_int = 55;
 2307              pub static EDEADLOCK: c_int = 56;
 2308              pub static EBFONT: c_int = 59;
 2309              pub static ENOSTR: c_int = 60;
 2310              pub static ENODATA: c_int = 61;
 2311              pub static ETIME: c_int = 62;
 2312              pub static ENOSR: c_int = 63;
 2313              pub static ENONET: c_int = 64;
 2314              pub static ENOPKG: c_int = 65;
 2315              pub static EREMOTE: c_int = 66;
 2316              pub static ENOLINK: c_int = 67;
 2317              pub static EADV: c_int = 68;
 2318              pub static ESRMNT: c_int = 69;
 2319              pub static ECOMM: c_int = 70;
 2320              pub static EPROTO: c_int = 71;
 2321              pub static EDOTDOT: c_int = 73;
 2322              pub static EMULTIHOP: c_int = 74;
 2323              pub static EBADMSG: c_int = 77;
 2324              pub static ENAMETOOLONG: c_int = 78;
 2325              pub static EOVERFLOW: c_int = 79;
 2326              pub static ENOTUNIQ: c_int = 80;
 2327              pub static EBADFD: c_int = 81;
 2328              pub static EREMCHG: c_int = 82;
 2329              pub static ELIBACC: c_int = 83;
 2330              pub static ELIBBAD: c_int = 84;
 2331              pub static ELIBSCN: c_int = 95;
 2332              pub static ELIBMAX: c_int = 86;
 2333              pub static ELIBEXEC: c_int = 87;
 2334              pub static EILSEQ: c_int = 88;
 2335              pub static ENOSYS: c_int = 89;
 2336              pub static ELOOP: c_int = 90;
 2337              pub static ERESTART: c_int = 91;
 2338              pub static ESTRPIPE: c_int = 92;
 2339              pub static ENOTEMPTY: c_int = 93;
 2340              pub static EUSERS: c_int = 94;
 2341              pub static ENOTSOCK: c_int = 95;
 2342              pub static EDESTADDRREQ: c_int = 96;
 2343              pub static EMSGSIZE: c_int = 97;
 2344              pub static EPROTOTYPE: c_int = 98;
 2345              pub static ENOPROTOOPT: c_int = 99;
 2346              pub static EPROTONOSUPPORT: c_int = 120;
 2347              pub static ESOCKTNOSUPPORT: c_int = 121;
 2348              pub static EOPNOTSUPP: c_int = 122;
 2349              pub static EPFNOSUPPORT: c_int = 123;
 2350              pub static EAFNOSUPPORT: c_int = 124;
 2351              pub static EADDRINUSE: c_int = 125;
 2352              pub static EADDRNOTAVAIL: c_int = 126;
 2353              pub static ENETDOWN: c_int = 127;
 2354              pub static ENETUNREACH: c_int = 128;
 2355              pub static ENETRESET: c_int = 129;
 2356              pub static ECONNABORTED: c_int = 130;
 2357              pub static ECONNRESET: c_int = 131;
 2358              pub static ENOBUFS: c_int = 132;
 2359              pub static EISCONN: c_int = 133;
 2360              pub static ENOTCONN: c_int = 134;
 2361              pub static EUCLEAN: c_int = 135;
 2362              pub static ENOTNAM: c_int = 137;
 2363              pub static ENAVAIL: c_int = 138;
 2364              pub static EISNAM: c_int = 139;
 2365              pub static EREMOTEIO: c_int = 140;
 2366              pub static ESHUTDOWN: c_int = 143;
 2367              pub static ETOOMANYREFS: c_int = 144;
 2368              pub static ETIMEDOUT: c_int = 145;
 2369              pub static ECONNREFUSED: c_int = 146;
 2370              pub static EHOSTDOWN: c_int = 147;
 2371              pub static EHOSTUNREACH: c_int = 148;
 2372              pub static EWOULDBLOCK: c_int = EAGAIN;
 2373              pub static EALREADY: c_int = 149;
 2374              pub static EINPROGRESS: c_int = 150;
 2375              pub static ESTALE: c_int = 151;
 2376              pub static ECANCELED: c_int = 158;
 2377  
 2378              pub static ENOMEDIUM: c_int = 159;
 2379              pub static EMEDIUMTYPE: c_int = 160;
 2380              pub static ENOKEY: c_int = 161;
 2381              pub static EKEYEXPIRED: c_int = 162;
 2382              pub static EKEYREVOKED: c_int = 163;
 2383              pub static EKEYREJECTED: c_int = 164;
 2384  
 2385              pub static EOWNERDEAD: c_int = 165;
 2386              pub static ENOTRECOVERABLE: c_int = 166;
 2387  
 2388              pub static ERFKILL: c_int = 167;
 2389  
 2390              pub static EHWPOISON: c_int = 168;
 2391  
 2392              pub static EDQUOT: c_int = 1133;
 2393          }
 2394          pub mod posix01 {
 2395              use types::os::arch::c95::{c_int, size_t};
 2396  
 2397              pub static SIGTRAP : c_int = 5;
 2398              pub static SIGPIPE: c_int = 13;
 2399              pub static SIG_IGN: size_t = 1;
 2400  
 2401              pub static GLOB_ERR      : c_int = 1 << 0;
 2402              pub static GLOB_MARK     : c_int = 1 << 1;
 2403              pub static GLOB_NOSORT   : c_int = 1 << 2;
 2404              pub static GLOB_DOOFFS   : c_int = 1 << 3;
 2405              pub static GLOB_NOCHECK  : c_int = 1 << 4;
 2406              pub static GLOB_APPEND   : c_int = 1 << 5;
 2407              pub static GLOB_NOESCAPE : c_int = 1 << 6;
 2408  
 2409              pub static GLOB_NOSPACE  : c_int = 1;
 2410              pub static GLOB_ABORTED  : c_int = 2;
 2411              pub static GLOB_NOMATCH  : c_int = 3;
 2412  
 2413              pub static POSIX_MADV_NORMAL : c_int = 0;
 2414              pub static POSIX_MADV_RANDOM : c_int = 1;
 2415              pub static POSIX_MADV_SEQUENTIAL : c_int = 2;
 2416              pub static POSIX_MADV_WILLNEED : c_int = 3;
 2417              pub static POSIX_MADV_DONTNEED : c_int = 4;
 2418  
 2419              pub static _SC_MQ_PRIO_MAX : c_int = 28;
 2420              pub static _SC_IOV_MAX : c_int = 60;
 2421              pub static _SC_GETGR_R_SIZE_MAX : c_int = 69;
 2422              pub static _SC_GETPW_R_SIZE_MAX : c_int = 70;
 2423              pub static _SC_LOGIN_NAME_MAX : c_int = 71;
 2424              pub static _SC_TTY_NAME_MAX : c_int = 72;
 2425              pub static _SC_THREADS : c_int = 67;
 2426              pub static _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
 2427              pub static _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
 2428              pub static _SC_THREAD_KEYS_MAX : c_int = 74;
 2429              pub static _SC_THREAD_STACK_MIN : c_int = 75;
 2430              pub static _SC_THREAD_THREADS_MAX : c_int = 76;
 2431              pub static _SC_THREAD_ATTR_STACKADDR : c_int = 77;
 2432              pub static _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
 2433              pub static _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
 2434              pub static _SC_THREAD_PRIO_INHERIT : c_int = 80;
 2435              pub static _SC_THREAD_PRIO_PROTECT : c_int = 81;
 2436              pub static _SC_THREAD_PROCESS_SHARED : c_int = 82;
 2437              pub static _SC_ATEXIT_MAX : c_int = 87;
 2438              pub static _SC_XOPEN_VERSION : c_int = 89;
 2439              pub static _SC_XOPEN_XCU_VERSION : c_int = 90;
 2440              pub static _SC_XOPEN_UNIX : c_int = 91;
 2441              pub static _SC_XOPEN_CRYPT : c_int = 92;
 2442              pub static _SC_XOPEN_ENH_I18N : c_int = 93;
 2443              pub static _SC_XOPEN_SHM : c_int = 94;
 2444              pub static _SC_XOPEN_LEGACY : c_int = 129;
 2445              pub static _SC_XOPEN_REALTIME : c_int = 130;
 2446              pub static _SC_XOPEN_REALTIME_THREADS : c_int = 131;
 2447  
 2448              pub static PTHREAD_CREATE_JOINABLE: c_int = 0;
 2449              pub static PTHREAD_CREATE_DETACHED: c_int = 1;
 2450  
 2451              #[cfg(target_os = "android")]
 2452              pub static PTHREAD_STACK_MIN: size_t = 8192;
 2453  
 2454              #[cfg(target_arch = "arm", target_os = "linux")]
 2455              #[cfg(target_arch = "x86", target_os = "linux")]
 2456              #[cfg(target_arch = "x86_64", target_os = "linux")]
 2457              pub static PTHREAD_STACK_MIN: size_t = 16384;
 2458  
 2459              #[cfg(target_arch = "mips", target_os = "linux")]
 2460              pub static PTHREAD_STACK_MIN: size_t = 131072;
 2461  
 2462              pub static CLOCK_REALTIME: c_int = 0;
 2463              pub static CLOCK_MONOTONIC: c_int = 1;
 2464  
 2465              pub static WNOHANG: c_int = 1;
 2466          }
 2467          pub mod posix08 {
 2468          }
 2469          pub mod bsd44 {
 2470              use types::os::arch::c95::c_int;
 2471  
 2472              pub static MADV_NORMAL : c_int = 0;
 2473              pub static MADV_RANDOM : c_int = 1;
 2474              pub static MADV_SEQUENTIAL : c_int = 2;
 2475              pub static MADV_WILLNEED : c_int = 3;
 2476              pub static MADV_DONTNEED : c_int = 4;
 2477              pub static MADV_REMOVE : c_int = 9;
 2478              pub static MADV_DONTFORK : c_int = 10;
 2479              pub static MADV_DOFORK : c_int = 11;
 2480              pub static MADV_MERGEABLE : c_int = 12;
 2481              pub static MADV_UNMERGEABLE : c_int = 13;
 2482              pub static MADV_HWPOISON : c_int = 100;
 2483  
 2484              pub static AF_UNIX: c_int = 1;
 2485              pub static AF_INET: c_int = 2;
 2486              pub static AF_INET6: c_int = 10;
 2487              pub static SOCK_STREAM: c_int = 1;
 2488              pub static SOCK_DGRAM: c_int = 2;
 2489              pub static IPPROTO_TCP: c_int = 6;
 2490              pub static IPPROTO_IP: c_int = 0;
 2491              pub static IPPROTO_IPV6: c_int = 41;
 2492              pub static IP_MULTICAST_TTL: c_int = 33;
 2493              pub static IP_MULTICAST_LOOP: c_int = 34;
 2494              pub static IP_TTL: c_int = 2;
 2495              pub static IP_ADD_MEMBERSHIP: c_int = 35;
 2496              pub static IP_DROP_MEMBERSHIP: c_int = 36;
 2497              pub static IPV6_ADD_MEMBERSHIP: c_int = 20;
 2498              pub static IPV6_DROP_MEMBERSHIP: c_int = 21;
 2499  
 2500              pub static TCP_NODELAY: c_int = 1;
 2501              pub static SOL_SOCKET: c_int = 1;
 2502              pub static SO_KEEPALIVE: c_int = 9;
 2503              pub static SO_BROADCAST: c_int = 6;
 2504              pub static SO_REUSEADDR: c_int = 2;
 2505              pub static SO_ERROR: c_int = 4;
 2506  
 2507              pub static SHUT_RD: c_int = 0;
 2508              pub static SHUT_WR: c_int = 1;
 2509              pub static SHUT_RDWR: c_int = 2;
 2510          }
 2511          #[cfg(target_arch = "x86")]
 2512          #[cfg(target_arch = "x86_64")]
 2513          #[cfg(target_arch = "arm")]
 2514          pub mod extra {
 2515              use types::os::arch::c95::c_int;
 2516  
 2517              pub static O_RSYNC : c_int = 1052672;
 2518              pub static O_DSYNC : c_int = 4096;
 2519              pub static O_SYNC : c_int = 1052672;
 2520  
 2521              pub static PROT_GROWSDOWN : c_int = 0x010000000;
 2522              pub static PROT_GROWSUP : c_int = 0x020000000;
 2523  
 2524              pub static MAP_TYPE : c_int = 0x000f;
 2525              pub static MAP_ANONONYMOUS : c_int = 0x0020;
 2526              pub static MAP_32BIT : c_int = 0x0040;
 2527              pub static MAP_GROWSDOWN : c_int = 0x0100;
 2528              pub static MAP_DENYWRITE : c_int = 0x0800;
 2529              pub static MAP_EXECUTABLE : c_int = 0x01000;
 2530              pub static MAP_LOCKED : c_int = 0x02000;
 2531              pub static MAP_NONRESERVE : c_int = 0x04000;
 2532              pub static MAP_POPULATE : c_int = 0x08000;
 2533              pub static MAP_NONBLOCK : c_int = 0x010000;
 2534              pub static MAP_STACK : c_int = 0x020000;
 2535          }
 2536          #[cfg(target_arch = "mips")]
 2537          pub mod extra {
 2538              use types::os::arch::c95::c_int;
 2539  
 2540              pub static O_RSYNC : c_int = 16400;
 2541              pub static O_DSYNC : c_int = 16;
 2542              pub static O_SYNC : c_int = 16400;
 2543  
 2544              pub static PROT_GROWSDOWN : c_int = 0x01000000;
 2545              pub static PROT_GROWSUP : c_int = 0x02000000;
 2546  
 2547              pub static MAP_TYPE : c_int = 0x000f;
 2548              pub static MAP_ANONONYMOUS : c_int = 0x0800;
 2549              pub static MAP_GROWSDOWN : c_int = 0x01000;
 2550              pub static MAP_DENYWRITE : c_int = 0x02000;
 2551              pub static MAP_EXECUTABLE : c_int = 0x04000;
 2552              pub static MAP_LOCKED : c_int = 0x08000;
 2553              pub static MAP_NONRESERVE : c_int = 0x0400;
 2554              pub static MAP_POPULATE : c_int = 0x010000;
 2555              pub static MAP_NONBLOCK : c_int = 0x020000;
 2556              pub static MAP_STACK : c_int = 0x040000;
 2557          }
 2558          #[cfg(target_os = "linux")]
 2559          pub mod sysconf {
 2560              use types::os::arch::c95::c_int;
 2561  
 2562              pub static _SC_ARG_MAX : c_int = 0;
 2563              pub static _SC_CHILD_MAX : c_int = 1;
 2564              pub static _SC_CLK_TCK : c_int = 2;
 2565              pub static _SC_NGROUPS_MAX : c_int = 3;
 2566              pub static _SC_OPEN_MAX : c_int = 4;
 2567              pub static _SC_STREAM_MAX : c_int = 5;
 2568              pub static _SC_TZNAME_MAX : c_int = 6;
 2569              pub static _SC_JOB_CONTROL : c_int = 7;
 2570              pub static _SC_SAVED_IDS : c_int = 8;
 2571              pub static _SC_REALTIME_SIGNALS : c_int = 9;
 2572              pub static _SC_PRIORITY_SCHEDULING : c_int = 10;
 2573              pub static _SC_TIMERS : c_int = 11;
 2574              pub static _SC_ASYNCHRONOUS_IO : c_int = 12;
 2575              pub static _SC_PRIORITIZED_IO : c_int = 13;
 2576              pub static _SC_SYNCHRONIZED_IO : c_int = 14;
 2577              pub static _SC_FSYNC : c_int = 15;
 2578              pub static _SC_MAPPED_FILES : c_int = 16;
 2579              pub static _SC_MEMLOCK : c_int = 17;
 2580              pub static _SC_MEMLOCK_RANGE : c_int = 18;
 2581              pub static _SC_MEMORY_PROTECTION : c_int = 19;
 2582              pub static _SC_MESSAGE_PASSING : c_int = 20;
 2583              pub static _SC_SEMAPHORES : c_int = 21;
 2584              pub static _SC_SHARED_MEMORY_OBJECTS : c_int = 22;
 2585              pub static _SC_AIO_LISTIO_MAX : c_int = 23;
 2586              pub static _SC_AIO_MAX : c_int = 24;
 2587              pub static _SC_AIO_PRIO_DELTA_MAX : c_int = 25;
 2588              pub static _SC_DELAYTIMER_MAX : c_int = 26;
 2589              pub static _SC_MQ_OPEN_MAX : c_int = 27;
 2590              pub static _SC_VERSION : c_int = 29;
 2591              pub static _SC_PAGESIZE : c_int = 30;
 2592              pub static _SC_RTSIG_MAX : c_int = 31;
 2593              pub static _SC_SEM_NSEMS_MAX : c_int = 32;
 2594              pub static _SC_SEM_VALUE_MAX : c_int = 33;
 2595              pub static _SC_SIGQUEUE_MAX : c_int = 34;
 2596              pub static _SC_TIMER_MAX : c_int = 35;
 2597              pub static _SC_BC_BASE_MAX : c_int = 36;
 2598              pub static _SC_BC_DIM_MAX : c_int = 37;
 2599              pub static _SC_BC_SCALE_MAX : c_int = 38;
 2600              pub static _SC_BC_STRING_MAX : c_int = 39;
 2601              pub static _SC_COLL_WEIGHTS_MAX : c_int = 40;
 2602              pub static _SC_EXPR_NEST_MAX : c_int = 42;
 2603              pub static _SC_LINE_MAX : c_int = 43;
 2604              pub static _SC_RE_DUP_MAX : c_int = 44;
 2605              pub static _SC_2_VERSION : c_int = 46;
 2606              pub static _SC_2_C_BIND : c_int = 47;
 2607              pub static _SC_2_C_DEV : c_int = 48;
 2608              pub static _SC_2_FORT_DEV : c_int = 49;
 2609              pub static _SC_2_FORT_RUN : c_int = 50;
 2610              pub static _SC_2_SW_DEV : c_int = 51;
 2611              pub static _SC_2_LOCALEDEF : c_int = 52;
 2612              pub static _SC_2_CHAR_TERM : c_int = 95;
 2613              pub static _SC_2_C_VERSION : c_int = 96;
 2614              pub static _SC_2_UPE : c_int = 97;
 2615              pub static _SC_XBS5_ILP32_OFF32 : c_int = 125;
 2616              pub static _SC_XBS5_ILP32_OFFBIG : c_int = 126;
 2617              pub static _SC_XBS5_LPBIG_OFFBIG : c_int = 128;
 2618          }
 2619          #[cfg(target_os = "android")]
 2620          pub mod sysconf {
 2621              use types::os::arch::c95::c_int;
 2622  
 2623              pub static _SC_ARG_MAX : c_int = 0;
 2624              pub static _SC_BC_BASE_MAX : c_int = 1;
 2625              pub static _SC_BC_DIM_MAX : c_int = 2;
 2626              pub static _SC_BC_SCALE_MAX : c_int = 3;
 2627              pub static _SC_BC_STRING_MAX : c_int = 4;
 2628              pub static _SC_CHILD_MAX : c_int = 5;
 2629              pub static _SC_CLK_TCK : c_int = 6;
 2630              pub static _SC_COLL_WEIGHTS_MAX : c_int = 7;
 2631              pub static _SC_EXPR_NEST_MAX : c_int = 8;
 2632              pub static _SC_LINE_MAX : c_int = 9;
 2633              pub static _SC_NGROUPS_MAX : c_int = 10;
 2634              pub static _SC_OPEN_MAX : c_int = 11;
 2635              pub static _SC_2_C_BIND : c_int = 13;
 2636              pub static _SC_2_C_DEV : c_int = 14;
 2637              pub static _SC_2_C_VERSION : c_int = 15;
 2638              pub static _SC_2_CHAR_TERM : c_int = 16;
 2639              pub static _SC_2_FORT_DEV : c_int = 17;
 2640              pub static _SC_2_FORT_RUN : c_int = 18;
 2641              pub static _SC_2_LOCALEDEF : c_int = 19;
 2642              pub static _SC_2_SW_DEV : c_int = 20;
 2643              pub static _SC_2_UPE : c_int = 21;
 2644              pub static _SC_2_VERSION : c_int = 22;
 2645              pub static _SC_JOB_CONTROL : c_int = 23;
 2646              pub static _SC_SAVED_IDS : c_int = 24;
 2647              pub static _SC_VERSION : c_int = 25;
 2648              pub static _SC_RE_DUP_MAX : c_int = 26;
 2649              pub static _SC_STREAM_MAX : c_int = 27;
 2650              pub static _SC_TZNAME_MAX : c_int = 28;
 2651              pub static _SC_PAGESIZE : c_int = 39;
 2652          }
 2653      }
 2654  
 2655      #[cfg(target_os = "freebsd")]
 2656      pub mod os {
 2657          pub mod c95 {
 2658              use types::os::arch::c95::{c_int, c_uint};
 2659  
 2660              pub static EXIT_FAILURE : c_int = 1;
 2661              pub static EXIT_SUCCESS : c_int = 0;
 2662              pub static RAND_MAX : c_int = 2147483647;
 2663              pub static EOF : c_int = -1;
 2664              pub static SEEK_SET : c_int = 0;
 2665              pub static SEEK_CUR : c_int = 1;
 2666              pub static SEEK_END : c_int = 2;
 2667              pub static _IOFBF : c_int = 0;
 2668              pub static _IONBF : c_int = 2;
 2669              pub static _IOLBF : c_int = 1;
 2670              pub static BUFSIZ : c_uint = 1024_u32;
 2671              pub static FOPEN_MAX : c_uint = 20_u32;
 2672              pub static FILENAME_MAX : c_uint = 1024_u32;
 2673              pub static L_tmpnam : c_uint = 1024_u32;
 2674              pub static TMP_MAX : c_uint = 308915776_u32;
 2675          }
 2676          pub mod c99 {
 2677          }
 2678          pub mod posix88 {
 2679              use types::common::c95::c_void;
 2680              use types::os::arch::c95::c_int;
 2681  
 2682              pub static O_RDONLY : c_int = 0;
 2683              pub static O_WRONLY : c_int = 1;
 2684              pub static O_RDWR : c_int = 2;
 2685              pub static O_APPEND : c_int = 8;
 2686              pub static O_CREAT : c_int = 512;
 2687              pub static O_EXCL : c_int = 2048;
 2688              pub static O_TRUNC : c_int = 1024;
 2689              pub static S_IFIFO : c_int = 4096;
 2690              pub static S_IFCHR : c_int = 8192;
 2691              pub static S_IFBLK : c_int = 24576;
 2692              pub static S_IFDIR : c_int = 16384;
 2693              pub static S_IFREG : c_int = 32768;
 2694              pub static S_IFLNK : c_int = 40960;
 2695              pub static S_IFMT : c_int = 61440;
 2696              pub static S_IEXEC : c_int = 64;
 2697              pub static S_IWRITE : c_int = 128;
 2698              pub static S_IREAD : c_int = 256;
 2699              pub static S_IRWXU : c_int = 448;
 2700              pub static S_IXUSR : c_int = 64;
 2701              pub static S_IWUSR : c_int = 128;
 2702              pub static S_IRUSR : c_int = 256;
 2703              pub static F_OK : c_int = 0;
 2704              pub static R_OK : c_int = 4;
 2705              pub static W_OK : c_int = 2;
 2706              pub static X_OK : c_int = 1;
 2707              pub static STDIN_FILENO : c_int = 0;
 2708              pub static STDOUT_FILENO : c_int = 1;
 2709              pub static STDERR_FILENO : c_int = 2;
 2710              pub static F_LOCK : c_int = 1;
 2711              pub static F_TEST : c_int = 3;
 2712              pub static F_TLOCK : c_int = 2;
 2713              pub static F_ULOCK : c_int = 0;
 2714              pub static SIGHUP : c_int = 1;
 2715              pub static SIGINT : c_int = 2;
 2716              pub static SIGQUIT : c_int = 3;
 2717              pub static SIGILL : c_int = 4;
 2718              pub static SIGABRT : c_int = 6;
 2719              pub static SIGFPE : c_int = 8;
 2720              pub static SIGKILL : c_int = 9;
 2721              pub static SIGSEGV : c_int = 11;
 2722              pub static SIGPIPE : c_int = 13;
 2723              pub static SIGALRM : c_int = 14;
 2724              pub static SIGTERM : c_int = 15;
 2725  
 2726              pub static PROT_NONE : c_int = 0;
 2727              pub static PROT_READ : c_int = 1;
 2728              pub static PROT_WRITE : c_int = 2;
 2729              pub static PROT_EXEC : c_int = 4;
 2730  
 2731              pub static MAP_FILE : c_int = 0x0000;
 2732              pub static MAP_SHARED : c_int = 0x0001;
 2733              pub static MAP_PRIVATE : c_int = 0x0002;
 2734              pub static MAP_FIXED : c_int = 0x0010;
 2735              pub static MAP_ANON : c_int = 0x1000;
 2736  
 2737              pub static MAP_FAILED : *c_void = -1 as *c_void;
 2738  
 2739              pub static MCL_CURRENT : c_int = 0x0001;
 2740              pub static MCL_FUTURE : c_int = 0x0002;
 2741  
 2742              pub static MS_SYNC : c_int = 0x0000;
 2743              pub static MS_ASYNC : c_int = 0x0001;
 2744              pub static MS_INVALIDATE : c_int = 0x0002;
 2745  
 2746              pub static EPERM : c_int = 1;
 2747              pub static ENOENT : c_int = 2;
 2748              pub static ESRCH : c_int = 3;
 2749              pub static EINTR : c_int = 4;
 2750              pub static EIO : c_int = 5;
 2751              pub static ENXIO : c_int = 6;
 2752              pub static E2BIG : c_int = 7;
 2753              pub static ENOEXEC : c_int = 8;
 2754              pub static EBADF : c_int = 9;
 2755              pub static ECHILD : c_int = 10;
 2756              pub static EDEADLK : c_int = 11;
 2757              pub static ENOMEM : c_int = 12;
 2758              pub static EACCES : c_int = 13;
 2759              pub static EFAULT : c_int = 14;
 2760              pub static ENOTBLK : c_int = 15;
 2761              pub static EBUSY : c_int = 16;
 2762              pub static EEXIST : c_int = 17;
 2763              pub static EXDEV : c_int = 18;
 2764              pub static ENODEV : c_int = 19;
 2765              pub static ENOTDIR : c_int = 20;
 2766              pub static EISDIR : c_int = 21;
 2767              pub static EINVAL : c_int = 22;
 2768              pub static ENFILE : c_int = 23;
 2769              pub static EMFILE : c_int = 24;
 2770              pub static ENOTTY : c_int = 25;
 2771              pub static ETXTBSY : c_int = 26;
 2772              pub static EFBIG : c_int = 27;
 2773              pub static ENOSPC : c_int = 28;
 2774              pub static ESPIPE : c_int = 29;
 2775              pub static EROFS : c_int = 30;
 2776              pub static EMLINK : c_int = 31;
 2777              pub static EPIPE : c_int = 32;
 2778              pub static EDOM : c_int = 33;
 2779              pub static ERANGE : c_int = 34;
 2780              pub static EAGAIN : c_int = 35;
 2781              pub static EWOULDBLOCK : c_int = 35;
 2782              pub static EINPROGRESS : c_int = 36;
 2783              pub static EALREADY : c_int = 37;
 2784              pub static ENOTSOCK : c_int = 38;
 2785              pub static EDESTADDRREQ : c_int = 39;
 2786              pub static EMSGSIZE : c_int = 40;
 2787              pub static EPROTOTYPE : c_int = 41;
 2788              pub static ENOPROTOOPT : c_int = 42;
 2789              pub static EPROTONOSUPPORT : c_int = 43;
 2790              pub static ESOCKTNOSUPPORT : c_int = 44;
 2791              pub static EOPNOTSUPP : c_int = 45;
 2792              pub static EPFNOSUPPORT : c_int = 46;
 2793              pub static EAFNOSUPPORT : c_int = 47;
 2794              pub static EADDRINUSE : c_int = 48;
 2795              pub static EADDRNOTAVAIL : c_int = 49;
 2796              pub static ENETDOWN : c_int = 50;
 2797              pub static ENETUNREACH : c_int = 51;
 2798              pub static ENETRESET : c_int = 52;
 2799              pub static ECONNABORTED : c_int = 53;
 2800              pub static ECONNRESET : c_int = 54;
 2801              pub static ENOBUFS : c_int = 55;
 2802              pub static EISCONN : c_int = 56;
 2803              pub static ENOTCONN : c_int = 57;
 2804              pub static ESHUTDOWN : c_int = 58;
 2805              pub static ETOOMANYREFS : c_int = 59;
 2806              pub static ETIMEDOUT : c_int = 60;
 2807              pub static ECONNREFUSED : c_int = 61;
 2808              pub static ELOOP : c_int = 62;
 2809              pub static ENAMETOOLONG : c_int = 63;
 2810              pub static EHOSTDOWN : c_int = 64;
 2811              pub static EHOSTUNREACH : c_int = 65;
 2812              pub static ENOTEMPTY : c_int = 66;
 2813              pub static EPROCLIM : c_int = 67;
 2814              pub static EUSERS : c_int = 68;
 2815              pub static EDQUOT : c_int = 69;
 2816              pub static ESTALE : c_int = 70;
 2817              pub static EREMOTE : c_int = 71;
 2818              pub static EBADRPC : c_int = 72;
 2819              pub static ERPCMISMATCH : c_int = 73;
 2820              pub static EPROGUNAVAIL : c_int = 74;
 2821              pub static EPROGMISMATCH : c_int = 75;
 2822              pub static EPROCUNAVAIL : c_int = 76;
 2823              pub static ENOLCK : c_int = 77;
 2824              pub static ENOSYS : c_int = 78;
 2825              pub static EFTYPE : c_int = 79;
 2826              pub static EAUTH : c_int = 80;
 2827              pub static ENEEDAUTH : c_int = 81;
 2828              pub static EIDRM : c_int = 82;
 2829              pub static ENOMSG : c_int = 83;
 2830              pub static EOVERFLOW : c_int = 84;
 2831              pub static ECANCELED : c_int = 85;
 2832              pub static EILSEQ : c_int = 86;
 2833              pub static ENOATTR : c_int = 87;
 2834              pub static EDOOFUS : c_int = 88;
 2835              pub static EBADMSG : c_int = 89;
 2836              pub static EMULTIHOP : c_int = 90;
 2837              pub static ENOLINK : c_int = 91;
 2838              pub static EPROTO : c_int = 92;
 2839              pub static ENOMEDIUM : c_int = 93;
 2840              pub static EUNUSED94 : c_int = 94;
 2841              pub static EUNUSED95 : c_int = 95;
 2842              pub static EUNUSED96 : c_int = 96;
 2843              pub static EUNUSED97 : c_int = 97;
 2844              pub static EUNUSED98 : c_int = 98;
 2845              pub static EASYNC : c_int = 99;
 2846              pub static ELAST : c_int = 99;
 2847          }
 2848          pub mod posix01 {
 2849              use types::os::arch::c95::{c_int, size_t};
 2850  
 2851              pub static SIGTRAP : c_int = 5;
 2852              pub static SIGPIPE: c_int = 13;
 2853              pub static SIG_IGN: size_t = 1;
 2854  
 2855              pub static GLOB_APPEND   : c_int = 0x0001;
 2856              pub static GLOB_DOOFFS   : c_int = 0x0002;
 2857              pub static GLOB_ERR      : c_int = 0x0004;
 2858              pub static GLOB_MARK     : c_int = 0x0008;
 2859              pub static GLOB_NOCHECK  : c_int = 0x0010;
 2860              pub static GLOB_NOSORT   : c_int = 0x0020;
 2861              pub static GLOB_NOESCAPE : c_int = 0x2000;
 2862  
 2863              pub static GLOB_NOSPACE  : c_int = -1;
 2864              pub static GLOB_ABORTED  : c_int = -2;
 2865              pub static GLOB_NOMATCH  : c_int = -3;
 2866  
 2867              pub static POSIX_MADV_NORMAL : c_int = 0;
 2868              pub static POSIX_MADV_RANDOM : c_int = 1;
 2869              pub static POSIX_MADV_SEQUENTIAL : c_int = 2;
 2870              pub static POSIX_MADV_WILLNEED : c_int = 3;
 2871              pub static POSIX_MADV_DONTNEED : c_int = 4;
 2872  
 2873              pub static _SC_IOV_MAX : c_int = 56;
 2874              pub static _SC_GETGR_R_SIZE_MAX : c_int = 70;
 2875              pub static _SC_GETPW_R_SIZE_MAX : c_int = 71;
 2876              pub static _SC_LOGIN_NAME_MAX : c_int = 73;
 2877              pub static _SC_MQ_PRIO_MAX : c_int = 75;
 2878              pub static _SC_THREAD_ATTR_STACKADDR : c_int = 82;
 2879              pub static _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
 2880              pub static _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
 2881              pub static _SC_THREAD_KEYS_MAX : c_int = 86;
 2882              pub static _SC_THREAD_PRIO_INHERIT : c_int = 87;
 2883              pub static _SC_THREAD_PRIO_PROTECT : c_int = 88;
 2884              pub static _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
 2885              pub static _SC_THREAD_PROCESS_SHARED : c_int = 90;
 2886              pub static _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
 2887              pub static _SC_THREAD_STACK_MIN : c_int = 93;
 2888              pub static _SC_THREAD_THREADS_MAX : c_int = 94;
 2889              pub static _SC_THREADS : c_int = 96;
 2890              pub static _SC_TTY_NAME_MAX : c_int = 101;
 2891              pub static _SC_ATEXIT_MAX : c_int = 107;
 2892              pub static _SC_XOPEN_CRYPT : c_int = 108;
 2893              pub static _SC_XOPEN_ENH_I18N : c_int = 109;
 2894              pub static _SC_XOPEN_LEGACY : c_int = 110;
 2895              pub static _SC_XOPEN_REALTIME : c_int = 111;
 2896              pub static _SC_XOPEN_REALTIME_THREADS : c_int = 112;
 2897              pub static _SC_XOPEN_SHM : c_int = 113;
 2898              pub static _SC_XOPEN_UNIX : c_int = 115;
 2899              pub static _SC_XOPEN_VERSION : c_int = 116;
 2900              pub static _SC_XOPEN_XCU_VERSION : c_int = 117;
 2901  
 2902              pub static PTHREAD_CREATE_JOINABLE: c_int = 0;
 2903              pub static PTHREAD_CREATE_DETACHED: c_int = 1;
 2904  
 2905              #[cfg(target_arch = "arm")]
 2906              pub static PTHREAD_STACK_MIN: size_t = 4096;
 2907  
 2908              #[cfg(target_arch = "mips")]
 2909              #[cfg(target_arch = "x86")]
 2910              #[cfg(target_arch = "x86_64")]
 2911              pub static PTHREAD_STACK_MIN: size_t = 2048;
 2912  
 2913              pub static CLOCK_REALTIME: c_int = 0;
 2914              pub static CLOCK_MONOTONIC: c_int = 4;
 2915  
 2916              pub static WNOHANG: c_int = 1;
 2917          }
 2918          pub mod posix08 {
 2919          }
 2920          pub mod bsd44 {
 2921              use types::os::arch::c95::c_int;
 2922  
 2923              pub static MADV_NORMAL : c_int = 0;
 2924              pub static MADV_RANDOM : c_int = 1;
 2925              pub static MADV_SEQUENTIAL : c_int = 2;
 2926              pub static MADV_WILLNEED : c_int = 3;
 2927              pub static MADV_DONTNEED : c_int = 4;
 2928              pub static MADV_FREE : c_int = 5;
 2929              pub static MADV_NOSYNC : c_int = 6;
 2930              pub static MADV_AUTOSYNC : c_int = 7;
 2931              pub static MADV_NOCORE : c_int = 8;
 2932              pub static MADV_CORE : c_int = 9;
 2933              pub static MADV_PROTECT : c_int = 10;
 2934  
 2935              pub static MINCORE_INCORE : c_int =  0x1;
 2936              pub static MINCORE_REFERENCED : c_int = 0x2;
 2937              pub static MINCORE_MODIFIED : c_int = 0x4;
 2938              pub static MINCORE_REFERENCED_OTHER : c_int = 0x8;
 2939              pub static MINCORE_MODIFIED_OTHER : c_int = 0x10;
 2940              pub static MINCORE_SUPER : c_int = 0x20;
 2941  
 2942              pub static AF_INET: c_int = 2;
 2943              pub static AF_INET6: c_int = 28;
 2944              pub static AF_UNIX: c_int = 1;
 2945              pub static SOCK_STREAM: c_int = 1;
 2946              pub static SOCK_DGRAM: c_int = 2;
 2947              pub static IPPROTO_TCP: c_int = 6;
 2948              pub static IPPROTO_IP: c_int = 0;
 2949              pub static IPPROTO_IPV6: c_int = 41;
 2950              pub static IP_MULTICAST_TTL: c_int = 10;
 2951              pub static IP_MULTICAST_LOOP: c_int = 11;
 2952              pub static IP_TTL: c_int = 4;
 2953              pub static IP_ADD_MEMBERSHIP: c_int = 12;
 2954              pub static IP_DROP_MEMBERSHIP: c_int = 13;
 2955              pub static IPV6_ADD_MEMBERSHIP: c_int = 12;
 2956              pub static IPV6_DROP_MEMBERSHIP: c_int = 13;
 2957  
 2958              pub static TCP_NODELAY: c_int = 1;
 2959              pub static TCP_KEEPIDLE: c_int = 256;
 2960              pub static SOL_SOCKET: c_int = 0xffff;
 2961              pub static SO_KEEPALIVE: c_int = 0x0008;
 2962              pub static SO_BROADCAST: c_int = 0x0020;
 2963              pub static SO_REUSEADDR: c_int = 0x0004;
 2964              pub static SO_ERROR: c_int = 0x1007;
 2965  
 2966              pub static SHUT_RD: c_int = 0;
 2967              pub static SHUT_WR: c_int = 1;
 2968              pub static SHUT_RDWR: c_int = 2;
 2969          }
 2970          pub mod extra {
 2971              use types::os::arch::c95::c_int;
 2972  
 2973              pub static O_SYNC : c_int = 128;
 2974              pub static CTL_KERN: c_int = 1;
 2975              pub static KERN_PROC: c_int = 14;
 2976              pub static KERN_PROC_PATHNAME: c_int = 12;
 2977  
 2978              pub static MAP_COPY : c_int = 0x0002;
 2979              pub static MAP_RENAME : c_int = 0x0020;
 2980              pub static MAP_NORESERVE : c_int = 0x0040;
 2981              pub static MAP_HASSEMAPHORE : c_int = 0x0200;
 2982              pub static MAP_STACK : c_int = 0x0400;
 2983              pub static MAP_NOSYNC : c_int = 0x0800;
 2984              pub static MAP_NOCORE : c_int = 0x020000;
 2985          }
 2986          pub mod sysconf {
 2987              use types::os::arch::c95::c_int;
 2988  
 2989              pub static _SC_ARG_MAX : c_int = 1;
 2990              pub static _SC_CHILD_MAX : c_int = 2;
 2991              pub static _SC_CLK_TCK : c_int = 3;
 2992              pub static _SC_NGROUPS_MAX : c_int = 4;
 2993              pub static _SC_OPEN_MAX : c_int = 5;
 2994              pub static _SC_JOB_CONTROL : c_int = 6;
 2995              pub static _SC_SAVED_IDS : c_int = 7;
 2996              pub static _SC_VERSION : c_int = 8;
 2997              pub static _SC_BC_BASE_MAX : c_int = 9;
 2998              pub static _SC_BC_DIM_MAX : c_int = 10;
 2999              pub static _SC_BC_SCALE_MAX : c_int = 11;
 3000              pub static _SC_BC_STRING_MAX : c_int = 12;
 3001              pub static _SC_COLL_WEIGHTS_MAX : c_int = 13;
 3002              pub static _SC_EXPR_NEST_MAX : c_int = 14;
 3003              pub static _SC_LINE_MAX : c_int = 15;
 3004              pub static _SC_RE_DUP_MAX : c_int = 16;
 3005              pub static _SC_2_VERSION : c_int = 17;
 3006              pub static _SC_2_C_BIND : c_int = 18;
 3007              pub static _SC_2_C_DEV : c_int = 19;
 3008              pub static _SC_2_CHAR_TERM : c_int = 20;
 3009              pub static _SC_2_FORT_DEV : c_int = 21;
 3010              pub static _SC_2_FORT_RUN : c_int = 22;
 3011              pub static _SC_2_LOCALEDEF : c_int = 23;
 3012              pub static _SC_2_SW_DEV : c_int = 24;
 3013              pub static _SC_2_UPE : c_int = 25;
 3014              pub static _SC_STREAM_MAX : c_int = 26;
 3015              pub static _SC_TZNAME_MAX : c_int = 27;
 3016              pub static _SC_ASYNCHRONOUS_IO : c_int = 28;
 3017              pub static _SC_MAPPED_FILES : c_int = 29;
 3018              pub static _SC_MEMLOCK : c_int = 30;
 3019              pub static _SC_MEMLOCK_RANGE : c_int = 31;
 3020              pub static _SC_MEMORY_PROTECTION : c_int = 32;
 3021              pub static _SC_MESSAGE_PASSING : c_int = 33;
 3022              pub static _SC_PRIORITIZED_IO : c_int = 34;
 3023              pub static _SC_PRIORITY_SCHEDULING : c_int = 35;
 3024              pub static _SC_REALTIME_SIGNALS : c_int = 36;
 3025              pub static _SC_SEMAPHORES : c_int = 37;
 3026              pub static _SC_FSYNC : c_int = 38;
 3027              pub static _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
 3028              pub static _SC_SYNCHRONIZED_IO : c_int = 40;
 3029              pub static _SC_TIMERS : c_int = 41;
 3030              pub static _SC_AIO_LISTIO_MAX : c_int = 42;
 3031              pub static _SC_AIO_MAX : c_int = 43;
 3032              pub static _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
 3033              pub static _SC_DELAYTIMER_MAX : c_int = 45;
 3034              pub static _SC_MQ_OPEN_MAX : c_int = 46;
 3035              pub static _SC_PAGESIZE : c_int = 47;
 3036              pub static _SC_RTSIG_MAX : c_int = 48;
 3037              pub static _SC_SEM_NSEMS_MAX : c_int = 49;
 3038              pub static _SC_SEM_VALUE_MAX : c_int = 50;
 3039              pub static _SC_SIGQUEUE_MAX : c_int = 51;
 3040              pub static _SC_TIMER_MAX : c_int = 52;
 3041          }
 3042      }
 3043  
 3044      #[cfg(target_os = "macos")]
 3045      pub mod os {
 3046          pub mod c95 {
 3047              use types::os::arch::c95::{c_int, c_uint};
 3048  
 3049              pub static EXIT_FAILURE : c_int = 1;
 3050              pub static EXIT_SUCCESS : c_int = 0;
 3051              pub static RAND_MAX : c_int = 2147483647;
 3052              pub static EOF : c_int = -1;
 3053              pub static SEEK_SET : c_int = 0;
 3054              pub static SEEK_CUR : c_int = 1;
 3055              pub static SEEK_END : c_int = 2;
 3056              pub static _IOFBF : c_int = 0;
 3057              pub static _IONBF : c_int = 2;
 3058              pub static _IOLBF : c_int = 1;
 3059              pub static BUFSIZ : c_uint = 1024_u32;
 3060              pub static FOPEN_MAX : c_uint = 20_u32;
 3061              pub static FILENAME_MAX : c_uint = 1024_u32;
 3062              pub static L_tmpnam : c_uint = 1024_u32;
 3063              pub static TMP_MAX : c_uint = 308915776_u32;
 3064          }
 3065          pub mod c99 {
 3066          }
 3067          pub mod posix88 {
 3068              use types::common::c95::c_void;
 3069              use types::os::arch::c95::c_int;
 3070  
 3071              pub static O_RDONLY : c_int = 0;
 3072              pub static O_WRONLY : c_int = 1;
 3073              pub static O_RDWR : c_int = 2;
 3074              pub static O_APPEND : c_int = 8;
 3075              pub static O_CREAT : c_int = 512;
 3076              pub static O_EXCL : c_int = 2048;
 3077              pub static O_TRUNC : c_int = 1024;
 3078              pub static S_IFIFO : c_int = 4096;
 3079              pub static S_IFCHR : c_int = 8192;
 3080              pub static S_IFBLK : c_int = 24576;
 3081              pub static S_IFDIR : c_int = 16384;
 3082              pub static S_IFREG : c_int = 32768;
 3083              pub static S_IFLNK : c_int = 40960;
 3084              pub static S_IFMT : c_int = 61440;
 3085              pub static S_IEXEC : c_int = 64;
 3086              pub static S_IWRITE : c_int = 128;
 3087              pub static S_IREAD : c_int = 256;
 3088              pub static S_IRWXU : c_int = 448;
 3089              pub static S_IXUSR : c_int = 64;
 3090              pub static S_IWUSR : c_int = 128;
 3091              pub static S_IRUSR : c_int = 256;
 3092              pub static F_OK : c_int = 0;
 3093              pub static R_OK : c_int = 4;
 3094              pub static W_OK : c_int = 2;
 3095              pub static X_OK : c_int = 1;
 3096              pub static STDIN_FILENO : c_int = 0;
 3097              pub static STDOUT_FILENO : c_int = 1;
 3098              pub static STDERR_FILENO : c_int = 2;
 3099              pub static F_LOCK : c_int = 1;
 3100              pub static F_TEST : c_int = 3;
 3101              pub static F_TLOCK : c_int = 2;
 3102              pub static F_ULOCK : c_int = 0;
 3103              pub static SIGHUP : c_int = 1;
 3104              pub static SIGINT : c_int = 2;
 3105              pub static SIGQUIT : c_int = 3;
 3106              pub static SIGILL : c_int = 4;
 3107              pub static SIGABRT : c_int = 6;
 3108              pub static SIGFPE : c_int = 8;
 3109              pub static SIGKILL : c_int = 9;
 3110              pub static SIGSEGV : c_int = 11;
 3111              pub static SIGPIPE : c_int = 13;
 3112              pub static SIGALRM : c_int = 14;
 3113              pub static SIGTERM : c_int = 15;
 3114  
 3115              pub static PROT_NONE : c_int = 0;
 3116              pub static PROT_READ : c_int = 1;
 3117              pub static PROT_WRITE : c_int = 2;
 3118              pub static PROT_EXEC : c_int = 4;
 3119  
 3120              pub static MAP_FILE : c_int = 0x0000;
 3121              pub static MAP_SHARED : c_int = 0x0001;
 3122              pub static MAP_PRIVATE : c_int = 0x0002;
 3123              pub static MAP_FIXED : c_int = 0x0010;
 3124              pub static MAP_ANON : c_int = 0x1000;
 3125  
 3126              pub static MAP_FAILED : *c_void = -1 as *c_void;
 3127  
 3128              pub static MCL_CURRENT : c_int = 0x0001;
 3129              pub static MCL_FUTURE : c_int = 0x0002;
 3130  
 3131              pub static MS_ASYNC : c_int = 0x0001;
 3132              pub static MS_INVALIDATE : c_int = 0x0002;
 3133              pub static MS_SYNC : c_int = 0x0010;
 3134  
 3135              pub static MS_KILLPAGES : c_int = 0x0004;
 3136              pub static MS_DEACTIVATE : c_int = 0x0008;
 3137  
 3138              pub static EPERM : c_int = 1;
 3139              pub static ENOENT : c_int = 2;
 3140              pub static ESRCH : c_int = 3;
 3141              pub static EINTR : c_int = 4;
 3142              pub static EIO : c_int = 5;
 3143              pub static ENXIO : c_int = 6;
 3144              pub static E2BIG : c_int = 7;
 3145              pub static ENOEXEC : c_int = 8;
 3146              pub static EBADF : c_int = 9;
 3147              pub static ECHILD : c_int = 10;
 3148              pub static EDEADLK : c_int = 11;
 3149              pub static ENOMEM : c_int = 12;
 3150              pub static EACCES : c_int = 13;
 3151              pub static EFAULT : c_int = 14;
 3152              pub static ENOTBLK : c_int = 15;
 3153              pub static EBUSY : c_int = 16;
 3154              pub static EEXIST : c_int = 17;
 3155              pub static EXDEV : c_int = 18;
 3156              pub static ENODEV : c_int = 19;
 3157              pub static ENOTDIR : c_int = 20;
 3158              pub static EISDIR : c_int = 21;
 3159              pub static EINVAL : c_int = 22;
 3160              pub static ENFILE : c_int = 23;
 3161              pub static EMFILE : c_int = 24;
 3162              pub static ENOTTY : c_int = 25;
 3163              pub static ETXTBSY : c_int = 26;
 3164              pub static EFBIG : c_int = 27;
 3165              pub static ENOSPC : c_int = 28;
 3166              pub static ESPIPE : c_int = 29;
 3167              pub static EROFS : c_int = 30;
 3168              pub static EMLINK : c_int = 31;
 3169              pub static EPIPE : c_int = 32;
 3170              pub static EDOM : c_int = 33;
 3171              pub static ERANGE : c_int = 34;
 3172              pub static EAGAIN : c_int = 35;
 3173              pub static EWOULDBLOCK : c_int = EAGAIN;
 3174              pub static EINPROGRESS : c_int = 36;
 3175              pub static EALREADY : c_int = 37;
 3176              pub static ENOTSOCK : c_int = 38;
 3177              pub static EDESTADDRREQ : c_int = 39;
 3178              pub static EMSGSIZE : c_int = 40;
 3179              pub static EPROTOTYPE : c_int = 41;
 3180              pub static ENOPROTOOPT : c_int = 42;
 3181              pub static EPROTONOSUPPORT : c_int = 43;
 3182              pub static ESOCKTNOSUPPORT : c_int = 44;
 3183              pub static ENOTSUP : c_int = 45;
 3184              pub static EPFNOSUPPORT : c_int = 46;
 3185              pub static EAFNOSUPPORT : c_int = 47;
 3186              pub static EADDRINUSE : c_int = 48;
 3187              pub static EADDRNOTAVAIL : c_int = 49;
 3188              pub static ENETDOWN : c_int = 50;
 3189              pub static ENETUNREACH : c_int = 51;
 3190              pub static ENETRESET : c_int = 52;
 3191              pub static ECONNABORTED : c_int = 53;
 3192              pub static ECONNRESET : c_int = 54;
 3193              pub static ENOBUFS : c_int = 55;
 3194              pub static EISCONN : c_int = 56;
 3195              pub static ENOTCONN : c_int = 57;
 3196              pub static ESHUTDOWN : c_int = 58;
 3197              pub static ETOOMANYREFS : c_int = 59;
 3198              pub static ETIMEDOUT : c_int = 60;
 3199              pub static ECONNREFUSED : c_int = 61;
 3200              pub static ELOOP : c_int = 62;
 3201              pub static ENAMETOOLONG : c_int = 63;
 3202              pub static EHOSTDOWN : c_int = 64;
 3203              pub static EHOSTUNREACH : c_int = 65;
 3204              pub static ENOTEMPTY : c_int = 66;
 3205              pub static EPROCLIM : c_int = 67;
 3206              pub static EUSERS : c_int = 68;
 3207              pub static EDQUOT : c_int = 69;
 3208              pub static ESTALE : c_int = 70;
 3209              pub static EREMOTE : c_int = 71;
 3210              pub static EBADRPC : c_int = 72;
 3211              pub static ERPCMISMATCH : c_int = 73;
 3212              pub static EPROGUNAVAIL : c_int = 74;
 3213              pub static EPROGMISMATCH : c_int = 75;
 3214              pub static EPROCUNAVAIL : c_int = 76;
 3215              pub static ENOLCK : c_int = 77;
 3216              pub static ENOSYS : c_int = 78;
 3217              pub static EFTYPE : c_int = 79;
 3218              pub static EAUTH : c_int = 80;
 3219              pub static ENEEDAUTH : c_int = 81;
 3220              pub static EPWROFF : c_int = 82;
 3221              pub static EDEVERR : c_int = 83;
 3222              pub static EOVERFLOW : c_int = 84;
 3223              pub static EBADEXEC : c_int = 85;
 3224              pub static EBADARCH : c_int = 86;
 3225              pub static ESHLIBVERS : c_int = 87;
 3226              pub static EBADMACHO : c_int = 88;
 3227              pub static ECANCELED : c_int = 89;
 3228              pub static EIDRM : c_int = 90;
 3229              pub static ENOMSG : c_int = 91;
 3230              pub static EILSEQ : c_int = 92;
 3231              pub static ENOATTR : c_int = 93;
 3232              pub static EBADMSG : c_int = 94;
 3233              pub static EMULTIHOP : c_int = 95;
 3234              pub static ENODATA : c_int = 96;
 3235              pub static ENOLINK : c_int = 97;
 3236              pub static ENOSR : c_int = 98;
 3237              pub static ENOSTR : c_int = 99;
 3238              pub static EPROTO : c_int = 100;
 3239              pub static ETIME : c_int = 101;
 3240              pub static EOPNOTSUPP : c_int = 102;
 3241              pub static ENOPOLICY : c_int = 103;
 3242              pub static ENOTRECOVERABLE : c_int = 104;
 3243              pub static EOWNERDEAD : c_int = 105;
 3244              pub static EQFULL : c_int = 106;
 3245              pub static ELAST : c_int = 106;
 3246          }
 3247          pub mod posix01 {
 3248              use types::os::arch::c95::{c_int, size_t};
 3249  
 3250              pub static SIGTRAP : c_int = 5;
 3251              pub static SIGPIPE: c_int = 13;
 3252              pub static SIG_IGN: size_t = 1;
 3253  
 3254              pub static GLOB_APPEND   : c_int = 0x0001;
 3255              pub static GLOB_DOOFFS   : c_int = 0x0002;
 3256              pub static GLOB_ERR      : c_int = 0x0004;
 3257              pub static GLOB_MARK     : c_int = 0x0008;
 3258              pub static GLOB_NOCHECK  : c_int = 0x0010;
 3259              pub static GLOB_NOSORT   : c_int = 0x0020;
 3260              pub static GLOB_NOESCAPE : c_int = 0x2000;
 3261  
 3262              pub static GLOB_NOSPACE  : c_int = -1;
 3263              pub static GLOB_ABORTED  : c_int = -2;
 3264              pub static GLOB_NOMATCH  : c_int = -3;
 3265  
 3266              pub static POSIX_MADV_NORMAL : c_int = 0;
 3267              pub static POSIX_MADV_RANDOM : c_int = 1;
 3268              pub static POSIX_MADV_SEQUENTIAL : c_int = 2;
 3269              pub static POSIX_MADV_WILLNEED : c_int = 3;
 3270              pub static POSIX_MADV_DONTNEED : c_int = 4;
 3271  
 3272              pub static _SC_IOV_MAX : c_int = 56;
 3273              pub static _SC_GETGR_R_SIZE_MAX : c_int = 70;
 3274              pub static _SC_GETPW_R_SIZE_MAX : c_int = 71;
 3275              pub static _SC_LOGIN_NAME_MAX : c_int = 73;
 3276              pub static _SC_MQ_PRIO_MAX : c_int = 75;
 3277              pub static _SC_THREAD_ATTR_STACKADDR : c_int = 82;
 3278              pub static _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
 3279              pub static _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
 3280              pub static _SC_THREAD_KEYS_MAX : c_int = 86;
 3281              pub static _SC_THREAD_PRIO_INHERIT : c_int = 87;
 3282              pub static _SC_THREAD_PRIO_PROTECT : c_int = 88;
 3283              pub static _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
 3284              pub static _SC_THREAD_PROCESS_SHARED : c_int = 90;
 3285              pub static _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
 3286              pub static _SC_THREAD_STACK_MIN : c_int = 93;
 3287              pub static _SC_THREAD_THREADS_MAX : c_int = 94;
 3288              pub static _SC_THREADS : c_int = 96;
 3289              pub static _SC_TTY_NAME_MAX : c_int = 101;
 3290              pub static _SC_ATEXIT_MAX : c_int = 107;
 3291              pub static _SC_XOPEN_CRYPT : c_int = 108;
 3292              pub static _SC_XOPEN_ENH_I18N : c_int = 109;
 3293              pub static _SC_XOPEN_LEGACY : c_int = 110;
 3294              pub static _SC_XOPEN_REALTIME : c_int = 111;
 3295              pub static _SC_XOPEN_REALTIME_THREADS : c_int = 112;
 3296              pub static _SC_XOPEN_SHM : c_int = 113;
 3297              pub static _SC_XOPEN_UNIX : c_int = 115;
 3298              pub static _SC_XOPEN_VERSION : c_int = 116;
 3299              pub static _SC_XOPEN_XCU_VERSION : c_int = 121;
 3300  
 3301              pub static PTHREAD_CREATE_JOINABLE: c_int = 1;
 3302              pub static PTHREAD_CREATE_DETACHED: c_int = 2;
 3303              pub static PTHREAD_STACK_MIN: size_t = 8192;
 3304  
 3305              pub static WNOHANG: c_int = 1;
 3306          }
 3307          pub mod posix08 {
 3308          }
 3309          pub mod bsd44 {
 3310              use types::os::arch::c95::c_int;
 3311  
 3312              pub static MADV_NORMAL : c_int = 0;
 3313              pub static MADV_RANDOM : c_int = 1;
 3314              pub static MADV_SEQUENTIAL : c_int = 2;
 3315              pub static MADV_WILLNEED : c_int = 3;
 3316              pub static MADV_DONTNEED : c_int = 4;
 3317              pub static MADV_FREE : c_int = 5;
 3318              pub static MADV_ZERO_WIRED_PAGES : c_int = 6;
 3319              pub static MADV_FREE_REUSABLE : c_int = 7;
 3320              pub static MADV_FREE_REUSE : c_int = 8;
 3321              pub static MADV_CAN_REUSE : c_int = 9;
 3322  
 3323              pub static MINCORE_INCORE : c_int =  0x1;
 3324              pub static MINCORE_REFERENCED : c_int = 0x2;
 3325              pub static MINCORE_MODIFIED : c_int = 0x4;
 3326              pub static MINCORE_REFERENCED_OTHER : c_int = 0x8;
 3327              pub static MINCORE_MODIFIED_OTHER : c_int = 0x10;
 3328  
 3329              pub static AF_UNIX: c_int = 1;
 3330              pub static AF_INET: c_int = 2;
 3331              pub static AF_INET6: c_int = 30;
 3332              pub static SOCK_STREAM: c_int = 1;
 3333              pub static SOCK_DGRAM: c_int = 2;
 3334              pub static IPPROTO_TCP: c_int = 6;
 3335              pub static IPPROTO_IP: c_int = 0;
 3336              pub static IPPROTO_IPV6: c_int = 41;
 3337              pub static IP_MULTICAST_TTL: c_int = 10;
 3338              pub static IP_MULTICAST_LOOP: c_int = 11;
 3339              pub static IP_TTL: c_int = 4;
 3340              pub static IP_ADD_MEMBERSHIP: c_int = 12;
 3341              pub static IP_DROP_MEMBERSHIP: c_int = 13;
 3342              pub static IPV6_ADD_MEMBERSHIP: c_int = 12;
 3343              pub static IPV6_DROP_MEMBERSHIP: c_int = 13;
 3344  
 3345              pub static TCP_NODELAY: c_int = 0x01;
 3346              pub static TCP_KEEPALIVE: c_int = 0x10;
 3347              pub static SOL_SOCKET: c_int = 0xffff;
 3348              pub static SO_KEEPALIVE: c_int = 0x0008;
 3349              pub static SO_BROADCAST: c_int = 0x0020;
 3350              pub static SO_REUSEADDR: c_int = 0x0004;
 3351              pub static SO_ERROR: c_int = 0x1007;
 3352  
 3353              pub static SHUT_RD: c_int = 0;
 3354              pub static SHUT_WR: c_int = 1;
 3355              pub static SHUT_RDWR: c_int = 2;
 3356          }
 3357          pub mod extra {
 3358              use types::os::arch::c95::c_int;
 3359  
 3360              pub static O_DSYNC : c_int = 4194304;
 3361              pub static O_SYNC : c_int = 128;
 3362              pub static F_FULLFSYNC : c_int = 51;
 3363  
 3364              pub static MAP_COPY : c_int = 0x0002;
 3365              pub static MAP_RENAME : c_int = 0x0020;
 3366              pub static MAP_NORESERVE : c_int = 0x0040;
 3367              pub static MAP_NOEXTEND : c_int = 0x0100;
 3368              pub static MAP_HASSEMAPHORE : c_int = 0x0200;
 3369              pub static MAP_NOCACHE : c_int = 0x0400;
 3370              pub static MAP_JIT : c_int = 0x0800;
 3371              pub static MAP_STACK : c_int = 0;
 3372          }
 3373          pub mod sysconf {
 3374              use types::os::arch::c95::c_int;
 3375  
 3376              pub static _SC_ARG_MAX : c_int = 1;
 3377              pub static _SC_CHILD_MAX : c_int = 2;
 3378              pub static _SC_CLK_TCK : c_int = 3;
 3379              pub static _SC_NGROUPS_MAX : c_int = 4;
 3380              pub static _SC_OPEN_MAX : c_int = 5;
 3381              pub static _SC_JOB_CONTROL : c_int = 6;
 3382              pub static _SC_SAVED_IDS : c_int = 7;
 3383              pub static _SC_VERSION : c_int = 8;
 3384              pub static _SC_BC_BASE_MAX : c_int = 9;
 3385              pub static _SC_BC_DIM_MAX : c_int = 10;
 3386              pub static _SC_BC_SCALE_MAX : c_int = 11;
 3387              pub static _SC_BC_STRING_MAX : c_int = 12;
 3388              pub static _SC_COLL_WEIGHTS_MAX : c_int = 13;
 3389              pub static _SC_EXPR_NEST_MAX : c_int = 14;
 3390              pub static _SC_LINE_MAX : c_int = 15;
 3391              pub static _SC_RE_DUP_MAX : c_int = 16;
 3392              pub static _SC_2_VERSION : c_int = 17;
 3393              pub static _SC_2_C_BIND : c_int = 18;
 3394              pub static _SC_2_C_DEV : c_int = 19;
 3395              pub static _SC_2_CHAR_TERM : c_int = 20;
 3396              pub static _SC_2_FORT_DEV : c_int = 21;
 3397              pub static _SC_2_FORT_RUN : c_int = 22;
 3398              pub static _SC_2_LOCALEDEF : c_int = 23;
 3399              pub static _SC_2_SW_DEV : c_int = 24;
 3400              pub static _SC_2_UPE : c_int = 25;
 3401              pub static _SC_STREAM_MAX : c_int = 26;
 3402              pub static _SC_TZNAME_MAX : c_int = 27;
 3403              pub static _SC_ASYNCHRONOUS_IO : c_int = 28;
 3404              pub static _SC_PAGESIZE : c_int = 29;
 3405              pub static _SC_MEMLOCK : c_int = 30;
 3406              pub static _SC_MEMLOCK_RANGE : c_int = 31;
 3407              pub static _SC_MEMORY_PROTECTION : c_int = 32;
 3408              pub static _SC_MESSAGE_PASSING : c_int = 33;
 3409              pub static _SC_PRIORITIZED_IO : c_int = 34;
 3410              pub static _SC_PRIORITY_SCHEDULING : c_int = 35;
 3411              pub static _SC_REALTIME_SIGNALS : c_int = 36;
 3412              pub static _SC_SEMAPHORES : c_int = 37;
 3413              pub static _SC_FSYNC : c_int = 38;
 3414              pub static _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
 3415              pub static _SC_SYNCHRONIZED_IO : c_int = 40;
 3416              pub static _SC_TIMERS : c_int = 41;
 3417              pub static _SC_AIO_LISTIO_MAX : c_int = 42;
 3418              pub static _SC_AIO_MAX : c_int = 43;
 3419              pub static _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
 3420              pub static _SC_DELAYTIMER_MAX : c_int = 45;
 3421              pub static _SC_MQ_OPEN_MAX : c_int = 46;
 3422              pub static _SC_MAPPED_FILES : c_int = 47;
 3423              pub static _SC_RTSIG_MAX : c_int = 48;
 3424              pub static _SC_SEM_NSEMS_MAX : c_int = 49;
 3425              pub static _SC_SEM_VALUE_MAX : c_int = 50;
 3426              pub static _SC_SIGQUEUE_MAX : c_int = 51;
 3427              pub static _SC_TIMER_MAX : c_int = 52;
 3428              pub static _SC_XBS5_ILP32_OFF32 : c_int = 122;
 3429              pub static _SC_XBS5_ILP32_OFFBIG : c_int = 123;
 3430              pub static _SC_XBS5_LP64_OFF64 : c_int = 124;
 3431              pub static _SC_XBS5_LPBIG_OFFBIG : c_int = 125;
 3432          }
 3433      }
 3434  }
 3435  
 3436  
 3437  pub mod funcs {
 3438      // Thankfull most of c95 is universally available and does not vary by OS
 3439      // or anything. The same is not true of POSIX.
 3440  
 3441      pub mod c95 {
 3442          pub mod ctype {
 3443              use types::os::arch::c95::{c_char, c_int};
 3444  
 3445              extern {
 3446                  pub fn isalnum(cc_int) -> c_int;
 3447                  pub fn isalpha(cc_int) -> c_int;
 3448                  pub fn iscntrl(cc_int) -> c_int;
 3449                  pub fn isdigit(cc_int) -> c_int;
 3450                  pub fn isgraph(cc_int) -> c_int;
 3451                  pub fn islower(cc_int) -> c_int;
 3452                  pub fn isprint(cc_int) -> c_int;
 3453                  pub fn ispunct(cc_int) -> c_int;
 3454                  pub fn isspace(cc_int) -> c_int;
 3455                  pub fn isupper(cc_int) -> c_int;
 3456                  pub fn isxdigit(cc_int) -> c_int;
 3457                  pub fn tolower(cc_char) -> c_char;
 3458                  pub fn toupper(cc_char) -> c_char;
 3459              }
 3460          }
 3461  
 3462          pub mod stdio {
 3463              use types::common::c95::{FILE, c_void, fpos_t};
 3464              use types::os::arch::c95::{c_char, c_int, c_long, size_t};
 3465  
 3466              extern {
 3467                  pub fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
 3468                  pub fn freopen(filename: *c_char, mode: *c_char, file: *FILE)
 3469                                 -> *FILE;
 3470                  pub fn fflush(file: *FILE) -> c_int;
 3471                  pub fn fclose(file: *FILE) -> c_int;
 3472                  pub fn remove(filename: *c_char) -> c_int;
 3473                  pub fn rename(oldname: *c_char, newname: *c_char) -> c_int;
 3474                  pub fn tmpfile() -> *FILE;
 3475                  pub fn setvbuf(stream: *FILE,
 3476                                 buffer: *c_char,
 3477                                 modec_int,
 3478                                 sizesize_t)
 3479                                 -> c_int;
 3480                  pub fn setbuf(stream: *FILE, buf: *c_char);
 3481                  // Omitted: printf and scanf variants.
 3482                  pub fn fgetc(stream: *FILE) -> c_int;
 3483                  pub fn fgets(buf: *mut c_char, nc_int, stream: *FILE)
 3484                               -> *c_char;
 3485                  pub fn fputc(cc_int, stream: *FILE) -> c_int;
 3486                  pub fn fputs(s: *c_char, stream: *FILE) -> *c_char;
 3487                  // Omitted: getc, getchar (might be macros).
 3488  
 3489                  // Omitted: gets, so ridiculously unsafe that it should not
 3490                  // survive.
 3491  
 3492                  // Omitted: putc, putchar (might be macros).
 3493                  pub fn puts(s: *c_char) -> c_int;
 3494                  pub fn ungetc(cc_int, stream: *FILE) -> c_int;
 3495                  pub fn fread(ptr: *mut c_void,
 3496                               sizesize_t,
 3497                               nobjsize_t,
 3498                               stream: *FILE)
 3499                               -> size_t;
 3500                  pub fn fwrite(ptr: *c_void,
 3501                                sizesize_t,
 3502                                nobjsize_t,
 3503                                stream: *FILE)
 3504                                -> size_t;
 3505                  pub fn fseek(stream: *FILE, offsetc_long, whencec_int)
 3506                               -> c_int;
 3507                  pub fn ftell(stream: *FILE) -> c_long;
 3508                  pub fn rewind(stream: *FILE);
 3509                  pub fn fgetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
 3510                  pub fn fsetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
 3511                  pub fn feof(stream: *FILE) -> c_int;
 3512                  pub fn ferror(stream: *FILE) -> c_int;
 3513                  pub fn perror(s: *c_char);
 3514              }
 3515          }
 3516  
 3517          pub mod stdlib {
 3518              use types::common::c95::c_void;
 3519              use types::os::arch::c95::{c_char, c_double, c_int};
 3520              use types::os::arch::c95::{c_long, c_uint, c_ulong};
 3521              use types::os::arch::c95::{size_t};
 3522  
 3523              extern {
 3524                  pub fn abs(ic_int) -> c_int;
 3525                  pub fn labs(ic_long) -> c_long;
 3526                  // Omitted: div, ldiv (return pub type incomplete).
 3527                  pub fn atof(s: *c_char) -> c_double;
 3528                  pub fn atoi(s: *c_char) -> c_int;
 3529                  pub fn strtod(s: *c_char, endp: **c_char) -> c_double;
 3530                  pub fn strtol(s: *c_char, endp: **c_char, basec_int)
 3531                                -> c_long;
 3532                  pub fn strtoul(s: *c_char, endp: **c_char, basec_int)
 3533                                 -> c_ulong;
 3534                  pub fn calloc(nobjsize_t, sizesize_t) -> *c_void;
 3535                  pub fn malloc(sizesize_t) -> *mut c_void;
 3536                  pub fn realloc(p: *mut c_void, sizesize_t) -> *mut c_void;
 3537                  pub fn free(p: *mut c_void);
 3538                  pub fn exit(statusc_int) -> !;
 3539                  pub fn _exit(statusc_int) -> !;
 3540                  // Omitted: atexit.
 3541                  pub fn system(s: *c_char) -> c_int;
 3542                  pub fn getenv(s: *c_char) -> *c_char;
 3543                  // Omitted: bsearch, qsort
 3544                  pub fn rand() -> c_int;
 3545                  pub fn srand(seedc_uint);
 3546              }
 3547          }
 3548  
 3549          pub mod string {
 3550              use types::common::c95::c_void;
 3551              use types::os::arch::c95::{c_char, c_int, size_t};
 3552              use types::os::arch::c95::{wchar_t};
 3553  
 3554              extern {
 3555                  pub fn strcpy(dst: *c_char, src: *c_char) -> *c_char;
 3556                  pub fn strncpy(dst: *c_char, src: *c_char, nsize_t)
 3557                                 -> *c_char;
 3558                  pub fn strcat(s: *c_char, ct: *c_char) -> *c_char;
 3559                  pub fn strncat(s: *c_char, ct: *c_char, nsize_t) -> *c_char;
 3560                  pub fn strcmp(cs: *c_char, ct: *c_char) -> c_int;
 3561                  pub fn strncmp(cs: *c_char, ct: *c_char, nsize_t) -> c_int;
 3562                  pub fn strcoll(cs: *c_char, ct: *c_char) -> c_int;
 3563                  pub fn strchr(cs: *c_char, cc_int) -> *c_char;
 3564                  pub fn strrchr(cs: *c_char, cc_int) -> *c_char;
 3565                  pub fn strspn(cs: *c_char, ct: *c_char) -> size_t;
 3566                  pub fn strcspn(cs: *c_char, ct: *c_char) -> size_t;
 3567                  pub fn strpbrk(cs: *c_char, ct: *c_char) -> *c_char;
 3568                  pub fn strstr(cs: *c_char, ct: *c_char) -> *c_char;
 3569                  pub fn strlen(cs: *c_char) -> size_t;
 3570                  pub fn strerror(nc_int) -> *c_char;
 3571                  pub fn strtok(s: *c_char, t: *c_char) -> *c_char;
 3572                  pub fn strxfrm(s: *c_char, ct: *c_char, nsize_t) -> size_t;
 3573                  pub fn wcslen(buf: *wchar_t) -> size_t;
 3574  
 3575                  // Omitted: memcpy, memmove, memset (provided by LLVM)
 3576  
 3577                  // These are fine to execute on the Rust stack. They must be,
 3578                  // in fact, because LLVM generates calls to them!
 3579                  pub fn memcmp(cx: *c_void, ct: *c_void, nsize_t) -> c_int;
 3580                  pub fn memchr(cx: *c_void, cc_int, nsize_t) -> *c_void;
 3581              }
 3582          }
 3583      }
 3584  
 3585      // Microsoft helpfully underscore-qualifies all of its POSIX-like symbols
 3586      // to make sure you don't use them accidentally. It also randomly deviates
 3587      // from the exact signatures you might otherwise expect, and omits much,
 3588      // so be careful when trying to write portable code; it won't always work
 3589      // with the same POSIX functions and types as other platforms.
 3590  
 3591      #[cfg(target_os = "win32")]
 3592      pub mod posix88 {
 3593          pub mod stat_ {
 3594              use types::os::common::posix01::{stat, utimbuf};
 3595              use types::os::arch::c95::{c_int, c_char, wchar_t};
 3596  
 3597              extern {
 3598                  #[link_name = "_chmod"]
 3599                  pub fn chmod(path: *c_char, mode: c_int) -> c_int;
 3600                  #[link_name = "_wchmod"]
 3601                  pub fn wchmod(path: *wchar_t, mode: c_int) -> c_int;
 3602                  #[link_name = "_mkdir"]
 3603                  pub fn mkdir(path: *c_char) -> c_int;
 3604                  #[link_name = "_wrmdir"]
 3605                  pub fn wrmdir(path: *wchar_t) -> c_int;
 3606                  #[link_name = "_fstat64"]
 3607                  pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
 3608                  #[link_name = "_stat64"]
 3609                  pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
 3610                  #[link_name = "_wstat64"]
 3611                  pub fn wstat(path: *wchar_t, buf: *mut stat) -> c_int;
 3612                  #[link_name = "_wutime64"]
 3613                  pub fn wutime(file: *wchar_t, buf: *utimbuf) -> c_int;
 3614              }
 3615          }
 3616  
 3617          pub mod stdio {
 3618              use types::common::c95::FILE;
 3619              use types::os::arch::c95::{c_int, c_char};
 3620  
 3621              extern {
 3622                  #[link_name = "_popen"]
 3623                  pub fn popen(command: *c_char, mode: *c_char) -> *FILE;
 3624                  #[link_name = "_pclose"]
 3625                  pub fn pclose(stream: *FILE) -> c_int;
 3626                  #[link_name = "_fdopen"]
 3627                  pub fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
 3628                  #[link_name = "_fileno"]
 3629                  pub fn fileno(stream: *FILE) -> c_int;
 3630              }
 3631          }
 3632  
 3633          pub mod fcntl {
 3634              use types::os::arch::c95::{c_int, c_char, wchar_t};
 3635              extern {
 3636                  #[link_name = "_open"]
 3637                  pub fn open(path: *c_char, oflag: c_int, mode: c_int)
 3638                              -> c_int;
 3639                  #[link_name = "_wopen"]
 3640                  pub fn wopen(path: *wchar_t, oflag: c_int, mode: c_int)
 3641                              -> c_int;
 3642                  #[link_name = "_creat"]
 3643                  pub fn creat(path: *c_char, mode: c_int) -> c_int;
 3644              }
 3645          }
 3646  
 3647          pub mod dirent {
 3648              // Not supplied at all.
 3649          }
 3650  
 3651          pub mod unistd {
 3652              use types::common::c95::c_void;
 3653              use types::os::arch::c95::{c_int, c_uint, c_char,
 3654                                               c_long, size_t};
 3655              use types::os::arch::c99::intptr_t;
 3656  
 3657              extern {
 3658                  #[link_name = "_access"]
 3659                  pub fn access(path: *c_char, amode: c_int) -> c_int;
 3660                  #[link_name = "_chdir"]
 3661                  pub fn chdir(dir: *c_char) -> c_int;
 3662                  #[link_name = "_close"]
 3663                  pub fn close(fd: c_int) -> c_int;
 3664                  #[link_name = "_dup"]
 3665                  pub fn dup(fd: c_int) -> c_int;
 3666                  #[link_name = "_dup2"]
 3667                  pub fn dup2(src: c_int, dst: c_int) -> c_int;
 3668                  #[link_name = "_execv"]
 3669                  pub fn execv(prog: *c_char, argv: **c_char) -> intptr_t;
 3670                  #[link_name = "_execve"]
 3671                  pub fn execve(prog: *c_char, argv: **c_char, envp: **c_char)
 3672                                -> c_int;
 3673                  #[link_name = "_execvp"]
 3674                  pub fn execvp(c: *c_char, argv: **c_char) -> c_int;
 3675                  #[link_name = "_execvpe"]
 3676                  pub fn execvpe(c: *c_char, argv: **c_char, envp: **c_char)
 3677                                 -> c_int;
 3678                  #[link_name = "_getcwd"]
 3679                  pub fn getcwd(buf: *mut c_char, size: size_t) -> *c_char;
 3680                  #[link_name = "_getpid"]
 3681                  pub fn getpid() -> c_int;
 3682                  #[link_name = "_isatty"]
 3683                  pub fn isatty(fd: c_int) -> c_int;
 3684                  #[link_name = "_lseek"]
 3685                  pub fn lseek(fd: c_int, offset: c_long, origin: c_int)
 3686                               -> c_long;
 3687                  #[link_name = "_pipe"]
 3688                  pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
 3689                              -> c_int;
 3690                  #[link_name = "_read"]
 3691                  pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
 3692                              -> c_int;
 3693                  #[link_name = "_rmdir"]
 3694                  pub fn rmdir(path: *c_char) -> c_int;
 3695                  #[link_name = "_unlink"]
 3696                  pub fn unlink(c: *c_char) -> c_int;
 3697                  #[link_name = "_write"]
 3698                  pub fn write(fd: c_int, buf: *c_void, count: c_uint) -> c_int;
 3699              }
 3700          }
 3701  
 3702          pub mod mman {
 3703          }
 3704      }
 3705  
 3706  
 3707      #[cfg(target_os = "linux")]
 3708      #[cfg(target_os = "android")]
 3709      #[cfg(target_os = "macos")]
 3710      #[cfg(target_os = "freebsd")]
 3711      pub mod posix88 {
 3712          pub mod stat_ {
 3713              use types::os::arch::c95::{c_char, c_int};
 3714              use types::os::arch::posix01::stat;
 3715              use types::os::arch::posix88::mode_t;
 3716  
 3717              extern {
 3718                  pub fn chmod(path: *c_char, modemode_t) -> c_int;
 3719                  pub fn fchmod(fdc_int, modemode_t) -> c_int;
 3720  
 3721                  #[cfg(target_os = "linux")]
 3722                  #[cfg(target_os = "freebsd")]
 3723                  #[cfg(target_os = "android")]
 3724                  pub fn fstat(fildesc_int, buf: *mut stat) -> c_int;
 3725  
 3726                  #[cfg(target_os = "macos")]
 3727                  #[link_name = "fstat64"]
 3728                  pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
 3729  
 3730                  pub fn mkdir(path: *c_char, modemode_t) -> c_int;
 3731                  pub fn mkfifo(path: *c_char, modemode_t) -> c_int;
 3732  
 3733                  #[cfg(target_os = "linux")]
 3734                  #[cfg(target_os = "freebsd")]
 3735                  #[cfg(target_os = "android")]
 3736                  pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
 3737  
 3738                  #[cfg(target_os = "macos")]
 3739                  #[link_name = "stat64"]
 3740                  pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
 3741              }
 3742          }
 3743  
 3744          pub mod stdio {
 3745              use types::common::c95::FILE;
 3746              use types::os::arch::c95::{c_char, c_int};
 3747  
 3748              extern {
 3749                  pub fn popen(command: *c_char, mode: *c_char) -> *FILE;
 3750                  pub fn pclose(stream: *FILE) -> c_int;
 3751                  pub fn fdopen(fdc_int, mode: *c_char) -> *FILE;
 3752                  pub fn fileno(stream: *FILE) -> c_int;
 3753              }
 3754          }
 3755  
 3756          pub mod fcntl {
 3757              use types::os::arch::c95::{c_char, c_int};
 3758              use types::os::arch::posix88::mode_t;
 3759  
 3760              extern {
 3761                  pub fn open(path: *c_char, oflagc_int, modec_int)
 3762                              -> c_int;
 3763                  pub fn creat(path: *c_char, modemode_t) -> c_int;
 3764                  pub fn fcntl(fdc_int, cmdc_int, ...) -> c_int;
 3765              }
 3766          }
 3767  
 3768          pub mod dirent {
 3769              use types::common::posix88::{DIR, dirent_t};
 3770              use types::os::arch::c95::{c_char, c_int, c_long};
 3771  
 3772              // NB: On OS X opendir and readdir have two versions,
 3773              // one for 32-bit kernelspace and one for 64.
 3774              // We should be linking to the 64-bit ones, called
 3775              // opendir$INODE64, etc. but for some reason rustc
 3776              // doesn't link it correctly on i686, so we're going
 3777              // through a C function that mysteriously does work.
 3778  
 3779              extern {
 3780                  #[link_name="rust_opendir"]
 3781                  pub fn opendir(dirname: *c_char) -> *DIR;
 3782                  #[link_name="rust_readdir_r"]
 3783                  pub fn readdir_r(dirp: *DIR, entry: *mut dirent_t,
 3784                                    result: *mut *mut dirent_t) -> c_int;
 3785              }
 3786  
 3787              extern {
 3788                  pub fn closedir(dirp: *DIR) -> c_int;
 3789                  pub fn rewinddir(dirp: *DIR);
 3790                  pub fn seekdir(dirp: *DIR, locc_long);
 3791                  pub fn telldir(dirp: *DIR) -> c_long;
 3792              }
 3793          }
 3794  
 3795          pub mod unistd {
 3796              use types::common::c95::c_void;
 3797              use types::os::arch::c95::{c_char, c_int, c_long, c_uint};
 3798              use types::os::arch::c95::{size_t};
 3799              use types::os::common::posix01::timespec;
 3800              use types::os::arch::posix01::utimbuf;
 3801              use types::os::arch::posix88::{gid_t, off_t, pid_t};
 3802              use types::os::arch::posix88::{ssize_t, uid_t};
 3803  
 3804              pub static _PC_NAME_MAX: c_int = 4;
 3805  
 3806              extern {
 3807                  pub fn access(path: *c_char, amodec_int) -> c_int;
 3808                  pub fn alarm(secondsc_uint) -> c_uint;
 3809                  pub fn chdir(dir: *c_char) -> c_int;
 3810                  pub fn chown(path: *c_char, uiduid_t, gidgid_t) -> c_int;
 3811                  pub fn close(fdc_int) -> c_int;
 3812                  pub fn dup(fdc_int) -> c_int;
 3813                  pub fn dup2(srcc_int, dstc_int) -> c_int;
 3814                  pub fn execv(prog: *c_char, argv: **c_char) -> c_int;
 3815                  pub fn execve(prog: *c_char, argv: **c_char, envp: **c_char)
 3816                                -> c_int;
 3817                  pub fn execvp(c: *c_char, argv: **c_char) -> c_int;
 3818                  pub fn fork() -> pid_t;
 3819                  pub fn fpathconf(filedesc_int, namec_int) -> c_long;
 3820                  pub fn getcwd(buf: *mut c_char, sizesize_t) -> *c_char;
 3821                  pub fn getegid() -> gid_t;
 3822                  pub fn geteuid() -> uid_t;
 3823                  pub fn getgid() -> gid_t ;
 3824                  pub fn getgroups(ngroups_maxc_int, groups: *mut gid_t)
 3825                                   -> c_int;
 3826                  pub fn getlogin() -> *c_char;
 3827                  pub fn getopt(argcc_int, argv: **c_char, optstr: *c_char)
 3828                                -> c_int;
 3829                  pub fn getpgrp() -> pid_t;
 3830                  pub fn getpid() -> pid_t;
 3831                  pub fn getppid() -> pid_t;
 3832                  pub fn getuid() -> uid_t;
 3833                  pub fn isatty(fdc_int) -> c_int;
 3834                  pub fn link(src: *c_char, dst: *c_char) -> c_int;
 3835                  pub fn lseek(fdc_int, offsetoff_t, whencec_int)
 3836                               -> off_t;
 3837                  pub fn pathconf(path: *c_char, namec_int) -> c_long;
 3838                  pub fn pause() -> c_int;
 3839                  pub fn pipe(fds: *mut c_int) -> c_int;
 3840                  pub fn read(fdc_int, buf: *mut c_void, countsize_t)
 3841                              -> ssize_t;
 3842                  pub fn rmdir(path: *c_char) -> c_int;
 3843                  pub fn setgid(gidgid_t) -> c_int;
 3844                  pub fn setpgid(pidpid_t, pgidpid_t) -> c_int;
 3845                  pub fn setsid() -> pid_t;
 3846                  pub fn setuid(uiduid_t) -> c_int;
 3847                  pub fn sleep(secsc_uint) -> c_uint;
 3848                  pub fn usleep(secsc_uint) -> c_int;
 3849                  pub fn nanosleep(rqtp: *timespec, rmtp: *mut timespec) -> c_int;
 3850                  pub fn sysconf(namec_int) -> c_long;
 3851                  pub fn tcgetpgrp(fdc_int) -> pid_t;
 3852                  pub fn ttyname(fdc_int) -> *c_char;
 3853                  pub fn unlink(c: *c_char) -> c_int;
 3854                  pub fn write(fdc_int, buf: *c_void, countsize_t)
 3855                               -> ssize_t;
 3856                  pub fn pread(fdc_int, buf: *c_void, countsize_t,
 3857                               offsetoff_t) -> ssize_t;
 3858                  pub fn pwrite(fdc_int, buf: *c_void, countsize_t,
 3859                                offsetoff_t) -> ssize_t;
 3860                  pub fn utime(file: *c_char, buf: *utimbuf) -> c_int;
 3861              }
 3862          }
 3863  
 3864          pub mod signal {
 3865              use types::os::arch::c95::{c_int};
 3866              use types::os::arch::posix88::{pid_t};
 3867  
 3868              extern {
 3869                  pub fn kill(pidpid_t, sigc_int) -> c_int;
 3870              }
 3871          }
 3872  
 3873          pub mod mman {
 3874              use types::common::c95::{c_void};
 3875              use types::os::arch::c95::{size_t, c_int, c_char};
 3876              use types::os::arch::posix88::{mode_t, off_t};
 3877  
 3878              extern {
 3879                  pub fn mlock(addr: *c_void, lensize_t) -> c_int;
 3880                  pub fn munlock(addr: *c_void, lensize_t) -> c_int;
 3881                  pub fn mlockall(flagsc_int) -> c_int;
 3882                  pub fn munlockall() -> c_int;
 3883  
 3884                  pub fn mmap(addr: *c_void,
 3885                              lensize_t,
 3886                              protc_int,
 3887                              flagsc_int,
 3888                              fdc_int,
 3889                              offsetoff_t)
 3890                              -> *mut c_void;
 3891                  pub fn munmap(addr: *c_void, lensize_t) -> c_int;
 3892  
 3893                  pub fn mprotect(addr: *c_void, lensize_t, protc_int)
 3894                                  -> c_int;
 3895  
 3896                  pub fn msync(addr: *c_void, lensize_t, flagsc_int)
 3897                               -> c_int;
 3898                  pub fn shm_open(name: *c_char, oflagc_int, modemode_t)
 3899                                  -> c_int;
 3900                  pub fn shm_unlink(name: *c_char) -> c_int;
 3901              }
 3902          }
 3903      }
 3904  
 3905      #[cfg(target_os = "linux")]
 3906      #[cfg(target_os = "android")]
 3907      #[cfg(target_os = "macos")]
 3908      #[cfg(target_os = "freebsd")]
 3909      pub mod posix01 {
 3910          pub mod stat_ {
 3911              use types::os::arch::c95::{c_char, c_int};
 3912              use types::os::arch::posix01::stat;
 3913  
 3914              extern {
 3915                  #[cfg(target_os = "linux")]
 3916                  #[cfg(target_os = "freebsd")]
 3917                  #[cfg(target_os = "android")]
 3918                  pub fn lstat(path: *c_char, buf: *mut stat) -> c_int;
 3919  
 3920                  #[cfg(target_os = "macos")]
 3921                  #[link_name = "lstat64"]
 3922                  pub fn lstat(path: *c_char, buf: *mut stat) -> c_int;
 3923              }
 3924          }
 3925  
 3926          pub mod unistd {
 3927              use types::os::arch::c95::{c_char, c_int, size_t};
 3928              use types::os::arch::posix88::{ssize_t, off_t};
 3929  
 3930              extern {
 3931                  pub fn readlink(path: *c_char,
 3932                                  buf: *mut c_char,
 3933                                  bufszsize_t)
 3934                                  -> ssize_t;
 3935  
 3936                  pub fn fsync(fdc_int) -> c_int;
 3937  
 3938                  #[cfg(target_os = "linux")]
 3939                  #[cfg(target_os = "android")]
 3940                  pub fn fdatasync(fdc_int) -> c_int;
 3941  
 3942                  pub fn setenv(name: *c_char, val: *c_char, overwritec_int)
 3943                                -> c_int;
 3944                  pub fn unsetenv(name: *c_char) -> c_int;
 3945                  pub fn putenv(string: *c_char) -> c_int;
 3946  
 3947                  pub fn symlink(path1: *c_char, path2: *c_char) -> c_int;
 3948  
 3949                  pub fn ftruncate(fdc_int, lengthoff_t) -> c_int;
 3950              }
 3951          }
 3952  
 3953          pub mod signal {
 3954              use types::os::arch::c95::c_int;
 3955              use types::os::common::posix01::sighandler_t;
 3956  
 3957              #[cfg(not(target_os = "android"))]
 3958              extern {
 3959                  pub fn signal(signumc_int,
 3960                                handlersighandler_t) -> sighandler_t;
 3961              }
 3962  
 3963              #[cfg(target_os = "android")]
 3964              extern {
 3965                  #[link_name = "bsd_signal"]
 3966                  pub fn signal(signum: c_int,
 3967                                handler: sighandler_t) -> sighandler_t;
 3968              }
 3969          }
 3970  
 3971          pub mod wait {
 3972              use types::os::arch::c95::{c_int};
 3973              use types::os::arch::posix88::{pid_t};
 3974  
 3975              extern {
 3976                  pub fn waitpid(pidpid_t, status: *mut c_int, optionsc_int)
 3977                                 -> pid_t;
 3978              }
 3979          }
 3980  
 3981          pub mod glob {
 3982              use types::os::arch::c95::{c_char, c_int};
 3983              use types::os::common::posix01::{glob_t};
 3984  
 3985              extern {
 3986                  pub fn glob(pattern: *c_char,
 3987                              flagsc_int,
 3988                              errfunc::Nullable<extern "C" fn(epath: *c_char, errno: int) -> int>,
 3989                              pglob: *mut glob_t);
 3990                  pub fn globfree(pglob: *mut glob_t);
 3991              }
 3992          }
 3993  
 3994          pub mod mman {
 3995              use types::common::c95::{c_void};
 3996              use types::os::arch::c95::{c_int, size_t};
 3997  
 3998              extern {
 3999                  pub fn posix_madvise(addr: *c_void,
 4000                                       lensize_t,
 4001                                       advicec_int)
 4002                                       -> c_int;
 4003              }
 4004          }
 4005      }
 4006  
 4007      #[cfg(target_os = "win32")]
 4008      pub mod posix01 {
 4009          pub mod stat_ {
 4010          }
 4011  
 4012          pub mod unistd {
 4013          }
 4014  
 4015          pub mod glob {
 4016          }
 4017  
 4018          pub mod mman {
 4019          }
 4020      }
 4021  
 4022  
 4023      #[cfg(target_os = "win32")]
 4024      #[cfg(target_os = "linux")]
 4025      #[cfg(target_os = "android")]
 4026      #[cfg(target_os = "macos")]
 4027      #[cfg(target_os = "freebsd")]
 4028      pub mod posix08 {
 4029          pub mod unistd {
 4030          }
 4031      }
 4032  
 4033      #[cfg(not(windows))]
 4034      pub mod bsd43 {
 4035          use types::common::c95::{c_void};
 4036          use types::os::common::bsd44::{socklen_t, sockaddr};
 4037          use types::os::arch::c95::{c_int, size_t};
 4038          use types::os::arch::posix88::ssize_t;
 4039  
 4040          extern "system" {
 4041              pub fn socket(domainc_int, tyc_int, protocolc_int) -> c_int;
 4042              pub fn connect(socketc_int, address: *sockaddr,
 4043                             lensocklen_t) -> c_int;
 4044              pub fn bind(socketc_int, address: *sockaddr,
 4045                          address_lensocklen_t) -> c_int;
 4046              pub fn listen(socketc_int, backlogc_int) -> c_int;
 4047              pub fn accept(socketc_int, address: *mut sockaddr,
 4048                            address_len: *mut socklen_t) -> c_int;
 4049              pub fn getpeername(socketc_int, address: *mut sockaddr,
 4050                                 address_len: *mut socklen_t) -> c_int;
 4051              pub fn getsockname(socketc_int, address: *mut sockaddr,
 4052                                 address_len: *mut socklen_t) -> c_int;
 4053              pub fn setsockopt(socketc_int, levelc_int, namec_int,
 4054                                value: *c_void, option_lensocklen_t) -> c_int;
 4055              pub fn recv(socketc_int, buf: *mut c_void, lensize_t,
 4056                          flagsc_int) -> ssize_t;
 4057              pub fn send(socketc_int, buf: *mut c_void, lensize_t,
 4058                          flagsc_int) -> ssize_t;
 4059              pub fn recvfrom(socketc_int, buf: *mut c_void, lensize_t,
 4060                              flagsc_int, addr: *mut sockaddr,
 4061                              addrlen: *mut socklen_t) -> ssize_t;
 4062              pub fn sendto(socketc_int, buf: *c_void, lensize_t,
 4063                            flagsc_int, addr: *sockaddr,
 4064                            addrlensocklen_t) -> ssize_t;
 4065              pub fn shutdown(socketc_int, howc_int) -> c_int;
 4066          }
 4067      }
 4068  
 4069      #[cfg(windows)]
 4070      pub mod bsd43 {
 4071          use types::common::c95::{c_void};
 4072          use types::os::common::bsd44::{socklen_t, sockaddr, SOCKET};
 4073          use types::os::arch::c95::c_int;
 4074          use types::os::arch::posix88::ssize_t;
 4075  
 4076          extern "system" {
 4077              pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> SOCKET;
 4078              pub fn connect(socket: SOCKET, address: *sockaddr,
 4079                             len: socklen_t) -> c_int;
 4080              pub fn bind(socket: SOCKET, address: *sockaddr,
 4081                          address_len: socklen_t) -> c_int;
 4082              pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
 4083              pub fn accept(socket: SOCKET, address: *mut sockaddr,
 4084                            address_len: *mut socklen_t) -> SOCKET;
 4085              pub fn getpeername(socket: SOCKET, address: *mut sockaddr,
 4086                                 address_len: *mut socklen_t) -> c_int;
 4087              pub fn getsockname(socket: SOCKET, address: *mut sockaddr,
 4088                                 address_len: *mut socklen_t) -> c_int;
 4089              pub fn setsockopt(socket: SOCKET, level: c_int, name: c_int,
 4090                                value: *c_void, option_len: socklen_t) -> c_int;
 4091              pub fn closesocket(socket: SOCKET) -> c_int;
 4092              pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
 4093                          flags: c_int) -> c_int;
 4094              pub fn send(socket: SOCKET, buf: *mut c_void, len: c_int,
 4095                          flags: c_int) -> c_int;
 4096              pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
 4097                              flags: c_int, addr: *mut sockaddr,
 4098                              addrlen: *mut c_int) -> ssize_t;
 4099              pub fn sendto(socket: SOCKET, buf: *c_void, len: c_int,
 4100                            flags: c_int, addr: *sockaddr,
 4101                            addrlen: c_int) -> c_int;
 4102              pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
 4103          }
 4104      }
 4105  
 4106      #[cfg(target_os = "macos")]
 4107      #[cfg(target_os = "freebsd")]
 4108      pub mod bsd44 {
 4109          use types::common::c95::{c_void};
 4110          use types::os::arch::c95::{c_char, c_uchar, c_int, c_uint, size_t};
 4111  
 4112          extern {
 4113              pub fn sysctl(name: *c_int,
 4114                            namelen: c_uint,
 4115                            oldp: *mut c_void,
 4116                            oldlenp: *mut size_t,
 4117                            newp: *c_void,
 4118                            newlen: size_t)
 4119                            -> c_int;
 4120              pub fn sysctlbyname(name: *c_char,
 4121                                  oldp: *mut c_void,
 4122                                  oldlenp: *mut size_t,
 4123                                  newp: *c_void,
 4124                                  newlen: size_t)
 4125                                  -> c_int;
 4126              pub fn sysctlnametomib(name: *c_char,
 4127                                     mibp: *mut c_int,
 4128                                     sizep: *mut size_t)
 4129                                     -> c_int;
 4130              pub fn getdtablesize() -> c_int;
 4131              pub fn madvise(addr: *c_void, len: size_t, advice: c_int)
 4132                             -> c_int;
 4133              pub fn mincore(addr: *c_void, len: size_t, vec: *c_uchar)
 4134                             -> c_int;
 4135          }
 4136      }
 4137  
 4138  
 4139      #[cfg(target_os = "linux")]
 4140      #[cfg(target_os = "android")]
 4141      pub mod bsd44 {
 4142          use types::common::c95::{c_void};
 4143          use types::os::arch::c95::{c_uchar, c_int, size_t};
 4144  
 4145          extern {
 4146              pub fn getdtablesize() -> c_int;
 4147              pub fn madvise(addr: *c_void, lensize_t, advicec_int)
 4148                             -> c_int;
 4149              pub fn mincore(addr: *c_void, lensize_t, vec: *c_uchar)
 4150                             -> c_int;
 4151          }
 4152      }
 4153  
 4154  
 4155      #[cfg(target_os = "win32")]
 4156      pub mod bsd44 {
 4157      }
 4158  
 4159      #[cfg(target_os = "macos")]
 4160      pub mod extra {
 4161          use types::os::arch::c95::{c_char, c_int};
 4162  
 4163          extern {
 4164              pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32)
 4165                                          -> c_int;
 4166          }
 4167      }
 4168  
 4169      #[cfg(target_os = "freebsd")]
 4170      pub mod extra {
 4171      }
 4172  
 4173      #[cfg(target_os = "linux")]
 4174      #[cfg(target_os = "android")]
 4175      pub mod extra {
 4176      }
 4177  
 4178  
 4179      #[cfg(target_os = "win32")]
 4180      pub mod extra {
 4181  
 4182          pub mod kernel32 {
 4183              use types::os::arch::c95::{c_uint};
 4184              use types::os::arch::extra::{BOOL, DWORD, SIZE_T, HMODULE,
 4185                                                 LPCWSTR, LPWSTR, LPCSTR, LPSTR,
 4186                                                 LPCH, LPDWORD, LPVOID,
 4187                                                 LPCVOID, LPOVERLAPPED,
 4188                                                 LPSECURITY_ATTRIBUTES,
 4189                                                 LPSTARTUPINFO,
 4190                                                 LPPROCESS_INFORMATION,
 4191                                                 LPMEMORY_BASIC_INFORMATION,
 4192                                                 LPSYSTEM_INFO, BOOLEAN,
 4193                                                 HANDLE, LPHANDLE, LARGE_INTEGER,
 4194                                                 PLARGE_INTEGER, LPFILETIME};
 4195  
 4196              extern "system" {
 4197                  pub fn GetEnvironmentVariableW(n: LPCWSTR,
 4198                                                 v: LPWSTR,
 4199                                                 nsize: DWORD)
 4200                                                 -> DWORD;
 4201                  pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
 4202                                                 -> BOOL;
 4203                  pub fn GetEnvironmentStringsA() -> LPCH;
 4204                  pub fn FreeEnvironmentStringsA(env_ptr: LPCH) -> BOOL;
 4205                  pub fn GetModuleFileNameW(hModule: HMODULE,
 4206                                            lpFilename: LPWSTR,
 4207                                            nSize: DWORD)
 4208                                            -> DWORD;
 4209                  pub fn CreateDirectoryW(lpPathName: LPCWSTR,
 4210                                          lpSecurityAttributes:
 4211                                          LPSECURITY_ATTRIBUTES)
 4212                                          -> BOOL;
 4213                  pub fn CopyFileW(lpExistingFileName: LPCWSTR,
 4214                                   lpNewFileName: LPCWSTR,
 4215                                   bFailIfExists: BOOL)
 4216                                   -> BOOL;
 4217                  pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
 4218                  pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
 4219                  pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
 4220                                              lpBuffer: LPWSTR)
 4221                                              -> DWORD;
 4222                  pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
 4223                  pub fn GetLastError() -> DWORD;
 4224                  pub fn FindFirstFileW(fileName: *u16, findFileData: HANDLE)
 4225                                        -> HANDLE;
 4226                  pub fn FindNextFileW(findFile: HANDLE, findFileData: HANDLE)
 4227                                       -> BOOL;
 4228                  pub fn FindClose(findFile: HANDLE) -> BOOL;
 4229                  pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
 4230                                         hSourceHandle: HANDLE,
 4231                                         hTargetProcessHandle: HANDLE,
 4232                                         lpTargetHandle: LPHANDLE,
 4233                                         dwDesiredAccess: DWORD,
 4234                                         bInheritHandle: BOOL,
 4235                                         dwOptions: DWORD)
 4236                                         -> BOOL;
 4237                  pub fn CloseHandle(hObject: HANDLE) -> BOOL;
 4238                  pub fn OpenProcess(dwDesiredAccess: DWORD,
 4239                                     bInheritHandle: BOOL,
 4240                                     dwProcessId: DWORD)
 4241                                     -> HANDLE;
 4242                  pub fn GetCurrentProcess() -> HANDLE;
 4243                  pub fn CreateProcessA(lpApplicationName: LPCSTR,
 4244                                        lpCommandLine: LPSTR,
 4245                                        lpProcessAttributes:
 4246                                        LPSECURITY_ATTRIBUTES,
 4247                                        lpThreadAttributes:
 4248                                        LPSECURITY_ATTRIBUTES,
 4249                                        bInheritHandles: BOOL,
 4250                                        dwCreationFlags: DWORD,
 4251                                        lpEnvironment: LPVOID,
 4252                                        lpCurrentDirectory: LPCSTR,
 4253                                        lpStartupInfo: LPSTARTUPINFO,
 4254                                        lpProcessInformation:
 4255                                        LPPROCESS_INFORMATION)
 4256                                        -> BOOL;
 4257                  pub fn WaitForSingleObject(hHandle: HANDLE,
 4258                                             dwMilliseconds: DWORD)
 4259                                             -> DWORD;
 4260                  pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
 4261                                          -> BOOL;
 4262                  pub fn GetExitCodeProcess(hProcess: HANDLE,
 4263                                            lpExitCode: LPDWORD)
 4264                                            -> BOOL;
 4265                  pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
 4266                  pub fn VirtualAlloc(lpAddress: LPVOID,
 4267                                      dwSize: SIZE_T,
 4268                                      flAllocationType: DWORD,
 4269                                      flProtect: DWORD)
 4270                                      -> LPVOID;
 4271                  pub fn VirtualFree(lpAddress: LPVOID,
 4272                                     dwSize: SIZE_T,
 4273                                     dwFreeType: DWORD)
 4274                                     -> BOOL;
 4275                  pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
 4276                  pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
 4277                                       -> BOOL;
 4278                  pub fn VirtualProtect(lpAddress: LPVOID,
 4279                                        dwSize: SIZE_T,
 4280                                        flNewProtect: DWORD,
 4281                                        lpflOldProtect: LPDWORD)
 4282                                        -> BOOL;
 4283                  pub fn VirtualQuery(lpAddress: LPCVOID,
 4284                                      lpBuffer: LPMEMORY_BASIC_INFORMATION,
 4285                                      dwLength: SIZE_T)
 4286                                      -> SIZE_T;
 4287                  pub fn CreateFileMappingW(hFile: HANDLE,
 4288                                            lpAttributes: LPSECURITY_ATTRIBUTES,
 4289                                            flProtect: DWORD,
 4290                                            dwMaximumSizeHigh: DWORD,
 4291                                            dwMaximumSizeLow: DWORD,
 4292                                            lpName: LPCWSTR)
 4293                                            -> HANDLE;
 4294                  pub fn MapViewOfFile(hFileMappingObject: HANDLE,
 4295                                       dwDesiredAccess: DWORD,
 4296                                       dwFileOffsetHigh: DWORD,
 4297                                       dwFileOffsetLow: DWORD,
 4298                                       dwNumberOfBytesToMap: SIZE_T)
 4299                                       -> LPVOID;
 4300                  pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
 4301                  pub fn MoveFileExW(lpExistingFileName: LPCWSTR,
 4302                                     lpNewFileName: LPCWSTR,
 4303                                     dwFlags: DWORD) -> BOOL;
 4304                  pub fn CreateSymbolicLinkW(lpSymlinkFileName: LPCWSTR,
 4305                                             lpTargetFileName: LPCWSTR,
 4306                                             dwFlags: DWORD) -> BOOLEAN;
 4307                  pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
 4308                                         lpTargetFileName: LPCWSTR,
 4309                                         lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
 4310                                          -> BOOL;
 4311                  pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL;
 4312                  pub fn CreateFileW(lpFileName: LPCWSTR,
 4313                                     dwDesiredAccess: DWORD,
 4314                                     dwShareMode: DWORD,
 4315                                     lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
 4316                                     dwCreationDisposition: DWORD,
 4317                                     dwFlagsAndAttributes: DWORD,
 4318                                     hTemplateFile: HANDLE) -> HANDLE;
 4319                  pub fn GetFinalPathNameByHandleW(hFile: HANDLE,
 4320                                                   lpszFilePath: LPCWSTR,
 4321                                                   cchFilePath: DWORD,
 4322                                                   dwFlags: DWORD) -> DWORD;
 4323                  pub fn ReadFile(hFile: HANDLE,
 4324                                  lpBuffer: LPVOID,
 4325                                  nNumberOfBytesToRead: DWORD,
 4326                                  lpNumberOfBytesRead: LPDWORD,
 4327                                  lpOverlapped: LPOVERLAPPED) -> BOOL;
 4328                  pub fn WriteFile(hFile: HANDLE,
 4329                                   lpBuffer: LPVOID,
 4330                                   nNumberOfBytesToRead: DWORD,
 4331                                   lpNumberOfBytesRead: LPDWORD,
 4332                                   lpOverlapped: LPOVERLAPPED) -> BOOL;
 4333                  pub fn SetFilePointerEx(hFile: HANDLE,
 4334                                          liDistanceToMove: LARGE_INTEGER,
 4335                                          lpNewFilePointer: PLARGE_INTEGER,
 4336                                          dwMoveMethod: DWORD) -> BOOL;
 4337                  pub fn SetEndOfFile(hFile: HANDLE) -> BOOL;
 4338  
 4339                  pub fn GetSystemTimeAsFileTime(
 4340                              lpSystemTimeAsFileTime: LPFILETIME);
 4341  
 4342                  pub fn QueryPerformanceFrequency(
 4343                              lpFrequency: *mut LARGE_INTEGER) -> BOOL;
 4344                  pub fn QueryPerformanceCounter(
 4345                              lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL;
 4346  
 4347                  pub fn GetCurrentProcessId() -> DWORD;
 4348                  pub fn CreateNamedPipeW(
 4349                              lpName: LPCWSTR,
 4350                              dwOpenMode: DWORD,
 4351                              dwPipeMode: DWORD,
 4352                              nMaxInstances: DWORD,
 4353                              nOutBufferSize: DWORD,
 4354                              nInBufferSize: DWORD,
 4355                              nDefaultTimeOut: DWORD,
 4356                              lpSecurityAttributes: LPSECURITY_ATTRIBUTES
 4357                              ) -> HANDLE;
 4358                  pub fn ConnectNamedPipe(hNamedPipe: HANDLE,
 4359                                          lpOverlapped: LPOVERLAPPED) -> BOOL;
 4360                  pub fn WaitNamedPipeW(lpNamedPipeName: LPCWSTR,
 4361                                        nTimeOut: DWORD) -> BOOL;
 4362                  pub fn SetNamedPipeHandleState(hNamedPipe: HANDLE,
 4363                                                 lpMode: LPDWORD,
 4364                                                 lpMaxCollectionCount: LPDWORD,
 4365                                                 lpCollectDataTimeout: LPDWORD)
 4366                                                              -> BOOL;
 4367                  pub fn CreateEventW(lpEventAttributes: LPSECURITY_ATTRIBUTES,
 4368                                      bManualReset: BOOL,
 4369                                      bInitialState: BOOL,
 4370                                      lpName: LPCWSTR) -> HANDLE;
 4371                  pub fn GetOverlappedResult(hFile: HANDLE,
 4372                                             lpOverlapped: LPOVERLAPPED,
 4373                                             lpNumberOfBytesTransferred: LPDWORD,
 4374                                             bWait: BOOL) -> BOOL;
 4375                  pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL;
 4376              }
 4377          }
 4378  
 4379          pub mod msvcrt {
 4380              use types::os::arch::c95::{c_int, c_long};
 4381              use types::os::arch::c99::intptr_t;
 4382  
 4383              extern {
 4384                  #[link_name = "_commit"]
 4385                  pub fn commit(fd: c_int) -> c_int;
 4386  
 4387                  #[link_name = "_get_osfhandle"]
 4388                  pub fn get_osfhandle(fd: c_int) -> c_long;
 4389  
 4390                  #[link_name = "_open_osfhandle"]
 4391                  pub fn open_osfhandle(osfhandle: intptr_t,
 4392                                        flags: c_int) -> c_int;
 4393              }
 4394          }
 4395      }
 4396  }
 4397  
 4398  #[test] fn work_on_windows() { } // FIXME #10872 needed for a happy windows


liblibc/lib.rs:639:16-639:16 -NK_AS_STR_TODO- definition:
                pub type c_int = i32;
                pub type c_uint = u32;
                pub type c_long = i64;
references:- 557


liblibc/lib.rs:324:12-324:12 -enum- definition:
            pub enum FILE {}
            pub enum fpos_t {}
        }
references:- 26
3470:                 pub fn fflush(file: *FILE) -> c_int;
3471:                 pub fn fclose(file: *FILE) -> c_int;
3472:                 pub fn remove(filename: *c_char) -> c_int;
--
3484:                              -> *c_char;
3485:                 pub fn fputc(c: c_int, stream: *FILE) -> c_int;
3486:                 pub fn fputs(s: *c_char, stream: *FILE) -> *c_char;
--
3751:                 pub fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
3752:                 pub fn fileno(stream: *FILE) -> c_int;
3753:             }


liblibc/lib.rs:634:16-634:16 -NK_AS_STR_TODO- definition:
                pub type c_char = i8;
                pub type c_schar = i8;
                pub type c_uchar = u8;
references:- 117


liblibc/lib.rs:339:12-339:12 -enum- definition:
            pub enum dirent_t {}
        }
        pub mod posix01 {}
references:- 2
3783:                 pub fn readdir_r(dirp: *DIR, entry: *mut dirent_t,
3784:                                   result: *mut *mut dirent_t) -> c_int;
3785:             }


liblibc/lib.rs:641:16-641:16 -NK_AS_STR_TODO- definition:
                pub type c_long = i64;
                pub type c_ulong = u64;
                pub type c_float = f32;
references:- 15
3818:                 pub fn fork() -> pid_t;
3819:                 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
3820:                 pub fn getcwd(buf: *mut c_char, size: size_t) -> *c_char;
--
3836:                              -> off_t;
3837:                 pub fn pathconf(path: *c_char, name: c_int) -> c_long;
3838:                 pub fn pause() -> c_int;
--
3849:                 pub fn nanosleep(rqtp: *timespec, rmtp: *mut timespec) -> c_int;
3850:                 pub fn sysconf(name: c_int) -> c_long;
3851:                 pub fn tcgetpgrp(fd: c_int) -> pid_t;


liblibc/lib.rs:320:12-320:12 -enum- definition:
            pub enum c_void {
                __variant1,
                __variant2,
references:- 37


liblibc/lib.rs:666:16-666:16 -NK_AS_STR_TODO- definition:
                pub type mode_t = u32;
                pub type ssize_t = i64;
            }
references:- 7
3762:                             -> c_int;
3763:                 pub fn creat(path: *c_char, mode: mode_t) -> c_int;
3764:                 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
--
3897:                              -> c_int;
3898:                 pub fn shm_open(name: *c_char, oflag: c_int, mode: mode_t)
3899:                                 -> c_int;


liblibc/lib.rs:417:16-417:16 -struct- definition:
                pub struct in6_addr {
                    pub s6_addr: [u16, ..8]
                }
references:- 2
424:                 pub struct ip6_mreq {
425:                     pub ipv6mr_multiaddr: in6_addr,
426:                     pub ipv6mr_interface: c_uint,


liblibc/lib.rs:642:16-642:16 -NK_AS_STR_TODO- definition:
                pub type c_ulong = u64;
                pub type c_float = f32;
                pub type c_double = f64;
references:- 2
357:                 pub type pthread_t = c_ulong;
--
3532:                 pub fn strtoul(s: *c_char, endp: **c_char, base: c_int)
3533:                                -> c_ulong;
3534:                 pub fn calloc(nobj: size_t, size: size_t) -> *c_void;


liblibc/lib.rs:338:12-338:12 -enum- definition:
            pub enum DIR {}
            pub enum dirent_t {}
        }
references:- 6
3789:                 pub fn rewinddir(dirp: *DIR);
3790:                 pub fn seekdir(dirp: *DIR, loc: c_long);
3791:                 pub fn telldir(dirp: *DIR) -> c_long;
3792:             }


liblibc/lib.rs:678:16-678:16 -struct- definition:
                pub struct stat {
                    pub st_dev: dev_t,
                    pub st_ino: ino_t,
references:- 3
3723:                 #[cfg(target_os = "android")]
3724:                 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
--
3735:                 #[cfg(target_os = "android")]
3736:                 pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
--
3917:                 #[cfg(target_os = "android")]
3918:                 pub fn lstat(path: *c_char, buf: *mut stat) -> c_int;


liblibc/lib.rs:383:16-383:16 -NK_AS_STR_TODO- definition:
                pub type sighandler_t = size_t;
            }
            pub mod bsd44 {
references:- 2
3959:                 pub fn signal(signum: c_int,
3960:                               handler: sighandler_t) -> sighandler_t;
3961:             }


liblibc/lib.rs:390:16-390:16 -NK_AS_STR_TODO- definition:
                pub type in_port_t = u16;
                pub type in_addr_t = u32;
                pub struct sockaddr {
references:- 2
402:                     pub sin_family: sa_family_t,
403:                     pub sin_port: in_port_t,
404:                     pub sin_addr: in_addr,
--
411:                     pub sin6_family: sa_family_t,
412:                     pub sin6_port: in_port_t,
413:                     pub sin6_flowinfo: u32,


liblibc/lib.rs:389:16-389:16 -NK_AS_STR_TODO- definition:
                pub type sa_family_t = u16;
                pub type in_port_t = u16;
                pub type in_addr_t = u32;
references:- 5
392:                 pub struct sockaddr {
393:                     pub sa_family: sa_family_t,
394:                     pub sa_data: [u8, ..14],
--
438:                 pub struct sockaddr_un {
439:                     pub sun_family: sa_family_t,
440:                     pub sun_path: [c_char, ..108]


liblibc/lib.rs:659:16-659:16 -NK_AS_STR_TODO- definition:
                pub type off_t = i64;
                pub type dev_t = u64;
                pub type ino_t = u64;
references:- 7
686:                     pub st_rdev: dev_t,
687:                     pub st_size: off_t,
688:                     pub st_blksize: blksize_t,
--
3856:                 pub fn pread(fd: c_int, buf: *c_void, count: size_t,
3857:                              offset: off_t) -> ssize_t;
3858:                 pub fn pwrite(fd: c_int, buf: *c_void, count: size_t,
--
3949:                 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
3950:             }


liblibc/lib.rs:376:16-376:16 -struct- definition:
                pub struct timespec {
                    pub tv_sec: time_t,
                    pub tv_nsec: c_long,
references:- 2
3848:                 pub fn usleep(secs: c_uint) -> c_int;
3849:                 pub fn nanosleep(rqtp: *timespec, rmtp: *mut timespec) -> c_int;
3850:                 pub fn sysconf(name: c_int) -> c_long;


liblibc/lib.rs:663:16-663:16 -NK_AS_STR_TODO- definition:
                pub type uid_t = u32;
                pub type gid_t = u32;
                pub type useconds_t = u32;
references:- 5
3821:                 pub fn getegid() -> gid_t;
3822:                 pub fn geteuid() -> uid_t;
3823:                 pub fn getgid() -> gid_t ;
--
3831:                 pub fn getppid() -> pid_t;
3832:                 pub fn getuid() -> uid_t;
3833:                 pub fn isatty(fd: c_int) -> c_int;
--
3845:                 pub fn setsid() -> pid_t;
3846:                 pub fn setuid(uid: uid_t) -> c_int;
3847:                 pub fn sleep(secs: c_uint) -> c_uint;


liblibc/lib.rs:388:16-388:16 -NK_AS_STR_TODO- definition:
                pub type socklen_t = u32;
                pub type sa_family_t = u16;
                pub type in_port_t = u16;
references:- 9
4049:             pub fn getpeername(socket: c_int, address: *mut sockaddr,
4050:                                address_len: *mut socklen_t) -> c_int;
4051:             pub fn getsockname(socket: c_int, address: *mut sockaddr,
4052:                                address_len: *mut socklen_t) -> c_int;
4053:             pub fn setsockopt(socket: c_int, level: c_int, name: c_int,
4054:                               value: *c_void, option_len: socklen_t) -> c_int;
4055:             pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
--
4063:                           flags: c_int, addr: *sockaddr,
4064:                           addrlen: socklen_t) -> ssize_t;
4065:             pub fn shutdown(socket: c_int, how: c_int) -> c_int;


liblibc/lib.rs:325:12-325:12 -enum- definition:
            pub enum fpos_t {}
        }
        pub mod c99 {
references:- 2
3508:                 pub fn rewind(stream: *FILE);
3509:                 pub fn fgetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
3510:                 pub fn fsetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
3511:                 pub fn feof(stream: *FILE) -> c_int;


liblibc/lib.rs:407:16-407:16 -struct- definition:
                pub struct in_addr {
                    pub s_addr: in_addr_t,
                }
references:- 3
421:                     pub imr_multiaddr: in_addr,
422:                     pub imr_interface: in_addr,
423:                 }


liblibc/lib.rs:359:16-359:16 -struct- definition:
                pub struct glob_t {
                    pub gl_pathc: size_t,
                    pub gl_pathv: **c_char,
references:- 2
3989:                             pglob: *mut glob_t);
3990:                 pub fn globfree(pglob: *mut glob_t);
3991:             }


liblibc/lib.rs:645:16-645:16 -NK_AS_STR_TODO- definition:
                pub type size_t = u64;
                pub type ptrdiff_t = i64;
                pub type clock_t = i64;
references:- 46


liblibc/lib.rs:644:16-644:16 -NK_AS_STR_TODO- definition:
                pub type c_double = f64;
                pub type size_t = u64;
                pub type ptrdiff_t = i64;
references:- 2
3526:                 // Omitted: div, ldiv (return pub type incomplete).
3527:                 pub fn atof(s: *c_char) -> c_double;
3528:                 pub fn atoi(s: *c_char) -> c_int;
3529:                 pub fn strtod(s: *c_char, endp: **c_char) -> c_double;
3530:                 pub fn strtol(s: *c_char, endp: **c_char, base: c_int)


liblibc/lib.rs:660:16-660:16 -NK_AS_STR_TODO- definition:
                pub type dev_t = u64;
                pub type ino_t = u64;
                pub type pid_t = i32;
references:- 2
685:                     pub __pad0: c_int,
686:                     pub st_rdev: dev_t,
687:                     pub st_size: off_t,


liblibc/lib.rs:392:16-392:16 -struct- definition:
                pub struct sockaddr {
                    pub sa_family: sa_family_t,
                    pub sa_data: [u8, ..14],
references:- 8
4043:                            len: socklen_t) -> c_int;
4044:             pub fn bind(socket: c_int, address: *sockaddr,
4045:                         address_len: socklen_t) -> c_int;
--
4050:                                address_len: *mut socklen_t) -> c_int;
4051:             pub fn getsockname(socket: c_int, address: *mut sockaddr,
4052:                                address_len: *mut socklen_t) -> c_int;
--
4059:             pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
4060:                             flags: c_int, addr: *mut sockaddr,
4061:                             addrlen: *mut socklen_t) -> ssize_t;
4062:             pub fn sendto(socket: c_int, buf: *c_void, len: size_t,
4063:                           flags: c_int, addr: *sockaddr,
4064:                           addrlen: socklen_t) -> ssize_t;


liblibc/lib.rs:664:16-664:16 -NK_AS_STR_TODO- definition:
                pub type gid_t = u32;
                pub type useconds_t = u32;
                pub type mode_t = u32;
references:- 6
3809:                 pub fn chdir(dir: *c_char) -> c_int;
3810:                 pub fn chown(path: *c_char, uid: uid_t, gid: gid_t) -> c_int;
3811:                 pub fn close(fd: c_int) -> c_int;
--
3842:                 pub fn rmdir(path: *c_char) -> c_int;
3843:                 pub fn setgid(gid: gid_t) -> c_int;
3844:                 pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;


liblibc/lib.rs:640:16-640:16 -NK_AS_STR_TODO- definition:
                pub type c_uint = u32;
                pub type c_long = i64;
                pub type c_ulong = u64;
references:- 12
425:                     pub ipv6mr_multiaddr: in6_addr,
426:                     pub ipv6mr_interface: c_uint,
427:                 }
--
1966:             pub static FILENAME_MAX : c_uint = 4096_u32;
1967:             pub static L_tmpnam : c_uint = 20_u32;
1968:             pub static TMP_MAX : c_uint = 238328_u32;
--
3847:                 pub fn sleep(secs: c_uint) -> c_uint;
3848:                 pub fn usleep(secs: c_uint) -> c_int;
3849:                 pub fn nanosleep(rqtp: *timespec, rmtp: *mut timespec) -> c_int;


liblibc/lib.rs:648:16-648:16 -NK_AS_STR_TODO- definition:
                pub type time_t = i64;
                pub type suseconds_t = i64;
                pub type wchar_t = i32;
references:- 7
371:                 pub struct timeval {
372:                     pub tv_sec: time_t,
373:                     pub tv_usec: suseconds_t,
--
691:                     pub st_atime_nsec: c_long,
692:                     pub st_mtime: time_t,
693:                     pub st_mtime_nsec: c_long,
694:                     pub st_ctime: time_t,
695:                     pub st_ctime_nsec: c_long,
--
700:                     pub actime: time_t,
701:                     pub modtime: time_t,
702:                 }


liblibc/lib.rs:667:16-667:16 -NK_AS_STR_TODO- definition:
                pub type ssize_t = i64;
            }
            pub mod posix01 {
references:- 9
3856:                 pub fn pread(fd: c_int, buf: *c_void, count: size_t,
3857:                              offset: off_t) -> ssize_t;
3858:                 pub fn pwrite(fd: c_int, buf: *c_void, count: size_t,
--
4057:             pub fn send(socket: c_int, buf: *mut c_void, len: size_t,
4058:                         flags: c_int) -> ssize_t;
4059:             pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
--
4063:                           flags: c_int, addr: *sockaddr,
4064:                           addrlen: socklen_t) -> ssize_t;
4065:             pub fn shutdown(socket: c_int, how: c_int) -> c_int;


liblibc/lib.rs:662:16-662:16 -NK_AS_STR_TODO- definition:
                pub type pid_t = i32;
                pub type uid_t = u32;
                pub type gid_t = u32;
references:- 11
3828:                               -> c_int;
3829:                 pub fn getpgrp() -> pid_t;
3830:                 pub fn getpid() -> pid_t;
3831:                 pub fn getppid() -> pid_t;
--
3976:                 pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int)
3977:                                -> pid_t;
3978:             }