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.
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.
11 #![crate_name = "libc"]
12 #![crate_type = "rlib"]
13 #![cfg_attr(not(feature = "cargo-build"),
14 unstable(feature = "libc"))]
15 #![cfg_attr(not(feature = "cargo-build"), feature(staged_api))]
16 #![cfg_attr(not(feature = "cargo-build"), staged_api)]
17 #![cfg_attr(not(feature = "cargo-build"), feature(core))]
20 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
21 html_favicon_url = "http://www.rust-lang.org/favicon.ico",
22 html_root_url = "http://doc.rust-lang.org/nightly/",
23 html_playground_url = "http://play.rust-lang.org/")]
24 #![cfg_attr(test, feature(test))]
26 //! Bindings for the C standard library and other platform libraries
28 //! **NOTE:** These are *architecture and libc* specific. On Linux, these
29 //! bindings are only correct for glibc.
31 //! This module contains bindings to the C standard library, organized into
32 //! modules by their defining standard. Additionally, it contains some assorted
33 //! platform-specific definitions. For convenience, most functions and types
34 //! are reexported, so `use libc::*` will import the available C bindings as
35 //! appropriate for the target platform. The exact set of functions available
36 //! are platform specific.
38 //! *Note:* Because these definitions are platform-specific, some may not appear
39 //! in the generated documentation.
41 //! We consider the following specs reasonably normative with respect to
42 //! interoperating with the C standard library (libc/msvcrt):
44 //! * ISO 9899:1990 ('C95', 'ANSI C', 'Standard C'), NA1, 1995.
45 //! * ISO 9899:1999 ('C99' or 'C9x').
46 //! * ISO 9945:1988 / IEEE 1003.1-1988 ('POSIX.1').
47 //! * ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
48 //! * ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
50 //! Note that any reference to the 1996 revision of POSIX, or any revs between
51 //! 1990 (when '88 was approved at ISO) and 2001 (when the next actual
52 //! revision-revision happened), are merely additions of other chapters (1b and
53 //! 1c) outside the core interfaces.
55 //! Despite having several names each, these are *reasonably* coherent
56 //! point-in-time, list-of-definition sorts of specs. You can get each under a
57 //! variety of names but will wind up with the same definition in each case.
59 //! See standards(7) in linux-manpages for more details.
61 //! Our interface to these libraries is complicated by the non-universality of
62 //! conformance to any of them. About the only thing universally supported is
63 //! the first (C95), beyond that definitions quickly become absent on various
66 //! We therefore wind up dividing our module-space up (mostly for the sake of
67 //! sanity while editing, filling-in-details and eliminating duplication) into
68 //! definitions common-to-all (held in modules named c95, c99, posix88, posix01
69 //! and posix08) and definitions that appear only on *some* platforms (named
70 //! 'extra'). This would be things like significant OSX foundation kit, or Windows
71 //! library kernel32.dll, or various fancy glibc, Linux or BSD extensions.
73 //! In addition to the per-platform 'extra' modules, we define a module of
74 //! 'common BSD' libc routines that never quite made it into POSIX but show up
75 //! in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the final
76 //! one from Berkeley after the lawsuits died down and the CSRG dissolved.
78 #![allow(bad_style, raw_pointer_derive)]
79 #[cfg(feature = "cargo-build")] extern crate "std" as core;
80 #[cfg(not(feature = "cargo-build"))] extern crate core;
82 #[cfg(test)] extern crate std;
83 #[cfg(test)] extern crate test;
85 // Explicit export lists for the intersection (provided here) mean that
86 // you can write more-platform-agnostic code if you stick to just these
89 pub use types::common::c95::{FILE, c_void, fpos_t};
90 pub use types::common::c99::{int8_t, int16_t, int32_t, int64_t};
91 pub use types::common::c99::{uint8_t, uint16_t, uint32_t, uint64_t};
92 pub use types::common::posix88::{DIR, dirent_t};
93 pub use types::os::common::posix01::{timeval};
94 pub use types::os::common::bsd44::{addrinfo, in_addr, in6_addr, sockaddr_storage};
95 pub use types::os::common::bsd44::{ip_mreq, ip6_mreq, sockaddr, sockaddr_un};
96 pub use types::os::common::bsd44::{sa_family_t, sockaddr_in, sockaddr_in6, socklen_t};
97 pub use types::os::arch::c95::{c_char, c_double, c_float, c_int, c_uint};
98 pub use types::os::arch::c95::{c_long, c_short, c_uchar, c_ulong, wchar_t};
99 pub use types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t, c_schar};
100 pub use types::os::arch::c95::{size_t, time_t, suseconds_t};
101 pub use types::os::arch::c99::{c_longlong, c_ulonglong};
102 pub use types::os::arch::c99::{intptr_t, uintptr_t};
103 pub use types::os::arch::c99::{intmax_t, uintmax_t};
104 pub use types::os::arch::posix88::{dev_t, ino_t, mode_t};
105 pub use types::os::arch::posix88::{off_t, pid_t, ssize_t};
107 pub use consts::os::c95::{_IOFBF, _IOLBF, _IONBF, BUFSIZ, EOF};
108 pub use consts::os::c95::{EXIT_FAILURE, EXIT_SUCCESS};
109 pub use consts::os::c95::{FILENAME_MAX, FOPEN_MAX, L_tmpnam};
110 pub use consts::os::c95::{RAND_MAX, SEEK_CUR, SEEK_END};
111 pub use consts::os::c95::{SEEK_SET, TMP_MAX};
112 pub use consts::os::posix88::{F_OK, O_APPEND, O_CREAT, O_EXCL};
113 pub use consts::os::posix88::{O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY};
114 pub use consts::os::posix88::{R_OK, S_IEXEC, S_IFBLK, S_IFCHR};
115 pub use consts::os::posix88::{S_IFDIR, S_IFIFO, S_IFMT, S_IFREG, S_IFLNK};
116 pub use consts::os::posix88::{S_IREAD, S_IRUSR, S_IRWXU, S_IWUSR};
117 pub use consts::os::posix88::{STDERR_FILENO, STDIN_FILENO, S_IXUSR};
118 pub use consts::os::posix88::{STDOUT_FILENO, W_OK, X_OK};
119 pub use consts::os::bsd44::{AF_INET, AF_INET6, SOCK_STREAM, SOCK_DGRAM, SOCK_RAW};
120 pub use consts::os::bsd44::{IPPROTO_IP, IPPROTO_IPV6, IPPROTO_TCP, TCP_NODELAY};
121 pub use consts::os::bsd44::{SOL_SOCKET, SO_KEEPALIVE, SO_ERROR};
122 pub use consts::os::bsd44::{SO_REUSEADDR, SO_BROADCAST, SHUT_WR, IP_MULTICAST_LOOP};
123 pub use consts::os::bsd44::{IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP};
124 pub use consts::os::bsd44::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP};
125 pub use consts::os::bsd44::{IP_MULTICAST_TTL, IP_TTL, IP_HDRINCL, SHUT_RD};
126 pub use consts::os::extra::{IPPROTO_RAW};
128 pub use funcs::c95::ctype::{isalnum, isalpha, iscntrl, isdigit};
129 pub use funcs::c95::ctype::{islower, isprint, ispunct, isspace};
130 pub use funcs::c95::ctype::{isupper, isxdigit, tolower, toupper};
132 pub use funcs::c95::stdio::{fclose, feof, ferror, fflush, fgetc};
133 pub use funcs::c95::stdio::{fgetpos, fgets, fopen, fputc, fputs};
134 pub use funcs::c95::stdio::{fread, freopen, fseek, fsetpos, ftell};
135 pub use funcs::c95::stdio::{fwrite, perror, puts, remove, rename, rewind};
136 pub use funcs::c95::stdio::{setbuf, setvbuf, tmpfile, ungetc};
138 pub use funcs::c95::stdlib::{abs, atof, atoi, calloc, exit, _exit, atexit};
139 pub use funcs::c95::stdlib::{free, getenv, labs, malloc, rand};
140 pub use funcs::c95::stdlib::{realloc, srand, strtod, strtol};
141 pub use funcs::c95::stdlib::{strtoul, system};
143 pub use funcs::c95::string::{memchr, memcmp};
144 pub use funcs::c95::string::{strcat, strchr, strcmp};
145 pub use funcs::c95::string::{strcoll, strcpy, strcspn, strerror};
146 pub use funcs::c95::string::{strlen, strncat, strncmp, strncpy};
147 pub use funcs::c95::string::{strpbrk, strrchr, strspn, strstr};
148 pub use funcs::c95::string::{strtok, strxfrm};
150 pub use funcs::posix88::fcntl::{open, creat};
151 pub use funcs::posix88::stat_::{chmod, fstat, mkdir, stat};
152 pub use funcs::posix88::stdio::{fdopen, fileno, pclose, popen};
153 pub use funcs::posix88::unistd::{access, chdir, close, dup, dup2};
154 pub use funcs::posix88::unistd::{execv, execve, execvp, getcwd};
155 pub use funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read};
156 pub use funcs::posix88::unistd::{rmdir, unlink, write};
158 pub use funcs::bsd43::{socket, setsockopt, bind, send, recv, recvfrom};
159 pub use funcs::bsd43::{listen, sendto, accept, connect, getpeername, getsockname};
160 pub use funcs::bsd43::{shutdown};
162 // But we also reexport most everything
163 // if you're interested in writing platform-specific code.
165 // FIXME: This is a mess, but the design of this entire module needs to be
166 // reconsidered, so I'm not inclined to do better right now. As part of
167 // #11870 I removed all the pub globs here, leaving explicit reexports
168 // of everything that is actually used in-tree.
170 // So the following exports don't follow any particular plan.
172 #[cfg(unix)] pub use consts::os::sysconf::{_SC_PAGESIZE};
173 #[cfg(unix)] pub use consts::os::posix88::{PROT_READ, PROT_WRITE, PROT_EXEC};
174 #[cfg(unix)] pub use consts::os::posix88::{MAP_FIXED, MAP_FILE, MAP_ANON, MAP_PRIVATE, MAP_FAILED};
175 #[cfg(unix)] pub use consts::os::posix88::{EACCES, EBADF, EINVAL, ENODEV, ENOMEM};
176 #[cfg(unix)] pub use consts::os::posix88::{ECONNREFUSED, ECONNRESET, EPERM, EPIPE};
177 #[cfg(unix)] pub use consts::os::posix88::{ENOTCONN, ECONNABORTED, EADDRNOTAVAIL, EINTR};
178 #[cfg(unix)] pub use consts::os::posix88::{EADDRINUSE, ENOENT, EISDIR, EAGAIN, EWOULDBLOCK};
179 #[cfg(unix)] pub use consts::os::posix88::{ECANCELED, SIGINT, EINPROGRESS};
180 #[cfg(unix)] pub use consts::os::posix88::{ENOSYS, ENOTTY, ETIMEDOUT, EMFILE};
181 #[cfg(unix)] pub use consts::os::posix88::{SIGTERM, SIGKILL, SIGPIPE, PROT_NONE};
182 #[cfg(unix)] pub use consts::os::posix01::{SIG_IGN, F_GETFL, F_SETFL};
183 #[cfg(unix)] pub use consts::os::bsd44::{AF_UNIX};
184 #[cfg(unix)] pub use consts::os::extra::{O_NONBLOCK};
186 #[cfg(unix)] pub use types::os::common::posix01::{pthread_t, timespec, timezone};
188 #[cfg(unix)] pub use types::os::arch::posix88::{uid_t, gid_t};
189 #[cfg(unix)] pub use types::os::arch::posix01::{pthread_attr_t};
190 #[cfg(unix)] pub use types::os::arch::posix01::{stat, utimbuf};
191 #[cfg(unix)] pub use types::os::common::bsd44::{ifaddrs};
192 #[cfg(unix)] pub use funcs::posix88::unistd::{sysconf, setgid, setsid, setuid, pread, pwrite};
193 #[cfg(unix)] pub use funcs::posix88::unistd::{getgid, getuid, getsid};
194 #[cfg(unix)] pub use funcs::posix88::unistd::{_PC_NAME_MAX, utime, nanosleep, pathconf, link};
195 #[cfg(unix)] pub use funcs::posix88::unistd::{chown};
196 #[cfg(unix)] pub use funcs::posix88::mman::{mmap, munmap, mprotect};
197 #[cfg(unix)] pub use funcs::posix88::dirent::{opendir, readdir_r, closedir};
198 #[cfg(unix)] pub use funcs::posix88::fcntl::{fcntl};
199 #[cfg(unix)] pub use funcs::posix88::net::{if_nametoindex};
200 #[cfg(unix)] pub use funcs::posix01::stat_::{lstat};
201 #[cfg(unix)] pub use funcs::posix01::unistd::{fsync, ftruncate};
202 #[cfg(unix)] pub use funcs::posix01::unistd::{readlink, symlink};
203 #[cfg(unix)] pub use funcs::bsd43::{getifaddrs, freeifaddrs};
205 #[cfg(windows)] pub use consts::os::c95::{WSAECONNREFUSED, WSAECONNRESET, WSAEACCES};
206 #[cfg(windows)] pub use consts::os::c95::{WSAEWOULDBLOCK, WSAENOTCONN, WSAECONNABORTED};
207 #[cfg(windows)] pub use consts::os::c95::{WSAEADDRNOTAVAIL, WSAEADDRINUSE, WSAEINTR};
208 #[cfg(windows)] pub use consts::os::c95::{WSAEINPROGRESS, WSAEINVAL, WSAEMFILE};
209 #[cfg(windows)] pub use consts::os::extra::{ERROR_INSUFFICIENT_BUFFER};
210 #[cfg(windows)] pub use consts::os::extra::{O_BINARY, O_NOINHERIT, PAGE_NOACCESS};
211 #[cfg(windows)] pub use consts::os::extra::{PAGE_READONLY, PAGE_READWRITE, PAGE_EXECUTE};
212 #[cfg(windows)] pub use consts::os::extra::{PAGE_EXECUTE_READ, PAGE_EXECUTE_READWRITE};
213 #[cfg(windows)] pub use consts::os::extra::{MEM_COMMIT, MEM_RESERVE, MEM_RELEASE};
214 #[cfg(windows)] pub use consts::os::extra::{FILE_MAP_READ, FILE_MAP_WRITE, FILE_MAP_EXECUTE};
215 #[cfg(windows)] pub use consts::os::extra::{ERROR_ALREADY_EXISTS, ERROR_NO_DATA};
216 #[cfg(windows)] pub use consts::os::extra::{ERROR_FILE_NOT_FOUND, ERROR_INVALID_NAME};
217 #[cfg(windows)] pub use consts::os::extra::{ERROR_BROKEN_PIPE, ERROR_INVALID_FUNCTION};
218 #[cfg(windows)] pub use consts::os::extra::{ERROR_CALL_NOT_IMPLEMENTED};
219 #[cfg(windows)] pub use consts::os::extra::{ERROR_NOTHING_TO_TERMINATE};
220 #[cfg(windows)] pub use consts::os::extra::{ERROR_INVALID_HANDLE};
221 #[cfg(windows)] pub use consts::os::extra::{TRUE, FALSE, INFINITE};
222 #[cfg(windows)] pub use consts::os::extra::{PROCESS_TERMINATE, PROCESS_QUERY_INFORMATION};
223 #[cfg(windows)] pub use consts::os::extra::{STILL_ACTIVE, DETACHED_PROCESS};
224 #[cfg(windows)] pub use consts::os::extra::{CREATE_NEW_PROCESS_GROUP, CREATE_UNICODE_ENVIRONMENT};
225 #[cfg(windows)] pub use consts::os::extra::{FILE_BEGIN, FILE_END, FILE_CURRENT};
226 #[cfg(windows)] pub use consts::os::extra::{FILE_GENERIC_READ, FILE_GENERIC_WRITE};
227 #[cfg(windows)] pub use consts::os::extra::{FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_DELETE};
228 #[cfg(windows)] pub use consts::os::extra::{TRUNCATE_EXISTING, CREATE_ALWAYS, OPEN_EXISTING};
229 #[cfg(windows)] pub use consts::os::extra::{CREATE_NEW, FILE_APPEND_DATA, FILE_WRITE_DATA};
230 #[cfg(windows)] pub use consts::os::extra::{OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL};
231 #[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_BACKUP_SEMANTICS, INVALID_HANDLE_VALUE};
232 #[cfg(windows)] pub use consts::os::extra::{MOVEFILE_REPLACE_EXISTING};
233 #[cfg(windows)] pub use consts::os::extra::{GENERIC_READ, GENERIC_WRITE};
234 #[cfg(windows)] pub use consts::os::extra::{VOLUME_NAME_DOS};
235 #[cfg(windows)] pub use consts::os::extra::{PIPE_ACCESS_DUPLEX, FILE_FLAG_FIRST_PIPE_INSTANCE};
236 #[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE};
237 #[cfg(windows)] pub use consts::os::extra::{PIPE_READMODE_BYTE, PIPE_WAIT};
238 #[cfg(windows)] pub use consts::os::extra::{PIPE_UNLIMITED_INSTANCES, ERROR_ACCESS_DENIED};
239 #[cfg(windows)] pub use consts::os::extra::{FILE_WRITE_ATTRIBUTES, FILE_READ_ATTRIBUTES};
240 #[cfg(windows)] pub use consts::os::extra::{ERROR_PIPE_BUSY, ERROR_IO_PENDING};
241 #[cfg(windows)] pub use consts::os::extra::{ERROR_PIPE_CONNECTED, WAIT_OBJECT_0};
242 #[cfg(windows)] pub use consts::os::extra::{ERROR_NOT_FOUND};
243 #[cfg(windows)] pub use consts::os::extra::{ERROR_OPERATION_ABORTED};
244 #[cfg(windows)] pub use consts::os::extra::{FIONBIO};
245 #[cfg(windows)] pub use types::os::common::bsd44::{SOCKET};
246 #[cfg(windows)] pub use types::os::common::posix01::{stat, utimbuf};
247 #[cfg(windows)] pub use types::os::arch::extra::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES};
248 #[cfg(windows)] pub use types::os::arch::extra::{LPCSTR, WORD, DWORD, BYTE, FILETIME};
249 #[cfg(windows)] pub use types::os::arch::extra::{LARGE_INTEGER, LPVOID, LONG};
250 #[cfg(windows)] pub use types::os::arch::extra::{time64_t, OVERLAPPED, LPCWSTR};
251 #[cfg(windows)] pub use types::os::arch::extra::{LPOVERLAPPED, SIZE_T, LPDWORD};
252 #[cfg(windows)] pub use types::os::arch::extra::{SECURITY_ATTRIBUTES, WIN32_FIND_DATAW};
253 #[cfg(windows)] pub use funcs::c95::string::{wcslen};
254 #[cfg(windows)] pub use funcs::posix88::stat_::{wstat, wutime, wchmod, wrmdir};
255 #[cfg(windows)] pub use funcs::bsd43::{closesocket};
256 #[cfg(windows)] pub use funcs::extra::kernel32::{GetCurrentDirectoryW, GetLastError};
257 #[cfg(windows)] pub use funcs::extra::kernel32::{GetEnvironmentVariableW, SetEnvironmentVariableW};
258 #[cfg(windows)] pub use funcs::extra::kernel32::{GetModuleFileNameW, SetCurrentDirectoryW};
259 #[cfg(windows)] pub use funcs::extra::kernel32::{GetSystemInfo, VirtualAlloc, VirtualFree};
260 #[cfg(windows)] pub use funcs::extra::kernel32::{CreateFileMappingW, MapViewOfFile};
261 #[cfg(windows)] pub use funcs::extra::kernel32::{UnmapViewOfFile, CloseHandle};
262 #[cfg(windows)] pub use funcs::extra::kernel32::{WaitForSingleObject, GetSystemTimeAsFileTime};
263 #[cfg(windows)] pub use funcs::extra::kernel32::{QueryPerformanceCounter};
264 #[cfg(windows)] pub use funcs::extra::kernel32::{QueryPerformanceFrequency};
265 #[cfg(windows)] pub use funcs::extra::kernel32::{GetExitCodeProcess, TerminateProcess};
266 #[cfg(windows)] pub use funcs::extra::kernel32::{ReadFile, WriteFile, SetFilePointerEx};
267 #[cfg(windows)] pub use funcs::extra::kernel32::{SetEndOfFile, CreateFileW};
268 #[cfg(windows)] pub use funcs::extra::kernel32::{CreateDirectoryW, FindFirstFileW};
269 #[cfg(windows)] pub use funcs::extra::kernel32::{FindNextFileW, FindClose, DeleteFileW};
270 #[cfg(windows)] pub use funcs::extra::kernel32::{CreateHardLinkW, CreateEventW};
271 #[cfg(windows)] pub use funcs::extra::kernel32::{FlushFileBuffers, CreateNamedPipeW};
272 #[cfg(windows)] pub use funcs::extra::kernel32::{SetNamedPipeHandleState, WaitNamedPipeW};
273 #[cfg(windows)] pub use funcs::extra::kernel32::{GetOverlappedResult, ConnectNamedPipe};
274 #[cfg(windows)] pub use funcs::extra::kernel32::{DisconnectNamedPipe, OpenProcess};
275 #[cfg(windows)] pub use funcs::extra::kernel32::{MoveFileExW, VirtualProtect};
276 #[cfg(windows)] pub use funcs::extra::kernel32::{RemoveDirectoryW};
277 #[cfg(windows)] pub use funcs::extra::msvcrt::{get_osfhandle, open_osfhandle};
278 #[cfg(windows)] pub use funcs::extra::winsock::{ioctlsocket};
280 #[cfg(any(target_os = "linux",
281 target_os = "android",
282 target_os = "freebsd",
283 target_os = "dragonfly",
284 target_os = "openbsd"))]
285 pub use consts::os::posix01::{CLOCK_REALTIME, CLOCK_MONOTONIC};
287 #[cfg(any(target_os = "linux", target_os = "android"))]
288 pub use funcs::posix01::unistd::{fdatasync};
289 #[cfg(any(target_os = "linux", target_os = "android"))]
290 pub use types::os::arch::extra::{sockaddr_ll};
291 #[cfg(any(target_os = "linux", target_os = "android"))]
292 pub use consts::os::extra::{AF_PACKET};
294 #[cfg(all(unix, not(any(target_os = "freebsd", target_os = "openbsd"))))]
295 pub use consts::os::extra::{MAP_STACK};
297 #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
298 pub use consts::os::bsd44::{TCP_KEEPIDLE};
300 #[cfg(any(target_os = "macos", target_os = "ios"))]
301 pub use consts::os::bsd44::{TCP_KEEPALIVE};
302 #[cfg(any(target_os = "macos", target_os = "ios"))]
303 pub use consts::os::extra::{F_FULLFSYNC};
305 #[cfg(any(target_os = "macos", target_os = "ios"))]
306 pub use types::os::arch::extra::{mach_timebase_info};
316 // Types tend to vary *per architecture* so we pull their definitions out
319 // Standard types that are opaque or common, so are not per-target.
322 /// Type used to construct void pointers for use with C.
324 /// This type is only useful as a pointer target. Do not use it as a
325 /// return type for FFI functions which have the `void` return type in
326 /// C. Use the unit type `()` or omit the return type instead.
328 /// For LLVM to recognize the void pointer type and by extension
329 /// functions like malloc(), we need to have it represented as i8* in
330 /// LLVM bitcode. The enum used here ensures this and prevents misuse
331 /// of the "raw" type by only having private variants.. We need two
332 /// variants, because the compiler complains about the repr attribute
344 pub type int8_t = i8;
345 pub type int16_t = i16;
346 pub type int32_t = i32;
347 pub type int64_t = i64;
348 pub type uint8_t = u8;
349 pub type uint16_t = u16;
350 pub type uint32_t = u32;
351 pub type uint64_t = u64;
362 // Standard types that are scalar but vary by OS and arch.
364 #[cfg(any(target_os = "linux", target_os = "android"))]
368 use types::common::c95::{c_void};
369 use types::os::arch::c95::{c_char, c_ulong, size_t,
370 time_t, suseconds_t, c_long};
372 pub type pthread_t = c_ulong;
375 #[derive(Copy)] pub struct glob_t {
376 pub gl_pathc: size_t,
377 pub gl_pathv: *mut *mut c_char,
380 pub __unused1: *mut c_void,
381 pub __unused2: *mut c_void,
382 pub __unused3: *mut c_void,
383 pub __unused4: *mut c_void,
384 pub __unused5: *mut c_void,
388 #[derive(Copy)] pub struct timeval {
390 pub tv_usec: suseconds_t,
394 #[derive(Copy)] pub struct timespec {
399 #[derive(Copy)] pub enum timezone {}
401 pub type sighandler_t = size_t;
404 use types::common::c95::{c_void};
405 use types::os::arch::c95::{c_char, c_int, c_uint};
407 pub type socklen_t = u32;
408 pub type sa_family_t = u16;
409 pub type in_port_t = u16;
410 pub type in_addr_t = u32;
412 #[derive(Copy)] pub struct sockaddr {
413 pub sa_family: sa_family_t,
414 pub sa_data: [u8; 14],
417 #[derive(Copy)] pub struct sockaddr_storage {
418 pub ss_family: sa_family_t,
420 pub __ss_pad2: [u8; 112],
423 #[derive(Copy)] pub struct sockaddr_in {
424 pub sin_family: sa_family_t,
425 pub sin_port: in_port_t,
426 pub sin_addr: in_addr,
427 pub sin_zero: [u8; 8],
430 #[derive(Copy)] pub struct in_addr {
431 pub s_addr: in_addr_t,
434 #[derive(Copy)] pub struct sockaddr_in6 {
435 pub sin6_family: sa_family_t,
436 pub sin6_port: in_port_t,
437 pub sin6_flowinfo: u32,
438 pub sin6_addr: in6_addr,
439 pub sin6_scope_id: u32,
442 #[derive(Copy)] pub struct in6_addr {
443 pub s6_addr: [u16; 8]
446 #[derive(Copy)] pub struct ip_mreq {
447 pub imr_multiaddr: in_addr,
448 pub imr_interface: in_addr,
451 #[derive(Copy)] pub struct ip6_mreq {
452 pub ipv6mr_multiaddr: in6_addr,
453 pub ipv6mr_interface: c_uint,
456 #[derive(Copy)] pub struct addrinfo {
458 pub ai_family: c_int,
459 pub ai_socktype: c_int,
460 pub ai_protocol: c_int,
461 pub ai_addrlen: socklen_t,
463 #[cfg(target_os = "linux")]
464 pub ai_addr: *mut sockaddr,
466 #[cfg(target_os = "linux")]
467 pub ai_canonname: *mut c_char,
469 #[cfg(target_os = "android")]
470 pub ai_canonname: *mut c_char,
472 #[cfg(target_os = "android")]
473 pub ai_addr: *mut sockaddr,
475 pub ai_next: *mut addrinfo,
478 #[derive(Copy)] pub struct sockaddr_un {
479 pub sun_family: sa_family_t,
480 pub sun_path: [c_char; 108]
484 #[derive(Copy)] pub struct ifaddrs {
485 pub ifa_next: *mut ifaddrs,
486 pub ifa_name: *mut c_char,
487 pub ifa_flags: c_uint,
488 pub ifa_addr: *mut sockaddr,
489 pub ifa_netmask: *mut sockaddr,
490 pub ifa_ifu: *mut sockaddr, // FIXME This should be a union
491 pub ifa_data: *mut c_void
497 #[cfg(any(target_arch = "x86",
499 target_arch = "mips",
500 target_arch = "mipsel",
501 target_arch = "powerpc"))]
504 pub type c_char = i8;
505 pub type c_schar = i8;
506 pub type c_uchar = u8;
507 pub type c_short = i16;
508 pub type c_ushort = u16;
509 pub type c_int = i32;
510 pub type c_uint = u32;
511 pub type c_long = i32;
512 pub type c_ulong = u32;
513 pub type c_float = f32;
514 pub type c_double = f64;
515 pub type size_t = u32;
516 pub type ptrdiff_t = i32;
517 pub type clock_t = i32;
518 pub type time_t = i32;
519 pub type suseconds_t = i32;
520 pub type wchar_t = i32;
523 pub type c_longlong = i64;
524 pub type c_ulonglong = u64;
525 pub type intptr_t = i32;
526 pub type uintptr_t = u32;
527 pub type intmax_t = i64;
528 pub type uintmax_t = u64;
530 #[cfg(any(target_arch = "x86",
531 target_arch = "mips",
532 target_arch = "mipsel",
533 target_arch = "powerpc"))]
535 pub type off_t = i32;
536 pub type dev_t = u64;
537 pub type ino_t = u32;
538 pub type pid_t = i32;
539 pub type uid_t = u32;
540 pub type gid_t = u32;
541 pub type useconds_t = u32;
542 pub type mode_t = u32;
543 pub type ssize_t = i32;
545 #[cfg(target_arch = "arm")]
547 pub type off_t = i32;
548 pub type dev_t = u32;
549 pub type ino_t = u32;
550 pub type pid_t = i32;
551 pub type uid_t = u32;
552 pub type gid_t = u32;
553 pub type useconds_t = u32;
554 pub type mode_t = u16;
555 pub type ssize_t = i32;
557 #[cfg(any(target_arch = "x86",
558 target_arch = "powerpc"))]
560 use types::os::arch::c95::{c_short, c_long, time_t};
561 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
562 use types::os::arch::posix88::{mode_t, off_t};
563 use types::os::arch::posix88::{uid_t};
565 pub type nlink_t = u32;
566 pub type blksize_t = i32;
567 pub type blkcnt_t = i32;
570 #[derive(Copy)] pub struct stat {
575 pub st_nlink: nlink_t,
581 pub st_blksize: blksize_t,
582 pub st_blocks: blkcnt_t,
583 pub st_atime: time_t,
584 pub st_atime_nsec: c_long,
585 pub st_mtime: time_t,
586 pub st_mtime_nsec: c_long,
587 pub st_ctime: time_t,
588 pub st_ctime_nsec: c_long,
589 pub __unused4: c_long,
590 pub __unused5: c_long,
594 #[derive(Copy)] pub struct utimbuf {
600 #[derive(Copy)] pub struct pthread_attr_t {
604 #[cfg(target_arch = "arm")]
606 use types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
607 use types::os::arch::c99::{c_longlong, c_ulonglong};
608 use types::os::arch::posix88::{uid_t, gid_t, ino_t};
610 pub type nlink_t = u16;
611 pub type blksize_t = u32;
612 pub type blkcnt_t = u32;
615 #[derive(Copy)] pub struct stat {
616 pub st_dev: c_ulonglong,
617 pub __pad0: [c_uchar; 4],
620 pub st_nlink: c_uint,
623 pub st_rdev: c_ulonglong,
624 pub __pad3: [c_uchar; 4],
625 pub st_size: c_longlong,
626 pub st_blksize: blksize_t,
627 pub st_blocks: c_ulonglong,
628 pub st_atime: time_t,
629 pub st_atime_nsec: c_ulong,
630 pub st_mtime: time_t,
631 pub st_mtime_nsec: c_ulong,
632 pub st_ctime: time_t,
633 pub st_ctime_nsec: c_ulong,
634 pub st_ino: c_ulonglong,
638 #[derive(Copy)] pub struct utimbuf {
644 #[derive(Copy)] pub struct pthread_attr_t {
648 #[cfg(any(target_arch = "mips",
649 target_arch = "mipsel"))]
651 use types::os::arch::c95::{c_long, c_ulong, time_t};
652 use types::os::arch::posix88::{gid_t, ino_t};
653 use types::os::arch::posix88::{mode_t, off_t};
654 use types::os::arch::posix88::{uid_t};
656 pub type nlink_t = u32;
657 pub type blksize_t = i32;
658 pub type blkcnt_t = i32;
661 #[derive(Copy)] pub struct stat {
663 pub st_pad1: [c_long; 3],
666 pub st_nlink: nlink_t,
669 pub st_rdev: c_ulong,
670 pub st_pad2: [c_long; 2],
673 pub st_atime: time_t,
674 pub st_atime_nsec: c_long,
675 pub st_mtime: time_t,
676 pub st_mtime_nsec: c_long,
677 pub st_ctime: time_t,
678 pub st_ctime_nsec: c_long,
679 pub st_blksize: blksize_t,
680 pub st_blocks: blkcnt_t,
681 pub st_pad5: [c_long; 14],
685 #[derive(Copy)] pub struct utimbuf {
691 #[derive(Copy)] pub struct pthread_attr_t {
698 use types::os::arch::c95::{c_ushort, c_int, c_uchar};
700 #[derive(Copy)] pub struct sockaddr_ll {
701 pub sll_family: c_ushort,
702 pub sll_protocol: c_ushort,
703 pub sll_ifindex: c_int,
704 pub sll_hatype: c_ushort,
705 pub sll_pkttype: c_uchar,
706 pub sll_halen: c_uchar,
707 pub sll_addr: [c_uchar; 8]
713 #[cfg(any(target_arch = "x86_64",
714 target_arch = "aarch64"))]
717 #[cfg(not(target_arch = "aarch64"))]
718 pub type c_char = i8;
719 #[cfg(target_arch = "aarch64")]
720 pub type c_char = u8;
721 pub type c_schar = i8;
722 pub type c_uchar = u8;
723 pub type c_short = i16;
724 pub type c_ushort = u16;
725 pub type c_int = i32;
726 pub type c_uint = u32;
727 pub type c_long = i64;
728 pub type c_ulong = u64;
729 pub type c_float = f32;
730 pub type c_double = f64;
731 pub type size_t = u64;
732 pub type ptrdiff_t = i64;
733 pub type clock_t = i64;
734 pub type time_t = i64;
735 pub type suseconds_t = i64;
736 #[cfg(not(target_arch = "aarch64"))]
737 pub type wchar_t = i32;
738 #[cfg(target_arch = "aarch64")]
739 pub type wchar_t = u32;
742 pub type c_longlong = i64;
743 pub type c_ulonglong = u64;
744 pub type intptr_t = i64;
745 pub type uintptr_t = u64;
746 pub type intmax_t = i64;
747 pub type uintmax_t = u64;
750 pub type off_t = i64;
751 pub type dev_t = u64;
752 pub type ino_t = u64;
753 pub type pid_t = i32;
754 pub type uid_t = u32;
755 pub type gid_t = u32;
756 pub type useconds_t = u32;
757 pub type mode_t = u32;
758 pub type ssize_t = i64;
760 #[cfg(not(target_arch = "aarch64"))]
762 use types::os::arch::c95::{c_int, c_long, time_t};
763 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
764 use types::os::arch::posix88::{mode_t, off_t};
765 use types::os::arch::posix88::{uid_t};
767 pub type nlink_t = u64;
768 pub type blksize_t = i64;
769 pub type blkcnt_t = i64;
772 #[derive(Copy)] pub struct stat {
775 pub st_nlink: nlink_t,
782 pub st_blksize: blksize_t,
783 pub st_blocks: blkcnt_t,
784 pub st_atime: time_t,
785 pub st_atime_nsec: c_long,
786 pub st_mtime: time_t,
787 pub st_mtime_nsec: c_long,
788 pub st_ctime: time_t,
789 pub st_ctime_nsec: c_long,
790 pub __unused: [c_long; 3],
794 #[derive(Copy)] pub struct utimbuf {
800 #[derive(Copy)] pub struct pthread_attr_t {
804 #[cfg(target_arch = "aarch64")]
806 use types::os::arch::c95::{c_int, c_long, time_t};
807 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
808 use types::os::arch::posix88::{mode_t, off_t};
809 use types::os::arch::posix88::{uid_t};
811 pub type nlink_t = u32;
812 pub type blksize_t = i32;
813 pub type blkcnt_t = i64;
816 #[derive(Copy)] pub struct stat {
820 pub st_nlink: nlink_t,
826 pub st_blksize: blksize_t,
828 pub st_blocks: blkcnt_t,
829 pub st_atime: time_t,
830 pub st_atime_nsec: c_long,
831 pub st_mtime: time_t,
832 pub st_mtime_nsec: c_long,
833 pub st_ctime: time_t,
834 pub st_ctime_nsec: c_long,
835 pub __unused: [c_int; 2],
839 #[derive(Copy)] pub struct utimbuf {
845 #[derive(Copy)] pub struct pthread_attr_t {
854 use types::os::arch::c95::{c_ushort, c_int, c_uchar};
855 #[derive(Copy)] pub struct sockaddr_ll {
856 pub sll_family: c_ushort,
857 pub sll_protocol: c_ushort,
858 pub sll_ifindex: c_int,
859 pub sll_hatype: c_ushort,
860 pub sll_pkttype: c_uchar,
861 pub sll_halen: c_uchar,
862 pub sll_addr: [c_uchar; 8]
869 #[cfg(target_os = "freebsd")]
873 use types::common::c95::{c_void};
874 use types::os::arch::c95::{c_char, c_int, size_t,
875 time_t, suseconds_t, c_long};
876 use types::os::arch::c99::{uintptr_t};
878 pub type pthread_t = uintptr_t;
881 #[derive(Copy)] pub struct glob_t {
882 pub gl_pathc: size_t,
883 pub __unused1: size_t,
885 pub __unused2: c_int,
886 pub gl_pathv: *mut *mut c_char,
888 pub __unused3: *mut c_void,
890 pub __unused4: *mut c_void,
891 pub __unused5: *mut c_void,
892 pub __unused6: *mut c_void,
893 pub __unused7: *mut c_void,
894 pub __unused8: *mut c_void,
898 #[derive(Copy)] pub struct timeval {
900 pub tv_usec: suseconds_t,
904 #[derive(Copy)] pub struct timespec {
909 #[derive(Copy)] pub enum timezone {}
911 pub type sighandler_t = size_t;
914 use types::common::c95::{c_void};
915 use types::os::arch::c95::{c_char, c_int, c_uint};
917 pub type socklen_t = u32;
918 pub type sa_family_t = u8;
919 pub type in_port_t = u16;
920 pub type in_addr_t = u32;
922 #[derive(Copy)] pub struct sockaddr {
924 pub sa_family: sa_family_t,
925 pub sa_data: [u8; 14],
928 #[derive(Copy)] pub struct sockaddr_storage {
930 pub ss_family: sa_family_t,
931 pub __ss_pad1: [u8; 6],
933 pub __ss_pad2: [u8; 112],
936 #[derive(Copy)] pub struct sockaddr_in {
938 pub sin_family: sa_family_t,
939 pub sin_port: in_port_t,
940 pub sin_addr: in_addr,
941 pub sin_zero: [u8; 8],
944 #[derive(Copy)] pub struct in_addr {
945 pub s_addr: in_addr_t,
948 #[derive(Copy)] pub struct sockaddr_in6 {
950 pub sin6_family: sa_family_t,
951 pub sin6_port: in_port_t,
952 pub sin6_flowinfo: u32,
953 pub sin6_addr: in6_addr,
954 pub sin6_scope_id: u32,
957 #[derive(Copy)] pub struct in6_addr {
958 pub s6_addr: [u16; 8]
961 #[derive(Copy)] pub struct ip_mreq {
962 pub imr_multiaddr: in_addr,
963 pub imr_interface: in_addr,
966 #[derive(Copy)] pub struct ip6_mreq {
967 pub ipv6mr_multiaddr: in6_addr,
968 pub ipv6mr_interface: c_uint,
971 #[derive(Copy)] pub struct addrinfo {
973 pub ai_family: c_int,
974 pub ai_socktype: c_int,
975 pub ai_protocol: c_int,
976 pub ai_addrlen: socklen_t,
977 pub ai_canonname: *mut c_char,
978 pub ai_addr: *mut sockaddr,
979 pub ai_next: *mut addrinfo,
982 #[derive(Copy)] pub struct sockaddr_un {
984 pub sun_family: sa_family_t,
985 pub sun_path: [c_char; 104]
988 #[derive(Copy)] pub struct ifaddrs {
989 pub ifa_next: *mut ifaddrs,
990 pub ifa_name: *mut c_char,
991 pub ifa_flags: c_uint,
992 pub ifa_addr: *mut sockaddr,
993 pub ifa_netmask: *mut sockaddr,
994 pub ifa_dstaddr: *mut sockaddr,
995 pub ifa_data: *mut c_void
1002 #[cfg(target_arch = "x86_64")]
1005 pub type c_char = i8;
1006 pub type c_schar = i8;
1007 pub type c_uchar = u8;
1008 pub type c_short = i16;
1009 pub type c_ushort = u16;
1010 pub type c_int = i32;
1011 pub type c_uint = u32;
1012 pub type c_long = i64;
1013 pub type c_ulong = u64;
1014 pub type c_float = f32;
1015 pub type c_double = f64;
1016 pub type size_t = u64;
1017 pub type ptrdiff_t = i64;
1018 pub type clock_t = i32;
1019 pub type time_t = i64;
1020 pub type suseconds_t = i64;
1021 pub type wchar_t = i32;
1024 pub type c_longlong = i64;
1025 pub type c_ulonglong = u64;
1026 pub type intptr_t = i64;
1027 pub type uintptr_t = u64;
1028 pub type intmax_t = i64;
1029 pub type uintmax_t = u64;
1032 pub type off_t = i64;
1033 pub type dev_t = u32;
1034 pub type ino_t = u32;
1035 pub type pid_t = i32;
1036 pub type uid_t = u32;
1037 pub type gid_t = u32;
1038 pub type useconds_t = u32;
1039 pub type mode_t = u16;
1040 pub type ssize_t = i64;
1043 use types::common::c95::{c_void};
1044 use types::common::c99::{uint8_t, uint32_t, int32_t};
1045 use types::os::arch::c95::{c_long, time_t};
1046 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
1047 use types::os::arch::posix88::{mode_t, off_t};
1048 use types::os::arch::posix88::{uid_t};
1050 pub type nlink_t = u16;
1051 pub type blksize_t = i64;
1052 pub type blkcnt_t = i64;
1053 pub type fflags_t = u32;
1055 #[derive(Copy)] pub struct stat {
1058 pub st_mode: mode_t,
1059 pub st_nlink: nlink_t,
1063 pub st_atime: time_t,
1064 pub st_atime_nsec: c_long,
1065 pub st_mtime: time_t,
1066 pub st_mtime_nsec: c_long,
1067 pub st_ctime: time_t,
1068 pub st_ctime_nsec: c_long,
1070 pub st_blocks: blkcnt_t,
1071 pub st_blksize: blksize_t,
1072 pub st_flags: fflags_t,
1073 pub st_gen: uint32_t,
1074 pub st_lspare: int32_t,
1075 pub st_birthtime: time_t,
1076 pub st_birthtime_nsec: c_long,
1077 pub __unused: [uint8_t; 2],
1081 #[derive(Copy)] pub struct utimbuf {
1083 pub modtime: time_t,
1086 pub type pthread_attr_t = *mut c_void;
1097 #[cfg(target_os = "dragonfly")]
1101 use types::common::c95::{c_void};
1102 use types::os::arch::c95::{c_char, c_int, size_t,
1103 time_t, suseconds_t, c_long};
1104 use types::os::arch::c99::{uintptr_t};
1106 pub type pthread_t = uintptr_t;
1109 #[derive(Copy)] pub struct glob_t {
1110 pub gl_pathc: size_t,
1111 pub __unused1: size_t,
1112 pub gl_offs: size_t,
1113 pub __unused2: c_int,
1114 pub gl_pathv: *mut *mut c_char,
1116 pub __unused3: *mut c_void,
1118 pub __unused4: *mut c_void,
1119 pub __unused5: *mut c_void,
1120 pub __unused6: *mut c_void,
1121 pub __unused7: *mut c_void,
1122 pub __unused8: *mut c_void,
1126 #[derive(Copy)] pub struct timeval {
1128 pub tv_usec: suseconds_t,
1132 #[derive(Copy)] pub struct timespec {
1134 pub tv_nsec: c_long,
1137 #[derive(Copy)] pub enum timezone {}
1139 pub type sighandler_t = size_t;
1142 use types::common::c95::{c_void};
1143 use types::os::arch::c95::{c_char, c_int, c_uint};
1145 pub type socklen_t = u32;
1146 pub type sa_family_t = u8;
1147 pub type in_port_t = u16;
1148 pub type in_addr_t = u32;
1150 #[derive(Copy)] pub struct sockaddr {
1152 pub sa_family: sa_family_t,
1153 pub sa_data: [u8; 14],
1156 #[derive(Copy)] pub struct sockaddr_storage {
1158 pub ss_family: sa_family_t,
1159 pub __ss_pad1: [u8; 6],
1160 pub __ss_align: i64,
1161 pub __ss_pad2: [u8; 112],
1164 #[derive(Copy)] pub struct sockaddr_in {
1166 pub sin_family: sa_family_t,
1167 pub sin_port: in_port_t,
1168 pub sin_addr: in_addr,
1169 pub sin_zero: [u8; 8],
1172 #[derive(Copy)] pub struct in_addr {
1173 pub s_addr: in_addr_t,
1176 #[derive(Copy)] pub struct sockaddr_in6 {
1178 pub sin6_family: sa_family_t,
1179 pub sin6_port: in_port_t,
1180 pub sin6_flowinfo: u32,
1181 pub sin6_addr: in6_addr,
1182 pub sin6_scope_id: u32,
1185 #[derive(Copy)] pub struct in6_addr {
1186 pub s6_addr: [u16; 8]
1189 #[derive(Copy)] pub struct ip_mreq {
1190 pub imr_multiaddr: in_addr,
1191 pub imr_interface: in_addr,
1194 #[derive(Copy)] pub struct ip6_mreq {
1195 pub ipv6mr_multiaddr: in6_addr,
1196 pub ipv6mr_interface: c_uint,
1199 #[derive(Copy)] pub struct addrinfo {
1200 pub ai_flags: c_int,
1201 pub ai_family: c_int,
1202 pub ai_socktype: c_int,
1203 pub ai_protocol: c_int,
1204 pub ai_addrlen: socklen_t,
1205 pub ai_canonname: *mut c_char,
1206 pub ai_addr: *mut sockaddr,
1207 pub ai_next: *mut addrinfo,
1210 #[derive(Copy)] pub struct sockaddr_un {
1212 pub sun_family: sa_family_t,
1213 pub sun_path: [c_char; 104]
1216 #[derive(Copy)] pub struct ifaddrs {
1217 pub ifa_next: *mut ifaddrs,
1218 pub ifa_name: *mut c_char,
1219 pub ifa_flags: c_uint,
1220 pub ifa_addr: *mut sockaddr,
1221 pub ifa_netmask: *mut sockaddr,
1222 pub ifa_dstaddr: *mut sockaddr,
1223 pub ifa_data: *mut c_void
1229 #[cfg(target_arch = "x86_64")]
1232 pub type c_char = i8;
1233 pub type c_schar = i8;
1234 pub type c_uchar = u8;
1235 pub type c_short = i16;
1236 pub type c_ushort = u16;
1237 pub type c_int = i32;
1238 pub type c_uint = u32;
1239 pub type c_long = i64;
1240 pub type c_ulong = u64;
1241 pub type c_float = f32;
1242 pub type c_double = f64;
1243 pub type size_t = u64;
1244 pub type ptrdiff_t = i64;
1245 pub type clock_t = i32;
1246 pub type time_t = i64;
1247 pub type suseconds_t = i64;
1248 pub type wchar_t = i32;
1251 pub type c_longlong = i64;
1252 pub type c_ulonglong = u64;
1253 pub type intptr_t = i64;
1254 pub type uintptr_t = u64;
1255 pub type intmax_t = i64;
1256 pub type uintmax_t = u64;
1259 pub type off_t = i64;
1260 pub type dev_t = u32;
1261 pub type ino_t = u32;
1262 pub type pid_t = i32;
1263 pub type uid_t = u32;
1264 pub type gid_t = u32;
1265 pub type useconds_t = u32;
1266 pub type mode_t = u16;
1267 pub type ssize_t = i64;
1270 use types::common::c95::{c_void};
1271 use types::common::c99::{uint16_t, uint32_t, int32_t, uint64_t, int64_t};
1272 use types::os::arch::c95::{c_long, time_t};
1273 use types::os::arch::posix88::{dev_t, gid_t};
1274 use types::os::arch::posix88::{mode_t, off_t};
1275 use types::os::arch::posix88::{uid_t};
1277 pub type nlink_t = u16;
1278 pub type blksize_t = uint32_t;
1279 pub type ino_t = uint64_t;
1280 pub type blkcnt_t = i64;
1281 pub type fflags_t = u32;
1284 #[derive(Copy)] pub struct stat {
1286 pub st_nlink: nlink_t,
1288 pub st_mode: mode_t,
1289 pub st_padding1: uint16_t,
1293 pub st_atime: time_t,
1294 pub st_atime_nsec: c_long,
1295 pub st_mtime: time_t,
1296 pub st_mtime_nsec: c_long,
1297 pub st_ctime: time_t,
1298 pub st_ctime_nsec: c_long,
1300 pub st_blocks: blkcnt_t,
1301 pub st_blksize: blksize_t,
1302 pub st_flags: fflags_t,
1303 pub st_gen: uint32_t,
1304 pub st_lspare: int32_t,
1305 pub st_qspare1: int64_t,
1306 pub st_qspare2: int64_t,
1309 #[derive(Copy)] pub struct utimbuf {
1311 pub modtime: time_t,
1314 pub type pthread_attr_t = *mut c_void;
1325 #[cfg(target_os = "openbsd")]
1329 use types::common::c95::{c_void};
1330 use types::os::arch::c95::{c_char, c_int, size_t,
1331 time_t, suseconds_t, c_long};
1332 use types::os::arch::c99::{uintptr_t};
1334 pub type pthread_t = uintptr_t;
1337 #[derive(Copy)] pub struct glob_t {
1338 pub gl_pathc: c_int,
1339 pub __unused1: c_int,
1341 pub __unused2: c_int,
1342 pub gl_pathv: *mut *mut c_char,
1344 pub __unused3: *mut c_void,
1346 pub __unused4: *mut c_void,
1347 pub __unused5: *mut c_void,
1348 pub __unused6: *mut c_void,
1349 pub __unused7: *mut c_void,
1350 pub __unused8: *mut c_void,
1351 pub __unused9: *mut c_void,
1355 #[derive(Copy)] pub struct timeval {
1357 pub tv_usec: suseconds_t,
1361 #[derive(Copy)] pub struct timespec {
1363 pub tv_nsec: c_long,
1366 #[derive(Copy)] pub enum timezone {}
1368 pub type sighandler_t = size_t;
1371 use types::common::c95::{c_void};
1372 use types::os::arch::c95::{c_char, c_int, c_uint};
1374 pub type socklen_t = u32;
1375 pub type sa_family_t = u8;
1376 pub type in_port_t = u16;
1377 pub type in_addr_t = u32;
1379 #[derive(Copy)] pub struct sockaddr {
1381 pub sa_family: sa_family_t,
1382 pub sa_data: [u8; 14],
1385 #[derive(Copy)] pub struct sockaddr_storage {
1387 pub ss_family: sa_family_t,
1388 pub __ss_pad1: [u8; 6],
1390 pub __ss_pad3: [u8; 240],
1393 #[derive(Copy)] pub struct sockaddr_in {
1395 pub sin_family: sa_family_t,
1396 pub sin_port: in_port_t,
1397 pub sin_addr: in_addr,
1398 pub sin_zero: [u8; 8],
1401 #[derive(Copy)] pub struct in_addr {
1402 pub s_addr: in_addr_t,
1405 #[derive(Copy)] pub struct sockaddr_in6 {
1407 pub sin6_family: sa_family_t,
1408 pub sin6_port: in_port_t,
1409 pub sin6_flowinfo: u32,
1410 pub sin6_addr: in6_addr,
1411 pub sin6_scope_id: u32,
1414 #[derive(Copy)] pub struct in6_addr {
1415 pub s6_addr: [u16; 8]
1418 #[derive(Copy)] pub struct ip_mreq {
1419 pub imr_multiaddr: in_addr,
1420 pub imr_interface: in_addr,
1423 #[derive(Copy)] pub struct ip6_mreq {
1424 pub ipv6mr_multiaddr: in6_addr,
1425 pub ipv6mr_interface: c_uint,
1428 #[derive(Copy)] pub struct addrinfo {
1429 pub ai_flags: c_int,
1430 pub ai_family: c_int,
1431 pub ai_socktype: c_int,
1432 pub ai_protocol: c_int,
1433 pub ai_addrlen: socklen_t,
1434 pub ai_addr: *mut sockaddr,
1435 pub ai_canonname: *mut c_char,
1436 pub ai_next: *mut addrinfo,
1439 #[derive(Copy)] pub struct sockaddr_un {
1441 pub sun_family: sa_family_t,
1442 pub sun_path: [c_char; 104]
1445 #[derive(Copy)] pub struct ifaddrs {
1446 pub ifa_next: *mut ifaddrs,
1447 pub ifa_name: *mut c_char,
1448 pub ifa_flags: c_uint,
1449 pub ifa_addr: *mut sockaddr,
1450 pub ifa_netmask: *mut sockaddr,
1451 pub ifa_dstaddr: *mut sockaddr,
1452 pub ifa_data: *mut c_void
1458 #[cfg(target_arch = "x86_64")]
1461 pub type c_char = i8;
1462 pub type c_schar = i8;
1463 pub type c_uchar = u8;
1464 pub type c_short = i16;
1465 pub type c_ushort = u16;
1466 pub type c_int = i32;
1467 pub type c_uint = u32;
1468 pub type c_long = i64;
1469 pub type c_ulong = u64;
1470 pub type c_float = f32;
1471 pub type c_double = f64;
1472 pub type size_t = u64;
1473 pub type ptrdiff_t = i64;
1474 pub type clock_t = i64;
1475 pub type time_t = i64;
1476 pub type suseconds_t = i64;
1477 pub type wchar_t = i32;
1480 pub type c_longlong = i64;
1481 pub type c_ulonglong = u64;
1482 pub type intptr_t = i64;
1483 pub type uintptr_t = u64;
1484 pub type intmax_t = i64;
1485 pub type uintmax_t = u64;
1488 pub type off_t = i64;
1489 pub type dev_t = u32;
1490 pub type ino_t = u64;
1491 pub type pid_t = i32;
1492 pub type uid_t = u32;
1493 pub type gid_t = u32;
1494 pub type useconds_t = u32;
1495 pub type mode_t = u32;
1496 pub type ssize_t = i64;
1499 use types::common::c95::{c_void};
1500 use types::common::c99::{uint32_t, uint64_t};
1501 use types::os::arch::c95::{c_long, time_t};
1502 use types::os::arch::posix88::{dev_t, gid_t};
1503 use types::os::arch::posix88::{mode_t, off_t};
1504 use types::os::arch::posix88::{uid_t};
1506 pub type nlink_t = u32;
1507 pub type blksize_t = uint32_t;
1508 pub type ino_t = uint64_t;
1509 pub type blkcnt_t = i64;
1510 pub type fflags_t = u32; // type not declared, but struct stat have u_int32_t
1513 #[derive(Copy)] pub struct stat {
1514 pub st_mode: mode_t,
1517 pub st_nlink: nlink_t,
1521 pub st_atime: time_t,
1522 pub st_atime_nsec: c_long,
1523 pub st_mtime: time_t,
1524 pub st_mtime_nsec: c_long,
1525 pub st_ctime: time_t,
1526 pub st_ctime_nsec: c_long,
1528 pub st_blocks: blkcnt_t,
1529 pub st_blksize: blksize_t,
1530 pub st_flags: fflags_t,
1531 pub st_gen: uint32_t,
1532 pub st_birthtime: time_t,
1533 pub st_birthtime_nsec: c_long,
1536 #[derive(Copy)] pub struct utimbuf {
1538 pub modtime: time_t,
1541 pub type pthread_attr_t = *mut c_void;
1552 #[cfg(target_os = "windows")]
1556 use types::os::arch::c95::{c_short, time_t, c_long};
1557 use types::os::arch::extra::{int64, time64_t};
1558 use types::os::arch::posix88::{dev_t, ino_t};
1560 // pub Note: this is the struct called stat64 in Windows. Not stat,
1563 #[derive(Copy)] pub struct stat {
1567 pub st_nlink: c_short,
1568 pub st_uid: c_short,
1569 pub st_gid: c_short,
1572 pub st_atime: time64_t,
1573 pub st_mtime: time64_t,
1574 pub st_ctime: time64_t,
1577 // note that this is called utimbuf64 in Windows
1579 #[derive(Copy)] pub struct utimbuf {
1580 pub actime: time64_t,
1581 pub modtime: time64_t,
1585 #[derive(Copy)] pub struct timeval {
1587 pub tv_usec: c_long,
1591 #[derive(Copy)] pub struct timespec {
1593 pub tv_nsec: c_long,
1596 #[derive(Copy)] pub enum timezone {}
1600 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1601 use types::os::arch::c99::uintptr_t;
1603 pub type SOCKET = uintptr_t;
1604 pub type socklen_t = c_int;
1605 pub type sa_family_t = u16;
1606 pub type in_port_t = u16;
1607 pub type in_addr_t = u32;
1609 #[derive(Copy)] pub struct sockaddr {
1610 pub sa_family: sa_family_t,
1611 pub sa_data: [u8; 14],
1614 #[derive(Copy)] pub struct sockaddr_storage {
1615 pub ss_family: sa_family_t,
1616 pub __ss_pad1: [u8; 6],
1617 pub __ss_align: i64,
1618 pub __ss_pad2: [u8; 112],
1621 #[derive(Copy)] pub struct sockaddr_in {
1622 pub sin_family: sa_family_t,
1623 pub sin_port: in_port_t,
1624 pub sin_addr: in_addr,
1625 pub sin_zero: [u8; 8],
1628 #[derive(Copy)] pub struct in_addr {
1629 pub s_addr: in_addr_t,
1632 #[derive(Copy)] pub struct sockaddr_in6 {
1633 pub sin6_family: sa_family_t,
1634 pub sin6_port: in_port_t,
1635 pub sin6_flowinfo: u32,
1636 pub sin6_addr: in6_addr,
1637 pub sin6_scope_id: u32,
1640 #[derive(Copy)] pub struct in6_addr {
1641 pub s6_addr: [u16; 8]
1644 #[derive(Copy)] pub struct ip_mreq {
1645 pub imr_multiaddr: in_addr,
1646 pub imr_interface: in_addr,
1649 #[derive(Copy)] pub struct ip6_mreq {
1650 pub ipv6mr_multiaddr: in6_addr,
1651 pub ipv6mr_interface: c_uint,
1654 #[derive(Copy)] pub struct addrinfo {
1655 pub ai_flags: c_int,
1656 pub ai_family: c_int,
1657 pub ai_socktype: c_int,
1658 pub ai_protocol: c_int,
1659 pub ai_addrlen: size_t,
1660 pub ai_canonname: *mut c_char,
1661 pub ai_addr: *mut sockaddr,
1662 pub ai_next: *mut addrinfo,
1665 #[derive(Copy)] pub struct sockaddr_un {
1666 pub sun_family: sa_family_t,
1667 pub sun_path: [c_char; 108]
1674 pub type c_char = i8;
1675 pub type c_schar = i8;
1676 pub type c_uchar = u8;
1677 pub type c_short = i16;
1678 pub type c_ushort = u16;
1679 pub type c_int = i32;
1680 pub type c_uint = u32;
1681 pub type c_long = i32;
1682 pub type c_ulong = u32;
1683 pub type c_float = f32;
1684 pub type c_double = f64;
1686 #[cfg(target_arch = "x86")]
1687 pub type size_t = u32;
1688 #[cfg(target_arch = "x86_64")]
1689 pub type size_t = u64;
1691 #[cfg(target_arch = "x86")]
1692 pub type ptrdiff_t = i32;
1693 #[cfg(target_arch = "x86_64")]
1694 pub type ptrdiff_t = i64;
1696 pub type clock_t = i32;
1698 #[cfg(target_arch = "x86")]
1699 pub type time_t = i32;
1700 #[cfg(target_arch = "x86_64")]
1701 pub type time_t = i64;
1703 #[cfg(target_arch = "x86")]
1704 pub type suseconds_t = i32;
1705 #[cfg(target_arch = "x86_64")]
1706 pub type suseconds_t = i64;
1708 pub type wchar_t = u16;
1712 pub type c_longlong = i64;
1713 pub type c_ulonglong = u64;
1715 #[cfg(target_arch = "x86")]
1716 pub type intptr_t = i32;
1717 #[cfg(target_arch = "x86_64")]
1718 pub type intptr_t = i64;
1720 #[cfg(target_arch = "x86")]
1721 pub type uintptr_t = u32;
1722 #[cfg(target_arch = "x86_64")]
1723 pub type uintptr_t = u64;
1725 pub type intmax_t = i64;
1726 pub type uintmax_t = u64;
1730 pub type off_t = i32;
1731 pub type dev_t = u32;
1732 pub type ino_t = u16;
1734 pub type pid_t = u32;
1736 pub type useconds_t = u32;
1737 pub type mode_t = u16;
1739 #[cfg(target_arch = "x86")]
1740 pub type ssize_t = i32;
1741 #[cfg(target_arch = "x86_64")]
1742 pub type ssize_t = i64;
1752 use consts::os::extra::{MAX_PROTOCOL_CHAIN,
1754 use types::common::c95::c_void;
1755 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1756 use types::os::arch::c95::{c_long, c_ulong};
1757 use types::os::arch::c95::{wchar_t};
1758 use types::os::arch::c99::{c_ulonglong, c_longlong, uintptr_t};
1760 pub type BOOL = c_int;
1762 pub type BOOLEAN = BYTE;
1763 pub type CCHAR = c_char;
1764 pub type CHAR = c_char;
1766 pub type DWORD = c_ulong;
1767 pub type DWORDLONG = c_ulonglong;
1769 pub type HANDLE = LPVOID;
1770 pub type HINSTANCE = HANDLE;
1771 pub type HMODULE = HINSTANCE;
1773 pub type LONG = c_long;
1774 pub type PLONG = *mut c_long;
1776 #[cfg(target_arch = "x86")]
1777 pub type LONG_PTR = c_long;
1778 #[cfg(target_arch = "x86_64")]
1779 pub type LONG_PTR = i64;
1781 pub type LARGE_INTEGER = c_longlong;
1782 pub type PLARGE_INTEGER = *mut c_longlong;
1784 pub type LPCWSTR = *const WCHAR;
1785 pub type LPCSTR = *const CHAR;
1787 pub type LPWSTR = *mut WCHAR;
1788 pub type LPSTR = *mut CHAR;
1790 pub type LPWCH = *mut WCHAR;
1791 pub type LPCH = *mut CHAR;
1794 #[derive(Copy)] pub struct SECURITY_ATTRIBUTES {
1796 pub lpSecurityDescriptor: LPVOID,
1797 pub bInheritHandle: BOOL,
1799 pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
1801 pub type LPVOID = *mut c_void;
1802 pub type LPCVOID = *const c_void;
1803 pub type LPBYTE = *mut BYTE;
1804 pub type LPWORD = *mut WORD;
1805 pub type LPDWORD = *mut DWORD;
1806 pub type LPHANDLE = *mut HANDLE;
1808 pub type LRESULT = LONG_PTR;
1809 pub type PBOOL = *mut BOOL;
1810 pub type WCHAR = wchar_t;
1811 pub type WORD = u16;
1812 pub type SIZE_T = size_t;
1814 pub type time64_t = i64;
1815 pub type int64 = i64;
1818 #[derive(Copy)] pub struct STARTUPINFO {
1820 pub lpReserved: LPWSTR,
1821 pub lpDesktop: LPWSTR,
1822 pub lpTitle: LPWSTR,
1827 pub dwXCountChars: DWORD,
1828 pub dwYCountCharts: DWORD,
1829 pub dwFillAttribute: DWORD,
1831 pub wShowWindow: WORD,
1832 pub cbReserved2: WORD,
1833 pub lpReserved2: LPBYTE,
1834 pub hStdInput: HANDLE,
1835 pub hStdOutput: HANDLE,
1836 pub hStdError: HANDLE,
1838 pub type LPSTARTUPINFO = *mut STARTUPINFO;
1841 #[derive(Copy)] pub struct PROCESS_INFORMATION {
1842 pub hProcess: HANDLE,
1843 pub hThread: HANDLE,
1844 pub dwProcessId: DWORD,
1845 pub dwThreadId: DWORD,
1847 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
1850 #[derive(Copy)] pub struct SYSTEM_INFO {
1851 pub wProcessorArchitecture: WORD,
1852 pub wReserved: WORD,
1853 pub dwPageSize: DWORD,
1854 pub lpMinimumApplicationAddress: LPVOID,
1855 pub lpMaximumApplicationAddress: LPVOID,
1856 pub dwActiveProcessorMask: uintptr_t,
1857 pub dwNumberOfProcessors: DWORD,
1858 pub dwProcessorType: DWORD,
1859 pub dwAllocationGranularity: DWORD,
1860 pub wProcessorLevel: WORD,
1861 pub wProcessorRevision: WORD,
1863 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
1866 #[derive(Copy)] pub struct MEMORY_BASIC_INFORMATION {
1867 pub BaseAddress: LPVOID,
1868 pub AllocationBase: LPVOID,
1869 pub AllocationProtect: DWORD,
1870 pub RegionSize: SIZE_T,
1875 pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
1878 #[derive(Copy)] pub struct OVERLAPPED {
1879 pub Internal: *mut c_ulong,
1880 pub InternalHigh: *mut c_ulong,
1882 pub OffsetHigh: DWORD,
1886 pub type LPOVERLAPPED = *mut OVERLAPPED;
1889 #[derive(Copy)] pub struct FILETIME {
1890 pub dwLowDateTime: DWORD,
1891 pub dwHighDateTime: DWORD,
1894 pub type LPFILETIME = *mut FILETIME;
1897 #[derive(Copy)] pub struct GUID {
1901 pub Data4: [BYTE; 8],
1905 #[derive(Copy)] pub struct WSAPROTOCOLCHAIN {
1906 pub ChainLen: c_int,
1907 pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as usize],
1910 pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
1913 #[derive(Copy)] pub struct WSAPROTOCOL_INFO {
1914 pub dwServiceFlags1: DWORD,
1915 pub dwServiceFlags2: DWORD,
1916 pub dwServiceFlags3: DWORD,
1917 pub dwServiceFlags4: DWORD,
1918 pub dwProviderFlags: DWORD,
1919 pub ProviderId: GUID,
1920 pub dwCatalogEntryId: DWORD,
1921 pub ProtocolChain: WSAPROTOCOLCHAIN,
1922 pub iVersion: c_int,
1923 pub iAddressFamily: c_int,
1924 pub iMaxSockAddr: c_int,
1925 pub iMinSockAddr: c_int,
1926 pub iSocketType: c_int,
1927 pub iProtocol: c_int,
1928 pub iProtocolMaxOffset: c_int,
1929 pub iNetworkByteOrder: c_int,
1930 pub iSecurityScheme: c_int,
1931 pub dwMessageSize: DWORD,
1932 pub dwProviderReserved: DWORD,
1933 pub szProtocol: [u8; WSAPROTOCOL_LEN as usize + 1us],
1936 pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
1938 pub type GROUP = c_uint;
1941 #[derive(Copy)] pub struct WIN32_FIND_DATAW {
1942 pub dwFileAttributes: DWORD,
1943 pub ftCreationTime: FILETIME,
1944 pub ftLastAccessTime: FILETIME,
1945 pub ftLastWriteTime: FILETIME,
1946 pub nFileSizeHigh: DWORD,
1947 pub nFileSizeLow: DWORD,
1948 pub dwReserved0: DWORD,
1949 pub dwReserved1: DWORD,
1950 pub cFileName: [wchar_t; 260], // #define MAX_PATH 260
1951 pub cAlternateFileName: [wchar_t; 14],
1954 pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
1959 #[cfg(any(target_os = "macos", target_os = "ios"))]
1963 use types::common::c95::c_void;
1964 use types::os::arch::c95::{c_char, c_int, size_t, time_t};
1965 use types::os::arch::c95::{suseconds_t, c_long};
1966 use types::os::arch::c99::{uintptr_t};
1968 pub type pthread_t = uintptr_t;
1971 #[derive(Copy)] pub struct glob_t {
1972 pub gl_pathc: size_t,
1973 pub __unused1: c_int,
1974 pub gl_offs: size_t,
1975 pub __unused2: c_int,
1976 pub gl_pathv: *mut *mut c_char,
1978 pub __unused3: *mut c_void,
1980 pub __unused4: *mut c_void,
1981 pub __unused5: *mut c_void,
1982 pub __unused6: *mut c_void,
1983 pub __unused7: *mut c_void,
1984 pub __unused8: *mut c_void,
1988 #[derive(Copy)] pub struct timeval {
1990 pub tv_usec: suseconds_t,
1994 #[derive(Copy)] pub struct timespec {
1996 pub tv_nsec: c_long,
1999 #[derive(Copy)] pub enum timezone {}
2001 pub type sighandler_t = size_t;
2005 use types::common::c95::{c_void};
2006 use types::os::arch::c95::{c_char, c_int, c_uint};
2008 pub type socklen_t = u32;
2009 pub type sa_family_t = u8;
2010 pub type in_port_t = u16;
2011 pub type in_addr_t = u32;
2013 #[derive(Copy)] pub struct sockaddr {
2015 pub sa_family: sa_family_t,
2016 pub sa_data: [u8; 14],
2020 #[derive(Copy)] pub struct sockaddr_storage {
2022 pub ss_family: sa_family_t,
2023 pub __ss_pad1: [u8; 6],
2024 pub __ss_align: i64,
2025 pub __ss_pad2: [u8; 112],
2029 #[derive(Copy)] pub struct sockaddr_in {
2031 pub sin_family: sa_family_t,
2032 pub sin_port: in_port_t,
2033 pub sin_addr: in_addr,
2034 pub sin_zero: [u8; 8],
2038 #[derive(Copy)] pub struct in_addr {
2039 pub s_addr: in_addr_t,
2043 #[derive(Copy)] pub struct sockaddr_in6 {
2045 pub sin6_family: sa_family_t,
2046 pub sin6_port: in_port_t,
2047 pub sin6_flowinfo: u32,
2048 pub sin6_addr: in6_addr,
2049 pub sin6_scope_id: u32,
2053 #[derive(Copy)] pub struct in6_addr {
2054 pub s6_addr: [u16; 8]
2058 #[derive(Copy)] pub struct ip_mreq {
2059 pub imr_multiaddr: in_addr,
2060 pub imr_interface: in_addr,
2064 #[derive(Copy)] pub struct ip6_mreq {
2065 pub ipv6mr_multiaddr: in6_addr,
2066 pub ipv6mr_interface: c_uint,
2070 #[derive(Copy)] pub struct addrinfo {
2071 pub ai_flags: c_int,
2072 pub ai_family: c_int,
2073 pub ai_socktype: c_int,
2074 pub ai_protocol: c_int,
2075 pub ai_addrlen: socklen_t,
2076 pub ai_canonname: *mut c_char,
2077 pub ai_addr: *mut sockaddr,
2078 pub ai_next: *mut addrinfo,
2082 #[derive(Copy)] pub struct sockaddr_un {
2084 pub sun_family: sa_family_t,
2085 pub sun_path: [c_char; 104]
2089 #[derive(Copy)] pub struct ifaddrs {
2090 pub ifa_next: *mut ifaddrs,
2091 pub ifa_name: *mut c_char,
2092 pub ifa_flags: c_uint,
2093 pub ifa_addr: *mut sockaddr,
2094 pub ifa_netmask: *mut sockaddr,
2095 pub ifa_dstaddr: *mut sockaddr,
2096 pub ifa_data: *mut c_void
2101 #[cfg(any(target_arch = "arm", target_arch = "x86"))]
2104 pub type c_char = i8;
2105 pub type c_schar = i8;
2106 pub type c_uchar = u8;
2107 pub type c_short = i16;
2108 pub type c_ushort = u16;
2109 pub type c_int = i32;
2110 pub type c_uint = u32;
2111 pub type c_long = i32;
2112 pub type c_ulong = u32;
2113 pub type c_float = f32;
2114 pub type c_double = f64;
2115 pub type size_t = u32;
2116 pub type ptrdiff_t = i32;
2117 pub type clock_t = c_ulong;
2118 pub type time_t = c_long;
2119 pub type suseconds_t = i32;
2120 pub type wchar_t = i32;
2123 pub type c_longlong = i64;
2124 pub type c_ulonglong = u64;
2125 pub type intptr_t = i32;
2126 pub type uintptr_t = u32;
2127 pub type intmax_t = i64;
2128 pub type uintmax_t = u64;
2131 use types::os::arch::c95::c_long;
2133 pub type off_t = i64;
2134 pub type dev_t = i32;
2135 pub type ino_t = u64;
2136 pub type pid_t = i32;
2137 pub type uid_t = u32;
2138 pub type gid_t = u32;
2139 pub type useconds_t = u32;
2140 pub type mode_t = u16;
2141 pub type ssize_t = c_long;
2144 use types::common::c99::{int32_t, int64_t, uint32_t};
2145 use types::os::arch::c95::{c_char, c_long, time_t};
2146 use types::os::arch::posix88::{dev_t, gid_t, ino_t,
2147 mode_t, off_t, uid_t};
2149 pub type nlink_t = u16;
2150 pub type blksize_t = i32;
2151 pub type blkcnt_t = i64;
2154 #[derive(Copy)] pub struct stat {
2156 pub st_mode: mode_t,
2157 pub st_nlink: nlink_t,
2162 pub st_atime: time_t,
2163 pub st_atime_nsec: c_long,
2164 pub st_mtime: time_t,
2165 pub st_mtime_nsec: c_long,
2166 pub st_ctime: time_t,
2167 pub st_ctime_nsec: c_long,
2168 pub st_birthtime: time_t,
2169 pub st_birthtime_nsec: c_long,
2171 pub st_blocks: blkcnt_t,
2172 pub st_blksize: blksize_t,
2173 pub st_flags: uint32_t,
2174 pub st_gen: uint32_t,
2175 pub st_lspare: int32_t,
2176 pub st_qspare: [int64_t; 2],
2180 #[derive(Copy)] pub struct utimbuf {
2182 pub modtime: time_t,
2186 #[derive(Copy)] pub struct pthread_attr_t {
2188 pub __opaque: [c_char; 36]
2197 #[derive(Copy)] pub struct mach_timebase_info {
2202 pub type mach_timebase_info_data_t = mach_timebase_info;
2206 #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
2209 pub type c_char = i8;
2210 pub type c_schar = i8;
2211 pub type c_uchar = u8;
2212 pub type c_short = i16;
2213 pub type c_ushort = u16;
2214 pub type c_int = i32;
2215 pub type c_uint = u32;
2216 pub type c_long = i64;
2217 pub type c_ulong = u64;
2218 pub type c_float = f32;
2219 pub type c_double = f64;
2220 pub type size_t = u64;
2221 pub type ptrdiff_t = i64;
2222 pub type clock_t = c_ulong;
2223 pub type time_t = c_long;
2224 pub type suseconds_t = i32;
2225 pub type wchar_t = i32;
2228 pub type c_longlong = i64;
2229 pub type c_ulonglong = u64;
2230 pub type intptr_t = i64;
2231 pub type uintptr_t = u64;
2232 pub type intmax_t = i64;
2233 pub type uintmax_t = u64;
2236 use types::os::arch::c95::c_long;
2238 pub type off_t = i64;
2239 pub type dev_t = i32;
2240 pub type ino_t = u64;
2241 pub type pid_t = i32;
2242 pub type uid_t = u32;
2243 pub type gid_t = u32;
2244 pub type useconds_t = u32;
2245 pub type mode_t = u16;
2246 pub type ssize_t = c_long;
2249 use types::common::c99::{int32_t, int64_t};
2250 use types::common::c99::{uint32_t};
2251 use types::os::arch::c95::{c_char, c_long, time_t};
2252 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
2253 use types::os::arch::posix88::{mode_t, off_t, uid_t};
2255 pub type nlink_t = u16;
2256 pub type blksize_t = i32;
2257 pub type blkcnt_t = i64;
2260 #[derive(Copy)] pub struct stat {
2262 pub st_mode: mode_t,
2263 pub st_nlink: nlink_t,
2268 pub st_atime: time_t,
2269 pub st_atime_nsec: c_long,
2270 pub st_mtime: time_t,
2271 pub st_mtime_nsec: c_long,
2272 pub st_ctime: time_t,
2273 pub st_ctime_nsec: c_long,
2274 pub st_birthtime: time_t,
2275 pub st_birthtime_nsec: c_long,
2277 pub st_blocks: blkcnt_t,
2278 pub st_blksize: blksize_t,
2279 pub st_flags: uint32_t,
2280 pub st_gen: uint32_t,
2281 pub st_lspare: int32_t,
2282 pub st_qspare: [int64_t; 2],
2286 #[derive(Copy)] pub struct utimbuf {
2288 pub modtime: time_t,
2292 #[derive(Copy)] pub struct pthread_attr_t {
2294 pub __opaque: [c_char; 56]
2303 #[derive(Copy)] pub struct mach_timebase_info {
2308 pub type mach_timebase_info_data_t = mach_timebase_info;
2315 // Consts tend to vary per OS so we pull their definitions out
2316 // into this module.
2318 #[cfg(target_os = "windows")]
2321 use types::os::arch::c95::{c_int, c_uint};
2323 pub const EXIT_FAILURE : c_int = 1;
2324 pub const EXIT_SUCCESS : c_int = 0;
2325 pub const RAND_MAX : c_int = 32767;
2326 pub const EOF : c_int = -1;
2327 pub const SEEK_SET : c_int = 0;
2328 pub const SEEK_CUR : c_int = 1;
2329 pub const SEEK_END : c_int = 2;
2330 pub const _IOFBF : c_int = 0;
2331 pub const _IONBF : c_int = 4;
2332 pub const _IOLBF : c_int = 64;
2333 pub const BUFSIZ : c_uint = 512_u32;
2334 pub const FOPEN_MAX : c_uint = 20_u32;
2335 pub const FILENAME_MAX : c_uint = 260_u32;
2336 pub const L_tmpnam : c_uint = 16_u32;
2337 pub const TMP_MAX : c_uint = 32767_u32;
2339 pub const WSAEINTR: c_int = 10004;
2340 pub const WSAEBADF: c_int = 10009;
2341 pub const WSAEACCES: c_int = 10013;
2342 pub const WSAEFAULT: c_int = 10014;
2343 pub const WSAEINVAL: c_int = 10022;
2344 pub const WSAEMFILE: c_int = 10024;
2345 pub const WSAEWOULDBLOCK: c_int = 10035;
2346 pub const WSAEINPROGRESS: c_int = 10036;
2347 pub const WSAEALREADY: c_int = 10037;
2348 pub const WSAENOTSOCK: c_int = 10038;
2349 pub const WSAEDESTADDRREQ: c_int = 10039;
2350 pub const WSAEMSGSIZE: c_int = 10040;
2351 pub const WSAEPROTOTYPE: c_int = 10041;
2352 pub const WSAENOPROTOOPT: c_int = 10042;
2353 pub const WSAEPROTONOSUPPORT: c_int = 10043;
2354 pub const WSAESOCKTNOSUPPORT: c_int = 10044;
2355 pub const WSAEOPNOTSUPP: c_int = 10045;
2356 pub const WSAEPFNOSUPPORT: c_int = 10046;
2357 pub const WSAEAFNOSUPPORT: c_int = 10047;
2358 pub const WSAEADDRINUSE: c_int = 10048;
2359 pub const WSAEADDRNOTAVAIL: c_int = 10049;
2360 pub const WSAENETDOWN: c_int = 10050;
2361 pub const WSAENETUNREACH: c_int = 10051;
2362 pub const WSAENETRESET: c_int = 10052;
2363 pub const WSAECONNABORTED: c_int = 10053;
2364 pub const WSAECONNRESET: c_int = 10054;
2365 pub const WSAENOBUFS: c_int = 10055;
2366 pub const WSAEISCONN: c_int = 10056;
2367 pub const WSAENOTCONN: c_int = 10057;
2368 pub const WSAESHUTDOWN: c_int = 10058;
2369 pub const WSAETOOMANYREFS: c_int = 10059;
2370 pub const WSAETIMEDOUT: c_int = 10060;
2371 pub const WSAECONNREFUSED: c_int = 10061;
2372 pub const WSAELOOP: c_int = 10062;
2373 pub const WSAENAMETOOLONG: c_int = 10063;
2374 pub const WSAEHOSTDOWN: c_int = 10064;
2375 pub const WSAEHOSTUNREACH: c_int = 10065;
2376 pub const WSAENOTEMPTY: c_int = 10066;
2377 pub const WSAEPROCLIM: c_int = 10067;
2378 pub const WSAEUSERS: c_int = 10068;
2379 pub const WSAEDQUOT: c_int = 10069;
2380 pub const WSAESTALE: c_int = 10070;
2381 pub const WSAEREMOTE: c_int = 10071;
2382 pub const WSASYSNOTREADY: c_int = 10091;
2383 pub const WSAVERNOTSUPPORTED: c_int = 10092;
2384 pub const WSANOTINITIALISED: c_int = 10093;
2385 pub const WSAEDISCON: c_int = 10101;
2386 pub const WSAENOMORE: c_int = 10102;
2387 pub const WSAECANCELLED: c_int = 10103;
2388 pub const WSAEINVALIDPROCTABLE: c_int = 10104;
2389 pub const WSAEINVALIDPROVIDER: c_int = 10105;
2390 pub const WSAEPROVIDERFAILEDINIT: c_int = 10106;
2395 use types::os::arch::c95::c_int;
2397 pub const O_RDONLY : c_int = 0;
2398 pub const O_WRONLY : c_int = 1;
2399 pub const O_RDWR : c_int = 2;
2400 pub const O_APPEND : c_int = 8;
2401 pub const O_CREAT : c_int = 256;
2402 pub const O_EXCL : c_int = 1024;
2403 pub const O_TRUNC : c_int = 512;
2404 pub const S_IFIFO : c_int = 4096;
2405 pub const S_IFCHR : c_int = 8192;
2406 pub const S_IFBLK : c_int = 12288;
2407 pub const S_IFDIR : c_int = 16384;
2408 pub const S_IFREG : c_int = 32768;
2409 pub const S_IFLNK : c_int = 40960;
2410 pub const S_IFMT : c_int = 61440;
2411 pub const S_IEXEC : c_int = 64;
2412 pub const S_IWRITE : c_int = 128;
2413 pub const S_IREAD : c_int = 256;
2414 pub const S_IRWXU : c_int = 448;
2415 pub const S_IXUSR : c_int = 64;
2416 pub const S_IWUSR : c_int = 128;
2417 pub const S_IRUSR : c_int = 256;
2418 pub const F_OK : c_int = 0;
2419 pub const R_OK : c_int = 4;
2420 pub const W_OK : c_int = 2;
2421 pub const X_OK : c_int = 1;
2422 pub const STDIN_FILENO : c_int = 0;
2423 pub const STDOUT_FILENO : c_int = 1;
2424 pub const STDERR_FILENO : c_int = 2;
2431 use types::os::arch::c95::c_int;
2433 pub const AF_INET: c_int = 2;
2434 pub const AF_INET6: c_int = 23;
2435 pub const SOCK_STREAM: c_int = 1;
2436 pub const SOCK_DGRAM: c_int = 2;
2437 pub const SOCK_RAW: c_int = 3;
2438 pub const IPPROTO_TCP: c_int = 6;
2439 pub const IPPROTO_IP: c_int = 0;
2440 pub const IPPROTO_IPV6: c_int = 41;
2441 pub const IP_MULTICAST_TTL: c_int = 10;
2442 pub const IP_MULTICAST_LOOP: c_int = 11;
2443 pub const IP_ADD_MEMBERSHIP: c_int = 12;
2444 pub const IP_DROP_MEMBERSHIP: c_int = 13;
2445 pub const IPV6_ADD_MEMBERSHIP: c_int = 5;
2446 pub const IPV6_DROP_MEMBERSHIP: c_int = 6;
2447 pub const IP_TTL: c_int = 4;
2448 pub const IP_HDRINCL: c_int = 2;
2450 pub const TCP_NODELAY: c_int = 0x0001;
2451 pub const SOL_SOCKET: c_int = 0xffff;
2452 pub const SO_KEEPALIVE: c_int = 8;
2453 pub const SO_BROADCAST: c_int = 32;
2454 pub const SO_REUSEADDR: c_int = 4;
2455 pub const SO_ERROR: c_int = 0x1007;
2457 pub const IFF_LOOPBACK: c_int = 4;
2459 pub const SHUT_RD: c_int = 0;
2460 pub const SHUT_WR: c_int = 1;
2461 pub const SHUT_RDWR: c_int = 2;
2465 use types::os::arch::c95::{c_int, c_long};
2466 use types::os::arch::extra::{WORD, DWORD, BOOL, HANDLE};
2468 pub const TRUE : BOOL = 1;
2469 pub const FALSE : BOOL = 0;
2471 pub const O_TEXT : c_int = 16384;
2472 pub const O_BINARY : c_int = 32768;
2473 pub const O_NOINHERIT: c_int = 128;
2475 pub const ERROR_SUCCESS : c_int = 0;
2476 pub const ERROR_INVALID_FUNCTION: c_int = 1;
2477 pub const ERROR_FILE_NOT_FOUND: c_int = 2;
2478 pub const ERROR_ACCESS_DENIED: c_int = 5;
2479 pub const ERROR_INVALID_HANDLE : c_int = 6;
2480 pub const ERROR_BROKEN_PIPE: c_int = 109;
2481 pub const ERROR_DISK_FULL : c_int = 112;
2482 pub const ERROR_CALL_NOT_IMPLEMENTED : c_int = 120;
2483 pub const ERROR_INSUFFICIENT_BUFFER : c_int = 122;
2484 pub const ERROR_INVALID_NAME : c_int = 123;
2485 pub const ERROR_ALREADY_EXISTS : c_int = 183;
2486 pub const ERROR_PIPE_BUSY: c_int = 231;
2487 pub const ERROR_NO_DATA: c_int = 232;
2488 pub const ERROR_INVALID_ADDRESS : c_int = 487;
2489 pub const ERROR_PIPE_CONNECTED: c_int = 535;
2490 pub const ERROR_NOTHING_TO_TERMINATE: c_int = 758;
2491 pub const ERROR_OPERATION_ABORTED: c_int = 995;
2492 pub const ERROR_IO_PENDING: c_int = 997;
2493 pub const ERROR_FILE_INVALID : c_int = 1006;
2494 pub const ERROR_NOT_FOUND: c_int = 1168;
2495 pub const INVALID_HANDLE_VALUE: HANDLE = -1 as HANDLE;
2497 pub const DELETE : DWORD = 0x00010000;
2498 pub const READ_CONTROL : DWORD = 0x00020000;
2499 pub const SYNCHRONIZE : DWORD = 0x00100000;
2500 pub const WRITE_DAC : DWORD = 0x00040000;
2501 pub const WRITE_OWNER : DWORD = 0x00080000;
2503 pub const PROCESS_CREATE_PROCESS : DWORD = 0x0080;
2504 pub const PROCESS_CREATE_THREAD : DWORD = 0x0002;
2505 pub const PROCESS_DUP_HANDLE : DWORD = 0x0040;
2506 pub const PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
2507 pub const PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
2508 pub const PROCESS_SET_INFORMATION : DWORD = 0x0200;
2509 pub const PROCESS_SET_QUOTA : DWORD = 0x0100;
2510 pub const PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
2511 pub const PROCESS_TERMINATE : DWORD = 0x0001;
2512 pub const PROCESS_VM_OPERATION : DWORD = 0x0008;
2513 pub const PROCESS_VM_READ : DWORD = 0x0010;
2514 pub const PROCESS_VM_WRITE : DWORD = 0x0020;
2516 pub const STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
2517 pub const STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
2518 pub const STARTF_PREVENTPINNING : DWORD = 0x00002000;
2519 pub const STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
2520 pub const STARTF_TITLEISAPPID : DWORD = 0x00001000;
2521 pub const STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
2522 pub const STARTF_USECOUNTCHARS : DWORD = 0x00000008;
2523 pub const STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
2524 pub const STARTF_USEHOTKEY : DWORD = 0x00000200;
2525 pub const STARTF_USEPOSITION : DWORD = 0x00000004;
2526 pub const STARTF_USESHOWWINDOW : DWORD = 0x00000001;
2527 pub const STARTF_USESIZE : DWORD = 0x00000002;
2528 pub const STARTF_USESTDHANDLES : DWORD = 0x00000100;
2530 pub const WAIT_ABANDONED : DWORD = 0x00000080;
2531 pub const WAIT_OBJECT_0 : DWORD = 0x00000000;
2532 pub const WAIT_TIMEOUT : DWORD = 0x00000102;
2533 pub const WAIT_FAILED : DWORD = -1;
2535 pub const DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
2536 pub const DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;
2538 pub const INFINITE : DWORD = -1;
2539 pub const STILL_ACTIVE : DWORD = 259;
2541 pub const MEM_COMMIT : DWORD = 0x00001000;
2542 pub const MEM_RESERVE : DWORD = 0x00002000;
2543 pub const MEM_DECOMMIT : DWORD = 0x00004000;
2544 pub const MEM_RELEASE : DWORD = 0x00008000;
2545 pub const MEM_RESET : DWORD = 0x00080000;
2546 pub const MEM_RESET_UNDO : DWORD = 0x1000000;
2547 pub const MEM_LARGE_PAGES : DWORD = 0x20000000;
2548 pub const MEM_PHYSICAL : DWORD = 0x00400000;
2549 pub const MEM_TOP_DOWN : DWORD = 0x00100000;
2550 pub const MEM_WRITE_WATCH : DWORD = 0x00200000;
2552 pub const PAGE_EXECUTE : DWORD = 0x10;
2553 pub const PAGE_EXECUTE_READ : DWORD = 0x20;
2554 pub const PAGE_EXECUTE_READWRITE : DWORD = 0x40;
2555 pub const PAGE_EXECUTE_WRITECOPY : DWORD = 0x80;
2556 pub const PAGE_NOACCESS : DWORD = 0x01;
2557 pub const PAGE_READONLY : DWORD = 0x02;
2558 pub const PAGE_READWRITE : DWORD = 0x04;
2559 pub const PAGE_WRITECOPY : DWORD = 0x08;
2560 pub const PAGE_GUARD : DWORD = 0x100;
2561 pub const PAGE_NOCACHE : DWORD = 0x200;
2562 pub const PAGE_WRITECOMBINE : DWORD = 0x400;
2564 pub const SEC_COMMIT : DWORD = 0x8000000;
2565 pub const SEC_IMAGE : DWORD = 0x1000000;
2566 pub const SEC_IMAGE_NO_EXECUTE : DWORD = 0x11000000;
2567 pub const SEC_LARGE_PAGES : DWORD = 0x80000000;
2568 pub const SEC_NOCACHE : DWORD = 0x10000000;
2569 pub const SEC_RESERVE : DWORD = 0x4000000;
2570 pub const SEC_WRITECOMBINE : DWORD = 0x40000000;
2572 pub const FILE_MAP_ALL_ACCESS : DWORD = 0xf001f;
2573 pub const FILE_MAP_READ : DWORD = 0x4;
2574 pub const FILE_MAP_WRITE : DWORD = 0x2;
2575 pub const FILE_MAP_COPY : DWORD = 0x1;
2576 pub const FILE_MAP_EXECUTE : DWORD = 0x20;
2578 pub const PROCESSOR_ARCHITECTURE_INTEL : WORD = 0;
2579 pub const PROCESSOR_ARCHITECTURE_ARM : WORD = 5;
2580 pub const PROCESSOR_ARCHITECTURE_IA64 : WORD = 6;
2581 pub const PROCESSOR_ARCHITECTURE_AMD64 : WORD = 9;
2582 pub const PROCESSOR_ARCHITECTURE_UNKNOWN : WORD = 0xffff;
2584 pub const MOVEFILE_COPY_ALLOWED: DWORD = 2;
2585 pub const MOVEFILE_CREATE_HARDLINK: DWORD = 16;
2586 pub const MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 4;
2587 pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 32;
2588 pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1;
2589 pub const MOVEFILE_WRITE_THROUGH: DWORD = 8;
2591 pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 1;
2593 pub const FILE_SHARE_DELETE: DWORD = 0x4;
2594 pub const FILE_SHARE_READ: DWORD = 0x1;
2595 pub const FILE_SHARE_WRITE: DWORD = 0x2;
2597 pub const CREATE_ALWAYS: DWORD = 2;
2598 pub const CREATE_NEW: DWORD = 1;
2599 pub const OPEN_ALWAYS: DWORD = 4;
2600 pub const OPEN_EXISTING: DWORD = 3;
2601 pub const TRUNCATE_EXISTING: DWORD = 5;
2603 pub const FILE_APPEND_DATA: DWORD = 0x00000004;
2604 pub const FILE_READ_DATA: DWORD = 0x00000001;
2605 pub const FILE_WRITE_DATA: DWORD = 0x00000002;
2607 pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x20;
2608 pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x800;
2609 pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x40;
2610 pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
2611 pub const FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x4000;
2612 pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x2;
2613 pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x8000;
2614 pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x80;
2615 pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x2000;
2616 pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x20000;
2617 pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x1000;
2618 pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
2619 pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
2620 pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x200;
2621 pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x4;
2622 pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x100;
2623 pub const FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x10000;
2625 pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
2626 pub const FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000;
2627 pub const FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000;
2628 pub const FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000;
2629 pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
2630 pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
2631 pub const FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x0100000;
2632 pub const FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000;
2633 pub const FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000;
2634 pub const FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000;
2635 pub const FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000;
2636 pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
2638 pub const FILE_NAME_NORMALIZED: DWORD = 0x0;
2639 pub const FILE_NAME_OPENED: DWORD = 0x8;
2641 pub const VOLUME_NAME_DOS: DWORD = 0x0;
2642 pub const VOLUME_NAME_GUID: DWORD = 0x1;
2643 pub const VOLUME_NAME_NONE: DWORD = 0x4;
2644 pub const VOLUME_NAME_NT: DWORD = 0x2;
2646 pub const GENERIC_READ: DWORD = 0x80000000;
2647 pub const GENERIC_WRITE: DWORD = 0x40000000;
2648 pub const GENERIC_EXECUTE: DWORD = 0x20000000;
2649 pub const GENERIC_ALL: DWORD = 0x10000000;
2650 pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
2651 pub const FILE_READ_ATTRIBUTES: DWORD = 0x00000080;
2653 pub const STANDARD_RIGHTS_READ: DWORD = 0x20000;
2654 pub const STANDARD_RIGHTS_WRITE: DWORD = 0x20000;
2655 pub const FILE_WRITE_EA: DWORD = 0x00000010;
2656 pub const FILE_READ_EA: DWORD = 0x00000008;
2657 pub const FILE_GENERIC_READ: DWORD =
2658 STANDARD_RIGHTS_READ | FILE_READ_DATA |
2659 FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE;
2660 pub const FILE_GENERIC_WRITE: DWORD =
2661 STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA |
2662 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA |
2665 pub const FILE_BEGIN: DWORD = 0;
2666 pub const FILE_CURRENT: DWORD = 1;
2667 pub const FILE_END: DWORD = 2;
2669 pub const MAX_PROTOCOL_CHAIN: DWORD = 7;
2670 pub const WSAPROTOCOL_LEN: DWORD = 255;
2671 pub const INVALID_SOCKET: SOCKET = !0;
2673 pub const DETACHED_PROCESS: DWORD = 0x00000008;
2674 pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
2675 pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
2677 pub const PIPE_ACCESS_DUPLEX: DWORD = 0x00000003;
2678 pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
2679 pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
2680 pub const PIPE_TYPE_BYTE: DWORD = 0x00000000;
2681 pub const PIPE_TYPE_MESSAGE: DWORD = 0x00000004;
2682 pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
2683 pub const PIPE_READMODE_MESSAGE: DWORD = 0x00000002;
2684 pub const PIPE_WAIT: DWORD = 0x00000000;
2685 pub const PIPE_NOWAIT: DWORD = 0x00000001;
2686 pub const PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000;
2687 pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
2688 pub const PIPE_UNLIMITED_INSTANCES: DWORD = 255;
2690 pub const IPPROTO_RAW: c_int = 255;
2692 pub const FIONBIO: c_long = -0x7FFB9982;
2699 #[cfg(any(target_os = "linux", target_os = "android"))]
2702 use types::os::arch::c95::{c_int, c_uint};
2704 pub const EXIT_FAILURE : c_int = 1;
2705 pub const EXIT_SUCCESS : c_int = 0;
2706 pub const RAND_MAX : c_int = 2147483647;
2707 pub const EOF : c_int = -1;
2708 pub const SEEK_SET : c_int = 0;
2709 pub const SEEK_CUR : c_int = 1;
2710 pub const SEEK_END : c_int = 2;
2711 pub const _IOFBF : c_int = 0;
2712 pub const _IONBF : c_int = 2;
2713 pub const _IOLBF : c_int = 1;
2714 pub const BUFSIZ : c_uint = 8192_u32;
2715 pub const FOPEN_MAX : c_uint = 16_u32;
2716 pub const FILENAME_MAX : c_uint = 4096_u32;
2717 pub const L_tmpnam : c_uint = 20_u32;
2718 pub const TMP_MAX : c_uint = 238328_u32;
2722 #[cfg(any(target_arch = "x86",
2723 target_arch = "x86_64",
2724 target_arch = "arm",
2725 target_arch = "aarch64",
2726 target_arch = "powerpc"))]
2728 use types::os::arch::c95::c_int;
2729 use types::common::c95::c_void;
2730 use types::os::arch::posix88::mode_t;
2732 pub const O_RDONLY : c_int = 0;
2733 pub const O_WRONLY : c_int = 1;
2734 pub const O_RDWR : c_int = 2;
2735 pub const O_APPEND : c_int = 1024;
2736 pub const O_CREAT : c_int = 64;
2737 pub const O_EXCL : c_int = 128;
2738 pub const O_TRUNC : c_int = 512;
2739 pub const S_IFIFO : mode_t = 4096;
2740 pub const S_IFCHR : mode_t = 8192;
2741 pub const S_IFBLK : mode_t = 24576;
2742 pub const S_IFDIR : mode_t = 16384;
2743 pub const S_IFREG : mode_t = 32768;
2744 pub const S_IFLNK : mode_t = 40960;
2745 pub const S_IFMT : mode_t = 61440;
2746 pub const S_IEXEC : mode_t = 64;
2747 pub const S_IWRITE : mode_t = 128;
2748 pub const S_IREAD : mode_t = 256;
2749 pub const S_IRWXU : mode_t = 448;
2750 pub const S_IXUSR : mode_t = 64;
2751 pub const S_IWUSR : mode_t = 128;
2752 pub const S_IRUSR : mode_t = 256;
2753 pub const F_OK : c_int = 0;
2754 pub const R_OK : c_int = 4;
2755 pub const W_OK : c_int = 2;
2756 pub const X_OK : c_int = 1;
2757 pub const STDIN_FILENO : c_int = 0;
2758 pub const STDOUT_FILENO : c_int = 1;
2759 pub const STDERR_FILENO : c_int = 2;
2760 pub const F_LOCK : c_int = 1;
2761 pub const F_TEST : c_int = 3;
2762 pub const F_TLOCK : c_int = 2;
2763 pub const F_ULOCK : c_int = 0;
2764 pub const SIGHUP : c_int = 1;
2765 pub const SIGINT : c_int = 2;
2766 pub const SIGQUIT : c_int = 3;
2767 pub const SIGILL : c_int = 4;
2768 pub const SIGABRT : c_int = 6;
2769 pub const SIGFPE : c_int = 8;
2770 pub const SIGKILL : c_int = 9;
2771 pub const SIGSEGV : c_int = 11;
2772 pub const SIGPIPE : c_int = 13;
2773 pub const SIGALRM : c_int = 14;
2774 pub const SIGTERM : c_int = 15;
2776 pub const PROT_NONE : c_int = 0;
2777 pub const PROT_READ : c_int = 1;
2778 pub const PROT_WRITE : c_int = 2;
2779 pub const PROT_EXEC : c_int = 4;
2781 pub const MAP_FILE : c_int = 0x0000;
2782 pub const MAP_SHARED : c_int = 0x0001;
2783 pub const MAP_PRIVATE : c_int = 0x0002;
2784 pub const MAP_FIXED : c_int = 0x0010;
2785 pub const MAP_ANON : c_int = 0x0020;
2787 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
2789 pub const MCL_CURRENT : c_int = 0x0001;
2790 pub const MCL_FUTURE : c_int = 0x0002;
2792 pub const MS_ASYNC : c_int = 0x0001;
2793 pub const MS_INVALIDATE : c_int = 0x0002;
2794 pub const MS_SYNC : c_int = 0x0004;
2796 pub const EPERM : c_int = 1;
2797 pub const ENOENT : c_int = 2;
2798 pub const ESRCH : c_int = 3;
2799 pub const EINTR : c_int = 4;
2800 pub const EIO : c_int = 5;
2801 pub const ENXIO : c_int = 6;
2802 pub const E2BIG : c_int = 7;
2803 pub const ENOEXEC : c_int = 8;
2804 pub const EBADF : c_int = 9;
2805 pub const ECHILD : c_int = 10;
2806 pub const EAGAIN : c_int = 11;
2807 pub const ENOMEM : c_int = 12;
2808 pub const EACCES : c_int = 13;
2809 pub const EFAULT : c_int = 14;
2810 pub const ENOTBLK : c_int = 15;
2811 pub const EBUSY : c_int = 16;
2812 pub const EEXIST : c_int = 17;
2813 pub const EXDEV : c_int = 18;
2814 pub const ENODEV : c_int = 19;
2815 pub const ENOTDIR : c_int = 20;
2816 pub const EISDIR : c_int = 21;
2817 pub const EINVAL : c_int = 22;
2818 pub const ENFILE : c_int = 23;
2819 pub const EMFILE : c_int = 24;
2820 pub const ENOTTY : c_int = 25;
2821 pub const ETXTBSY : c_int = 26;
2822 pub const EFBIG : c_int = 27;
2823 pub const ENOSPC : c_int = 28;
2824 pub const ESPIPE : c_int = 29;
2825 pub const EROFS : c_int = 30;
2826 pub const EMLINK : c_int = 31;
2827 pub const EPIPE : c_int = 32;
2828 pub const EDOM : c_int = 33;
2829 pub const ERANGE : c_int = 34;
2831 pub const EDEADLK: c_int = 35;
2832 pub const ENAMETOOLONG: c_int = 36;
2833 pub const ENOLCK: c_int = 37;
2834 pub const ENOSYS: c_int = 38;
2835 pub const ENOTEMPTY: c_int = 39;
2836 pub const ELOOP: c_int = 40;
2837 pub const EWOULDBLOCK: c_int = EAGAIN;
2838 pub const ENOMSG: c_int = 42;
2839 pub const EIDRM: c_int = 43;
2840 pub const ECHRNG: c_int = 44;
2841 pub const EL2NSYNC: c_int = 45;
2842 pub const EL3HLT: c_int = 46;
2843 pub const EL3RST: c_int = 47;
2844 pub const ELNRNG: c_int = 48;
2845 pub const EUNATCH: c_int = 49;
2846 pub const ENOCSI: c_int = 50;
2847 pub const EL2HLT: c_int = 51;
2848 pub const EBADE: c_int = 52;
2849 pub const EBADR: c_int = 53;
2850 pub const EXFULL: c_int = 54;
2851 pub const ENOANO: c_int = 55;
2852 pub const EBADRQC: c_int = 56;
2853 pub const EBADSLT: c_int = 57;
2855 pub const EDEADLOCK: c_int = EDEADLK;
2857 pub const EBFONT: c_int = 59;
2858 pub const ENOSTR: c_int = 60;
2859 pub const ENODATA: c_int = 61;
2860 pub const ETIME: c_int = 62;
2861 pub const ENOSR: c_int = 63;
2862 pub const ENONET: c_int = 64;
2863 pub const ENOPKG: c_int = 65;
2864 pub const EREMOTE: c_int = 66;
2865 pub const ENOLINK: c_int = 67;
2866 pub const EADV: c_int = 68;
2867 pub const ESRMNT: c_int = 69;
2868 pub const ECOMM: c_int = 70;
2869 pub const EPROTO: c_int = 71;
2870 pub const EMULTIHOP: c_int = 72;
2871 pub const EDOTDOT: c_int = 73;
2872 pub const EBADMSG: c_int = 74;
2873 pub const EOVERFLOW: c_int = 75;
2874 pub const ENOTUNIQ: c_int = 76;
2875 pub const EBADFD: c_int = 77;
2876 pub const EREMCHG: c_int = 78;
2877 pub const ELIBACC: c_int = 79;
2878 pub const ELIBBAD: c_int = 80;
2879 pub const ELIBSCN: c_int = 81;
2880 pub const ELIBMAX: c_int = 82;
2881 pub const ELIBEXEC: c_int = 83;
2882 pub const EILSEQ: c_int = 84;
2883 pub const ERESTART: c_int = 85;
2884 pub const ESTRPIPE: c_int = 86;
2885 pub const EUSERS: c_int = 87;
2886 pub const ENOTSOCK: c_int = 88;
2887 pub const EDESTADDRREQ: c_int = 89;
2888 pub const EMSGSIZE: c_int = 90;
2889 pub const EPROTOTYPE: c_int = 91;
2890 pub const ENOPROTOOPT: c_int = 92;
2891 pub const EPROTONOSUPPORT: c_int = 93;
2892 pub const ESOCKTNOSUPPORT: c_int = 94;
2893 pub const EOPNOTSUPP: c_int = 95;
2894 pub const EPFNOSUPPORT: c_int = 96;
2895 pub const EAFNOSUPPORT: c_int = 97;
2896 pub const EADDRINUSE: c_int = 98;
2897 pub const EADDRNOTAVAIL: c_int = 99;
2898 pub const ENETDOWN: c_int = 100;
2899 pub const ENETUNREACH: c_int = 101;
2900 pub const ENETRESET: c_int = 102;
2901 pub const ECONNABORTED: c_int = 103;
2902 pub const ECONNRESET: c_int = 104;
2903 pub const ENOBUFS: c_int = 105;
2904 pub const EISCONN: c_int = 106;
2905 pub const ENOTCONN: c_int = 107;
2906 pub const ESHUTDOWN: c_int = 108;
2907 pub const ETOOMANYREFS: c_int = 109;
2908 pub const ETIMEDOUT: c_int = 110;
2909 pub const ECONNREFUSED: c_int = 111;
2910 pub const EHOSTDOWN: c_int = 112;
2911 pub const EHOSTUNREACH: c_int = 113;
2912 pub const EALREADY: c_int = 114;
2913 pub const EINPROGRESS: c_int = 115;
2914 pub const ESTALE: c_int = 116;
2915 pub const EUCLEAN: c_int = 117;
2916 pub const ENOTNAM: c_int = 118;
2917 pub const ENAVAIL: c_int = 119;
2918 pub const EISNAM: c_int = 120;
2919 pub const EREMOTEIO: c_int = 121;
2920 pub const EDQUOT: c_int = 122;
2922 pub const ENOMEDIUM: c_int = 123;
2923 pub const EMEDIUMTYPE: c_int = 124;
2924 pub const ECANCELED: c_int = 125;
2925 pub const ENOKEY: c_int = 126;
2926 pub const EKEYEXPIRED: c_int = 127;
2927 pub const EKEYREVOKED: c_int = 128;
2928 pub const EKEYREJECTED: c_int = 129;
2930 pub const EOWNERDEAD: c_int = 130;
2931 pub const ENOTRECOVERABLE: c_int = 131;
2933 pub const ERFKILL: c_int = 132;
2935 pub const EHWPOISON: c_int = 133;
2938 #[cfg(any(target_arch = "mips",
2939 target_arch = "mipsel"))]
2941 use types::os::arch::c95::c_int;
2942 use types::common::c95::c_void;
2943 use types::os::arch::posix88::mode_t;
2945 pub const O_RDONLY : c_int = 0;
2946 pub const O_WRONLY : c_int = 1;
2947 pub const O_RDWR : c_int = 2;
2948 pub const O_APPEND : c_int = 8;
2949 pub const O_CREAT : c_int = 256;
2950 pub const O_EXCL : c_int = 1024;
2951 pub const O_TRUNC : c_int = 512;
2952 pub const S_IFIFO : mode_t = 4096;
2953 pub const S_IFCHR : mode_t = 8192;
2954 pub const S_IFBLK : mode_t = 24576;
2955 pub const S_IFDIR : mode_t = 16384;
2956 pub const S_IFREG : mode_t = 32768;
2957 pub const S_IFLNK : mode_t = 40960;
2958 pub const S_IFMT : mode_t = 61440;
2959 pub const S_IEXEC : mode_t = 64;
2960 pub const S_IWRITE : mode_t = 128;
2961 pub const S_IREAD : mode_t = 256;
2962 pub const S_IRWXU : mode_t = 448;
2963 pub const S_IXUSR : mode_t = 64;
2964 pub const S_IWUSR : mode_t = 128;
2965 pub const S_IRUSR : mode_t = 256;
2966 pub const F_OK : c_int = 0;
2967 pub const R_OK : c_int = 4;
2968 pub const W_OK : c_int = 2;
2969 pub const X_OK : c_int = 1;
2970 pub const STDIN_FILENO : c_int = 0;
2971 pub const STDOUT_FILENO : c_int = 1;
2972 pub const STDERR_FILENO : c_int = 2;
2973 pub const F_LOCK : c_int = 1;
2974 pub const F_TEST : c_int = 3;
2975 pub const F_TLOCK : c_int = 2;
2976 pub const F_ULOCK : c_int = 0;
2977 pub const SIGHUP : c_int = 1;
2978 pub const SIGINT : c_int = 2;
2979 pub const SIGQUIT : c_int = 3;
2980 pub const SIGILL : c_int = 4;
2981 pub const SIGABRT : c_int = 6;
2982 pub const SIGFPE : c_int = 8;
2983 pub const SIGKILL : c_int = 9;
2984 pub const SIGSEGV : c_int = 11;
2985 pub const SIGPIPE : c_int = 13;
2986 pub const SIGALRM : c_int = 14;
2987 pub const SIGTERM : c_int = 15;
2989 pub const PROT_NONE : c_int = 0;
2990 pub const PROT_READ : c_int = 1;
2991 pub const PROT_WRITE : c_int = 2;
2992 pub const PROT_EXEC : c_int = 4;
2994 pub const MAP_FILE : c_int = 0x0000;
2995 pub const MAP_SHARED : c_int = 0x0001;
2996 pub const MAP_PRIVATE : c_int = 0x0002;
2997 pub const MAP_FIXED : c_int = 0x0010;
2998 pub const MAP_ANON : c_int = 0x0800;
3000 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
3002 pub const MCL_CURRENT : c_int = 0x0001;
3003 pub const MCL_FUTURE : c_int = 0x0002;
3005 pub const MS_ASYNC : c_int = 0x0001;
3006 pub const MS_INVALIDATE : c_int = 0x0002;
3007 pub const MS_SYNC : c_int = 0x0004;
3009 pub const EPERM : c_int = 1;
3010 pub const ENOENT : c_int = 2;
3011 pub const ESRCH : c_int = 3;
3012 pub const EINTR : c_int = 4;
3013 pub const EIO : c_int = 5;
3014 pub const ENXIO : c_int = 6;
3015 pub const E2BIG : c_int = 7;
3016 pub const ENOEXEC : c_int = 8;
3017 pub const EBADF : c_int = 9;
3018 pub const ECHILD : c_int = 10;
3019 pub const EAGAIN : c_int = 11;
3020 pub const ENOMEM : c_int = 12;
3021 pub const EACCES : c_int = 13;
3022 pub const EFAULT : c_int = 14;
3023 pub const ENOTBLK : c_int = 15;
3024 pub const EBUSY : c_int = 16;
3025 pub const EEXIST : c_int = 17;
3026 pub const EXDEV : c_int = 18;
3027 pub const ENODEV : c_int = 19;
3028 pub const ENOTDIR : c_int = 20;
3029 pub const EISDIR : c_int = 21;
3030 pub const EINVAL : c_int = 22;
3031 pub const ENFILE : c_int = 23;
3032 pub const EMFILE : c_int = 24;
3033 pub const ENOTTY : c_int = 25;
3034 pub const ETXTBSY : c_int = 26;
3035 pub const EFBIG : c_int = 27;
3036 pub const ENOSPC : c_int = 28;
3037 pub const ESPIPE : c_int = 29;
3038 pub const EROFS : c_int = 30;
3039 pub const EMLINK : c_int = 31;
3040 pub const EPIPE : c_int = 32;
3041 pub const EDOM : c_int = 33;
3042 pub const ERANGE : c_int = 34;
3044 pub const ENOMSG: c_int = 35;
3045 pub const EIDRM: c_int = 36;
3046 pub const ECHRNG: c_int = 37;
3047 pub const EL2NSYNC: c_int = 38;
3048 pub const EL3HLT: c_int = 39;
3049 pub const EL3RST: c_int = 40;
3050 pub const ELNRNG: c_int = 41;
3051 pub const EUNATCH: c_int = 42;
3052 pub const ENOCSI: c_int = 43;
3053 pub const EL2HLT: c_int = 44;
3054 pub const EDEADLK: c_int = 45;
3055 pub const ENOLCK: c_int = 46;
3056 pub const EBADE: c_int = 50;
3057 pub const EBADR: c_int = 51;
3058 pub const EXFULL: c_int = 52;
3059 pub const ENOANO: c_int = 53;
3060 pub const EBADRQC: c_int = 54;
3061 pub const EBADSLT: c_int = 55;
3062 pub const EDEADLOCK: c_int = 56;
3063 pub const EBFONT: c_int = 59;
3064 pub const ENOSTR: c_int = 60;
3065 pub const ENODATA: c_int = 61;
3066 pub const ETIME: c_int = 62;
3067 pub const ENOSR: c_int = 63;
3068 pub const ENONET: c_int = 64;
3069 pub const ENOPKG: c_int = 65;
3070 pub const EREMOTE: c_int = 66;
3071 pub const ENOLINK: c_int = 67;
3072 pub const EADV: c_int = 68;
3073 pub const ESRMNT: c_int = 69;
3074 pub const ECOMM: c_int = 70;
3075 pub const EPROTO: c_int = 71;
3076 pub const EDOTDOT: c_int = 73;
3077 pub const EMULTIHOP: c_int = 74;
3078 pub const EBADMSG: c_int = 77;
3079 pub const ENAMETOOLONG: c_int = 78;
3080 pub const EOVERFLOW: c_int = 79;
3081 pub const ENOTUNIQ: c_int = 80;
3082 pub const EBADFD: c_int = 81;
3083 pub const EREMCHG: c_int = 82;
3084 pub const ELIBACC: c_int = 83;
3085 pub const ELIBBAD: c_int = 84;
3086 pub const ELIBSCN: c_int = 95;
3087 pub const ELIBMAX: c_int = 86;
3088 pub const ELIBEXEC: c_int = 87;
3089 pub const EILSEQ: c_int = 88;
3090 pub const ENOSYS: c_int = 89;
3091 pub const ELOOP: c_int = 90;
3092 pub const ERESTART: c_int = 91;
3093 pub const ESTRPIPE: c_int = 92;
3094 pub const ENOTEMPTY: c_int = 93;
3095 pub const EUSERS: c_int = 94;
3096 pub const ENOTSOCK: c_int = 95;
3097 pub const EDESTADDRREQ: c_int = 96;
3098 pub const EMSGSIZE: c_int = 97;
3099 pub const EPROTOTYPE: c_int = 98;
3100 pub const ENOPROTOOPT: c_int = 99;
3101 pub const EPROTONOSUPPORT: c_int = 120;
3102 pub const ESOCKTNOSUPPORT: c_int = 121;
3103 pub const EOPNOTSUPP: c_int = 122;
3104 pub const EPFNOSUPPORT: c_int = 123;
3105 pub const EAFNOSUPPORT: c_int = 124;
3106 pub const EADDRINUSE: c_int = 125;
3107 pub const EADDRNOTAVAIL: c_int = 126;
3108 pub const ENETDOWN: c_int = 127;
3109 pub const ENETUNREACH: c_int = 128;
3110 pub const ENETRESET: c_int = 129;
3111 pub const ECONNABORTED: c_int = 130;
3112 pub const ECONNRESET: c_int = 131;
3113 pub const ENOBUFS: c_int = 132;
3114 pub const EISCONN: c_int = 133;
3115 pub const ENOTCONN: c_int = 134;
3116 pub const EUCLEAN: c_int = 135;
3117 pub const ENOTNAM: c_int = 137;
3118 pub const ENAVAIL: c_int = 138;
3119 pub const EISNAM: c_int = 139;
3120 pub const EREMOTEIO: c_int = 140;
3121 pub const ESHUTDOWN: c_int = 143;
3122 pub const ETOOMANYREFS: c_int = 144;
3123 pub const ETIMEDOUT: c_int = 145;
3124 pub const ECONNREFUSED: c_int = 146;
3125 pub const EHOSTDOWN: c_int = 147;
3126 pub const EHOSTUNREACH: c_int = 148;
3127 pub const EWOULDBLOCK: c_int = EAGAIN;
3128 pub const EALREADY: c_int = 149;
3129 pub const EINPROGRESS: c_int = 150;
3130 pub const ESTALE: c_int = 151;
3131 pub const ECANCELED: c_int = 158;
3133 pub const ENOMEDIUM: c_int = 159;
3134 pub const EMEDIUMTYPE: c_int = 160;
3135 pub const ENOKEY: c_int = 161;
3136 pub const EKEYEXPIRED: c_int = 162;
3137 pub const EKEYREVOKED: c_int = 163;
3138 pub const EKEYREJECTED: c_int = 164;
3140 pub const EOWNERDEAD: c_int = 165;
3141 pub const ENOTRECOVERABLE: c_int = 166;
3143 pub const ERFKILL: c_int = 167;
3145 pub const EHWPOISON: c_int = 168;
3147 pub const EDQUOT: c_int = 1133;
3150 use types::os::arch::c95::{c_int, size_t};
3152 pub const F_DUPFD : c_int = 0;
3153 pub const F_GETFD : c_int = 1;
3154 pub const F_SETFD : c_int = 2;
3155 pub const F_GETFL : c_int = 3;
3156 pub const F_SETFL : c_int = 4;
3158 pub const SIGTRAP : c_int = 5;
3159 pub const SIGPIPE: c_int = 13;
3160 pub const SIG_IGN: size_t = 1;
3162 pub const GLOB_ERR : c_int = 1 << 0;
3163 pub const GLOB_MARK : c_int = 1 << 1;
3164 pub const GLOB_NOSORT : c_int = 1 << 2;
3165 pub const GLOB_DOOFFS : c_int = 1 << 3;
3166 pub const GLOB_NOCHECK : c_int = 1 << 4;
3167 pub const GLOB_APPEND : c_int = 1 << 5;
3168 pub const GLOB_NOESCAPE : c_int = 1 << 6;
3170 pub const GLOB_NOSPACE : c_int = 1;
3171 pub const GLOB_ABORTED : c_int = 2;
3172 pub const GLOB_NOMATCH : c_int = 3;
3174 pub const POSIX_MADV_NORMAL : c_int = 0;
3175 pub const POSIX_MADV_RANDOM : c_int = 1;
3176 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3177 pub const POSIX_MADV_WILLNEED : c_int = 3;
3178 pub const POSIX_MADV_DONTNEED : c_int = 4;
3180 pub const _SC_MQ_PRIO_MAX : c_int = 28;
3181 pub const _SC_IOV_MAX : c_int = 60;
3182 pub const _SC_GETGR_R_SIZE_MAX : c_int = 69;
3183 pub const _SC_GETPW_R_SIZE_MAX : c_int = 70;
3184 pub const _SC_LOGIN_NAME_MAX : c_int = 71;
3185 pub const _SC_TTY_NAME_MAX : c_int = 72;
3186 pub const _SC_THREADS : c_int = 67;
3187 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
3188 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
3189 pub const _SC_THREAD_KEYS_MAX : c_int = 74;
3190 pub const _SC_THREAD_STACK_MIN : c_int = 75;
3191 pub const _SC_THREAD_THREADS_MAX : c_int = 76;
3192 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
3193 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
3194 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
3195 pub const _SC_THREAD_PRIO_INHERIT : c_int = 80;
3196 pub const _SC_THREAD_PRIO_PROTECT : c_int = 81;
3197 pub const _SC_THREAD_PROCESS_SHARED : c_int = 82;
3198 pub const _SC_ATEXIT_MAX : c_int = 87;
3199 pub const _SC_XOPEN_VERSION : c_int = 89;
3200 pub const _SC_XOPEN_XCU_VERSION : c_int = 90;
3201 pub const _SC_XOPEN_UNIX : c_int = 91;
3202 pub const _SC_XOPEN_CRYPT : c_int = 92;
3203 pub const _SC_XOPEN_ENH_I18N : c_int = 93;
3204 pub const _SC_XOPEN_SHM : c_int = 94;
3205 pub const _SC_XOPEN_LEGACY : c_int = 129;
3206 pub const _SC_XOPEN_REALTIME : c_int = 130;
3207 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 131;
3209 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
3210 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
3212 #[cfg(target_os = "android")]
3213 pub const PTHREAD_STACK_MIN: size_t = 8192;
3215 #[cfg(all(target_os = "linux",
3216 any(target_arch = "arm",
3217 target_arch = "x86",
3218 target_arch = "x86_64")))]
3219 pub const PTHREAD_STACK_MIN: size_t = 16384;
3221 #[cfg(all(target_os = "linux",
3222 any(target_arch = "mips",
3223 target_arch = "mipsel",
3224 target_arch = "aarch64",
3225 target_arch = "powerpc")))]
3226 pub const PTHREAD_STACK_MIN: size_t = 131072;
3228 pub const CLOCK_REALTIME: c_int = 0;
3229 pub const CLOCK_MONOTONIC: c_int = 1;
3233 #[cfg(any(target_arch = "arm",
3234 target_arch = "aarch64",
3235 target_arch = "x86",
3236 target_arch = "x86_64",
3237 target_arch = "powerpc"))]
3239 use types::os::arch::c95::c_int;
3241 pub const MADV_NORMAL : c_int = 0;
3242 pub const MADV_RANDOM : c_int = 1;
3243 pub const MADV_SEQUENTIAL : c_int = 2;
3244 pub const MADV_WILLNEED : c_int = 3;
3245 pub const MADV_DONTNEED : c_int = 4;
3246 pub const MADV_REMOVE : c_int = 9;
3247 pub const MADV_DONTFORK : c_int = 10;
3248 pub const MADV_DOFORK : c_int = 11;
3249 pub const MADV_MERGEABLE : c_int = 12;
3250 pub const MADV_UNMERGEABLE : c_int = 13;
3251 pub const MADV_HWPOISON : c_int = 100;
3253 pub const IFF_LOOPBACK: c_int = 0x8;
3255 pub const AF_UNIX: c_int = 1;
3256 pub const AF_INET: c_int = 2;
3257 pub const AF_INET6: c_int = 10;
3258 pub const SOCK_STREAM: c_int = 1;
3259 pub const SOCK_DGRAM: c_int = 2;
3260 pub const SOCK_RAW: c_int = 3;
3261 pub const IPPROTO_TCP: c_int = 6;
3262 pub const IPPROTO_IP: c_int = 0;
3263 pub const IPPROTO_IPV6: c_int = 41;
3264 pub const IP_MULTICAST_TTL: c_int = 33;
3265 pub const IP_MULTICAST_LOOP: c_int = 34;
3266 pub const IP_TTL: c_int = 2;
3267 pub const IP_HDRINCL: c_int = 3;
3268 pub const IP_ADD_MEMBERSHIP: c_int = 35;
3269 pub const IP_DROP_MEMBERSHIP: c_int = 36;
3270 pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
3271 pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
3273 pub const TCP_NODELAY: c_int = 1;
3274 pub const SOL_SOCKET: c_int = 1;
3275 pub const SO_KEEPALIVE: c_int = 9;
3276 pub const SO_BROADCAST: c_int = 6;
3277 pub const SO_REUSEADDR: c_int = 2;
3278 pub const SO_ERROR: c_int = 4;
3280 pub const SHUT_RD: c_int = 0;
3281 pub const SHUT_WR: c_int = 1;
3282 pub const SHUT_RDWR: c_int = 2;
3284 #[cfg(any(target_arch = "mips",
3285 target_arch = "mipsel"))]
3287 use types::os::arch::c95::c_int;
3289 pub const MADV_NORMAL : c_int = 0;
3290 pub const MADV_RANDOM : c_int = 1;
3291 pub const MADV_SEQUENTIAL : c_int = 2;
3292 pub const MADV_WILLNEED : c_int = 3;
3293 pub const MADV_DONTNEED : c_int = 4;
3294 pub const MADV_REMOVE : c_int = 9;
3295 pub const MADV_DONTFORK : c_int = 10;
3296 pub const MADV_DOFORK : c_int = 11;
3297 pub const MADV_MERGEABLE : c_int = 12;
3298 pub const MADV_UNMERGEABLE : c_int = 13;
3299 pub const MADV_HWPOISON : c_int = 100;
3301 pub const AF_UNIX: c_int = 1;
3302 pub const AF_INET: c_int = 2;
3303 pub const AF_INET6: c_int = 10;
3304 pub const SOCK_STREAM: c_int = 2;
3305 pub const SOCK_DGRAM: c_int = 1;
3306 pub const SOCK_RAW: c_int = 3;
3307 pub const IPPROTO_TCP: c_int = 6;
3308 pub const IPPROTO_IP: c_int = 0;
3309 pub const IPPROTO_IPV6: c_int = 41;
3310 pub const IP_MULTICAST_TTL: c_int = 33;
3311 pub const IP_MULTICAST_LOOP: c_int = 34;
3312 pub const IP_TTL: c_int = 2;
3313 pub const IP_HDRINCL: c_int = 3;
3314 pub const IP_ADD_MEMBERSHIP: c_int = 35;
3315 pub const IP_DROP_MEMBERSHIP: c_int = 36;
3316 pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
3317 pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
3319 pub const TCP_NODELAY: c_int = 1;
3320 pub const SOL_SOCKET: c_int = 65535;
3321 pub const SO_KEEPALIVE: c_int = 8;
3322 pub const SO_BROADCAST: c_int = 32;
3323 pub const SO_REUSEADDR: c_int = 4;
3324 pub const SO_ERROR: c_int = 4103;
3326 pub const SHUT_RD: c_int = 0;
3327 pub const SHUT_WR: c_int = 1;
3328 pub const SHUT_RDWR: c_int = 2;
3330 #[cfg(any(target_arch = "x86",
3331 target_arch = "x86_64",
3332 target_arch = "arm",
3333 target_arch = "aarch64",
3334 target_arch = "powerpc"))]
3336 use types::os::arch::c95::c_int;
3338 pub const AF_PACKET : c_int = 17;
3339 pub const IPPROTO_RAW : c_int = 255;
3341 pub const O_RSYNC : c_int = 1052672;
3342 pub const O_DSYNC : c_int = 4096;
3343 pub const O_NONBLOCK : c_int = 2048;
3344 pub const O_SYNC : c_int = 1052672;
3346 pub const PROT_GROWSDOWN : c_int = 0x010000000;
3347 pub const PROT_GROWSUP : c_int = 0x020000000;
3349 pub const MAP_TYPE : c_int = 0x000f;
3350 pub const MAP_ANONYMOUS : c_int = 0x0020;
3351 pub const MAP_32BIT : c_int = 0x0040;
3352 pub const MAP_GROWSDOWN : c_int = 0x0100;
3353 pub const MAP_DENYWRITE : c_int = 0x0800;
3354 pub const MAP_EXECUTABLE : c_int = 0x01000;
3355 pub const MAP_LOCKED : c_int = 0x02000;
3356 pub const MAP_NONRESERVE : c_int = 0x04000;
3357 pub const MAP_POPULATE : c_int = 0x08000;
3358 pub const MAP_NONBLOCK : c_int = 0x010000;
3359 pub const MAP_STACK : c_int = 0x020000;
3361 #[cfg(any(target_arch = "mips",
3362 target_arch = "mipsel"))]
3364 use types::os::arch::c95::c_int;
3366 pub const AF_PACKET : c_int = 17;
3367 pub const IPPROTO_RAW : c_int = 255;
3369 pub const O_RSYNC : c_int = 16400;
3370 pub const O_DSYNC : c_int = 16;
3371 pub const O_NONBLOCK : c_int = 128;
3372 pub const O_SYNC : c_int = 16400;
3374 pub const PROT_GROWSDOWN : c_int = 0x01000000;
3375 pub const PROT_GROWSUP : c_int = 0x02000000;
3377 pub const MAP_TYPE : c_int = 0x000f;
3378 pub const MAP_ANONYMOUS : c_int = 0x0800;
3379 pub const MAP_GROWSDOWN : c_int = 0x01000;
3380 pub const MAP_DENYWRITE : c_int = 0x02000;
3381 pub const MAP_EXECUTABLE : c_int = 0x04000;
3382 pub const MAP_LOCKED : c_int = 0x08000;
3383 pub const MAP_NONRESERVE : c_int = 0x0400;
3384 pub const MAP_POPULATE : c_int = 0x010000;
3385 pub const MAP_NONBLOCK : c_int = 0x020000;
3386 pub const MAP_STACK : c_int = 0x040000;
3388 #[cfg(target_os = "linux")]
3390 use types::os::arch::c95::c_int;
3392 pub const _SC_ARG_MAX : c_int = 0;
3393 pub const _SC_CHILD_MAX : c_int = 1;
3394 pub const _SC_CLK_TCK : c_int = 2;
3395 pub const _SC_NGROUPS_MAX : c_int = 3;
3396 pub const _SC_OPEN_MAX : c_int = 4;
3397 pub const _SC_STREAM_MAX : c_int = 5;
3398 pub const _SC_TZNAME_MAX : c_int = 6;
3399 pub const _SC_JOB_CONTROL : c_int = 7;
3400 pub const _SC_SAVED_IDS : c_int = 8;
3401 pub const _SC_REALTIME_SIGNALS : c_int = 9;
3402 pub const _SC_PRIORITY_SCHEDULING : c_int = 10;
3403 pub const _SC_TIMERS : c_int = 11;
3404 pub const _SC_ASYNCHRONOUS_IO : c_int = 12;
3405 pub const _SC_PRIORITIZED_IO : c_int = 13;
3406 pub const _SC_SYNCHRONIZED_IO : c_int = 14;
3407 pub const _SC_FSYNC : c_int = 15;
3408 pub const _SC_MAPPED_FILES : c_int = 16;
3409 pub const _SC_MEMLOCK : c_int = 17;
3410 pub const _SC_MEMLOCK_RANGE : c_int = 18;
3411 pub const _SC_MEMORY_PROTECTION : c_int = 19;
3412 pub const _SC_MESSAGE_PASSING : c_int = 20;
3413 pub const _SC_SEMAPHORES : c_int = 21;
3414 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 22;
3415 pub const _SC_AIO_LISTIO_MAX : c_int = 23;
3416 pub const _SC_AIO_MAX : c_int = 24;
3417 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 25;
3418 pub const _SC_DELAYTIMER_MAX : c_int = 26;
3419 pub const _SC_MQ_OPEN_MAX : c_int = 27;
3420 pub const _SC_VERSION : c_int = 29;
3421 pub const _SC_PAGESIZE : c_int = 30;
3422 pub const _SC_RTSIG_MAX : c_int = 31;
3423 pub const _SC_SEM_NSEMS_MAX : c_int = 32;
3424 pub const _SC_SEM_VALUE_MAX : c_int = 33;
3425 pub const _SC_SIGQUEUE_MAX : c_int = 34;
3426 pub const _SC_TIMER_MAX : c_int = 35;
3427 pub const _SC_BC_BASE_MAX : c_int = 36;
3428 pub const _SC_BC_DIM_MAX : c_int = 37;
3429 pub const _SC_BC_SCALE_MAX : c_int = 38;
3430 pub const _SC_BC_STRING_MAX : c_int = 39;
3431 pub const _SC_COLL_WEIGHTS_MAX : c_int = 40;
3432 pub const _SC_EXPR_NEST_MAX : c_int = 42;
3433 pub const _SC_LINE_MAX : c_int = 43;
3434 pub const _SC_RE_DUP_MAX : c_int = 44;
3435 pub const _SC_2_VERSION : c_int = 46;
3436 pub const _SC_2_C_BIND : c_int = 47;
3437 pub const _SC_2_C_DEV : c_int = 48;
3438 pub const _SC_2_FORT_DEV : c_int = 49;
3439 pub const _SC_2_FORT_RUN : c_int = 50;
3440 pub const _SC_2_SW_DEV : c_int = 51;
3441 pub const _SC_2_LOCALEDEF : c_int = 52;
3442 pub const _SC_2_CHAR_TERM : c_int = 95;
3443 pub const _SC_2_C_VERSION : c_int = 96;
3444 pub const _SC_2_UPE : c_int = 97;
3445 pub const _SC_XBS5_ILP32_OFF32 : c_int = 125;
3446 pub const _SC_XBS5_ILP32_OFFBIG : c_int = 126;
3447 pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 128;
3449 #[cfg(target_os = "android")]
3451 use types::os::arch::c95::c_int;
3453 pub const _SC_ARG_MAX : c_int = 0;
3454 pub const _SC_BC_BASE_MAX : c_int = 1;
3455 pub const _SC_BC_DIM_MAX : c_int = 2;
3456 pub const _SC_BC_SCALE_MAX : c_int = 3;
3457 pub const _SC_BC_STRING_MAX : c_int = 4;
3458 pub const _SC_CHILD_MAX : c_int = 5;
3459 pub const _SC_CLK_TCK : c_int = 6;
3460 pub const _SC_COLL_WEIGHTS_MAX : c_int = 7;
3461 pub const _SC_EXPR_NEST_MAX : c_int = 8;
3462 pub const _SC_LINE_MAX : c_int = 9;
3463 pub const _SC_NGROUPS_MAX : c_int = 10;
3464 pub const _SC_OPEN_MAX : c_int = 11;
3465 pub const _SC_2_C_BIND : c_int = 13;
3466 pub const _SC_2_C_DEV : c_int = 14;
3467 pub const _SC_2_C_VERSION : c_int = 15;
3468 pub const _SC_2_CHAR_TERM : c_int = 16;
3469 pub const _SC_2_FORT_DEV : c_int = 17;
3470 pub const _SC_2_FORT_RUN : c_int = 18;
3471 pub const _SC_2_LOCALEDEF : c_int = 19;
3472 pub const _SC_2_SW_DEV : c_int = 20;
3473 pub const _SC_2_UPE : c_int = 21;
3474 pub const _SC_2_VERSION : c_int = 22;
3475 pub const _SC_JOB_CONTROL : c_int = 23;
3476 pub const _SC_SAVED_IDS : c_int = 24;
3477 pub const _SC_VERSION : c_int = 25;
3478 pub const _SC_RE_DUP_MAX : c_int = 26;
3479 pub const _SC_STREAM_MAX : c_int = 27;
3480 pub const _SC_TZNAME_MAX : c_int = 28;
3481 pub const _SC_PAGESIZE : c_int = 39;
3485 #[cfg(any(target_os = "freebsd",
3486 target_os = "dragonfly"))]
3489 use types::os::arch::c95::{c_int, c_uint};
3491 pub const EXIT_FAILURE : c_int = 1;
3492 pub const EXIT_SUCCESS : c_int = 0;
3493 pub const RAND_MAX : c_int = 2147483647;
3494 pub const EOF : c_int = -1;
3495 pub const SEEK_SET : c_int = 0;
3496 pub const SEEK_CUR : c_int = 1;
3497 pub const SEEK_END : c_int = 2;
3498 pub const _IOFBF : c_int = 0;
3499 pub const _IONBF : c_int = 2;
3500 pub const _IOLBF : c_int = 1;
3501 pub const BUFSIZ : c_uint = 1024_u32;
3502 pub const FOPEN_MAX : c_uint = 20_u32;
3503 pub const FILENAME_MAX : c_uint = 1024_u32;
3504 pub const L_tmpnam : c_uint = 1024_u32;
3505 pub const TMP_MAX : c_uint = 308915776_u32;
3510 use types::common::c95::c_void;
3511 use types::os::arch::c95::c_int;
3512 use types::os::arch::posix88::mode_t;
3514 pub const O_RDONLY : c_int = 0;
3515 pub const O_WRONLY : c_int = 1;
3516 pub const O_RDWR : c_int = 2;
3517 pub const O_APPEND : c_int = 8;
3518 pub const O_CREAT : c_int = 512;
3519 pub const O_EXCL : c_int = 2048;
3520 pub const O_TRUNC : c_int = 1024;
3521 pub const S_IFIFO : mode_t = 4096;
3522 pub const S_IFCHR : mode_t = 8192;
3523 pub const S_IFBLK : mode_t = 24576;
3524 pub const S_IFDIR : mode_t = 16384;
3525 pub const S_IFREG : mode_t = 32768;
3526 pub const S_IFLNK : mode_t = 40960;
3527 pub const S_IFMT : mode_t = 61440;
3528 pub const S_IEXEC : mode_t = 64;
3529 pub const S_IWRITE : mode_t = 128;
3530 pub const S_IREAD : mode_t = 256;
3531 pub const S_IRWXU : mode_t = 448;
3532 pub const S_IXUSR : mode_t = 64;
3533 pub const S_IWUSR : mode_t = 128;
3534 pub const S_IRUSR : mode_t = 256;
3535 pub const F_OK : c_int = 0;
3536 pub const R_OK : c_int = 4;
3537 pub const W_OK : c_int = 2;
3538 pub const X_OK : c_int = 1;
3539 pub const STDIN_FILENO : c_int = 0;
3540 pub const STDOUT_FILENO : c_int = 1;
3541 pub const STDERR_FILENO : c_int = 2;
3542 pub const F_LOCK : c_int = 1;
3543 pub const F_TEST : c_int = 3;
3544 pub const F_TLOCK : c_int = 2;
3545 pub const F_ULOCK : c_int = 0;
3546 pub const SIGHUP : c_int = 1;
3547 pub const SIGINT : c_int = 2;
3548 pub const SIGQUIT : c_int = 3;
3549 pub const SIGILL : c_int = 4;
3550 pub const SIGABRT : c_int = 6;
3551 pub const SIGFPE : c_int = 8;
3552 pub const SIGKILL : c_int = 9;
3553 pub const SIGSEGV : c_int = 11;
3554 pub const SIGPIPE : c_int = 13;
3555 pub const SIGALRM : c_int = 14;
3556 pub const SIGTERM : c_int = 15;
3558 pub const PROT_NONE : c_int = 0;
3559 pub const PROT_READ : c_int = 1;
3560 pub const PROT_WRITE : c_int = 2;
3561 pub const PROT_EXEC : c_int = 4;
3563 pub const MAP_FILE : c_int = 0x0000;
3564 pub const MAP_SHARED : c_int = 0x0001;
3565 pub const MAP_PRIVATE : c_int = 0x0002;
3566 pub const MAP_FIXED : c_int = 0x0010;
3567 pub const MAP_ANON : c_int = 0x1000;
3569 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
3571 pub const MCL_CURRENT : c_int = 0x0001;
3572 pub const MCL_FUTURE : c_int = 0x0002;
3574 pub const MS_SYNC : c_int = 0x0000;
3575 pub const MS_ASYNC : c_int = 0x0001;
3576 pub const MS_INVALIDATE : c_int = 0x0002;
3578 pub const EPERM : c_int = 1;
3579 pub const ENOENT : c_int = 2;
3580 pub const ESRCH : c_int = 3;
3581 pub const EINTR : c_int = 4;
3582 pub const EIO : c_int = 5;
3583 pub const ENXIO : c_int = 6;
3584 pub const E2BIG : c_int = 7;
3585 pub const ENOEXEC : c_int = 8;
3586 pub const EBADF : c_int = 9;
3587 pub const ECHILD : c_int = 10;
3588 pub const EDEADLK : c_int = 11;
3589 pub const ENOMEM : c_int = 12;
3590 pub const EACCES : c_int = 13;
3591 pub const EFAULT : c_int = 14;
3592 pub const ENOTBLK : c_int = 15;
3593 pub const EBUSY : c_int = 16;
3594 pub const EEXIST : c_int = 17;
3595 pub const EXDEV : c_int = 18;
3596 pub const ENODEV : c_int = 19;
3597 pub const ENOTDIR : c_int = 20;
3598 pub const EISDIR : c_int = 21;
3599 pub const EINVAL : c_int = 22;
3600 pub const ENFILE : c_int = 23;
3601 pub const EMFILE : c_int = 24;
3602 pub const ENOTTY : c_int = 25;
3603 pub const ETXTBSY : c_int = 26;
3604 pub const EFBIG : c_int = 27;
3605 pub const ENOSPC : c_int = 28;
3606 pub const ESPIPE : c_int = 29;
3607 pub const EROFS : c_int = 30;
3608 pub const EMLINK : c_int = 31;
3609 pub const EPIPE : c_int = 32;
3610 pub const EDOM : c_int = 33;
3611 pub const ERANGE : c_int = 34;
3612 pub const EAGAIN : c_int = 35;
3613 pub const EWOULDBLOCK : c_int = 35;
3614 pub const EINPROGRESS : c_int = 36;
3615 pub const EALREADY : c_int = 37;
3616 pub const ENOTSOCK : c_int = 38;
3617 pub const EDESTADDRREQ : c_int = 39;
3618 pub const EMSGSIZE : c_int = 40;
3619 pub const EPROTOTYPE : c_int = 41;
3620 pub const ENOPROTOOPT : c_int = 42;
3621 pub const EPROTONOSUPPORT : c_int = 43;
3622 pub const ESOCKTNOSUPPORT : c_int = 44;
3623 pub const EOPNOTSUPP : c_int = 45;
3624 pub const EPFNOSUPPORT : c_int = 46;
3625 pub const EAFNOSUPPORT : c_int = 47;
3626 pub const EADDRINUSE : c_int = 48;
3627 pub const EADDRNOTAVAIL : c_int = 49;
3628 pub const ENETDOWN : c_int = 50;
3629 pub const ENETUNREACH : c_int = 51;
3630 pub const ENETRESET : c_int = 52;
3631 pub const ECONNABORTED : c_int = 53;
3632 pub const ECONNRESET : c_int = 54;
3633 pub const ENOBUFS : c_int = 55;
3634 pub const EISCONN : c_int = 56;
3635 pub const ENOTCONN : c_int = 57;
3636 pub const ESHUTDOWN : c_int = 58;
3637 pub const ETOOMANYREFS : c_int = 59;
3638 pub const ETIMEDOUT : c_int = 60;
3639 pub const ECONNREFUSED : c_int = 61;
3640 pub const ELOOP : c_int = 62;
3641 pub const ENAMETOOLONG : c_int = 63;
3642 pub const EHOSTDOWN : c_int = 64;
3643 pub const EHOSTUNREACH : c_int = 65;
3644 pub const ENOTEMPTY : c_int = 66;
3645 pub const EPROCLIM : c_int = 67;
3646 pub const EUSERS : c_int = 68;
3647 pub const EDQUOT : c_int = 69;
3648 pub const ESTALE : c_int = 70;
3649 pub const EREMOTE : c_int = 71;
3650 pub const EBADRPC : c_int = 72;
3651 pub const ERPCMISMATCH : c_int = 73;
3652 pub const EPROGUNAVAIL : c_int = 74;
3653 pub const EPROGMISMATCH : c_int = 75;
3654 pub const EPROCUNAVAIL : c_int = 76;
3655 pub const ENOLCK : c_int = 77;
3656 pub const ENOSYS : c_int = 78;
3657 pub const EFTYPE : c_int = 79;
3658 pub const EAUTH : c_int = 80;
3659 pub const ENEEDAUTH : c_int = 81;
3660 pub const EIDRM : c_int = 82;
3661 pub const ENOMSG : c_int = 83;
3662 pub const EOVERFLOW : c_int = 84;
3663 pub const ECANCELED : c_int = 85;
3664 pub const EILSEQ : c_int = 86;
3665 pub const ENOATTR : c_int = 87;
3666 pub const EDOOFUS : c_int = 88;
3667 pub const EBADMSG : c_int = 89;
3668 pub const EMULTIHOP : c_int = 90;
3669 pub const ENOLINK : c_int = 91;
3670 pub const EPROTO : c_int = 92;
3671 pub const ENOMEDIUM : c_int = 93;
3672 pub const EUNUSED94 : c_int = 94;
3673 pub const EUNUSED95 : c_int = 95;
3674 pub const EUNUSED96 : c_int = 96;
3675 pub const EUNUSED97 : c_int = 97;
3676 pub const EUNUSED98 : c_int = 98;
3677 pub const EASYNC : c_int = 99;
3678 pub const ELAST : c_int = 99;
3681 use types::os::arch::c95::{c_int, size_t};
3683 pub const F_DUPFD : c_int = 0;
3684 pub const F_GETFD : c_int = 1;
3685 pub const F_SETFD : c_int = 2;
3686 pub const F_GETFL : c_int = 3;
3687 pub const F_SETFL : c_int = 4;
3689 pub const SIGTRAP : c_int = 5;
3690 pub const SIGPIPE: c_int = 13;
3691 pub const SIG_IGN: size_t = 1;
3693 pub const GLOB_APPEND : c_int = 0x0001;
3694 pub const GLOB_DOOFFS : c_int = 0x0002;
3695 pub const GLOB_ERR : c_int = 0x0004;
3696 pub const GLOB_MARK : c_int = 0x0008;
3697 pub const GLOB_NOCHECK : c_int = 0x0010;
3698 pub const GLOB_NOSORT : c_int = 0x0020;
3699 pub const GLOB_NOESCAPE : c_int = 0x2000;
3701 pub const GLOB_NOSPACE : c_int = -1;
3702 pub const GLOB_ABORTED : c_int = -2;
3703 pub const GLOB_NOMATCH : c_int = -3;
3705 pub const POSIX_MADV_NORMAL : c_int = 0;
3706 pub const POSIX_MADV_RANDOM : c_int = 1;
3707 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3708 pub const POSIX_MADV_WILLNEED : c_int = 3;
3709 pub const POSIX_MADV_DONTNEED : c_int = 4;
3711 pub const _SC_IOV_MAX : c_int = 56;
3712 pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
3713 pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
3714 pub const _SC_LOGIN_NAME_MAX : c_int = 73;
3715 pub const _SC_MQ_PRIO_MAX : c_int = 75;
3716 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
3717 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
3718 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
3719 pub const _SC_THREAD_KEYS_MAX : c_int = 86;
3720 pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
3721 pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
3722 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
3723 pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
3724 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
3725 pub const _SC_THREAD_STACK_MIN : c_int = 93;
3726 pub const _SC_THREAD_THREADS_MAX : c_int = 94;
3727 pub const _SC_THREADS : c_int = 96;
3728 pub const _SC_TTY_NAME_MAX : c_int = 101;
3729 pub const _SC_ATEXIT_MAX : c_int = 107;
3730 pub const _SC_XOPEN_CRYPT : c_int = 108;
3731 pub const _SC_XOPEN_ENH_I18N : c_int = 109;
3732 pub const _SC_XOPEN_LEGACY : c_int = 110;
3733 pub const _SC_XOPEN_REALTIME : c_int = 111;
3734 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
3735 pub const _SC_XOPEN_SHM : c_int = 113;
3736 pub const _SC_XOPEN_UNIX : c_int = 115;
3737 pub const _SC_XOPEN_VERSION : c_int = 116;
3738 pub const _SC_XOPEN_XCU_VERSION : c_int = 117;
3740 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
3741 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
3743 #[cfg(target_arch = "arm")]
3744 pub const PTHREAD_STACK_MIN: size_t = 4096;
3746 #[cfg(all(target_os = "freebsd",
3747 any(target_arch = "mips",
3748 target_arch = "mipsel",
3749 target_arch = "x86",
3750 target_arch = "x86_64")))]
3751 pub const PTHREAD_STACK_MIN: size_t = 2048;
3753 #[cfg(target_os = "dragonfly")]
3754 pub const PTHREAD_STACK_MIN: size_t = 1024;
3756 pub const CLOCK_REALTIME: c_int = 0;
3757 pub const CLOCK_MONOTONIC: c_int = 4;
3762 use types::os::arch::c95::c_int;
3764 pub const MADV_NORMAL : c_int = 0;
3765 pub const MADV_RANDOM : c_int = 1;
3766 pub const MADV_SEQUENTIAL : c_int = 2;
3767 pub const MADV_WILLNEED : c_int = 3;
3768 pub const MADV_DONTNEED : c_int = 4;
3769 pub const MADV_FREE : c_int = 5;
3770 pub const MADV_NOSYNC : c_int = 6;
3771 pub const MADV_AUTOSYNC : c_int = 7;
3772 pub const MADV_NOCORE : c_int = 8;
3773 pub const MADV_CORE : c_int = 9;
3774 pub const MADV_PROTECT : c_int = 10;
3776 pub const MINCORE_INCORE : c_int = 0x1;
3777 pub const MINCORE_REFERENCED : c_int = 0x2;
3778 pub const MINCORE_MODIFIED : c_int = 0x4;
3779 pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
3780 pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
3781 pub const MINCORE_SUPER : c_int = 0x20;
3783 pub const AF_INET: c_int = 2;
3784 pub const AF_INET6: c_int = 28;
3785 pub const AF_UNIX: c_int = 1;
3786 pub const SOCK_STREAM: c_int = 1;
3787 pub const SOCK_DGRAM: c_int = 2;
3788 pub const SOCK_RAW: c_int = 3;
3789 pub const IPPROTO_TCP: c_int = 6;
3790 pub const IPPROTO_IP: c_int = 0;
3791 pub const IPPROTO_IPV6: c_int = 41;
3792 pub const IP_MULTICAST_TTL: c_int = 10;
3793 pub const IP_MULTICAST_LOOP: c_int = 11;
3794 pub const IP_TTL: c_int = 4;
3795 pub const IP_HDRINCL: c_int = 2;
3796 pub const IP_ADD_MEMBERSHIP: c_int = 12;
3797 pub const IP_DROP_MEMBERSHIP: c_int = 13;
3798 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
3799 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
3801 pub const TCP_NODELAY: c_int = 1;
3802 pub const TCP_KEEPIDLE: c_int = 256;
3803 pub const SOL_SOCKET: c_int = 0xffff;
3804 pub const SO_KEEPALIVE: c_int = 0x0008;
3805 pub const SO_BROADCAST: c_int = 0x0020;
3806 pub const SO_REUSEADDR: c_int = 0x0004;
3807 pub const SO_ERROR: c_int = 0x1007;
3809 pub const IFF_LOOPBACK: c_int = 0x8;
3811 pub const SHUT_RD: c_int = 0;
3812 pub const SHUT_WR: c_int = 1;
3813 pub const SHUT_RDWR: c_int = 2;
3816 use types::os::arch::c95::c_int;
3818 pub const O_SYNC : c_int = 128;
3819 pub const O_NONBLOCK : c_int = 4;
3820 pub const CTL_KERN: c_int = 1;
3821 pub const KERN_PROC: c_int = 14;
3822 #[cfg(target_os = "freebsd")]
3823 pub const KERN_PROC_PATHNAME: c_int = 12;
3824 #[cfg(target_os = "dragonfly")]
3825 pub const KERN_PROC_PATHNAME: c_int = 9;
3827 pub const MAP_COPY : c_int = 0x0002;
3828 pub const MAP_RENAME : c_int = 0x0020;
3829 pub const MAP_NORESERVE : c_int = 0x0040;
3830 pub const MAP_HASSEMAPHORE : c_int = 0x0200;
3831 pub const MAP_STACK : c_int = 0x0400;
3832 pub const MAP_NOSYNC : c_int = 0x0800;
3833 pub const MAP_NOCORE : c_int = 0x020000;
3835 pub const IPPROTO_RAW : c_int = 255;
3838 use types::os::arch::c95::c_int;
3840 pub const _SC_ARG_MAX : c_int = 1;
3841 pub const _SC_CHILD_MAX : c_int = 2;
3842 pub const _SC_CLK_TCK : c_int = 3;
3843 pub const _SC_NGROUPS_MAX : c_int = 4;
3844 pub const _SC_OPEN_MAX : c_int = 5;
3845 pub const _SC_JOB_CONTROL : c_int = 6;
3846 pub const _SC_SAVED_IDS : c_int = 7;
3847 pub const _SC_VERSION : c_int = 8;
3848 pub const _SC_BC_BASE_MAX : c_int = 9;
3849 pub const _SC_BC_DIM_MAX : c_int = 10;
3850 pub const _SC_BC_SCALE_MAX : c_int = 11;
3851 pub const _SC_BC_STRING_MAX : c_int = 12;
3852 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
3853 pub const _SC_EXPR_NEST_MAX : c_int = 14;
3854 pub const _SC_LINE_MAX : c_int = 15;
3855 pub const _SC_RE_DUP_MAX : c_int = 16;
3856 pub const _SC_2_VERSION : c_int = 17;
3857 pub const _SC_2_C_BIND : c_int = 18;
3858 pub const _SC_2_C_DEV : c_int = 19;
3859 pub const _SC_2_CHAR_TERM : c_int = 20;
3860 pub const _SC_2_FORT_DEV : c_int = 21;
3861 pub const _SC_2_FORT_RUN : c_int = 22;
3862 pub const _SC_2_LOCALEDEF : c_int = 23;
3863 pub const _SC_2_SW_DEV : c_int = 24;
3864 pub const _SC_2_UPE : c_int = 25;
3865 pub const _SC_STREAM_MAX : c_int = 26;
3866 pub const _SC_TZNAME_MAX : c_int = 27;
3867 pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
3868 pub const _SC_MAPPED_FILES : c_int = 29;
3869 pub const _SC_MEMLOCK : c_int = 30;
3870 pub const _SC_MEMLOCK_RANGE : c_int = 31;
3871 pub const _SC_MEMORY_PROTECTION : c_int = 32;
3872 pub const _SC_MESSAGE_PASSING : c_int = 33;
3873 pub const _SC_PRIORITIZED_IO : c_int = 34;
3874 pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
3875 pub const _SC_REALTIME_SIGNALS : c_int = 36;
3876 pub const _SC_SEMAPHORES : c_int = 37;
3877 pub const _SC_FSYNC : c_int = 38;
3878 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
3879 pub const _SC_SYNCHRONIZED_IO : c_int = 40;
3880 pub const _SC_TIMERS : c_int = 41;
3881 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
3882 pub const _SC_AIO_MAX : c_int = 43;
3883 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
3884 pub const _SC_DELAYTIMER_MAX : c_int = 45;
3885 pub const _SC_MQ_OPEN_MAX : c_int = 46;
3886 pub const _SC_PAGESIZE : c_int = 47;
3887 pub const _SC_RTSIG_MAX : c_int = 48;
3888 pub const _SC_SEM_NSEMS_MAX : c_int = 49;
3889 pub const _SC_SEM_VALUE_MAX : c_int = 50;
3890 pub const _SC_SIGQUEUE_MAX : c_int = 51;
3891 pub const _SC_TIMER_MAX : c_int = 52;
3895 #[cfg(target_os = "openbsd")]
3898 use types::os::arch::c95::{c_int, c_uint};
3900 pub const EXIT_FAILURE : c_int = 1;
3901 pub const EXIT_SUCCESS : c_int = 0;
3902 pub const RAND_MAX : c_int = 2147483647;
3903 pub const EOF : c_int = -1;
3904 pub const SEEK_SET : c_int = 0;
3905 pub const SEEK_CUR : c_int = 1;
3906 pub const SEEK_END : c_int = 2;
3907 pub const _IOFBF : c_int = 0;
3908 pub const _IONBF : c_int = 2;
3909 pub const _IOLBF : c_int = 1;
3910 pub const BUFSIZ : c_uint = 1024_u32;
3911 pub const FOPEN_MAX : c_uint = 20_u32;
3912 pub const FILENAME_MAX : c_uint = 1024_u32;
3913 pub const L_tmpnam : c_uint = 1024_u32;
3914 pub const TMP_MAX : c_uint = 308915776_u32;
3919 use types::common::c95::c_void;
3920 use types::os::arch::c95::c_int;
3921 use types::os::arch::posix88::mode_t;
3923 pub const O_RDONLY : c_int = 0;
3924 pub const O_WRONLY : c_int = 1;
3925 pub const O_RDWR : c_int = 2;
3926 pub const O_APPEND : c_int = 8;
3927 pub const O_CREAT : c_int = 512;
3928 pub const O_EXCL : c_int = 2048;
3929 pub const O_TRUNC : c_int = 1024;
3930 pub const S_IFIFO : mode_t = 4096;
3931 pub const S_IFCHR : mode_t = 8192;
3932 pub const S_IFBLK : mode_t = 24576;
3933 pub const S_IFDIR : mode_t = 16384;
3934 pub const S_IFREG : mode_t = 32768;
3935 pub const S_IFLNK : mode_t = 40960;
3936 pub const S_IFMT : mode_t = 61440;
3937 pub const S_IEXEC : mode_t = 64;
3938 pub const S_IWRITE : mode_t = 128;
3939 pub const S_IREAD : mode_t = 256;
3940 pub const S_IRWXU : mode_t = 448;
3941 pub const S_IXUSR : mode_t = 64;
3942 pub const S_IWUSR : mode_t = 128;
3943 pub const S_IRUSR : mode_t = 256;
3944 pub const F_OK : c_int = 0;
3945 pub const R_OK : c_int = 4;
3946 pub const W_OK : c_int = 2;
3947 pub const X_OK : c_int = 1;
3948 pub const STDIN_FILENO : c_int = 0;
3949 pub const STDOUT_FILENO : c_int = 1;
3950 pub const STDERR_FILENO : c_int = 2;
3951 pub const F_LOCK : c_int = 1;
3952 pub const F_TEST : c_int = 3;
3953 pub const F_TLOCK : c_int = 2;
3954 pub const F_ULOCK : c_int = 0;
3955 pub const SIGHUP : c_int = 1;
3956 pub const SIGINT : c_int = 2;
3957 pub const SIGQUIT : c_int = 3;
3958 pub const SIGILL : c_int = 4;
3959 pub const SIGABRT : c_int = 6;
3960 pub const SIGFPE : c_int = 8;
3961 pub const SIGKILL : c_int = 9;
3962 pub const SIGSEGV : c_int = 11;
3963 pub const SIGPIPE : c_int = 13;
3964 pub const SIGALRM : c_int = 14;
3965 pub const SIGTERM : c_int = 15;
3967 pub const PROT_NONE : c_int = 0;
3968 pub const PROT_READ : c_int = 1;
3969 pub const PROT_WRITE : c_int = 2;
3970 pub const PROT_EXEC : c_int = 4;
3972 pub const MAP_FILE : c_int = 0x0000;
3973 pub const MAP_SHARED : c_int = 0x0001;
3974 pub const MAP_PRIVATE : c_int = 0x0002;
3975 pub const MAP_FIXED : c_int = 0x0010;
3976 pub const MAP_ANON : c_int = 0x1000;
3978 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
3980 pub const MCL_CURRENT : c_int = 0x0001;
3981 pub const MCL_FUTURE : c_int = 0x0002;
3983 pub const MS_SYNC : c_int = 0x0002; // changed
3984 pub const MS_ASYNC : c_int = 0x0001;
3985 pub const MS_INVALIDATE : c_int = 0x0004; // changed
3987 pub const EPERM : c_int = 1; // not checked
3988 pub const ENOENT : c_int = 2;
3989 pub const ESRCH : c_int = 3;
3990 pub const EINTR : c_int = 4;
3991 pub const EIO : c_int = 5;
3992 pub const ENXIO : c_int = 6;
3993 pub const E2BIG : c_int = 7;
3994 pub const ENOEXEC : c_int = 8;
3995 pub const EBADF : c_int = 9;
3996 pub const ECHILD : c_int = 10;
3997 pub const EDEADLK : c_int = 11;
3998 pub const ENOMEM : c_int = 12;
3999 pub const EACCES : c_int = 13;
4000 pub const EFAULT : c_int = 14;
4001 pub const ENOTBLK : c_int = 15;
4002 pub const EBUSY : c_int = 16;
4003 pub const EEXIST : c_int = 17;
4004 pub const EXDEV : c_int = 18;
4005 pub const ENODEV : c_int = 19;
4006 pub const ENOTDIR : c_int = 20;
4007 pub const EISDIR : c_int = 21;
4008 pub const EINVAL : c_int = 22;
4009 pub const ENFILE : c_int = 23;
4010 pub const EMFILE : c_int = 24;
4011 pub const ENOTTY : c_int = 25;
4012 pub const ETXTBSY : c_int = 26;
4013 pub const EFBIG : c_int = 27;
4014 pub const ENOSPC : c_int = 28;
4015 pub const ESPIPE : c_int = 29;
4016 pub const EROFS : c_int = 30;
4017 pub const EMLINK : c_int = 31;
4018 pub const EPIPE : c_int = 32;
4019 pub const EDOM : c_int = 33;
4020 pub const ERANGE : c_int = 34;
4021 pub const EAGAIN : c_int = 35;
4022 pub const EWOULDBLOCK : c_int = 35;
4023 pub const EINPROGRESS : c_int = 36;
4024 pub const EALREADY : c_int = 37;
4025 pub const ENOTSOCK : c_int = 38;
4026 pub const EDESTADDRREQ : c_int = 39;
4027 pub const EMSGSIZE : c_int = 40;
4028 pub const EPROTOTYPE : c_int = 41;
4029 pub const ENOPROTOOPT : c_int = 42;
4030 pub const EPROTONOSUPPORT : c_int = 43;
4031 pub const ESOCKTNOSUPPORT : c_int = 44;
4032 pub const EOPNOTSUPP : c_int = 45;
4033 pub const EPFNOSUPPORT : c_int = 46;
4034 pub const EAFNOSUPPORT : c_int = 47;
4035 pub const EADDRINUSE : c_int = 48;
4036 pub const EADDRNOTAVAIL : c_int = 49;
4037 pub const ENETDOWN : c_int = 50;
4038 pub const ENETUNREACH : c_int = 51;
4039 pub const ENETRESET : c_int = 52;
4040 pub const ECONNABORTED : c_int = 53;
4041 pub const ECONNRESET : c_int = 54;
4042 pub const ENOBUFS : c_int = 55;
4043 pub const EISCONN : c_int = 56;
4044 pub const ENOTCONN : c_int = 57;
4045 pub const ESHUTDOWN : c_int = 58;
4046 pub const ETOOMANYREFS : c_int = 59;
4047 pub const ETIMEDOUT : c_int = 60;
4048 pub const ECONNREFUSED : c_int = 61;
4049 pub const ELOOP : c_int = 62;
4050 pub const ENAMETOOLONG : c_int = 63;
4051 pub const EHOSTDOWN : c_int = 64;
4052 pub const EHOSTUNREACH : c_int = 65;
4053 pub const ENOTEMPTY : c_int = 66;
4054 pub const EPROCLIM : c_int = 67;
4055 pub const EUSERS : c_int = 68;
4056 pub const EDQUOT : c_int = 69;
4057 pub const ESTALE : c_int = 70;
4058 pub const EREMOTE : c_int = 71;
4059 pub const EBADRPC : c_int = 72;
4060 pub const ERPCMISMATCH : c_int = 73;
4061 pub const EPROGUNAVAIL : c_int = 74;
4062 pub const EPROGMISMATCH : c_int = 75;
4063 pub const EPROCUNAVAIL : c_int = 76;
4064 pub const ENOLCK : c_int = 77;
4065 pub const ENOSYS : c_int = 78;
4066 pub const EFTYPE : c_int = 79;
4067 pub const EAUTH : c_int = 80;
4068 pub const ENEEDAUTH : c_int = 81;
4069 pub const EIDRM : c_int = 82;
4070 pub const ENOMSG : c_int = 83;
4071 pub const EOVERFLOW : c_int = 84;
4072 pub const ECANCELED : c_int = 85;
4073 pub const EILSEQ : c_int = 86;
4074 pub const ENOATTR : c_int = 87;
4075 pub const EDOOFUS : c_int = 88;
4076 pub const EBADMSG : c_int = 89;
4077 pub const EMULTIHOP : c_int = 90;
4078 pub const ENOLINK : c_int = 91;
4079 pub const EPROTO : c_int = 92;
4080 pub const ENOMEDIUM : c_int = 93;
4081 pub const EUNUSED94 : c_int = 94;
4082 pub const EUNUSED95 : c_int = 95;
4083 pub const EUNUSED96 : c_int = 96;
4084 pub const EUNUSED97 : c_int = 97;
4085 pub const EUNUSED98 : c_int = 98;
4086 pub const EASYNC : c_int = 99;
4087 pub const ELAST : c_int = 99;
4090 use types::os::arch::c95::{c_int, size_t};
4092 pub const F_DUPFD : c_int = 0;
4093 pub const F_GETFD : c_int = 1;
4094 pub const F_SETFD : c_int = 2;
4095 pub const F_GETFL : c_int = 3;
4096 pub const F_SETFL : c_int = 4;
4098 pub const SIGTRAP : c_int = 5;
4099 pub const SIGPIPE: c_int = 13;
4100 pub const SIG_IGN: size_t = 1;
4102 pub const GLOB_APPEND : c_int = 0x0001;
4103 pub const GLOB_DOOFFS : c_int = 0x0002;
4104 pub const GLOB_ERR : c_int = 0x0004;
4105 pub const GLOB_MARK : c_int = 0x0008;
4106 pub const GLOB_NOCHECK : c_int = 0x0010;
4107 pub const GLOB_NOSORT : c_int = 0x0020;
4108 pub const GLOB_NOESCAPE : c_int = 0x1000; // changed
4110 pub const GLOB_NOSPACE : c_int = -1;
4111 pub const GLOB_ABORTED : c_int = -2;
4112 pub const GLOB_NOMATCH : c_int = -3;
4114 pub const POSIX_MADV_NORMAL : c_int = 0;
4115 pub const POSIX_MADV_RANDOM : c_int = 1;
4116 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
4117 pub const POSIX_MADV_WILLNEED : c_int = 3;
4118 pub const POSIX_MADV_DONTNEED : c_int = 4;
4120 pub const _SC_IOV_MAX : c_int = 51; // all changed...
4121 pub const _SC_GETGR_R_SIZE_MAX : c_int = 100;
4122 pub const _SC_GETPW_R_SIZE_MAX : c_int = 101;
4123 pub const _SC_LOGIN_NAME_MAX : c_int = 102;
4124 pub const _SC_MQ_PRIO_MAX : c_int = 59;
4125 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
4126 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
4127 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 80;
4128 pub const _SC_THREAD_KEYS_MAX : c_int = 81;
4129 pub const _SC_THREAD_PRIO_INHERIT : c_int = 82;
4130 pub const _SC_THREAD_PRIO_PROTECT : c_int = 83;
4131 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 84;
4132 pub const _SC_THREAD_PROCESS_SHARED : c_int = 85;
4133 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 103;
4134 pub const _SC_THREAD_STACK_MIN : c_int = 89;
4135 pub const _SC_THREAD_THREADS_MAX : c_int = 90;
4136 pub const _SC_THREADS : c_int = 91;
4137 pub const _SC_TTY_NAME_MAX : c_int = 107;
4138 pub const _SC_ATEXIT_MAX : c_int = 46;
4139 pub const _SC_XOPEN_CRYPT : c_int = 117;
4140 pub const _SC_XOPEN_ENH_I18N : c_int = 118;
4141 pub const _SC_XOPEN_LEGACY : c_int = 119;
4142 pub const _SC_XOPEN_REALTIME : c_int = 120;
4143 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 121;
4144 pub const _SC_XOPEN_SHM : c_int = 30;
4145 pub const _SC_XOPEN_UNIX : c_int = 123;
4146 pub const _SC_XOPEN_VERSION : c_int = 125;
4147 //pub const _SC_XOPEN_XCU_VERSION : c_int = ;
4149 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
4150 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
4151 pub const PTHREAD_STACK_MIN: size_t = 2048;
4153 pub const CLOCK_REALTIME: c_int = 0;
4154 pub const CLOCK_MONOTONIC: c_int = 3;
4159 use types::os::arch::c95::c_int;
4161 pub const MADV_NORMAL : c_int = 0;
4162 pub const MADV_RANDOM : c_int = 1;
4163 pub const MADV_SEQUENTIAL : c_int = 2;
4164 pub const MADV_WILLNEED : c_int = 3;
4165 pub const MADV_DONTNEED : c_int = 4;
4166 pub const MADV_FREE : c_int = 6; // changed
4167 //pub const MADV_NOSYNC : c_int = ;
4168 //pub const MADV_AUTOSYNC : c_int = ;
4169 //pub const MADV_NOCORE : c_int = ;
4170 //pub const MADV_CORE : c_int = ;
4171 //pub const MADV_PROTECT : c_int = ;
4173 //pub const MINCORE_INCORE : c_int = ;
4174 //pub const MINCORE_REFERENCED : c_int = ;
4175 //pub const MINCORE_MODIFIED : c_int = ;
4176 //pub const MINCORE_REFERENCED_OTHER : c_int = ;
4177 //pub const MINCORE_MODIFIED_OTHER : c_int = ;
4178 //pub const MINCORE_SUPER : c_int = ;
4180 pub const AF_INET: c_int = 2;
4181 pub const AF_INET6: c_int = 24; // changed
4182 pub const AF_UNIX: c_int = 1;
4183 pub const SOCK_STREAM: c_int = 1;
4184 pub const SOCK_DGRAM: c_int = 2;
4185 pub const SOCK_RAW: c_int = 3;
4186 pub const IPPROTO_TCP: c_int = 6;
4187 pub const IPPROTO_IP: c_int = 0;
4188 pub const IPPROTO_IPV6: c_int = 41;
4189 pub const IP_MULTICAST_TTL: c_int = 10;
4190 pub const IP_MULTICAST_LOOP: c_int = 11;
4191 pub const IP_TTL: c_int = 4;
4192 pub const IP_HDRINCL: c_int = 2;
4193 pub const IP_ADD_MEMBERSHIP: c_int = 12;
4194 pub const IP_DROP_MEMBERSHIP: c_int = 13;
4195 // don't exist, keep same as IP_ADD_MEMBERSHIP
4196 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
4197 // don't exist, keep same as IP_DROP_MEMBERSHIP
4198 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
4200 pub const TCP_NODELAY: c_int = 1;
4201 //pub const TCP_KEEPIDLE: c_int = ;
4202 pub const SOL_SOCKET: c_int = 0xffff;
4203 pub const SO_KEEPALIVE: c_int = 0x0008;
4204 pub const SO_BROADCAST: c_int = 0x0020;
4205 pub const SO_REUSEADDR: c_int = 0x0004;
4206 pub const SO_ERROR: c_int = 0x1007;
4208 pub const IFF_LOOPBACK: c_int = 0x8;
4210 pub const SHUT_RD: c_int = 0;
4211 pub const SHUT_WR: c_int = 1;
4212 pub const SHUT_RDWR: c_int = 2;
4215 use types::os::arch::c95::c_int;
4217 pub const O_SYNC : c_int = 128;
4218 pub const O_NONBLOCK : c_int = 4;
4219 pub const CTL_KERN: c_int = 1;
4220 pub const KERN_PROC: c_int = 66;
4222 pub const MAP_COPY : c_int = 0x0002;
4223 pub const MAP_RENAME : c_int = 0x0000; // changed
4224 pub const MAP_NORESERVE : c_int = 0x0000; // changed
4225 pub const MAP_HASSEMAPHORE : c_int = 0x0000; // changed
4226 //pub const MAP_STACK : c_int = ;
4227 //pub const MAP_NOSYNC : c_int = ;
4228 //pub const MAP_NOCORE : c_int = ;
4230 pub const IPPROTO_RAW : c_int = 255;
4233 use types::os::arch::c95::c_int;
4235 pub const _SC_ARG_MAX : c_int = 1;
4236 pub const _SC_CHILD_MAX : c_int = 2;
4237 pub const _SC_CLK_TCK : c_int = 3;
4238 pub const _SC_NGROUPS_MAX : c_int = 4;
4239 pub const _SC_OPEN_MAX : c_int = 5;
4240 pub const _SC_JOB_CONTROL : c_int = 6;
4241 pub const _SC_SAVED_IDS : c_int = 7;
4242 pub const _SC_VERSION : c_int = 8;
4243 pub const _SC_BC_BASE_MAX : c_int = 9;
4244 pub const _SC_BC_DIM_MAX : c_int = 10;
4245 pub const _SC_BC_SCALE_MAX : c_int = 11;
4246 pub const _SC_BC_STRING_MAX : c_int = 12;
4247 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
4248 pub const _SC_EXPR_NEST_MAX : c_int = 14;
4249 pub const _SC_LINE_MAX : c_int = 15;
4250 pub const _SC_RE_DUP_MAX : c_int = 16;
4251 pub const _SC_2_VERSION : c_int = 17;
4252 pub const _SC_2_C_BIND : c_int = 18;
4253 pub const _SC_2_C_DEV : c_int = 19;
4254 pub const _SC_2_CHAR_TERM : c_int = 20;
4255 pub const _SC_2_FORT_DEV : c_int = 21;
4256 pub const _SC_2_FORT_RUN : c_int = 22;
4257 pub const _SC_2_LOCALEDEF : c_int = 23;
4258 pub const _SC_2_SW_DEV : c_int = 24;
4259 pub const _SC_2_UPE : c_int = 25;
4260 pub const _SC_STREAM_MAX : c_int = 26;
4261 pub const _SC_TZNAME_MAX : c_int = 27;
4262 pub const _SC_ASYNCHRONOUS_IO : c_int = 45; // changed...
4263 pub const _SC_MAPPED_FILES : c_int = 53;
4264 pub const _SC_MEMLOCK : c_int = 54;
4265 pub const _SC_MEMLOCK_RANGE : c_int = 55;
4266 pub const _SC_MEMORY_PROTECTION : c_int = 56;
4267 pub const _SC_MESSAGE_PASSING : c_int = 57;
4268 pub const _SC_PRIORITIZED_IO : c_int = 60;
4269 pub const _SC_PRIORITY_SCHEDULING : c_int = 61;
4270 pub const _SC_REALTIME_SIGNALS : c_int = 64;
4271 pub const _SC_SEMAPHORES : c_int = 67;
4272 pub const _SC_FSYNC : c_int = 29;
4273 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 68;
4274 pub const _SC_SYNCHRONIZED_IO : c_int = 75;
4275 pub const _SC_TIMERS : c_int = 94; // ...changed
4276 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
4277 pub const _SC_AIO_MAX : c_int = 43;
4278 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
4279 pub const _SC_DELAYTIMER_MAX : c_int = 50; // changed...
4280 pub const _SC_MQ_OPEN_MAX : c_int = 58;
4281 pub const _SC_PAGESIZE : c_int = 28;
4282 pub const _SC_RTSIG_MAX : c_int = 66;
4283 pub const _SC_SEM_NSEMS_MAX : c_int = 31;
4284 pub const _SC_SEM_VALUE_MAX : c_int = 32;
4285 pub const _SC_SIGQUEUE_MAX : c_int = 70;
4286 pub const _SC_TIMER_MAX : c_int = 93;
4290 #[cfg(any(target_os = "macos", target_os = "ios"))]
4293 use types::os::arch::c95::{c_int, c_uint};
4295 pub const EXIT_FAILURE : c_int = 1;
4296 pub const EXIT_SUCCESS : c_int = 0;
4297 pub const RAND_MAX : c_int = 2147483647;
4298 pub const EOF : c_int = -1;
4299 pub const SEEK_SET : c_int = 0;
4300 pub const SEEK_CUR : c_int = 1;
4301 pub const SEEK_END : c_int = 2;
4302 pub const _IOFBF : c_int = 0;
4303 pub const _IONBF : c_int = 2;
4304 pub const _IOLBF : c_int = 1;
4305 pub const BUFSIZ : c_uint = 1024_u32;
4306 pub const FOPEN_MAX : c_uint = 20_u32;
4307 pub const FILENAME_MAX : c_uint = 1024_u32;
4308 pub const L_tmpnam : c_uint = 1024_u32;
4309 pub const TMP_MAX : c_uint = 308915776_u32;
4314 use types::common::c95::c_void;
4315 use types::os::arch::c95::c_int;
4316 use types::os::arch::posix88::mode_t;
4318 pub const O_RDONLY : c_int = 0;
4319 pub const O_WRONLY : c_int = 1;
4320 pub const O_RDWR : c_int = 2;
4321 pub const O_APPEND : c_int = 8;
4322 pub const O_CREAT : c_int = 512;
4323 pub const O_EXCL : c_int = 2048;
4324 pub const O_TRUNC : c_int = 1024;
4325 pub const S_IFIFO : mode_t = 4096;
4326 pub const S_IFCHR : mode_t = 8192;
4327 pub const S_IFBLK : mode_t = 24576;
4328 pub const S_IFDIR : mode_t = 16384;
4329 pub const S_IFREG : mode_t = 32768;
4330 pub const S_IFLNK : mode_t = 40960;
4331 pub const S_IFMT : mode_t = 61440;
4332 pub const S_IEXEC : mode_t = 64;
4333 pub const S_IWRITE : mode_t = 128;
4334 pub const S_IREAD : mode_t = 256;
4335 pub const S_IRWXU : mode_t = 448;
4336 pub const S_IXUSR : mode_t = 64;
4337 pub const S_IWUSR : mode_t = 128;
4338 pub const S_IRUSR : mode_t = 256;
4339 pub const F_OK : c_int = 0;
4340 pub const R_OK : c_int = 4;
4341 pub const W_OK : c_int = 2;
4342 pub const X_OK : c_int = 1;
4343 pub const STDIN_FILENO : c_int = 0;
4344 pub const STDOUT_FILENO : c_int = 1;
4345 pub const STDERR_FILENO : c_int = 2;
4346 pub const F_LOCK : c_int = 1;
4347 pub const F_TEST : c_int = 3;
4348 pub const F_TLOCK : c_int = 2;
4349 pub const F_ULOCK : c_int = 0;
4350 pub const SIGHUP : c_int = 1;
4351 pub const SIGINT : c_int = 2;
4352 pub const SIGQUIT : c_int = 3;
4353 pub const SIGILL : c_int = 4;
4354 pub const SIGABRT : c_int = 6;
4355 pub const SIGFPE : c_int = 8;
4356 pub const SIGKILL : c_int = 9;
4357 pub const SIGSEGV : c_int = 11;
4358 pub const SIGPIPE : c_int = 13;
4359 pub const SIGALRM : c_int = 14;
4360 pub const SIGTERM : c_int = 15;
4362 pub const PROT_NONE : c_int = 0;
4363 pub const PROT_READ : c_int = 1;
4364 pub const PROT_WRITE : c_int = 2;
4365 pub const PROT_EXEC : c_int = 4;
4367 pub const MAP_FILE : c_int = 0x0000;
4368 pub const MAP_SHARED : c_int = 0x0001;
4369 pub const MAP_PRIVATE : c_int = 0x0002;
4370 pub const MAP_FIXED : c_int = 0x0010;
4371 pub const MAP_ANON : c_int = 0x1000;
4373 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
4375 pub const MCL_CURRENT : c_int = 0x0001;
4376 pub const MCL_FUTURE : c_int = 0x0002;
4378 pub const MS_ASYNC : c_int = 0x0001;
4379 pub const MS_INVALIDATE : c_int = 0x0002;
4380 pub const MS_SYNC : c_int = 0x0010;
4382 pub const MS_KILLPAGES : c_int = 0x0004;
4383 pub const MS_DEACTIVATE : c_int = 0x0008;
4385 pub const EPERM : c_int = 1;
4386 pub const ENOENT : c_int = 2;
4387 pub const ESRCH : c_int = 3;
4388 pub const EINTR : c_int = 4;
4389 pub const EIO : c_int = 5;
4390 pub const ENXIO : c_int = 6;
4391 pub const E2BIG : c_int = 7;
4392 pub const ENOEXEC : c_int = 8;
4393 pub const EBADF : c_int = 9;
4394 pub const ECHILD : c_int = 10;
4395 pub const EDEADLK : c_int = 11;
4396 pub const ENOMEM : c_int = 12;
4397 pub const EACCES : c_int = 13;
4398 pub const EFAULT : c_int = 14;
4399 pub const ENOTBLK : c_int = 15;
4400 pub const EBUSY : c_int = 16;
4401 pub const EEXIST : c_int = 17;
4402 pub const EXDEV : c_int = 18;
4403 pub const ENODEV : c_int = 19;
4404 pub const ENOTDIR : c_int = 20;
4405 pub const EISDIR : c_int = 21;
4406 pub const EINVAL : c_int = 22;
4407 pub const ENFILE : c_int = 23;
4408 pub const EMFILE : c_int = 24;
4409 pub const ENOTTY : c_int = 25;
4410 pub const ETXTBSY : c_int = 26;
4411 pub const EFBIG : c_int = 27;
4412 pub const ENOSPC : c_int = 28;
4413 pub const ESPIPE : c_int = 29;
4414 pub const EROFS : c_int = 30;
4415 pub const EMLINK : c_int = 31;
4416 pub const EPIPE : c_int = 32;
4417 pub const EDOM : c_int = 33;
4418 pub const ERANGE : c_int = 34;
4419 pub const EAGAIN : c_int = 35;
4420 pub const EWOULDBLOCK : c_int = EAGAIN;
4421 pub const EINPROGRESS : c_int = 36;
4422 pub const EALREADY : c_int = 37;
4423 pub const ENOTSOCK : c_int = 38;
4424 pub const EDESTADDRREQ : c_int = 39;
4425 pub const EMSGSIZE : c_int = 40;
4426 pub const EPROTOTYPE : c_int = 41;
4427 pub const ENOPROTOOPT : c_int = 42;
4428 pub const EPROTONOSUPPORT : c_int = 43;
4429 pub const ESOCKTNOSUPPORT : c_int = 44;
4430 pub const ENOTSUP : c_int = 45;
4431 pub const EPFNOSUPPORT : c_int = 46;
4432 pub const EAFNOSUPPORT : c_int = 47;
4433 pub const EADDRINUSE : c_int = 48;
4434 pub const EADDRNOTAVAIL : c_int = 49;
4435 pub const ENETDOWN : c_int = 50;
4436 pub const ENETUNREACH : c_int = 51;
4437 pub const ENETRESET : c_int = 52;
4438 pub const ECONNABORTED : c_int = 53;
4439 pub const ECONNRESET : c_int = 54;
4440 pub const ENOBUFS : c_int = 55;
4441 pub const EISCONN : c_int = 56;
4442 pub const ENOTCONN : c_int = 57;
4443 pub const ESHUTDOWN : c_int = 58;
4444 pub const ETOOMANYREFS : c_int = 59;
4445 pub const ETIMEDOUT : c_int = 60;
4446 pub const ECONNREFUSED : c_int = 61;
4447 pub const ELOOP : c_int = 62;
4448 pub const ENAMETOOLONG : c_int = 63;
4449 pub const EHOSTDOWN : c_int = 64;
4450 pub const EHOSTUNREACH : c_int = 65;
4451 pub const ENOTEMPTY : c_int = 66;
4452 pub const EPROCLIM : c_int = 67;
4453 pub const EUSERS : c_int = 68;
4454 pub const EDQUOT : c_int = 69;
4455 pub const ESTALE : c_int = 70;
4456 pub const EREMOTE : c_int = 71;
4457 pub const EBADRPC : c_int = 72;
4458 pub const ERPCMISMATCH : c_int = 73;
4459 pub const EPROGUNAVAIL : c_int = 74;
4460 pub const EPROGMISMATCH : c_int = 75;
4461 pub const EPROCUNAVAIL : c_int = 76;
4462 pub const ENOLCK : c_int = 77;
4463 pub const ENOSYS : c_int = 78;
4464 pub const EFTYPE : c_int = 79;
4465 pub const EAUTH : c_int = 80;
4466 pub const ENEEDAUTH : c_int = 81;
4467 pub const EPWROFF : c_int = 82;
4468 pub const EDEVERR : c_int = 83;
4469 pub const EOVERFLOW : c_int = 84;
4470 pub const EBADEXEC : c_int = 85;
4471 pub const EBADARCH : c_int = 86;
4472 pub const ESHLIBVERS : c_int = 87;
4473 pub const EBADMACHO : c_int = 88;
4474 pub const ECANCELED : c_int = 89;
4475 pub const EIDRM : c_int = 90;
4476 pub const ENOMSG : c_int = 91;
4477 pub const EILSEQ : c_int = 92;
4478 pub const ENOATTR : c_int = 93;
4479 pub const EBADMSG : c_int = 94;
4480 pub const EMULTIHOP : c_int = 95;
4481 pub const ENODATA : c_int = 96;
4482 pub const ENOLINK : c_int = 97;
4483 pub const ENOSR : c_int = 98;
4484 pub const ENOSTR : c_int = 99;
4485 pub const EPROTO : c_int = 100;
4486 pub const ETIME : c_int = 101;
4487 pub const EOPNOTSUPP : c_int = 102;
4488 pub const ENOPOLICY : c_int = 103;
4489 pub const ENOTRECOVERABLE : c_int = 104;
4490 pub const EOWNERDEAD : c_int = 105;
4491 pub const EQFULL : c_int = 106;
4492 pub const ELAST : c_int = 106;
4495 use types::os::arch::c95::{c_int, size_t};
4497 pub const F_DUPFD : c_int = 0;
4498 pub const F_GETFD : c_int = 1;
4499 pub const F_SETFD : c_int = 2;
4500 pub const F_GETFL : c_int = 3;
4501 pub const F_SETFL : c_int = 4;
4503 pub const SIGTRAP : c_int = 5;
4504 pub const SIGPIPE: c_int = 13;
4505 pub const SIG_IGN: size_t = 1;
4507 pub const GLOB_APPEND : c_int = 0x0001;
4508 pub const GLOB_DOOFFS : c_int = 0x0002;
4509 pub const GLOB_ERR : c_int = 0x0004;
4510 pub const GLOB_MARK : c_int = 0x0008;
4511 pub const GLOB_NOCHECK : c_int = 0x0010;
4512 pub const GLOB_NOSORT : c_int = 0x0020;
4513 pub const GLOB_NOESCAPE : c_int = 0x2000;
4515 pub const GLOB_NOSPACE : c_int = -1;
4516 pub const GLOB_ABORTED : c_int = -2;
4517 pub const GLOB_NOMATCH : c_int = -3;
4519 pub const POSIX_MADV_NORMAL : c_int = 0;
4520 pub const POSIX_MADV_RANDOM : c_int = 1;
4521 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
4522 pub const POSIX_MADV_WILLNEED : c_int = 3;
4523 pub const POSIX_MADV_DONTNEED : c_int = 4;
4525 pub const _SC_IOV_MAX : c_int = 56;
4526 pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
4527 pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
4528 pub const _SC_LOGIN_NAME_MAX : c_int = 73;
4529 pub const _SC_MQ_PRIO_MAX : c_int = 75;
4530 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
4531 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
4532 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
4533 pub const _SC_THREAD_KEYS_MAX : c_int = 86;
4534 pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
4535 pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
4536 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
4537 pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
4538 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
4539 pub const _SC_THREAD_STACK_MIN : c_int = 93;
4540 pub const _SC_THREAD_THREADS_MAX : c_int = 94;
4541 pub const _SC_THREADS : c_int = 96;
4542 pub const _SC_TTY_NAME_MAX : c_int = 101;
4543 pub const _SC_ATEXIT_MAX : c_int = 107;
4544 pub const _SC_XOPEN_CRYPT : c_int = 108;
4545 pub const _SC_XOPEN_ENH_I18N : c_int = 109;
4546 pub const _SC_XOPEN_LEGACY : c_int = 110;
4547 pub const _SC_XOPEN_REALTIME : c_int = 111;
4548 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
4549 pub const _SC_XOPEN_SHM : c_int = 113;
4550 pub const _SC_XOPEN_UNIX : c_int = 115;
4551 pub const _SC_XOPEN_VERSION : c_int = 116;
4552 pub const _SC_XOPEN_XCU_VERSION : c_int = 121;
4554 pub const PTHREAD_CREATE_JOINABLE: c_int = 1;
4555 pub const PTHREAD_CREATE_DETACHED: c_int = 2;
4556 pub const PTHREAD_STACK_MIN: size_t = 8192;
4561 use types::os::arch::c95::c_int;
4563 pub const MADV_NORMAL : c_int = 0;
4564 pub const MADV_RANDOM : c_int = 1;
4565 pub const MADV_SEQUENTIAL : c_int = 2;
4566 pub const MADV_WILLNEED : c_int = 3;
4567 pub const MADV_DONTNEED : c_int = 4;
4568 pub const MADV_FREE : c_int = 5;
4569 pub const MADV_ZERO_WIRED_PAGES : c_int = 6;
4570 pub const MADV_FREE_REUSABLE : c_int = 7;
4571 pub const MADV_FREE_REUSE : c_int = 8;
4572 pub const MADV_CAN_REUSE : c_int = 9;
4574 pub const MINCORE_INCORE : c_int = 0x1;
4575 pub const MINCORE_REFERENCED : c_int = 0x2;
4576 pub const MINCORE_MODIFIED : c_int = 0x4;
4577 pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
4578 pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
4580 pub const AF_UNIX: c_int = 1;
4581 pub const AF_INET: c_int = 2;
4582 pub const AF_INET6: c_int = 30;
4583 pub const SOCK_STREAM: c_int = 1;
4584 pub const SOCK_DGRAM: c_int = 2;
4585 pub const SOCK_RAW: c_int = 3;
4586 pub const IPPROTO_TCP: c_int = 6;
4587 pub const IPPROTO_IP: c_int = 0;
4588 pub const IPPROTO_IPV6: c_int = 41;
4589 pub const IP_MULTICAST_TTL: c_int = 10;
4590 pub const IP_MULTICAST_LOOP: c_int = 11;
4591 pub const IP_TTL: c_int = 4;
4592 pub const IP_HDRINCL: c_int = 2;
4593 pub const IP_ADD_MEMBERSHIP: c_int = 12;
4594 pub const IP_DROP_MEMBERSHIP: c_int = 13;
4595 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
4596 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
4598 pub const TCP_NODELAY: c_int = 0x01;
4599 pub const TCP_KEEPALIVE: c_int = 0x10;
4600 pub const SOL_SOCKET: c_int = 0xffff;
4601 pub const SO_KEEPALIVE: c_int = 0x0008;
4602 pub const SO_BROADCAST: c_int = 0x0020;
4603 pub const SO_REUSEADDR: c_int = 0x0004;
4604 pub const SO_ERROR: c_int = 0x1007;
4606 pub const IFF_LOOPBACK: c_int = 0x8;
4608 pub const SHUT_RD: c_int = 0;
4609 pub const SHUT_WR: c_int = 1;
4610 pub const SHUT_RDWR: c_int = 2;
4613 use types::os::arch::c95::c_int;
4615 pub const O_DSYNC : c_int = 4194304;
4616 pub const O_SYNC : c_int = 128;
4617 pub const O_NONBLOCK : c_int = 4;
4618 pub const F_FULLFSYNC : c_int = 51;
4620 pub const MAP_COPY : c_int = 0x0002;
4621 pub const MAP_RENAME : c_int = 0x0020;
4622 pub const MAP_NORESERVE : c_int = 0x0040;
4623 pub const MAP_NOEXTEND : c_int = 0x0100;
4624 pub const MAP_HASSEMAPHORE : c_int = 0x0200;
4625 pub const MAP_NOCACHE : c_int = 0x0400;
4626 pub const MAP_JIT : c_int = 0x0800;
4627 pub const MAP_STACK : c_int = 0;
4629 pub const IPPROTO_RAW : c_int = 255;
4632 use types::os::arch::c95::c_int;
4634 pub const _SC_ARG_MAX : c_int = 1;
4635 pub const _SC_CHILD_MAX : c_int = 2;
4636 pub const _SC_CLK_TCK : c_int = 3;
4637 pub const _SC_NGROUPS_MAX : c_int = 4;
4638 pub const _SC_OPEN_MAX : c_int = 5;
4639 pub const _SC_JOB_CONTROL : c_int = 6;
4640 pub const _SC_SAVED_IDS : c_int = 7;
4641 pub const _SC_VERSION : c_int = 8;
4642 pub const _SC_BC_BASE_MAX : c_int = 9;
4643 pub const _SC_BC_DIM_MAX : c_int = 10;
4644 pub const _SC_BC_SCALE_MAX : c_int = 11;
4645 pub const _SC_BC_STRING_MAX : c_int = 12;
4646 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
4647 pub const _SC_EXPR_NEST_MAX : c_int = 14;
4648 pub const _SC_LINE_MAX : c_int = 15;
4649 pub const _SC_RE_DUP_MAX : c_int = 16;
4650 pub const _SC_2_VERSION : c_int = 17;
4651 pub const _SC_2_C_BIND : c_int = 18;
4652 pub const _SC_2_C_DEV : c_int = 19;
4653 pub const _SC_2_CHAR_TERM : c_int = 20;
4654 pub const _SC_2_FORT_DEV : c_int = 21;
4655 pub const _SC_2_FORT_RUN : c_int = 22;
4656 pub const _SC_2_LOCALEDEF : c_int = 23;
4657 pub const _SC_2_SW_DEV : c_int = 24;
4658 pub const _SC_2_UPE : c_int = 25;
4659 pub const _SC_STREAM_MAX : c_int = 26;
4660 pub const _SC_TZNAME_MAX : c_int = 27;
4661 pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
4662 pub const _SC_PAGESIZE : c_int = 29;
4663 pub const _SC_MEMLOCK : c_int = 30;
4664 pub const _SC_MEMLOCK_RANGE : c_int = 31;
4665 pub const _SC_MEMORY_PROTECTION : c_int = 32;
4666 pub const _SC_MESSAGE_PASSING : c_int = 33;
4667 pub const _SC_PRIORITIZED_IO : c_int = 34;
4668 pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
4669 pub const _SC_REALTIME_SIGNALS : c_int = 36;
4670 pub const _SC_SEMAPHORES : c_int = 37;
4671 pub const _SC_FSYNC : c_int = 38;
4672 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
4673 pub const _SC_SYNCHRONIZED_IO : c_int = 40;
4674 pub const _SC_TIMERS : c_int = 41;
4675 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
4676 pub const _SC_AIO_MAX : c_int = 43;
4677 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
4678 pub const _SC_DELAYTIMER_MAX : c_int = 45;
4679 pub const _SC_MQ_OPEN_MAX : c_int = 46;
4680 pub const _SC_MAPPED_FILES : c_int = 47;
4681 pub const _SC_RTSIG_MAX : c_int = 48;
4682 pub const _SC_SEM_NSEMS_MAX : c_int = 49;
4683 pub const _SC_SEM_VALUE_MAX : c_int = 50;
4684 pub const _SC_SIGQUEUE_MAX : c_int = 51;
4685 pub const _SC_TIMER_MAX : c_int = 52;
4686 pub const _SC_XBS5_ILP32_OFF32 : c_int = 122;
4687 pub const _SC_XBS5_ILP32_OFFBIG : c_int = 123;
4688 pub const _SC_XBS5_LP64_OFF64 : c_int = 124;
4689 pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 125;
4696 // Thankfully most of c95 is universally available and does not vary by OS
4697 // or anything. The same is not true of POSIX.
4701 use types::os::arch::c95::{c_char, c_int};
4704 pub fn isalnum(c: c_int) -> c_int;
4705 pub fn isalpha(c: c_int) -> c_int;
4706 pub fn iscntrl(c: c_int) -> c_int;
4707 pub fn isdigit(c: c_int) -> c_int;
4708 pub fn isgraph(c: c_int) -> c_int;
4709 pub fn islower(c: c_int) -> c_int;
4710 pub fn isprint(c: c_int) -> c_int;
4711 pub fn ispunct(c: c_int) -> c_int;
4712 pub fn isspace(c: c_int) -> c_int;
4713 pub fn isupper(c: c_int) -> c_int;
4714 pub fn isxdigit(c: c_int) -> c_int;
4715 pub fn tolower(c: c_char) -> c_char;
4716 pub fn toupper(c: c_char) -> c_char;
4721 use types::common::c95::{FILE, c_void, fpos_t};
4722 use types::os::arch::c95::{c_char, c_int, c_long, size_t};
4725 pub fn fopen(filename: *const c_char,
4726 mode: *const c_char) -> *mut FILE;
4727 pub fn freopen(filename: *const c_char, mode: *const c_char,
4730 pub fn fflush(file: *mut FILE) -> c_int;
4731 pub fn fclose(file: *mut FILE) -> c_int;
4732 pub fn remove(filename: *const c_char) -> c_int;
4733 pub fn rename(oldname: *const c_char,
4734 newname: *const c_char) -> c_int;
4735 pub fn tmpfile() -> *mut FILE;
4736 pub fn setvbuf(stream: *mut FILE,
4737 buffer: *mut c_char,
4741 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
4742 // Omitted: printf and scanf variants.
4743 pub fn fgetc(stream: *mut FILE) -> c_int;
4744 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
4746 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
4747 pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int;
4748 // Omitted: getc, getchar (might be macros).
4750 // Omitted: gets, so ridiculously unsafe that it should not
4753 // Omitted: putc, putchar (might be macros).
4754 pub fn puts(s: *const c_char) -> c_int;
4755 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
4756 pub fn fread(ptr: *mut c_void,
4761 pub fn fwrite(ptr: *const c_void,
4766 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int)
4768 pub fn ftell(stream: *mut FILE) -> c_long;
4769 pub fn rewind(stream: *mut FILE);
4770 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
4771 pub fn fsetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
4772 pub fn feof(stream: *mut FILE) -> c_int;
4773 pub fn ferror(stream: *mut FILE) -> c_int;
4774 pub fn perror(s: *const c_char);
4779 use types::common::c95::c_void;
4780 use types::os::arch::c95::{c_char, c_double, c_int};
4781 use types::os::arch::c95::{c_long, c_uint, c_ulong};
4782 use types::os::arch::c95::{size_t};
4785 pub fn abs(i: c_int) -> c_int;
4786 pub fn labs(i: c_long) -> c_long;
4787 // Omitted: div, ldiv (return pub type incomplete).
4788 pub fn atof(s: *const c_char) -> c_double;
4789 pub fn atoi(s: *const c_char) -> c_int;
4790 pub fn strtod(s: *const c_char,
4791 endp: *mut *mut c_char) -> c_double;
4792 pub fn strtol(s: *const c_char,
4793 endp: *mut *mut c_char, base: c_int) -> c_long;
4794 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
4795 base: c_int) -> c_ulong;
4796 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
4797 pub fn malloc(size: size_t) -> *mut c_void;
4798 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
4799 pub fn free(p: *mut c_void);
4801 /// Exits the running program in a possibly dangerous manner.
4805 /// While this forces your program to exit, it does so in a way that has
4806 /// consequences. This will skip all unwinding code, which means that anything
4807 /// relying on unwinding for cleanup (such as flushing and closing a buffer to a
4808 /// file) may act in an unexpected way.
4813 /// extern crate libc;
4821 pub fn exit(status: c_int) -> !;
4822 pub fn _exit(status: c_int) -> !;
4823 pub fn atexit(cb: extern fn()) -> c_int;
4824 pub fn system(s: *const c_char) -> c_int;
4825 pub fn getenv(s: *const c_char) -> *mut c_char;
4826 // Omitted: bsearch, qsort
4827 pub fn rand() -> c_int;
4828 pub fn srand(seed: c_uint);
4833 use types::common::c95::c_void;
4834 use types::os::arch::c95::{c_char, c_int, size_t};
4835 use types::os::arch::c95::{wchar_t};
4838 pub fn strcpy(dst: *mut c_char,
4839 src: *const c_char) -> *mut c_char;
4840 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t)
4842 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
4843 pub fn strncat(s: *mut c_char, ct: *const c_char,
4844 n: size_t) -> *mut c_char;
4845 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
4846 pub fn strncmp(cs: *const c_char, ct: *const c_char,
4847 n: size_t) -> c_int;
4848 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
4849 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
4850 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
4851 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
4852 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
4853 pub fn strpbrk(cs: *const c_char,
4854 ct: *const c_char) -> *mut c_char;
4855 pub fn strstr(cs: *const c_char,
4856 ct: *const c_char) -> *mut c_char;
4857 pub fn strlen(cs: *const c_char) -> size_t;
4858 pub fn strerror(n: c_int) -> *mut c_char;
4859 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
4860 pub fn strxfrm(s: *mut c_char, ct: *const c_char,
4861 n: size_t) -> size_t;
4862 pub fn wcslen(buf: *const wchar_t) -> size_t;
4864 // Omitted: memcpy, memmove, memset (provided by LLVM)
4866 // These are fine to execute on the Rust stack. They must be,
4867 // in fact, because LLVM generates calls to them!
4868 pub fn memcmp(cx: *const c_void, ct: *const c_void,
4869 n: size_t) -> c_int;
4870 pub fn memchr(cx: *const c_void, c: c_int,
4871 n: size_t) -> *mut c_void;
4876 // Microsoft helpfully underscore-qualifies all of its POSIX-like symbols
4877 // to make sure you don't use them accidentally. It also randomly deviates
4878 // from the exact signatures you might otherwise expect, and omits much,
4879 // so be careful when trying to write portable code; it won't always work
4880 // with the same POSIX functions and types as other platforms.
4882 #[cfg(target_os = "windows")]
4885 use types::os::common::posix01::{stat, utimbuf};
4886 use types::os::arch::c95::{c_int, c_char, wchar_t};
4889 #[link_name = "_chmod"]
4890 pub fn chmod(path: *const c_char, mode: c_int) -> c_int;
4891 #[link_name = "_wchmod"]
4892 pub fn wchmod(path: *const wchar_t, mode: c_int) -> c_int;
4893 #[link_name = "_mkdir"]
4894 pub fn mkdir(path: *const c_char) -> c_int;
4895 #[link_name = "_wrmdir"]
4896 pub fn wrmdir(path: *const wchar_t) -> c_int;
4897 #[link_name = "_fstat64"]
4898 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
4899 #[link_name = "_stat64"]
4900 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
4901 #[link_name = "_wstat64"]
4902 pub fn wstat(path: *const wchar_t, buf: *mut stat) -> c_int;
4903 #[link_name = "_wutime64"]
4904 pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> c_int;
4909 use types::common::c95::FILE;
4910 use types::os::arch::c95::{c_int, c_char};
4913 #[link_name = "_popen"]
4914 pub fn popen(command: *const c_char,
4915 mode: *const c_char) -> *mut FILE;
4916 #[link_name = "_pclose"]
4917 pub fn pclose(stream: *mut FILE) -> c_int;
4918 #[link_name = "_fdopen"]
4919 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
4920 #[link_name = "_fileno"]
4921 pub fn fileno(stream: *mut FILE) -> c_int;
4926 use types::os::arch::c95::{c_int, c_char, wchar_t};
4928 #[link_name = "_open"]
4929 pub fn open(path: *const c_char, oflag: c_int, mode: c_int)
4931 #[link_name = "_wopen"]
4932 pub fn wopen(path: *const wchar_t, oflag: c_int, mode: c_int)
4934 #[link_name = "_creat"]
4935 pub fn creat(path: *const c_char, mode: c_int) -> c_int;
4940 // Not supplied at all.
4944 use types::common::c95::c_void;
4945 use types::os::arch::c95::{c_int, c_uint, c_char,
4947 use types::os::arch::c99::intptr_t;
4950 #[link_name = "_access"]
4951 pub fn access(path: *const c_char, amode: c_int) -> c_int;
4952 #[link_name = "_chdir"]
4953 pub fn chdir(dir: *const c_char) -> c_int;
4954 #[link_name = "_close"]
4955 pub fn close(fd: c_int) -> c_int;
4956 #[link_name = "_dup"]
4957 pub fn dup(fd: c_int) -> c_int;
4958 #[link_name = "_dup2"]
4959 pub fn dup2(src: c_int, dst: c_int) -> c_int;
4960 #[link_name = "_execv"]
4961 pub fn execv(prog: *const c_char,
4962 argv: *mut *const c_char) -> intptr_t;
4963 #[link_name = "_execve"]
4964 pub fn execve(prog: *const c_char, argv: *mut *const c_char,
4965 envp: *mut *const c_char)
4967 #[link_name = "_execvp"]
4968 pub fn execvp(c: *const c_char,
4969 argv: *mut *const c_char) -> c_int;
4970 #[link_name = "_execvpe"]
4971 pub fn execvpe(c: *const c_char, argv: *mut *const c_char,
4972 envp: *mut *const c_char) -> c_int;
4973 #[link_name = "_getcwd"]
4974 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
4975 #[link_name = "_getpid"]
4976 pub fn getpid() -> c_int;
4977 #[link_name = "_isatty"]
4978 pub fn isatty(fd: c_int) -> c_int;
4979 #[link_name = "_lseek"]
4980 pub fn lseek(fd: c_int, offset: c_long, origin: c_int)
4982 #[link_name = "_pipe"]
4983 pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
4985 #[link_name = "_read"]
4986 pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
4988 #[link_name = "_rmdir"]
4989 pub fn rmdir(path: *const c_char) -> c_int;
4990 #[link_name = "_unlink"]
4991 pub fn unlink(c: *const c_char) -> c_int;
4992 #[link_name = "_write"]
4993 pub fn write(fd: c_int, buf: *const c_void,
4994 count: c_uint) -> c_int;
5002 #[cfg(any(target_os = "linux",
5003 target_os = "android",
5004 target_os = "macos",
5006 target_os = "freebsd",
5007 target_os = "dragonfly",
5008 target_os = "openbsd"))]
5011 use types::os::arch::c95::{c_char, c_int};
5012 use types::os::arch::posix01::stat;
5013 use types::os::arch::posix88::mode_t;
5016 pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
5017 pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
5019 #[cfg(any(target_os = "linux",
5020 target_os = "freebsd",
5021 target_os = "dragonfly",
5022 target_os = "openbsd",
5023 target_os = "android",
5024 target_os = "ios"))]
5025 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
5027 #[cfg(target_os = "macos")]
5028 #[link_name = "fstat64"]
5029 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
5031 pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
5032 pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
5034 #[cfg(any(target_os = "linux",
5035 target_os = "freebsd",
5036 target_os = "dragonfly",
5037 target_os = "openbsd",
5038 target_os = "android",
5039 target_os = "ios"))]
5040 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
5042 #[cfg(target_os = "macos")]
5043 #[link_name = "stat64"]
5044 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
5049 use types::common::c95::FILE;
5050 use types::os::arch::c95::{c_char, c_int};
5053 pub fn popen(command: *const c_char,
5054 mode: *const c_char) -> *mut FILE;
5055 pub fn pclose(stream: *mut FILE) -> c_int;
5056 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
5057 pub fn fileno(stream: *mut FILE) -> c_int;
5062 use types::os::arch::c95::{c_char, c_int};
5063 use types::os::arch::posix88::mode_t;
5066 pub fn open(path: *const c_char, oflag: c_int, mode: mode_t)
5068 pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
5069 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
5074 use types::common::posix88::{DIR, dirent_t};
5075 use types::os::arch::c95::{c_char, c_int, c_long};
5077 // NB: On OS X opendir and readdir have two versions,
5078 // one for 32-bit kernelspace and one for 64.
5079 // We should be linking to the 64-bit ones, called
5080 // opendir$INODE64, etc. but for some reason rustc
5081 // doesn't link it correctly on i686, so we're going
5082 // through a C function that mysteriously does work.
5085 #[link_name="rust_opendir"]
5086 pub fn opendir(dirname: *const c_char) -> *mut DIR;
5087 #[link_name="rust_readdir_r"]
5088 pub fn readdir_r(dirp: *mut DIR, entry: *mut dirent_t,
5089 result: *mut *mut dirent_t) -> c_int;
5093 pub fn closedir(dirp: *mut DIR) -> c_int;
5094 pub fn rewinddir(dirp: *mut DIR);
5095 pub fn seekdir(dirp: *mut DIR, loc: c_long);
5096 pub fn telldir(dirp: *mut DIR) -> c_long;
5101 use types::common::c95::c_void;
5102 use types::os::arch::c95::{c_char, c_int, c_long, c_uint};
5103 use types::os::arch::c95::{size_t};
5104 use types::os::common::posix01::timespec;
5105 use types::os::arch::posix01::utimbuf;
5106 use types::os::arch::posix88::{gid_t, off_t, pid_t};
5107 use types::os::arch::posix88::{ssize_t, uid_t};
5109 pub const _PC_NAME_MAX: c_int = 4;
5112 pub fn access(path: *const c_char, amode: c_int) -> c_int;
5113 pub fn alarm(seconds: c_uint) -> c_uint;
5114 pub fn chdir(dir: *const c_char) -> c_int;
5115 pub fn chown(path: *const c_char, uid: uid_t,
5116 gid: gid_t) -> c_int;
5117 pub fn close(fd: c_int) -> c_int;
5118 pub fn dup(fd: c_int) -> c_int;
5119 pub fn dup2(src: c_int, dst: c_int) -> c_int;
5120 pub fn execv(prog: *const c_char,
5121 argv: *mut *const c_char) -> c_int;
5122 pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5123 envp: *mut *const c_char)
5125 pub fn execvp(c: *const c_char,
5126 argv: *mut *const c_char) -> c_int;
5127 pub fn fork() -> pid_t;
5128 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
5129 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
5130 pub fn getegid() -> gid_t;
5131 pub fn geteuid() -> uid_t;
5132 pub fn getgid() -> gid_t ;
5133 pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
5135 pub fn getlogin() -> *mut c_char;
5136 pub fn getopt(argc: c_int, argv: *mut *const c_char,
5137 optstr: *const c_char) -> c_int;
5138 pub fn getpgrp() -> pid_t;
5139 pub fn getpid() -> pid_t;
5140 pub fn getppid() -> pid_t;
5141 pub fn getuid() -> uid_t;
5142 pub fn getsid(pid: pid_t) -> pid_t;
5143 pub fn isatty(fd: c_int) -> c_int;
5144 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
5145 pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
5147 pub fn pathconf(path: *mut c_char, name: c_int) -> c_long;
5148 pub fn pause() -> c_int;
5149 pub fn pipe(fds: *mut c_int) -> c_int;
5150 pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
5152 pub fn rmdir(path: *const c_char) -> c_int;
5153 pub fn setgid(gid: gid_t) -> c_int;
5154 pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
5155 pub fn setsid() -> pid_t;
5156 pub fn setuid(uid: uid_t) -> c_int;
5157 pub fn sleep(secs: c_uint) -> c_uint;
5158 pub fn usleep(secs: c_uint) -> c_int;
5159 pub fn nanosleep(rqtp: *const timespec,
5160 rmtp: *mut timespec) -> c_int;
5161 pub fn sysconf(name: c_int) -> c_long;
5162 pub fn tcgetpgrp(fd: c_int) -> pid_t;
5163 pub fn ttyname(fd: c_int) -> *mut c_char;
5164 pub fn unlink(c: *const c_char) -> c_int;
5165 pub fn write(fd: c_int, buf: *const c_void, count: size_t)
5167 pub fn pread(fd: c_int, buf: *mut c_void, count: size_t,
5168 offset: off_t) -> ssize_t;
5169 pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t,
5170 offset: off_t) -> ssize_t;
5171 pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
5176 use types::os::arch::c95::{c_int};
5177 use types::os::arch::posix88::{pid_t};
5180 pub fn kill(pid: pid_t, sig: c_int) -> c_int;
5185 use types::common::c95::{c_void};
5186 use types::os::arch::c95::{size_t, c_int, c_char};
5187 use types::os::arch::posix88::{mode_t, off_t};
5190 pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
5191 pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
5192 pub fn mlockall(flags: c_int) -> c_int;
5193 pub fn munlockall() -> c_int;
5195 pub fn mmap(addr: *mut c_void,
5202 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
5204 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int)
5207 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int)
5209 pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t)
5211 pub fn shm_unlink(name: *const c_char) -> c_int;
5216 use types::os::arch::c95::{c_char, c_uint};
5219 pub fn if_nametoindex(ifname: *const c_char) -> c_uint;
5225 #[cfg(any(target_os = "linux",
5226 target_os = "android",
5227 target_os = "macos",
5229 target_os = "freebsd",
5230 target_os = "dragonfly",
5231 target_os = "openbsd"))]
5234 use types::os::arch::c95::{c_char, c_int};
5235 use types::os::arch::posix01::stat;
5238 #[cfg(any(target_os = "linux",
5239 target_os = "freebsd",
5240 target_os = "dragonfly",
5241 target_os = "openbsd",
5242 target_os = "android",
5243 target_os = "ios"))]
5244 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
5246 #[cfg(target_os = "macos")]
5247 #[link_name = "lstat64"]
5248 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
5253 use types::os::arch::c95::{c_char, c_int, size_t};
5254 use types::os::arch::posix88::{ssize_t, off_t};
5257 pub fn readlink(path: *const c_char,
5262 pub fn fsync(fd: c_int) -> c_int;
5264 #[cfg(any(target_os = "linux", target_os = "android"))]
5265 pub fn fdatasync(fd: c_int) -> c_int;
5267 pub fn setenv(name: *const c_char, val: *const c_char,
5268 overwrite: c_int) -> c_int;
5269 pub fn unsetenv(name: *const c_char) -> c_int;
5270 pub fn putenv(string: *mut c_char) -> c_int;
5272 pub fn symlink(path1: *const c_char,
5273 path2: *const c_char) -> c_int;
5275 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
5280 use types::os::arch::c95::c_int;
5281 use types::os::common::posix01::sighandler_t;
5283 #[cfg(not(all(target_os = "android", target_arch = "arm")))]
5285 pub fn signal(signum: c_int,
5286 handler: sighandler_t) -> sighandler_t;
5289 #[cfg(all(target_os = "android", target_arch = "arm"))]
5291 #[link_name = "bsd_signal"]
5292 pub fn signal(signum: c_int,
5293 handler: sighandler_t) -> sighandler_t;
5298 use types::os::arch::c95::{c_char, c_int};
5299 use types::os::common::posix01::{glob_t};
5302 pub fn glob(pattern: *const c_char,
5304 errfunc: ::core::option::Option<extern "C" fn(epath: *const c_char,
5305 errno: c_int) -> c_int>,
5306 pglob: *mut glob_t);
5307 pub fn globfree(pglob: *mut glob_t);
5312 use types::common::c95::{c_void};
5313 use types::os::arch::c95::{c_int, size_t};
5316 pub fn posix_madvise(addr: *mut c_void,
5324 #[cfg(target_os = "windows")]
5343 #[cfg(any(target_os = "windows",
5344 target_os = "linux",
5345 target_os = "android",
5346 target_os = "macos",
5348 target_os = "freebsd",
5349 target_os = "dragonfly",
5350 target_os = "openbsd"))]
5356 #[cfg(not(windows))]
5358 use types::common::c95::{c_void};
5359 use types::os::common::bsd44::{socklen_t, sockaddr, ifaddrs};
5360 use types::os::arch::c95::{c_int, size_t};
5361 use types::os::arch::posix88::ssize_t;
5364 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int;
5365 pub fn connect(socket: c_int, address: *const sockaddr,
5366 len: socklen_t) -> c_int;
5367 pub fn bind(socket: c_int, address: *const sockaddr,
5368 address_len: socklen_t) -> c_int;
5369 pub fn listen(socket: c_int, backlog: c_int) -> c_int;
5370 pub fn accept(socket: c_int, address: *mut sockaddr,
5371 address_len: *mut socklen_t) -> c_int;
5372 pub fn getpeername(socket: c_int, address: *mut sockaddr,
5373 address_len: *mut socklen_t) -> c_int;
5374 pub fn getsockname(socket: c_int, address: *mut sockaddr,
5375 address_len: *mut socklen_t) -> c_int;
5376 pub fn setsockopt(socket: c_int, level: c_int, name: c_int,
5377 value: *const c_void,
5378 option_len: socklen_t) -> c_int;
5379 pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
5380 flags: c_int) -> ssize_t;
5381 pub fn send(socket: c_int, buf: *const c_void, len: size_t,
5382 flags: c_int) -> ssize_t;
5383 pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
5384 flags: c_int, addr: *mut sockaddr,
5385 addrlen: *mut socklen_t) -> ssize_t;
5386 pub fn sendto(socket: c_int, buf: *const c_void, len: size_t,
5387 flags: c_int, addr: *const sockaddr,
5388 addrlen: socklen_t) -> ssize_t;
5389 pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> c_int;
5390 pub fn freeifaddrs(ifa: *mut ifaddrs);
5391 pub fn shutdown(socket: c_int, how: c_int) -> c_int;
5397 use types::common::c95::{c_void};
5398 use types::os::common::bsd44::{socklen_t, sockaddr, SOCKET};
5399 use types::os::arch::c95::c_int;
5400 use types::os::arch::posix88::ssize_t;
5403 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> SOCKET;
5404 pub fn connect(socket: SOCKET, address: *const sockaddr,
5405 len: socklen_t) -> c_int;
5406 pub fn bind(socket: SOCKET, address: *const sockaddr,
5407 address_len: socklen_t) -> c_int;
5408 pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
5409 pub fn accept(socket: SOCKET, address: *mut sockaddr,
5410 address_len: *mut socklen_t) -> SOCKET;
5411 pub fn getpeername(socket: SOCKET, address: *mut sockaddr,
5412 address_len: *mut socklen_t) -> c_int;
5413 pub fn getsockname(socket: SOCKET, address: *mut sockaddr,
5414 address_len: *mut socklen_t) -> c_int;
5415 pub fn setsockopt(socket: SOCKET, level: c_int, name: c_int,
5416 value: *const c_void,
5417 option_len: socklen_t) -> c_int;
5418 pub fn closesocket(socket: SOCKET) -> c_int;
5419 pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
5420 flags: c_int) -> c_int;
5421 pub fn send(socket: SOCKET, buf: *const c_void, len: c_int,
5422 flags: c_int) -> c_int;
5423 pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
5424 flags: c_int, addr: *mut sockaddr,
5425 addrlen: *mut c_int) -> ssize_t;
5426 pub fn sendto(socket: SOCKET, buf: *const c_void, len: c_int,
5427 flags: c_int, addr: *const sockaddr,
5428 addrlen: c_int) -> c_int;
5429 pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
5433 #[cfg(any(target_os = "macos",
5435 target_os = "freebsd",
5436 target_os = "dragonfly",
5437 target_os = "openbsd"))]
5439 use types::common::c95::{c_void};
5440 use types::os::arch::c95::{c_char, c_uchar, c_int, c_uint, c_ulong, size_t};
5443 pub fn ioctl(d: c_int, request: c_ulong, ...) -> c_int;
5444 pub fn sysctl(name: *mut c_int,
5447 oldlenp: *mut size_t,
5451 pub fn sysctlbyname(name: *const c_char,
5453 oldlenp: *mut size_t,
5457 pub fn sysctlnametomib(name: *const c_char,
5461 pub fn getdtablesize() -> c_int;
5462 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
5464 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
5470 #[cfg(any(target_os = "linux", target_os = "android"))]
5472 use types::common::c95::{c_void};
5473 use types::os::arch::c95::{c_uchar, c_int, size_t};
5476 #[cfg(not(all(target_os = "android", target_arch = "aarch64")))]
5477 pub fn getdtablesize() -> c_int;
5478 pub fn ioctl(d: c_int, request: c_int, ...) -> c_int;
5479 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
5481 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
5487 #[cfg(target_os = "windows")]
5491 #[cfg(any(target_os = "macos", target_os = "ios"))]
5493 use types::os::arch::c95::{c_char, c_int};
5496 pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32)
5501 #[cfg(any(target_os = "freebsd",
5502 target_os = "dragonfly",
5503 target_os = "openbsd"))]
5507 #[cfg(any(target_os = "linux", target_os = "android"))]
5512 #[cfg(target_os = "windows")]
5516 use types::os::arch::c95::{c_uint};
5517 use types::os::arch::extra::{BOOL, DWORD, SIZE_T, HMODULE,
5519 LPWCH, LPDWORD, LPVOID,
5520 LPCVOID, LPOVERLAPPED,
5521 LPSECURITY_ATTRIBUTES,
5523 LPPROCESS_INFORMATION,
5524 LPMEMORY_BASIC_INFORMATION,
5525 LPSYSTEM_INFO, HANDLE, LPHANDLE,
5526 LARGE_INTEGER, PLARGE_INTEGER,
5527 LPFILETIME, LPWIN32_FIND_DATAW};
5530 pub fn GetEnvironmentVariableW(n: LPCWSTR,
5534 pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
5536 pub fn GetEnvironmentStringsW() -> LPWCH;
5537 pub fn FreeEnvironmentStringsW(env_ptr: LPWCH) -> BOOL;
5538 pub fn GetModuleFileNameW(hModule: HMODULE,
5542 pub fn CreateDirectoryW(lpPathName: LPCWSTR,
5543 lpSecurityAttributes:
5544 LPSECURITY_ATTRIBUTES)
5546 pub fn CopyFileW(lpExistingFileName: LPCWSTR,
5547 lpNewFileName: LPCWSTR,
5548 bFailIfExists: BOOL)
5550 pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
5551 pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
5552 pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
5555 pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
5556 pub fn GetLastError() -> DWORD;
5557 pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW)
5559 pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW)
5561 pub fn FindClose(findFile: HANDLE) -> BOOL;
5562 pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
5563 hSourceHandle: HANDLE,
5564 hTargetProcessHandle: HANDLE,
5565 lpTargetHandle: LPHANDLE,
5566 dwDesiredAccess: DWORD,
5567 bInheritHandle: BOOL,
5570 pub fn CloseHandle(hObject: HANDLE) -> BOOL;
5571 pub fn OpenProcess(dwDesiredAccess: DWORD,
5572 bInheritHandle: BOOL,
5575 pub fn GetCurrentProcess() -> HANDLE;
5576 pub fn CreateProcessW(lpApplicationName: LPCWSTR,
5577 lpCommandLine: LPWSTR,
5578 lpProcessAttributes:
5579 LPSECURITY_ATTRIBUTES,
5581 LPSECURITY_ATTRIBUTES,
5582 bInheritHandles: BOOL,
5583 dwCreationFlags: DWORD,
5584 lpEnvironment: LPVOID,
5585 lpCurrentDirectory: LPCWSTR,
5586 lpStartupInfo: LPSTARTUPINFO,
5587 lpProcessInformation:
5588 LPPROCESS_INFORMATION)
5590 pub fn WaitForSingleObject(hHandle: HANDLE,
5591 dwMilliseconds: DWORD)
5593 pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
5595 pub fn GetExitCodeProcess(hProcess: HANDLE,
5596 lpExitCode: LPDWORD)
5598 pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
5599 pub fn VirtualAlloc(lpAddress: LPVOID,
5601 flAllocationType: DWORD,
5604 pub fn VirtualFree(lpAddress: LPVOID,
5608 pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
5609 pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
5611 pub fn VirtualProtect(lpAddress: LPVOID,
5613 flNewProtect: DWORD,
5614 lpflOldProtect: LPDWORD)
5616 pub fn VirtualQuery(lpAddress: LPCVOID,
5617 lpBuffer: LPMEMORY_BASIC_INFORMATION,
5620 pub fn CreateFileMappingW(hFile: HANDLE,
5621 lpAttributes: LPSECURITY_ATTRIBUTES,
5623 dwMaximumSizeHigh: DWORD,
5624 dwMaximumSizeLow: DWORD,
5627 pub fn MapViewOfFile(hFileMappingObject: HANDLE,
5628 dwDesiredAccess: DWORD,
5629 dwFileOffsetHigh: DWORD,
5630 dwFileOffsetLow: DWORD,
5631 dwNumberOfBytesToMap: SIZE_T)
5633 pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
5634 pub fn MoveFileExW(lpExistingFileName: LPCWSTR,
5635 lpNewFileName: LPCWSTR,
5636 dwFlags: DWORD) -> BOOL;
5637 pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
5638 lpTargetFileName: LPCWSTR,
5639 lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
5641 pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL;
5642 pub fn CreateFileW(lpFileName: LPCWSTR,
5643 dwDesiredAccess: DWORD,
5645 lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
5646 dwCreationDisposition: DWORD,
5647 dwFlagsAndAttributes: DWORD,
5648 hTemplateFile: HANDLE) -> HANDLE;
5649 pub fn ReadFile(hFile: HANDLE,
5651 nNumberOfBytesToRead: DWORD,
5652 lpNumberOfBytesRead: LPDWORD,
5653 lpOverlapped: LPOVERLAPPED) -> BOOL;
5654 pub fn WriteFile(hFile: HANDLE,
5656 nNumberOfBytesToRead: DWORD,
5657 lpNumberOfBytesRead: LPDWORD,
5658 lpOverlapped: LPOVERLAPPED) -> BOOL;
5659 pub fn SetFilePointerEx(hFile: HANDLE,
5660 liDistanceToMove: LARGE_INTEGER,
5661 lpNewFilePointer: PLARGE_INTEGER,
5662 dwMoveMethod: DWORD) -> BOOL;
5663 pub fn SetEndOfFile(hFile: HANDLE) -> BOOL;
5665 pub fn GetSystemTimeAsFileTime(
5666 lpSystemTimeAsFileTime: LPFILETIME);
5668 pub fn QueryPerformanceFrequency(
5669 lpFrequency: *mut LARGE_INTEGER) -> BOOL;
5670 pub fn QueryPerformanceCounter(
5671 lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL;
5673 pub fn GetCurrentProcessId() -> DWORD;
5674 pub fn CreateNamedPipeW(
5678 nMaxInstances: DWORD,
5679 nOutBufferSize: DWORD,
5680 nInBufferSize: DWORD,
5681 nDefaultTimeOut: DWORD,
5682 lpSecurityAttributes: LPSECURITY_ATTRIBUTES
5684 pub fn ConnectNamedPipe(hNamedPipe: HANDLE,
5685 lpOverlapped: LPOVERLAPPED) -> BOOL;
5686 pub fn WaitNamedPipeW(lpNamedPipeName: LPCWSTR,
5687 nTimeOut: DWORD) -> BOOL;
5688 pub fn SetNamedPipeHandleState(hNamedPipe: HANDLE,
5690 lpMaxCollectionCount: LPDWORD,
5691 lpCollectDataTimeout: LPDWORD)
5693 pub fn CreateEventW(lpEventAttributes: LPSECURITY_ATTRIBUTES,
5695 bInitialState: BOOL,
5696 lpName: LPCWSTR) -> HANDLE;
5697 pub fn GetOverlappedResult(hFile: HANDLE,
5698 lpOverlapped: LPOVERLAPPED,
5699 lpNumberOfBytesTransferred: LPDWORD,
5700 bWait: BOOL) -> BOOL;
5701 pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL;
5706 use types::os::arch::c95::{c_int, c_long};
5707 use types::os::arch::c99::intptr_t;
5710 #[link_name = "_commit"]
5711 pub fn commit(fd: c_int) -> c_int;
5713 #[link_name = "_get_osfhandle"]
5714 pub fn get_osfhandle(fd: c_int) -> c_long;
5716 #[link_name = "_open_osfhandle"]
5717 pub fn open_osfhandle(osfhandle: intptr_t,
5718 flags: c_int) -> c_int;
5723 use types::os::arch::c95::{c_int, c_long, c_ulong};
5724 use types::os::common::bsd44::SOCKET;
5727 pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int;
5734 pub fn issue_14344_workaround() {} // FIXME #14344 force linkage to happen correctly
5736 #[test] fn work_on_windows() { } // FIXME #10872 needed for a happy windows