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