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