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"), unstable)]
14 #![cfg_attr(not(feature = "cargo-build"), staged_api)]
15 #![allow(unknown_features)] #![feature(int_uint)]
17 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
18 html_favicon_url = "http://www.rust-lang.org/favicon.ico",
19 html_root_url = "http://doc.rust-lang.org/nightly/",
20 html_playground_url = "http://play.rust-lang.org/")]
22 //! Bindings for the C standard library and other platform libraries
24 //! **NOTE:** These are *architecture and libc* specific. On Linux, these
25 //! bindings are only correct for glibc.
27 //! This module contains bindings to the C standard library, organized into
28 //! modules by their defining standard. Additionally, it contains some assorted
29 //! platform-specific definitions. For convenience, most functions and types
30 //! are reexported, so `use libc::*` will import the available C bindings as
31 //! appropriate for the target platform. The exact set of functions available
32 //! are platform specific.
34 //! *Note:* Because these definitions are platform-specific, some may not appear
35 //! in the generated documentation.
37 //! We consider the following specs reasonably normative with respect to
38 //! interoperating with the C standard library (libc/msvcrt):
40 //! * ISO 9899:1990 ('C95', 'ANSI C', 'Standard C'), NA1, 1995.
41 //! * ISO 9899:1999 ('C99' or 'C9x').
42 //! * ISO 9945:1988 / IEEE 1003.1-1988 ('POSIX.1').
43 //! * ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
44 //! * ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
46 //! Note that any reference to the 1996 revision of POSIX, or any revs between
47 //! 1990 (when '88 was approved at ISO) and 2001 (when the next actual
48 //! revision-revision happened), are merely additions of other chapters (1b and
49 //! 1c) outside the core interfaces.
51 //! Despite having several names each, these are *reasonably* coherent
52 //! point-in-time, list-of-definition sorts of specs. You can get each under a
53 //! variety of names but will wind up with the same definition in each case.
55 //! See standards(7) in linux-manpages for more details.
57 //! Our interface to these libraries is complicated by the non-universality of
58 //! conformance to any of them. About the only thing universally supported is
59 //! the first (C95), beyond that definitions quickly become absent on various
62 //! We therefore wind up dividing our module-space up (mostly for the sake of
63 //! sanity while editing, filling-in-details and eliminating duplication) into
64 //! definitions common-to-all (held in modules named c95, c99, posix88, posix01
65 //! and posix08) and definitions that appear only on *some* platforms (named
66 //! 'extra'). This would be things like significant OSX foundation kit, or Windows
67 //! library kernel32.dll, or various fancy glibc, Linux or BSD extensions.
69 //! In addition to the per-platform 'extra' modules, we define a module of
70 //! 'common BSD' libc routines that never quite made it into POSIX but show up
71 //! in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the final
72 //! one from Berkeley after the lawsuits died down and the CSRG dissolved.
74 #![allow(bad_style, raw_pointer_derive)]
76 #[cfg(feature = "cargo-build")] extern crate "std" as core;
77 #[cfg(not(feature = "cargo-build"))] extern crate core;
79 #[cfg(test)] extern crate std;
80 #[cfg(test)] extern crate test;
82 // Explicit export lists for the intersection (provided here) mean that
83 // you can write more-platform-agnostic code if you stick to just these
86 pub use types::common::c95::{FILE, c_void, fpos_t};
87 pub use types::common::c99::{int8_t, int16_t, int32_t, int64_t};
88 pub use types::common::c99::{uint8_t, uint16_t, uint32_t, uint64_t};
89 pub use types::common::posix88::{DIR, dirent_t};
90 pub use types::os::common::posix01::{timeval};
91 pub use types::os::common::bsd44::{addrinfo, in_addr, in6_addr, sockaddr_storage};
92 pub use types::os::common::bsd44::{ip_mreq, ip6_mreq, sockaddr, sockaddr_un};
93 pub use types::os::common::bsd44::{sa_family_t, sockaddr_in, sockaddr_in6, socklen_t};
94 pub use types::os::arch::c95::{c_char, c_double, c_float, c_int, c_uint};
95 pub use types::os::arch::c95::{c_long, c_short, c_uchar, c_ulong, wchar_t};
96 pub use types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t, c_schar};
97 pub use types::os::arch::c95::{size_t, time_t, suseconds_t};
98 pub use types::os::arch::c99::{c_longlong, c_ulonglong};
99 pub use types::os::arch::c99::{intptr_t, uintptr_t};
100 pub use types::os::arch::c99::{intmax_t, uintmax_t};
101 pub use types::os::arch::posix88::{dev_t, ino_t, mode_t};
102 pub use types::os::arch::posix88::{off_t, pid_t, ssize_t};
104 pub use consts::os::c95::{_IOFBF, _IOLBF, _IONBF, BUFSIZ, EOF};
105 pub use consts::os::c95::{EXIT_FAILURE, EXIT_SUCCESS};
106 pub use consts::os::c95::{FILENAME_MAX, FOPEN_MAX, L_tmpnam};
107 pub use consts::os::c95::{RAND_MAX, SEEK_CUR, SEEK_END};
108 pub use consts::os::c95::{SEEK_SET, TMP_MAX};
109 pub use consts::os::posix88::{F_OK, O_APPEND, O_CREAT, O_EXCL};
110 pub use consts::os::posix88::{O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY};
111 pub use consts::os::posix88::{R_OK, S_IEXEC, S_IFBLK, S_IFCHR};
112 pub use consts::os::posix88::{S_IFDIR, S_IFIFO, S_IFMT, S_IFREG, S_IFLNK};
113 pub use consts::os::posix88::{S_IREAD, S_IRUSR, S_IRWXU, S_IWUSR};
114 pub use consts::os::posix88::{STDERR_FILENO, STDIN_FILENO, S_IXUSR};
115 pub use consts::os::posix88::{STDOUT_FILENO, W_OK, X_OK};
116 pub use consts::os::bsd44::{AF_INET, AF_INET6, SOCK_STREAM, SOCK_DGRAM, SOCK_RAW};
117 pub use consts::os::bsd44::{IPPROTO_IP, IPPROTO_IPV6, IPPROTO_TCP, TCP_NODELAY};
118 pub use consts::os::bsd44::{SOL_SOCKET, SO_KEEPALIVE, SO_ERROR};
119 pub use consts::os::bsd44::{SO_REUSEADDR, SO_BROADCAST, SHUT_WR, IP_MULTICAST_LOOP};
120 pub use consts::os::bsd44::{IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP};
121 pub use consts::os::bsd44::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP};
122 pub use consts::os::bsd44::{IP_MULTICAST_TTL, IP_TTL, IP_HDRINCL, SHUT_RD};
123 pub use consts::os::extra::{IPPROTO_RAW};
125 pub use funcs::c95::ctype::{isalnum, isalpha, iscntrl, isdigit};
126 pub use funcs::c95::ctype::{islower, isprint, ispunct, isspace};
127 pub use funcs::c95::ctype::{isupper, isxdigit, tolower, toupper};
129 pub use funcs::c95::stdio::{fclose, feof, ferror, fflush, fgetc};
130 pub use funcs::c95::stdio::{fgetpos, fgets, fopen, fputc, fputs};
131 pub use funcs::c95::stdio::{fread, freopen, fseek, fsetpos, ftell};
132 pub use funcs::c95::stdio::{fwrite, perror, puts, remove, rename, rewind};
133 pub use funcs::c95::stdio::{setbuf, setvbuf, tmpfile, ungetc};
135 pub use funcs::c95::stdlib::{abs, atof, atoi, calloc, exit, _exit, atexit};
136 pub use funcs::c95::stdlib::{free, getenv, labs, malloc, rand};
137 pub use funcs::c95::stdlib::{realloc, srand, strtod, strtol};
138 pub use funcs::c95::stdlib::{strtoul, system};
140 pub use funcs::c95::string::{memchr, memcmp};
141 pub use funcs::c95::string::{strcat, strchr, strcmp};
142 pub use funcs::c95::string::{strcoll, strcpy, strcspn, strerror};
143 pub use funcs::c95::string::{strlen, strncat, strncmp, strncpy};
144 pub use funcs::c95::string::{strpbrk, strrchr, strspn, strstr};
145 pub use funcs::c95::string::{strtok, strxfrm};
147 pub use funcs::posix88::fcntl::{open, creat};
148 pub use funcs::posix88::stat_::{chmod, fstat, mkdir, stat};
149 pub use funcs::posix88::stdio::{fdopen, fileno, pclose, popen};
150 pub use funcs::posix88::unistd::{access, chdir, close, dup, dup2};
151 pub use funcs::posix88::unistd::{execv, execve, execvp, getcwd};
152 pub use funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read};
153 pub use funcs::posix88::unistd::{rmdir, unlink, write};
155 pub use funcs::bsd43::{socket, setsockopt, bind, send, recv, recvfrom};
156 pub use funcs::bsd43::{listen, sendto, accept, connect, getpeername, getsockname};
157 pub use funcs::bsd43::{shutdown};
159 // But we also reexport most everything
160 // if you're interested in writing platform-specific code.
162 // FIXME: This is a mess, but the design of this entire module needs to be
163 // reconsidered, so I'm not inclined to do better right now. As part of
164 // #11870 I removed all the pub globs here, leaving explicit reexports
165 // of everything that is actually used in-tree.
167 // So the following exports don't follow any particular plan.
169 #[cfg(unix)] pub use consts::os::sysconf::{_SC_PAGESIZE};
170 #[cfg(unix)] pub use consts::os::posix88::{PROT_READ, PROT_WRITE, PROT_EXEC};
171 #[cfg(unix)] pub use consts::os::posix88::{MAP_FIXED, MAP_FILE, MAP_ANON, MAP_PRIVATE, MAP_FAILED};
172 #[cfg(unix)] pub use consts::os::posix88::{EACCES, EBADF, EINVAL, ENODEV, ENOMEM};
173 #[cfg(unix)] pub use consts::os::posix88::{ECONNREFUSED, ECONNRESET, EPERM, EPIPE};
174 #[cfg(unix)] pub use consts::os::posix88::{ENOTCONN, ECONNABORTED, EADDRNOTAVAIL, EINTR};
175 #[cfg(unix)] pub use consts::os::posix88::{EADDRINUSE, ENOENT, EISDIR, EAGAIN, EWOULDBLOCK};
176 #[cfg(unix)] pub use consts::os::posix88::{ECANCELED, SIGINT, EINPROGRESS};
177 #[cfg(unix)] pub use consts::os::posix88::{ENOSYS, ENOTTY, ETIMEDOUT, EMFILE};
178 #[cfg(unix)] pub use consts::os::posix88::{SIGTERM, SIGKILL, SIGPIPE, PROT_NONE};
179 #[cfg(unix)] pub use consts::os::posix01::{SIG_IGN, F_GETFL, F_SETFL};
180 #[cfg(unix)] pub use consts::os::bsd44::{AF_UNIX};
181 #[cfg(unix)] pub use consts::os::extra::{O_NONBLOCK};
183 #[cfg(unix)] pub use types::os::common::posix01::{pthread_t, timespec, timezone};
185 #[cfg(unix)] pub use types::os::arch::posix88::{uid_t, gid_t};
186 #[cfg(unix)] pub use types::os::arch::posix01::{pthread_attr_t};
187 #[cfg(unix)] pub use types::os::arch::posix01::{stat, utimbuf};
188 #[cfg(unix)] pub use types::os::common::bsd44::{ifaddrs};
189 #[cfg(unix)] pub use funcs::posix88::unistd::{sysconf, setgid, setsid, setuid, pread, pwrite};
190 #[cfg(unix)] pub use funcs::posix88::unistd::{getgid, getuid, getsid};
191 #[cfg(unix)] pub use funcs::posix88::unistd::{_PC_NAME_MAX, utime, nanosleep, pathconf, link};
192 #[cfg(unix)] pub use funcs::posix88::unistd::{chown};
193 #[cfg(unix)] pub use funcs::posix88::mman::{mmap, munmap, mprotect};
194 #[cfg(unix)] pub use funcs::posix88::dirent::{opendir, readdir_r, closedir};
195 #[cfg(unix)] pub use funcs::posix88::fcntl::{fcntl};
196 #[cfg(unix)] pub use funcs::posix88::net::{if_nametoindex};
197 #[cfg(unix)] pub use funcs::posix01::stat_::{lstat};
198 #[cfg(unix)] pub use funcs::posix01::unistd::{fsync, ftruncate};
199 #[cfg(unix)] pub use funcs::posix01::unistd::{readlink, symlink};
200 #[cfg(unix)] pub use funcs::bsd43::{getifaddrs, freeifaddrs};
202 #[cfg(windows)] pub use consts::os::c95::{WSAECONNREFUSED, WSAECONNRESET, WSAEACCES};
203 #[cfg(windows)] pub use consts::os::c95::{WSAEWOULDBLOCK, WSAENOTCONN, WSAECONNABORTED};
204 #[cfg(windows)] pub use consts::os::c95::{WSAEADDRNOTAVAIL, WSAEADDRINUSE, WSAEINTR};
205 #[cfg(windows)] pub use consts::os::c95::{WSAEINPROGRESS, WSAEINVAL, WSAEMFILE};
206 #[cfg(windows)] pub use consts::os::extra::{ERROR_INSUFFICIENT_BUFFER};
207 #[cfg(windows)] pub use consts::os::extra::{O_BINARY, O_NOINHERIT, PAGE_NOACCESS};
208 #[cfg(windows)] pub use consts::os::extra::{PAGE_READONLY, PAGE_READWRITE, PAGE_EXECUTE};
209 #[cfg(windows)] pub use consts::os::extra::{PAGE_EXECUTE_READ, PAGE_EXECUTE_READWRITE};
210 #[cfg(windows)] pub use consts::os::extra::{MEM_COMMIT, MEM_RESERVE, MEM_RELEASE};
211 #[cfg(windows)] pub use consts::os::extra::{FILE_MAP_READ, FILE_MAP_WRITE, FILE_MAP_EXECUTE};
212 #[cfg(windows)] pub use consts::os::extra::{ERROR_ALREADY_EXISTS, ERROR_NO_DATA};
213 #[cfg(windows)] pub use consts::os::extra::{ERROR_FILE_NOT_FOUND, ERROR_INVALID_NAME};
214 #[cfg(windows)] pub use consts::os::extra::{ERROR_BROKEN_PIPE, ERROR_INVALID_FUNCTION};
215 #[cfg(windows)] pub use consts::os::extra::{ERROR_CALL_NOT_IMPLEMENTED};
216 #[cfg(windows)] pub use consts::os::extra::{ERROR_NOTHING_TO_TERMINATE};
217 #[cfg(windows)] pub use consts::os::extra::{ERROR_INVALID_HANDLE};
218 #[cfg(windows)] pub use consts::os::extra::{TRUE, FALSE, INFINITE};
219 #[cfg(windows)] pub use consts::os::extra::{PROCESS_TERMINATE, PROCESS_QUERY_INFORMATION};
220 #[cfg(windows)] pub use consts::os::extra::{STILL_ACTIVE, DETACHED_PROCESS};
221 #[cfg(windows)] pub use consts::os::extra::{CREATE_NEW_PROCESS_GROUP, CREATE_UNICODE_ENVIRONMENT};
222 #[cfg(windows)] pub use consts::os::extra::{FILE_BEGIN, FILE_END, FILE_CURRENT};
223 #[cfg(windows)] pub use consts::os::extra::{FILE_GENERIC_READ, FILE_GENERIC_WRITE};
224 #[cfg(windows)] pub use consts::os::extra::{FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_DELETE};
225 #[cfg(windows)] pub use consts::os::extra::{TRUNCATE_EXISTING, CREATE_ALWAYS, OPEN_EXISTING};
226 #[cfg(windows)] pub use consts::os::extra::{CREATE_NEW, FILE_APPEND_DATA, FILE_WRITE_DATA};
227 #[cfg(windows)] pub use consts::os::extra::{OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL};
228 #[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_BACKUP_SEMANTICS, INVALID_HANDLE_VALUE};
229 #[cfg(windows)] pub use consts::os::extra::{MOVEFILE_REPLACE_EXISTING};
230 #[cfg(windows)] pub use consts::os::extra::{GENERIC_READ, GENERIC_WRITE};
231 #[cfg(windows)] pub use consts::os::extra::{VOLUME_NAME_DOS};
232 #[cfg(windows)] pub use consts::os::extra::{PIPE_ACCESS_DUPLEX, FILE_FLAG_FIRST_PIPE_INSTANCE};
233 #[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE};
234 #[cfg(windows)] pub use consts::os::extra::{PIPE_READMODE_BYTE, PIPE_WAIT};
235 #[cfg(windows)] pub use consts::os::extra::{PIPE_UNLIMITED_INSTANCES, ERROR_ACCESS_DENIED};
236 #[cfg(windows)] pub use consts::os::extra::{FILE_WRITE_ATTRIBUTES, FILE_READ_ATTRIBUTES};
237 #[cfg(windows)] pub use consts::os::extra::{ERROR_PIPE_BUSY, ERROR_IO_PENDING};
238 #[cfg(windows)] pub use consts::os::extra::{ERROR_PIPE_CONNECTED, WAIT_OBJECT_0};
239 #[cfg(windows)] pub use consts::os::extra::{ERROR_NOT_FOUND};
240 #[cfg(windows)] pub use consts::os::extra::{ERROR_OPERATION_ABORTED};
241 #[cfg(windows)] pub use consts::os::extra::{FIONBIO};
242 #[cfg(windows)] pub use types::os::common::bsd44::{SOCKET};
243 #[cfg(windows)] pub use types::os::common::posix01::{stat, utimbuf};
244 #[cfg(windows)] pub use types::os::arch::extra::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES};
245 #[cfg(windows)] pub use types::os::arch::extra::{LPCSTR, WORD, DWORD, BYTE, FILETIME};
246 #[cfg(windows)] pub use types::os::arch::extra::{LARGE_INTEGER, LPVOID, LONG};
247 #[cfg(windows)] pub use types::os::arch::extra::{time64_t, OVERLAPPED, LPCWSTR};
248 #[cfg(windows)] pub use types::os::arch::extra::{LPOVERLAPPED, SIZE_T, LPDWORD};
249 #[cfg(windows)] pub use types::os::arch::extra::{SECURITY_ATTRIBUTES, WIN32_FIND_DATAW};
250 #[cfg(windows)] pub use funcs::c95::string::{wcslen};
251 #[cfg(windows)] pub use funcs::posix88::stat_::{wstat, wutime, wchmod, wrmdir};
252 #[cfg(windows)] pub use funcs::bsd43::{closesocket};
253 #[cfg(windows)] pub use funcs::extra::kernel32::{GetCurrentDirectoryW, GetLastError};
254 #[cfg(windows)] pub use funcs::extra::kernel32::{GetEnvironmentVariableW, SetEnvironmentVariableW};
255 #[cfg(windows)] pub use funcs::extra::kernel32::{GetModuleFileNameW, SetCurrentDirectoryW};
256 #[cfg(windows)] pub use funcs::extra::kernel32::{GetSystemInfo, VirtualAlloc, VirtualFree};
257 #[cfg(windows)] pub use funcs::extra::kernel32::{CreateFileMappingW, MapViewOfFile};
258 #[cfg(windows)] pub use funcs::extra::kernel32::{UnmapViewOfFile, CloseHandle};
259 #[cfg(windows)] pub use funcs::extra::kernel32::{WaitForSingleObject, GetSystemTimeAsFileTime};
260 #[cfg(windows)] pub use funcs::extra::kernel32::{QueryPerformanceCounter};
261 #[cfg(windows)] pub use funcs::extra::kernel32::{QueryPerformanceFrequency};
262 #[cfg(windows)] pub use funcs::extra::kernel32::{GetExitCodeProcess, TerminateProcess};
263 #[cfg(windows)] pub use funcs::extra::kernel32::{ReadFile, WriteFile, SetFilePointerEx};
264 #[cfg(windows)] pub use funcs::extra::kernel32::{SetEndOfFile, CreateFileW};
265 #[cfg(windows)] pub use funcs::extra::kernel32::{CreateDirectoryW, FindFirstFileW};
266 #[cfg(windows)] pub use funcs::extra::kernel32::{FindNextFileW, FindClose, DeleteFileW};
267 #[cfg(windows)] pub use funcs::extra::kernel32::{CreateHardLinkW, CreateEventW};
268 #[cfg(windows)] pub use funcs::extra::kernel32::{FlushFileBuffers, CreateNamedPipeW};
269 #[cfg(windows)] pub use funcs::extra::kernel32::{SetNamedPipeHandleState, WaitNamedPipeW};
270 #[cfg(windows)] pub use funcs::extra::kernel32::{GetOverlappedResult, ConnectNamedPipe};
271 #[cfg(windows)] pub use funcs::extra::kernel32::{DisconnectNamedPipe, OpenProcess};
272 #[cfg(windows)] pub use funcs::extra::kernel32::{MoveFileExW, VirtualProtect};
273 #[cfg(windows)] pub use funcs::extra::msvcrt::{get_osfhandle, open_osfhandle};
274 #[cfg(windows)] pub use funcs::extra::winsock::{ioctlsocket};
276 #[cfg(any(target_os = "linux",
277 target_os = "android",
278 target_os = "freebsd",
279 target_os = "dragonfly"))]
280 pub use consts::os::posix01::{CLOCK_REALTIME, CLOCK_MONOTONIC};
282 #[cfg(any(target_os = "linux", target_os = "android"))]
283 pub use funcs::posix01::unistd::{fdatasync};
284 #[cfg(any(target_os = "linux", target_os = "android"))]
285 pub use types::os::arch::extra::{sockaddr_ll};
286 #[cfg(any(target_os = "linux", target_os = "android"))]
287 pub use consts::os::extra::{AF_PACKET};
289 #[cfg(all(unix, not(target_os = "freebsd")))]
290 pub use consts::os::extra::{MAP_STACK};
292 #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
293 pub use consts::os::bsd44::{TCP_KEEPIDLE};
295 #[cfg(any(target_os = "macos", target_os = "ios"))]
296 pub use consts::os::bsd44::{TCP_KEEPALIVE};
297 #[cfg(any(target_os = "macos", target_os = "ios"))]
298 pub use consts::os::extra::{F_FULLFSYNC};
300 #[cfg(any(target_os = "macos", target_os = "ios"))]
301 pub use types::os::arch::extra::{mach_timebase_info};
311 // Types tend to vary *per architecture* so we pull their definitions out
314 // Standard types that are opaque or common, so are not per-target.
317 /// Type used to construct void pointers for use with C.
319 /// This type is only useful as a pointer target. Do not use it as a
320 /// return type for FFI functions which have the `void` return type in
321 /// C. Use the unit type `()` or omit the return type instead.
323 /// For LLVM to recognize the void pointer type and by extension
324 /// functions like malloc(), we need to have it represented as i8* in
325 /// LLVM bitcode. The enum used here ensures this and prevents misuse
326 /// of the "raw" type by only having private variants.. We need two
327 /// variants, because the compiler complains about the repr attribute
330 #[allow(missing_copy_implementations)]
336 #[allow(missing_copy_implementations)]
338 #[allow(missing_copy_implementations)]
342 pub type int8_t = i8;
343 pub type int16_t = i16;
344 pub type int32_t = i32;
345 pub type int64_t = i64;
346 pub type uint8_t = u8;
347 pub type uint16_t = u16;
348 pub type uint32_t = u32;
349 pub type uint64_t = u64;
352 #[allow(missing_copy_implementations)]
354 #[allow(missing_copy_implementations)]
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(target_arch = "x86")]
559 use types::os::arch::c95::{c_short, c_long, time_t};
560 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
561 use types::os::arch::posix88::{mode_t, off_t};
562 use types::os::arch::posix88::{uid_t};
564 pub type nlink_t = u32;
565 pub type blksize_t = i32;
566 pub type blkcnt_t = i32;
569 #[derive(Copy)] pub struct stat {
574 pub st_nlink: nlink_t,
580 pub st_blksize: blksize_t,
581 pub st_blocks: blkcnt_t,
582 pub st_atime: time_t,
583 pub st_atime_nsec: c_long,
584 pub st_mtime: time_t,
585 pub st_mtime_nsec: c_long,
586 pub st_ctime: time_t,
587 pub st_ctime_nsec: c_long,
588 pub __unused4: c_long,
589 pub __unused5: c_long,
593 #[derive(Copy)] pub struct utimbuf {
599 #[derive(Copy)] pub struct pthread_attr_t {
603 #[cfg(target_arch = "arm")]
605 use types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
606 use types::os::arch::c99::{c_longlong, c_ulonglong};
607 use types::os::arch::posix88::{uid_t, gid_t, ino_t};
609 pub type nlink_t = u16;
610 pub type blksize_t = u32;
611 pub type blkcnt_t = u32;
614 #[derive(Copy)] pub struct stat {
615 pub st_dev: c_ulonglong,
616 pub __pad0: [c_uchar; 4],
619 pub st_nlink: c_uint,
622 pub st_rdev: c_ulonglong,
623 pub __pad3: [c_uchar; 4],
624 pub st_size: c_longlong,
625 pub st_blksize: blksize_t,
626 pub st_blocks: c_ulonglong,
627 pub st_atime: time_t,
628 pub st_atime_nsec: c_ulong,
629 pub st_mtime: time_t,
630 pub st_mtime_nsec: c_ulong,
631 pub st_ctime: time_t,
632 pub st_ctime_nsec: c_ulong,
633 pub st_ino: c_ulonglong,
637 #[derive(Copy)] pub struct utimbuf {
643 #[derive(Copy)] pub struct pthread_attr_t {
647 #[cfg(any(target_arch = "mips",
648 target_arch = "mipsel",
649 target_arch = "powerpc"))]
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 = "windows")]
1329 use types::os::arch::c95::{c_short, time_t, c_long};
1330 use types::os::arch::extra::{int64, time64_t};
1331 use types::os::arch::posix88::{dev_t, ino_t};
1333 // pub Note: this is the struct called stat64 in Windows. Not stat,
1336 #[derive(Copy)] pub struct stat {
1340 pub st_nlink: c_short,
1341 pub st_uid: c_short,
1342 pub st_gid: c_short,
1345 pub st_atime: time64_t,
1346 pub st_mtime: time64_t,
1347 pub st_ctime: time64_t,
1350 // note that this is called utimbuf64 in Windows
1352 #[derive(Copy)] pub struct utimbuf {
1353 pub actime: time64_t,
1354 pub modtime: time64_t,
1358 #[derive(Copy)] pub struct timeval {
1360 pub tv_usec: c_long,
1364 #[derive(Copy)] pub struct timespec {
1366 pub tv_nsec: c_long,
1369 #[derive(Copy)] pub enum timezone {}
1373 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1374 use types::os::arch::c99::uintptr_t;
1376 pub type SOCKET = uintptr_t;
1377 pub type socklen_t = c_int;
1378 pub type sa_family_t = u16;
1379 pub type in_port_t = u16;
1380 pub type in_addr_t = u32;
1382 #[derive(Copy)] pub struct sockaddr {
1383 pub sa_family: sa_family_t,
1384 pub sa_data: [u8; 14],
1387 #[derive(Copy)] pub struct sockaddr_storage {
1388 pub ss_family: sa_family_t,
1389 pub __ss_pad1: [u8; 6],
1390 pub __ss_align: i64,
1391 pub __ss_pad2: [u8; 112],
1394 #[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 {
1406 pub sin6_family: sa_family_t,
1407 pub sin6_port: in_port_t,
1408 pub sin6_flowinfo: u32,
1409 pub sin6_addr: in6_addr,
1410 pub sin6_scope_id: u32,
1413 #[derive(Copy)] pub struct in6_addr {
1414 pub s6_addr: [u16; 8]
1417 #[derive(Copy)] pub struct ip_mreq {
1418 pub imr_multiaddr: in_addr,
1419 pub imr_interface: in_addr,
1422 #[derive(Copy)] pub struct ip6_mreq {
1423 pub ipv6mr_multiaddr: in6_addr,
1424 pub ipv6mr_interface: c_uint,
1427 #[derive(Copy)] pub struct addrinfo {
1428 pub ai_flags: c_int,
1429 pub ai_family: c_int,
1430 pub ai_socktype: c_int,
1431 pub ai_protocol: c_int,
1432 pub ai_addrlen: size_t,
1433 pub ai_canonname: *mut c_char,
1434 pub ai_addr: *mut sockaddr,
1435 pub ai_next: *mut addrinfo,
1438 #[derive(Copy)] pub struct sockaddr_un {
1439 pub sun_family: sa_family_t,
1440 pub sun_path: [c_char; 108]
1447 pub type c_char = i8;
1448 pub type c_schar = i8;
1449 pub type c_uchar = u8;
1450 pub type c_short = i16;
1451 pub type c_ushort = u16;
1452 pub type c_int = i32;
1453 pub type c_uint = u32;
1454 pub type c_long = i32;
1455 pub type c_ulong = u32;
1456 pub type c_float = f32;
1457 pub type c_double = f64;
1459 #[cfg(target_arch = "x86")]
1460 pub type size_t = u32;
1461 #[cfg(target_arch = "x86_64")]
1462 pub type size_t = u64;
1464 #[cfg(target_arch = "x86")]
1465 pub type ptrdiff_t = i32;
1466 #[cfg(target_arch = "x86_64")]
1467 pub type ptrdiff_t = i64;
1469 pub type clock_t = i32;
1471 #[cfg(target_arch = "x86")]
1472 pub type time_t = i32;
1473 #[cfg(target_arch = "x86_64")]
1474 pub type time_t = i64;
1476 #[cfg(target_arch = "x86")]
1477 pub type suseconds_t = i32;
1478 #[cfg(target_arch = "x86_64")]
1479 pub type suseconds_t = i64;
1481 pub type wchar_t = u16;
1485 pub type c_longlong = i64;
1486 pub type c_ulonglong = u64;
1488 #[cfg(target_arch = "x86")]
1489 pub type intptr_t = i32;
1490 #[cfg(target_arch = "x86_64")]
1491 pub type intptr_t = i64;
1493 #[cfg(target_arch = "x86")]
1494 pub type uintptr_t = u32;
1495 #[cfg(target_arch = "x86_64")]
1496 pub type uintptr_t = u64;
1498 pub type intmax_t = i64;
1499 pub type uintmax_t = u64;
1503 pub type off_t = i32;
1504 pub type dev_t = u32;
1505 pub type ino_t = u16;
1507 pub type pid_t = u32;
1509 pub type useconds_t = u32;
1510 pub type mode_t = u16;
1512 #[cfg(target_arch = "x86")]
1513 pub type ssize_t = i32;
1514 #[cfg(target_arch = "x86_64")]
1515 pub type ssize_t = i64;
1525 use consts::os::extra::{MAX_PROTOCOL_CHAIN,
1527 use types::common::c95::c_void;
1528 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1529 use types::os::arch::c95::{c_long, c_ulong};
1530 use types::os::arch::c95::{wchar_t};
1531 use types::os::arch::c99::{c_ulonglong, c_longlong, uintptr_t};
1533 pub type BOOL = c_int;
1535 pub type BOOLEAN = BYTE;
1536 pub type CCHAR = c_char;
1537 pub type CHAR = c_char;
1539 pub type DWORD = c_ulong;
1540 pub type DWORDLONG = c_ulonglong;
1542 pub type HANDLE = LPVOID;
1543 pub type HMODULE = c_uint;
1545 pub type LONG = c_long;
1546 pub type PLONG = *mut c_long;
1548 #[cfg(target_arch = "x86")]
1549 pub type LONG_PTR = c_long;
1550 #[cfg(target_arch = "x86_64")]
1551 pub type LONG_PTR = i64;
1553 pub type LARGE_INTEGER = c_longlong;
1554 pub type PLARGE_INTEGER = *mut c_longlong;
1556 pub type LPCWSTR = *const WCHAR;
1557 pub type LPCSTR = *const CHAR;
1559 pub type LPWSTR = *mut WCHAR;
1560 pub type LPSTR = *mut CHAR;
1562 pub type LPWCH = *mut WCHAR;
1563 pub type LPCH = *mut CHAR;
1566 #[derive(Copy)] pub struct SECURITY_ATTRIBUTES {
1568 pub lpSecurityDescriptor: LPVOID,
1569 pub bInheritHandle: BOOL,
1571 pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
1573 pub type LPVOID = *mut c_void;
1574 pub type LPCVOID = *const c_void;
1575 pub type LPBYTE = *mut BYTE;
1576 pub type LPWORD = *mut WORD;
1577 pub type LPDWORD = *mut DWORD;
1578 pub type LPHANDLE = *mut HANDLE;
1580 pub type LRESULT = LONG_PTR;
1581 pub type PBOOL = *mut BOOL;
1582 pub type WCHAR = wchar_t;
1583 pub type WORD = u16;
1584 pub type SIZE_T = size_t;
1586 pub type time64_t = i64;
1587 pub type int64 = i64;
1590 #[derive(Copy)] pub struct STARTUPINFO {
1592 pub lpReserved: LPWSTR,
1593 pub lpDesktop: LPWSTR,
1594 pub lpTitle: LPWSTR,
1599 pub dwXCountChars: DWORD,
1600 pub dwYCountCharts: DWORD,
1601 pub dwFillAttribute: DWORD,
1603 pub wShowWindow: WORD,
1604 pub cbReserved2: WORD,
1605 pub lpReserved2: LPBYTE,
1606 pub hStdInput: HANDLE,
1607 pub hStdOutput: HANDLE,
1608 pub hStdError: HANDLE,
1610 pub type LPSTARTUPINFO = *mut STARTUPINFO;
1613 #[derive(Copy)] pub struct PROCESS_INFORMATION {
1614 pub hProcess: HANDLE,
1615 pub hThread: HANDLE,
1616 pub dwProcessId: DWORD,
1617 pub dwThreadId: DWORD,
1619 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
1622 #[derive(Copy)] pub struct SYSTEM_INFO {
1623 pub wProcessorArchitecture: WORD,
1624 pub wReserved: WORD,
1625 pub dwPageSize: DWORD,
1626 pub lpMinimumApplicationAddress: LPVOID,
1627 pub lpMaximumApplicationAddress: LPVOID,
1628 pub dwActiveProcessorMask: uintptr_t,
1629 pub dwNumberOfProcessors: DWORD,
1630 pub dwProcessorType: DWORD,
1631 pub dwAllocationGranularity: DWORD,
1632 pub wProcessorLevel: WORD,
1633 pub wProcessorRevision: WORD,
1635 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
1638 #[derive(Copy)] pub struct MEMORY_BASIC_INFORMATION {
1639 pub BaseAddress: LPVOID,
1640 pub AllocationBase: LPVOID,
1641 pub AllocationProtect: DWORD,
1642 pub RegionSize: SIZE_T,
1647 pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
1650 #[derive(Copy)] pub struct OVERLAPPED {
1651 pub Internal: *mut c_ulong,
1652 pub InternalHigh: *mut c_ulong,
1654 pub OffsetHigh: DWORD,
1658 pub type LPOVERLAPPED = *mut OVERLAPPED;
1661 #[derive(Copy)] pub struct FILETIME {
1662 pub dwLowDateTime: DWORD,
1663 pub dwHighDateTime: DWORD,
1666 pub type LPFILETIME = *mut FILETIME;
1669 #[derive(Copy)] pub struct GUID {
1673 pub Data4: [BYTE; 8],
1677 #[derive(Copy)] pub struct WSAPROTOCOLCHAIN {
1678 pub ChainLen: c_int,
1679 pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as uint],
1682 pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
1685 #[derive(Copy)] pub struct WSAPROTOCOL_INFO {
1686 pub dwServiceFlags1: DWORD,
1687 pub dwServiceFlags2: DWORD,
1688 pub dwServiceFlags3: DWORD,
1689 pub dwServiceFlags4: DWORD,
1690 pub dwProviderFlags: DWORD,
1691 pub ProviderId: GUID,
1692 pub dwCatalogEntryId: DWORD,
1693 pub ProtocolChain: WSAPROTOCOLCHAIN,
1694 pub iVersion: c_int,
1695 pub iAddressFamily: c_int,
1696 pub iMaxSockAddr: c_int,
1697 pub iMinSockAddr: c_int,
1698 pub iSocketType: c_int,
1699 pub iProtocol: c_int,
1700 pub iProtocolMaxOffset: c_int,
1701 pub iNetworkByteOrder: c_int,
1702 pub iSecurityScheme: c_int,
1703 pub dwMessageSize: DWORD,
1704 pub dwProviderReserved: DWORD,
1705 pub szProtocol: [u8; (WSAPROTOCOL_LEN as uint) + 1u],
1708 pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
1710 pub type GROUP = c_uint;
1713 #[derive(Copy)] pub struct WIN32_FIND_DATAW {
1714 pub dwFileAttributes: DWORD,
1715 pub ftCreationTime: FILETIME,
1716 pub ftLastAccessTime: FILETIME,
1717 pub ftLastWriteTime: FILETIME,
1718 pub nFileSizeHigh: DWORD,
1719 pub nFileSizeLow: DWORD,
1720 pub dwReserved0: DWORD,
1721 pub dwReserved1: DWORD,
1722 pub cFileName: [wchar_t; 260], // #define MAX_PATH 260
1723 pub cAlternateFileName: [wchar_t; 14],
1726 pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
1731 #[cfg(any(target_os = "macos", target_os = "ios"))]
1735 use types::common::c95::c_void;
1736 use types::os::arch::c95::{c_char, c_int, size_t, time_t};
1737 use types::os::arch::c95::{suseconds_t, c_long};
1738 use types::os::arch::c99::{uintptr_t};
1740 pub type pthread_t = uintptr_t;
1743 #[derive(Copy)] pub struct glob_t {
1744 pub gl_pathc: size_t,
1745 pub __unused1: c_int,
1746 pub gl_offs: size_t,
1747 pub __unused2: c_int,
1748 pub gl_pathv: *mut *mut c_char,
1750 pub __unused3: *mut c_void,
1752 pub __unused4: *mut c_void,
1753 pub __unused5: *mut c_void,
1754 pub __unused6: *mut c_void,
1755 pub __unused7: *mut c_void,
1756 pub __unused8: *mut c_void,
1760 #[derive(Copy)] pub struct timeval {
1762 pub tv_usec: suseconds_t,
1766 #[derive(Copy)] pub struct timespec {
1768 pub tv_nsec: c_long,
1771 #[derive(Copy)] pub enum timezone {}
1773 pub type sighandler_t = size_t;
1777 use types::common::c95::{c_void};
1778 use types::os::arch::c95::{c_char, c_int, c_uint};
1780 pub type socklen_t = c_int;
1781 pub type sa_family_t = u8;
1782 pub type in_port_t = u16;
1783 pub type in_addr_t = u32;
1785 #[derive(Copy)] pub struct sockaddr {
1787 pub sa_family: sa_family_t,
1788 pub sa_data: [u8; 14],
1792 #[derive(Copy)] pub struct sockaddr_storage {
1794 pub ss_family: sa_family_t,
1795 pub __ss_pad1: [u8; 6],
1796 pub __ss_align: i64,
1797 pub __ss_pad2: [u8; 112],
1801 #[derive(Copy)] pub struct sockaddr_in {
1803 pub sin_family: sa_family_t,
1804 pub sin_port: in_port_t,
1805 pub sin_addr: in_addr,
1806 pub sin_zero: [u8; 8],
1810 #[derive(Copy)] pub struct in_addr {
1811 pub s_addr: in_addr_t,
1815 #[derive(Copy)] pub struct sockaddr_in6 {
1817 pub sin6_family: sa_family_t,
1818 pub sin6_port: in_port_t,
1819 pub sin6_flowinfo: u32,
1820 pub sin6_addr: in6_addr,
1821 pub sin6_scope_id: u32,
1825 #[derive(Copy)] pub struct in6_addr {
1826 pub s6_addr: [u16; 8]
1830 #[derive(Copy)] pub struct ip_mreq {
1831 pub imr_multiaddr: in_addr,
1832 pub imr_interface: in_addr,
1836 #[derive(Copy)] pub struct ip6_mreq {
1837 pub ipv6mr_multiaddr: in6_addr,
1838 pub ipv6mr_interface: c_uint,
1842 #[derive(Copy)] pub struct addrinfo {
1843 pub ai_flags: c_int,
1844 pub ai_family: c_int,
1845 pub ai_socktype: c_int,
1846 pub ai_protocol: c_int,
1847 pub ai_addrlen: socklen_t,
1848 pub ai_canonname: *mut c_char,
1849 pub ai_addr: *mut sockaddr,
1850 pub ai_next: *mut addrinfo,
1854 #[derive(Copy)] pub struct sockaddr_un {
1856 pub sun_family: sa_family_t,
1857 pub sun_path: [c_char; 104]
1861 #[derive(Copy)] pub struct ifaddrs {
1862 pub ifa_next: *mut ifaddrs,
1863 pub ifa_name: *mut c_char,
1864 pub ifa_flags: c_uint,
1865 pub ifa_addr: *mut sockaddr,
1866 pub ifa_netmask: *mut sockaddr,
1867 pub ifa_dstaddr: *mut sockaddr,
1868 pub ifa_data: *mut c_void
1873 #[cfg(any(target_arch = "arm", target_arch = "x86"))]
1876 pub type c_char = i8;
1877 pub type c_schar = i8;
1878 pub type c_uchar = u8;
1879 pub type c_short = i16;
1880 pub type c_ushort = u16;
1881 pub type c_int = i32;
1882 pub type c_uint = u32;
1883 pub type c_long = i32;
1884 pub type c_ulong = u32;
1885 pub type c_float = f32;
1886 pub type c_double = f64;
1887 pub type size_t = u32;
1888 pub type ptrdiff_t = i32;
1889 pub type clock_t = u32;
1890 pub type time_t = i32;
1891 pub type suseconds_t = i32;
1892 pub type wchar_t = i32;
1895 pub type c_longlong = i64;
1896 pub type c_ulonglong = u64;
1897 pub type intptr_t = i32;
1898 pub type uintptr_t = u32;
1899 pub type intmax_t = i64;
1900 pub type uintmax_t = u64;
1903 pub type off_t = i64;
1904 pub type dev_t = i32;
1905 pub type ino_t = u64;
1906 pub type pid_t = i32;
1907 pub type uid_t = u32;
1908 pub type gid_t = u32;
1909 pub type useconds_t = u32;
1910 pub type mode_t = u16;
1911 pub type ssize_t = i32;
1914 use types::common::c99::{int32_t, int64_t, uint32_t};
1915 use types::os::arch::c95::{c_char, c_long, time_t};
1916 use types::os::arch::posix88::{dev_t, gid_t, ino_t,
1917 mode_t, off_t, uid_t};
1919 pub type nlink_t = u16;
1920 pub type blksize_t = i64;
1921 pub type blkcnt_t = i32;
1924 #[derive(Copy)] pub struct stat {
1926 pub st_mode: mode_t,
1927 pub st_nlink: nlink_t,
1932 pub st_atime: time_t,
1933 pub st_atime_nsec: c_long,
1934 pub st_mtime: time_t,
1935 pub st_mtime_nsec: c_long,
1936 pub st_ctime: time_t,
1937 pub st_ctime_nsec: c_long,
1938 pub st_birthtime: time_t,
1939 pub st_birthtime_nsec: c_long,
1941 pub st_blocks: blkcnt_t,
1942 pub st_blksize: blksize_t,
1943 pub st_flags: uint32_t,
1944 pub st_gen: uint32_t,
1945 pub st_lspare: int32_t,
1946 pub st_qspare: [int64_t; 2],
1950 #[derive(Copy)] pub struct utimbuf {
1952 pub modtime: time_t,
1956 #[derive(Copy)] pub struct pthread_attr_t {
1958 pub __opaque: [c_char; 36]
1967 #[derive(Copy)] pub struct mach_timebase_info {
1972 pub type mach_timebase_info_data_t = mach_timebase_info;
1976 #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
1979 pub type c_char = i8;
1980 pub type c_schar = i8;
1981 pub type c_uchar = u8;
1982 pub type c_short = i16;
1983 pub type c_ushort = u16;
1984 pub type c_int = i32;
1985 pub type c_uint = u32;
1986 pub type c_long = i64;
1987 pub type c_ulong = u64;
1988 pub type c_float = f32;
1989 pub type c_double = f64;
1990 pub type size_t = u64;
1991 pub type ptrdiff_t = i64;
1992 pub type clock_t = u64;
1993 pub type time_t = i64;
1994 pub type suseconds_t = i32;
1995 pub type wchar_t = i32;
1998 pub type c_longlong = i64;
1999 pub type c_ulonglong = u64;
2000 pub type intptr_t = i64;
2001 pub type uintptr_t = u64;
2002 pub type intmax_t = i64;
2003 pub type uintmax_t = u64;
2006 pub type off_t = i64;
2007 pub type dev_t = i32;
2008 pub type ino_t = u64;
2009 pub type pid_t = i32;
2010 pub type uid_t = u32;
2011 pub type gid_t = u32;
2012 pub type useconds_t = u32;
2013 pub type mode_t = u16;
2014 pub type ssize_t = i64;
2017 use types::common::c99::{int32_t, int64_t};
2018 use types::common::c99::{uint32_t};
2019 use types::os::arch::c95::{c_char, c_long, time_t};
2020 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
2021 use types::os::arch::posix88::{mode_t, off_t, uid_t};
2023 pub type nlink_t = u16;
2024 pub type blksize_t = i64;
2025 pub type blkcnt_t = i32;
2028 #[derive(Copy)] pub struct stat {
2030 pub st_mode: mode_t,
2031 pub st_nlink: nlink_t,
2036 pub st_atime: time_t,
2037 pub st_atime_nsec: c_long,
2038 pub st_mtime: time_t,
2039 pub st_mtime_nsec: c_long,
2040 pub st_ctime: time_t,
2041 pub st_ctime_nsec: c_long,
2042 pub st_birthtime: time_t,
2043 pub st_birthtime_nsec: c_long,
2045 pub st_blocks: blkcnt_t,
2046 pub st_blksize: blksize_t,
2047 pub st_flags: uint32_t,
2048 pub st_gen: uint32_t,
2049 pub st_lspare: int32_t,
2050 pub st_qspare: [int64_t; 2],
2054 #[derive(Copy)] pub struct utimbuf {
2056 pub modtime: time_t,
2060 #[derive(Copy)] pub struct pthread_attr_t {
2062 pub __opaque: [c_char; 56]
2071 #[derive(Copy)] pub struct mach_timebase_info {
2076 pub type mach_timebase_info_data_t = mach_timebase_info;
2083 // Consts tend to vary per OS so we pull their definitions out
2084 // into this module.
2086 #[cfg(target_os = "windows")]
2089 use types::os::arch::c95::{c_int, c_uint};
2091 pub const EXIT_FAILURE : c_int = 1;
2092 pub const EXIT_SUCCESS : c_int = 0;
2093 pub const RAND_MAX : c_int = 32767;
2094 pub const EOF : c_int = -1;
2095 pub const SEEK_SET : c_int = 0;
2096 pub const SEEK_CUR : c_int = 1;
2097 pub const SEEK_END : c_int = 2;
2098 pub const _IOFBF : c_int = 0;
2099 pub const _IONBF : c_int = 4;
2100 pub const _IOLBF : c_int = 64;
2101 pub const BUFSIZ : c_uint = 512_u32;
2102 pub const FOPEN_MAX : c_uint = 20_u32;
2103 pub const FILENAME_MAX : c_uint = 260_u32;
2104 pub const L_tmpnam : c_uint = 16_u32;
2105 pub const TMP_MAX : c_uint = 32767_u32;
2107 pub const WSAEINTR: c_int = 10004;
2108 pub const WSAEBADF: c_int = 10009;
2109 pub const WSAEACCES: c_int = 10013;
2110 pub const WSAEFAULT: c_int = 10014;
2111 pub const WSAEINVAL: c_int = 10022;
2112 pub const WSAEMFILE: c_int = 10024;
2113 pub const WSAEWOULDBLOCK: c_int = 10035;
2114 pub const WSAEINPROGRESS: c_int = 10036;
2115 pub const WSAEALREADY: c_int = 10037;
2116 pub const WSAENOTSOCK: c_int = 10038;
2117 pub const WSAEDESTADDRREQ: c_int = 10039;
2118 pub const WSAEMSGSIZE: c_int = 10040;
2119 pub const WSAEPROTOTYPE: c_int = 10041;
2120 pub const WSAENOPROTOOPT: c_int = 10042;
2121 pub const WSAEPROTONOSUPPORT: c_int = 10043;
2122 pub const WSAESOCKTNOSUPPORT: c_int = 10044;
2123 pub const WSAEOPNOTSUPP: c_int = 10045;
2124 pub const WSAEPFNOSUPPORT: c_int = 10046;
2125 pub const WSAEAFNOSUPPORT: c_int = 10047;
2126 pub const WSAEADDRINUSE: c_int = 10048;
2127 pub const WSAEADDRNOTAVAIL: c_int = 10049;
2128 pub const WSAENETDOWN: c_int = 10050;
2129 pub const WSAENETUNREACH: c_int = 10051;
2130 pub const WSAENETRESET: c_int = 10052;
2131 pub const WSAECONNABORTED: c_int = 10053;
2132 pub const WSAECONNRESET: c_int = 10054;
2133 pub const WSAENOBUFS: c_int = 10055;
2134 pub const WSAEISCONN: c_int = 10056;
2135 pub const WSAENOTCONN: c_int = 10057;
2136 pub const WSAESHUTDOWN: c_int = 10058;
2137 pub const WSAETOOMANYREFS: c_int = 10059;
2138 pub const WSAETIMEDOUT: c_int = 10060;
2139 pub const WSAECONNREFUSED: c_int = 10061;
2140 pub const WSAELOOP: c_int = 10062;
2141 pub const WSAENAMETOOLONG: c_int = 10063;
2142 pub const WSAEHOSTDOWN: c_int = 10064;
2143 pub const WSAEHOSTUNREACH: c_int = 10065;
2144 pub const WSAENOTEMPTY: c_int = 10066;
2145 pub const WSAEPROCLIM: c_int = 10067;
2146 pub const WSAEUSERS: c_int = 10068;
2147 pub const WSAEDQUOT: c_int = 10069;
2148 pub const WSAESTALE: c_int = 10070;
2149 pub const WSAEREMOTE: c_int = 10071;
2150 pub const WSASYSNOTREADY: c_int = 10091;
2151 pub const WSAVERNOTSUPPORTED: c_int = 10092;
2152 pub const WSANOTINITIALISED: c_int = 10093;
2153 pub const WSAEDISCON: c_int = 10101;
2154 pub const WSAENOMORE: c_int = 10102;
2155 pub const WSAECANCELLED: c_int = 10103;
2156 pub const WSAEINVALIDPROCTABLE: c_int = 10104;
2157 pub const WSAEINVALIDPROVIDER: c_int = 10105;
2158 pub const WSAEPROVIDERFAILEDINIT: c_int = 10106;
2163 use types::os::arch::c95::c_int;
2165 pub const O_RDONLY : c_int = 0;
2166 pub const O_WRONLY : c_int = 1;
2167 pub const O_RDWR : c_int = 2;
2168 pub const O_APPEND : c_int = 8;
2169 pub const O_CREAT : c_int = 256;
2170 pub const O_EXCL : c_int = 1024;
2171 pub const O_TRUNC : c_int = 512;
2172 pub const S_IFIFO : c_int = 4096;
2173 pub const S_IFCHR : c_int = 8192;
2174 pub const S_IFBLK : c_int = 12288;
2175 pub const S_IFDIR : c_int = 16384;
2176 pub const S_IFREG : c_int = 32768;
2177 pub const S_IFLNK : c_int = 40960;
2178 pub const S_IFMT : c_int = 61440;
2179 pub const S_IEXEC : c_int = 64;
2180 pub const S_IWRITE : c_int = 128;
2181 pub const S_IREAD : c_int = 256;
2182 pub const S_IRWXU : c_int = 448;
2183 pub const S_IXUSR : c_int = 64;
2184 pub const S_IWUSR : c_int = 128;
2185 pub const S_IRUSR : c_int = 256;
2186 pub const F_OK : c_int = 0;
2187 pub const R_OK : c_int = 4;
2188 pub const W_OK : c_int = 2;
2189 pub const X_OK : c_int = 1;
2190 pub const STDIN_FILENO : c_int = 0;
2191 pub const STDOUT_FILENO : c_int = 1;
2192 pub const STDERR_FILENO : c_int = 2;
2199 use types::os::arch::c95::c_int;
2201 pub const AF_INET: c_int = 2;
2202 pub const AF_INET6: c_int = 23;
2203 pub const SOCK_STREAM: c_int = 1;
2204 pub const SOCK_DGRAM: c_int = 2;
2205 pub const SOCK_RAW: c_int = 3;
2206 pub const IPPROTO_TCP: c_int = 6;
2207 pub const IPPROTO_IP: c_int = 0;
2208 pub const IPPROTO_IPV6: c_int = 41;
2209 pub const IP_MULTICAST_TTL: c_int = 3;
2210 pub const IP_MULTICAST_LOOP: c_int = 4;
2211 pub const IP_ADD_MEMBERSHIP: c_int = 5;
2212 pub const IP_DROP_MEMBERSHIP: c_int = 6;
2213 pub const IPV6_ADD_MEMBERSHIP: c_int = 5;
2214 pub const IPV6_DROP_MEMBERSHIP: c_int = 6;
2215 pub const IP_TTL: c_int = 4;
2216 pub const IP_HDRINCL: c_int = 2;
2218 pub const TCP_NODELAY: c_int = 0x0001;
2219 pub const SOL_SOCKET: c_int = 0xffff;
2220 pub const SO_KEEPALIVE: c_int = 8;
2221 pub const SO_BROADCAST: c_int = 32;
2222 pub const SO_REUSEADDR: c_int = 4;
2223 pub const SO_ERROR: c_int = 0x1007;
2225 pub const IFF_LOOPBACK: c_int = 4;
2227 pub const SHUT_RD: c_int = 0;
2228 pub const SHUT_WR: c_int = 1;
2229 pub const SHUT_RDWR: c_int = 2;
2232 use types::os::arch::c95::{c_int, c_long};
2233 use types::os::arch::extra::{WORD, DWORD, BOOL, HANDLE};
2235 pub const TRUE : BOOL = 1;
2236 pub const FALSE : BOOL = 0;
2238 pub const O_TEXT : c_int = 16384;
2239 pub const O_BINARY : c_int = 32768;
2240 pub const O_NOINHERIT: c_int = 128;
2242 pub const ERROR_SUCCESS : c_int = 0;
2243 pub const ERROR_INVALID_FUNCTION: c_int = 1;
2244 pub const ERROR_FILE_NOT_FOUND: c_int = 2;
2245 pub const ERROR_ACCESS_DENIED: c_int = 5;
2246 pub const ERROR_INVALID_HANDLE : c_int = 6;
2247 pub const ERROR_BROKEN_PIPE: c_int = 109;
2248 pub const ERROR_DISK_FULL : c_int = 112;
2249 pub const ERROR_CALL_NOT_IMPLEMENTED : c_int = 120;
2250 pub const ERROR_INSUFFICIENT_BUFFER : c_int = 122;
2251 pub const ERROR_INVALID_NAME : c_int = 123;
2252 pub const ERROR_ALREADY_EXISTS : c_int = 183;
2253 pub const ERROR_PIPE_BUSY: c_int = 231;
2254 pub const ERROR_NO_DATA: c_int = 232;
2255 pub const ERROR_INVALID_ADDRESS : c_int = 487;
2256 pub const ERROR_PIPE_CONNECTED: c_int = 535;
2257 pub const ERROR_NOTHING_TO_TERMINATE: c_int = 758;
2258 pub const ERROR_OPERATION_ABORTED: c_int = 995;
2259 pub const ERROR_IO_PENDING: c_int = 997;
2260 pub const ERROR_FILE_INVALID : c_int = 1006;
2261 pub const ERROR_NOT_FOUND: c_int = 1168;
2262 pub const INVALID_HANDLE_VALUE: HANDLE = -1 as HANDLE;
2264 pub const DELETE : DWORD = 0x00010000;
2265 pub const READ_CONTROL : DWORD = 0x00020000;
2266 pub const SYNCHRONIZE : DWORD = 0x00100000;
2267 pub const WRITE_DAC : DWORD = 0x00040000;
2268 pub const WRITE_OWNER : DWORD = 0x00080000;
2270 pub const PROCESS_CREATE_PROCESS : DWORD = 0x0080;
2271 pub const PROCESS_CREATE_THREAD : DWORD = 0x0002;
2272 pub const PROCESS_DUP_HANDLE : DWORD = 0x0040;
2273 pub const PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
2274 pub const PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
2275 pub const PROCESS_SET_INFORMATION : DWORD = 0x0200;
2276 pub const PROCESS_SET_QUOTA : DWORD = 0x0100;
2277 pub const PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
2278 pub const PROCESS_TERMINATE : DWORD = 0x0001;
2279 pub const PROCESS_VM_OPERATION : DWORD = 0x0008;
2280 pub const PROCESS_VM_READ : DWORD = 0x0010;
2281 pub const PROCESS_VM_WRITE : DWORD = 0x0020;
2283 pub const STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
2284 pub const STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
2285 pub const STARTF_PREVENTPINNING : DWORD = 0x00002000;
2286 pub const STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
2287 pub const STARTF_TITLEISAPPID : DWORD = 0x00001000;
2288 pub const STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
2289 pub const STARTF_USECOUNTCHARS : DWORD = 0x00000008;
2290 pub const STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
2291 pub const STARTF_USEHOTKEY : DWORD = 0x00000200;
2292 pub const STARTF_USEPOSITION : DWORD = 0x00000004;
2293 pub const STARTF_USESHOWWINDOW : DWORD = 0x00000001;
2294 pub const STARTF_USESIZE : DWORD = 0x00000002;
2295 pub const STARTF_USESTDHANDLES : DWORD = 0x00000100;
2297 pub const WAIT_ABANDONED : DWORD = 0x00000080;
2298 pub const WAIT_OBJECT_0 : DWORD = 0x00000000;
2299 pub const WAIT_TIMEOUT : DWORD = 0x00000102;
2300 pub const WAIT_FAILED : DWORD = -1;
2302 pub const DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
2303 pub const DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;
2305 pub const INFINITE : DWORD = -1;
2306 pub const STILL_ACTIVE : DWORD = 259;
2308 pub const MEM_COMMIT : DWORD = 0x00001000;
2309 pub const MEM_RESERVE : DWORD = 0x00002000;
2310 pub const MEM_DECOMMIT : DWORD = 0x00004000;
2311 pub const MEM_RELEASE : DWORD = 0x00008000;
2312 pub const MEM_RESET : DWORD = 0x00080000;
2313 pub const MEM_RESET_UNDO : DWORD = 0x1000000;
2314 pub const MEM_LARGE_PAGES : DWORD = 0x20000000;
2315 pub const MEM_PHYSICAL : DWORD = 0x00400000;
2316 pub const MEM_TOP_DOWN : DWORD = 0x00100000;
2317 pub const MEM_WRITE_WATCH : DWORD = 0x00200000;
2319 pub const PAGE_EXECUTE : DWORD = 0x10;
2320 pub const PAGE_EXECUTE_READ : DWORD = 0x20;
2321 pub const PAGE_EXECUTE_READWRITE : DWORD = 0x40;
2322 pub const PAGE_EXECUTE_WRITECOPY : DWORD = 0x80;
2323 pub const PAGE_NOACCESS : DWORD = 0x01;
2324 pub const PAGE_READONLY : DWORD = 0x02;
2325 pub const PAGE_READWRITE : DWORD = 0x04;
2326 pub const PAGE_WRITECOPY : DWORD = 0x08;
2327 pub const PAGE_GUARD : DWORD = 0x100;
2328 pub const PAGE_NOCACHE : DWORD = 0x200;
2329 pub const PAGE_WRITECOMBINE : DWORD = 0x400;
2331 pub const SEC_COMMIT : DWORD = 0x8000000;
2332 pub const SEC_IMAGE : DWORD = 0x1000000;
2333 pub const SEC_IMAGE_NO_EXECUTE : DWORD = 0x11000000;
2334 pub const SEC_LARGE_PAGES : DWORD = 0x80000000;
2335 pub const SEC_NOCACHE : DWORD = 0x10000000;
2336 pub const SEC_RESERVE : DWORD = 0x4000000;
2337 pub const SEC_WRITECOMBINE : DWORD = 0x40000000;
2339 pub const FILE_MAP_ALL_ACCESS : DWORD = 0xf001f;
2340 pub const FILE_MAP_READ : DWORD = 0x4;
2341 pub const FILE_MAP_WRITE : DWORD = 0x2;
2342 pub const FILE_MAP_COPY : DWORD = 0x1;
2343 pub const FILE_MAP_EXECUTE : DWORD = 0x20;
2345 pub const PROCESSOR_ARCHITECTURE_INTEL : WORD = 0;
2346 pub const PROCESSOR_ARCHITECTURE_ARM : WORD = 5;
2347 pub const PROCESSOR_ARCHITECTURE_IA64 : WORD = 6;
2348 pub const PROCESSOR_ARCHITECTURE_AMD64 : WORD = 9;
2349 pub const PROCESSOR_ARCHITECTURE_UNKNOWN : WORD = 0xffff;
2351 pub const MOVEFILE_COPY_ALLOWED: DWORD = 2;
2352 pub const MOVEFILE_CREATE_HARDLINK: DWORD = 16;
2353 pub const MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 4;
2354 pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 32;
2355 pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1;
2356 pub const MOVEFILE_WRITE_THROUGH: DWORD = 8;
2358 pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 1;
2360 pub const FILE_SHARE_DELETE: DWORD = 0x4;
2361 pub const FILE_SHARE_READ: DWORD = 0x1;
2362 pub const FILE_SHARE_WRITE: DWORD = 0x2;
2364 pub const CREATE_ALWAYS: DWORD = 2;
2365 pub const CREATE_NEW: DWORD = 1;
2366 pub const OPEN_ALWAYS: DWORD = 4;
2367 pub const OPEN_EXISTING: DWORD = 3;
2368 pub const TRUNCATE_EXISTING: DWORD = 5;
2370 pub const FILE_APPEND_DATA: DWORD = 0x00000004;
2371 pub const FILE_READ_DATA: DWORD = 0x00000001;
2372 pub const FILE_WRITE_DATA: DWORD = 0x00000002;
2374 pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x20;
2375 pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x800;
2376 pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x40;
2377 pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
2378 pub const FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x4000;
2379 pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x2;
2380 pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x8000;
2381 pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x80;
2382 pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x2000;
2383 pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x20000;
2384 pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x1000;
2385 pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
2386 pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
2387 pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x200;
2388 pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x4;
2389 pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x100;
2390 pub const FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x10000;
2392 pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
2393 pub const FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000;
2394 pub const FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000;
2395 pub const FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000;
2396 pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
2397 pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
2398 pub const FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x0100000;
2399 pub const FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000;
2400 pub const FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000;
2401 pub const FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000;
2402 pub const FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000;
2403 pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
2405 pub const FILE_NAME_NORMALIZED: DWORD = 0x0;
2406 pub const FILE_NAME_OPENED: DWORD = 0x8;
2408 pub const VOLUME_NAME_DOS: DWORD = 0x0;
2409 pub const VOLUME_NAME_GUID: DWORD = 0x1;
2410 pub const VOLUME_NAME_NONE: DWORD = 0x4;
2411 pub const VOLUME_NAME_NT: DWORD = 0x2;
2413 pub const GENERIC_READ: DWORD = 0x80000000;
2414 pub const GENERIC_WRITE: DWORD = 0x40000000;
2415 pub const GENERIC_EXECUTE: DWORD = 0x20000000;
2416 pub const GENERIC_ALL: DWORD = 0x10000000;
2417 pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
2418 pub const FILE_READ_ATTRIBUTES: DWORD = 0x00000080;
2420 pub const STANDARD_RIGHTS_READ: DWORD = 0x20000;
2421 pub const STANDARD_RIGHTS_WRITE: DWORD = 0x20000;
2422 pub const FILE_WRITE_EA: DWORD = 0x00000010;
2423 pub const FILE_READ_EA: DWORD = 0x00000008;
2424 pub const FILE_GENERIC_READ: DWORD =
2425 STANDARD_RIGHTS_READ | FILE_READ_DATA |
2426 FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE;
2427 pub const FILE_GENERIC_WRITE: DWORD =
2428 STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA |
2429 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA |
2432 pub const FILE_BEGIN: DWORD = 0;
2433 pub const FILE_CURRENT: DWORD = 1;
2434 pub const FILE_END: DWORD = 2;
2436 pub const MAX_PROTOCOL_CHAIN: DWORD = 7;
2437 pub const WSAPROTOCOL_LEN: DWORD = 255;
2438 pub const INVALID_SOCKET: DWORD = !0;
2440 pub const DETACHED_PROCESS: DWORD = 0x00000008;
2441 pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
2442 pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
2444 pub const PIPE_ACCESS_DUPLEX: DWORD = 0x00000003;
2445 pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
2446 pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
2447 pub const PIPE_TYPE_BYTE: DWORD = 0x00000000;
2448 pub const PIPE_TYPE_MESSAGE: DWORD = 0x00000004;
2449 pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
2450 pub const PIPE_READMODE_MESSAGE: DWORD = 0x00000002;
2451 pub const PIPE_WAIT: DWORD = 0x00000000;
2452 pub const PIPE_NOWAIT: DWORD = 0x00000001;
2453 pub const PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000;
2454 pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
2455 pub const PIPE_UNLIMITED_INSTANCES: DWORD = 255;
2457 pub const IPPROTO_RAW: c_int = 255;
2459 pub const FIONBIO: c_long = -0x7FFB9982;
2466 #[cfg(any(target_os = "linux", target_os = "android"))]
2469 use types::os::arch::c95::{c_int, c_uint};
2471 pub const EXIT_FAILURE : c_int = 1;
2472 pub const EXIT_SUCCESS : c_int = 0;
2473 pub const RAND_MAX : c_int = 2147483647;
2474 pub const EOF : c_int = -1;
2475 pub const SEEK_SET : c_int = 0;
2476 pub const SEEK_CUR : c_int = 1;
2477 pub const SEEK_END : c_int = 2;
2478 pub const _IOFBF : c_int = 0;
2479 pub const _IONBF : c_int = 2;
2480 pub const _IOLBF : c_int = 1;
2481 pub const BUFSIZ : c_uint = 8192_u32;
2482 pub const FOPEN_MAX : c_uint = 16_u32;
2483 pub const FILENAME_MAX : c_uint = 4096_u32;
2484 pub const L_tmpnam : c_uint = 20_u32;
2485 pub const TMP_MAX : c_uint = 238328_u32;
2489 #[cfg(any(target_arch = "x86",
2490 target_arch = "x86_64",
2491 target_arch = "arm",
2492 target_arch = "aarch64"))]
2494 use types::os::arch::c95::c_int;
2495 use types::common::c95::c_void;
2496 use types::os::arch::posix88::mode_t;
2498 pub const O_RDONLY : c_int = 0;
2499 pub const O_WRONLY : c_int = 1;
2500 pub const O_RDWR : c_int = 2;
2501 pub const O_APPEND : c_int = 1024;
2502 pub const O_CREAT : c_int = 64;
2503 pub const O_EXCL : c_int = 128;
2504 pub const O_TRUNC : c_int = 512;
2505 pub const S_IFIFO : mode_t = 4096;
2506 pub const S_IFCHR : mode_t = 8192;
2507 pub const S_IFBLK : mode_t = 24576;
2508 pub const S_IFDIR : mode_t = 16384;
2509 pub const S_IFREG : mode_t = 32768;
2510 pub const S_IFLNK : mode_t = 40960;
2511 pub const S_IFMT : mode_t = 61440;
2512 pub const S_IEXEC : mode_t = 64;
2513 pub const S_IWRITE : mode_t = 128;
2514 pub const S_IREAD : mode_t = 256;
2515 pub const S_IRWXU : mode_t = 448;
2516 pub const S_IXUSR : mode_t = 64;
2517 pub const S_IWUSR : mode_t = 128;
2518 pub const S_IRUSR : mode_t = 256;
2519 pub const F_OK : c_int = 0;
2520 pub const R_OK : c_int = 4;
2521 pub const W_OK : c_int = 2;
2522 pub const X_OK : c_int = 1;
2523 pub const STDIN_FILENO : c_int = 0;
2524 pub const STDOUT_FILENO : c_int = 1;
2525 pub const STDERR_FILENO : c_int = 2;
2526 pub const F_LOCK : c_int = 1;
2527 pub const F_TEST : c_int = 3;
2528 pub const F_TLOCK : c_int = 2;
2529 pub const F_ULOCK : c_int = 0;
2530 pub const SIGHUP : c_int = 1;
2531 pub const SIGINT : c_int = 2;
2532 pub const SIGQUIT : c_int = 3;
2533 pub const SIGILL : c_int = 4;
2534 pub const SIGABRT : c_int = 6;
2535 pub const SIGFPE : c_int = 8;
2536 pub const SIGKILL : c_int = 9;
2537 pub const SIGSEGV : c_int = 11;
2538 pub const SIGPIPE : c_int = 13;
2539 pub const SIGALRM : c_int = 14;
2540 pub const SIGTERM : c_int = 15;
2542 pub const PROT_NONE : c_int = 0;
2543 pub const PROT_READ : c_int = 1;
2544 pub const PROT_WRITE : c_int = 2;
2545 pub const PROT_EXEC : c_int = 4;
2547 pub const MAP_FILE : c_int = 0x0000;
2548 pub const MAP_SHARED : c_int = 0x0001;
2549 pub const MAP_PRIVATE : c_int = 0x0002;
2550 pub const MAP_FIXED : c_int = 0x0010;
2551 pub const MAP_ANON : c_int = 0x0020;
2553 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
2555 pub const MCL_CURRENT : c_int = 0x0001;
2556 pub const MCL_FUTURE : c_int = 0x0002;
2558 pub const MS_ASYNC : c_int = 0x0001;
2559 pub const MS_INVALIDATE : c_int = 0x0002;
2560 pub const MS_SYNC : c_int = 0x0004;
2562 pub const EPERM : c_int = 1;
2563 pub const ENOENT : c_int = 2;
2564 pub const ESRCH : c_int = 3;
2565 pub const EINTR : c_int = 4;
2566 pub const EIO : c_int = 5;
2567 pub const ENXIO : c_int = 6;
2568 pub const E2BIG : c_int = 7;
2569 pub const ENOEXEC : c_int = 8;
2570 pub const EBADF : c_int = 9;
2571 pub const ECHILD : c_int = 10;
2572 pub const EAGAIN : c_int = 11;
2573 pub const ENOMEM : c_int = 12;
2574 pub const EACCES : c_int = 13;
2575 pub const EFAULT : c_int = 14;
2576 pub const ENOTBLK : c_int = 15;
2577 pub const EBUSY : c_int = 16;
2578 pub const EEXIST : c_int = 17;
2579 pub const EXDEV : c_int = 18;
2580 pub const ENODEV : c_int = 19;
2581 pub const ENOTDIR : c_int = 20;
2582 pub const EISDIR : c_int = 21;
2583 pub const EINVAL : c_int = 22;
2584 pub const ENFILE : c_int = 23;
2585 pub const EMFILE : c_int = 24;
2586 pub const ENOTTY : c_int = 25;
2587 pub const ETXTBSY : c_int = 26;
2588 pub const EFBIG : c_int = 27;
2589 pub const ENOSPC : c_int = 28;
2590 pub const ESPIPE : c_int = 29;
2591 pub const EROFS : c_int = 30;
2592 pub const EMLINK : c_int = 31;
2593 pub const EPIPE : c_int = 32;
2594 pub const EDOM : c_int = 33;
2595 pub const ERANGE : c_int = 34;
2597 pub const EDEADLK: c_int = 35;
2598 pub const ENAMETOOLONG: c_int = 36;
2599 pub const ENOLCK: c_int = 37;
2600 pub const ENOSYS: c_int = 38;
2601 pub const ENOTEMPTY: c_int = 39;
2602 pub const ELOOP: c_int = 40;
2603 pub const EWOULDBLOCK: c_int = EAGAIN;
2604 pub const ENOMSG: c_int = 42;
2605 pub const EIDRM: c_int = 43;
2606 pub const ECHRNG: c_int = 44;
2607 pub const EL2NSYNC: c_int = 45;
2608 pub const EL3HLT: c_int = 46;
2609 pub const EL3RST: c_int = 47;
2610 pub const ELNRNG: c_int = 48;
2611 pub const EUNATCH: c_int = 49;
2612 pub const ENOCSI: c_int = 50;
2613 pub const EL2HLT: c_int = 51;
2614 pub const EBADE: c_int = 52;
2615 pub const EBADR: c_int = 53;
2616 pub const EXFULL: c_int = 54;
2617 pub const ENOANO: c_int = 55;
2618 pub const EBADRQC: c_int = 56;
2619 pub const EBADSLT: c_int = 57;
2621 pub const EDEADLOCK: c_int = EDEADLK;
2623 pub const EBFONT: c_int = 59;
2624 pub const ENOSTR: c_int = 60;
2625 pub const ENODATA: c_int = 61;
2626 pub const ETIME: c_int = 62;
2627 pub const ENOSR: c_int = 63;
2628 pub const ENONET: c_int = 64;
2629 pub const ENOPKG: c_int = 65;
2630 pub const EREMOTE: c_int = 66;
2631 pub const ENOLINK: c_int = 67;
2632 pub const EADV: c_int = 68;
2633 pub const ESRMNT: c_int = 69;
2634 pub const ECOMM: c_int = 70;
2635 pub const EPROTO: c_int = 71;
2636 pub const EMULTIHOP: c_int = 72;
2637 pub const EDOTDOT: c_int = 73;
2638 pub const EBADMSG: c_int = 74;
2639 pub const EOVERFLOW: c_int = 75;
2640 pub const ENOTUNIQ: c_int = 76;
2641 pub const EBADFD: c_int = 77;
2642 pub const EREMCHG: c_int = 78;
2643 pub const ELIBACC: c_int = 79;
2644 pub const ELIBBAD: c_int = 80;
2645 pub const ELIBSCN: c_int = 81;
2646 pub const ELIBMAX: c_int = 82;
2647 pub const ELIBEXEC: c_int = 83;
2648 pub const EILSEQ: c_int = 84;
2649 pub const ERESTART: c_int = 85;
2650 pub const ESTRPIPE: c_int = 86;
2651 pub const EUSERS: c_int = 87;
2652 pub const ENOTSOCK: c_int = 88;
2653 pub const EDESTADDRREQ: c_int = 89;
2654 pub const EMSGSIZE: c_int = 90;
2655 pub const EPROTOTYPE: c_int = 91;
2656 pub const ENOPROTOOPT: c_int = 92;
2657 pub const EPROTONOSUPPORT: c_int = 93;
2658 pub const ESOCKTNOSUPPORT: c_int = 94;
2659 pub const EOPNOTSUPP: c_int = 95;
2660 pub const EPFNOSUPPORT: c_int = 96;
2661 pub const EAFNOSUPPORT: c_int = 97;
2662 pub const EADDRINUSE: c_int = 98;
2663 pub const EADDRNOTAVAIL: c_int = 99;
2664 pub const ENETDOWN: c_int = 100;
2665 pub const ENETUNREACH: c_int = 101;
2666 pub const ENETRESET: c_int = 102;
2667 pub const ECONNABORTED: c_int = 103;
2668 pub const ECONNRESET: c_int = 104;
2669 pub const ENOBUFS: c_int = 105;
2670 pub const EISCONN: c_int = 106;
2671 pub const ENOTCONN: c_int = 107;
2672 pub const ESHUTDOWN: c_int = 108;
2673 pub const ETOOMANYREFS: c_int = 109;
2674 pub const ETIMEDOUT: c_int = 110;
2675 pub const ECONNREFUSED: c_int = 111;
2676 pub const EHOSTDOWN: c_int = 112;
2677 pub const EHOSTUNREACH: c_int = 113;
2678 pub const EALREADY: c_int = 114;
2679 pub const EINPROGRESS: c_int = 115;
2680 pub const ESTALE: c_int = 116;
2681 pub const EUCLEAN: c_int = 117;
2682 pub const ENOTNAM: c_int = 118;
2683 pub const ENAVAIL: c_int = 119;
2684 pub const EISNAM: c_int = 120;
2685 pub const EREMOTEIO: c_int = 121;
2686 pub const EDQUOT: c_int = 122;
2688 pub const ENOMEDIUM: c_int = 123;
2689 pub const EMEDIUMTYPE: c_int = 124;
2690 pub const ECANCELED: c_int = 125;
2691 pub const ENOKEY: c_int = 126;
2692 pub const EKEYEXPIRED: c_int = 127;
2693 pub const EKEYREVOKED: c_int = 128;
2694 pub const EKEYREJECTED: c_int = 129;
2696 pub const EOWNERDEAD: c_int = 130;
2697 pub const ENOTRECOVERABLE: c_int = 131;
2699 pub const ERFKILL: c_int = 132;
2701 pub const EHWPOISON: c_int = 133;
2704 #[cfg(any(target_arch = "mips",
2705 target_arch = "mipsel",
2706 target_arch = "powerpc"))]
2708 use types::os::arch::c95::c_int;
2709 use types::common::c95::c_void;
2710 use types::os::arch::posix88::mode_t;
2712 pub const O_RDONLY : c_int = 0;
2713 pub const O_WRONLY : c_int = 1;
2714 pub const O_RDWR : c_int = 2;
2715 pub const O_APPEND : c_int = 8;
2716 pub const O_CREAT : c_int = 256;
2717 pub const O_EXCL : c_int = 1024;
2718 pub const O_TRUNC : c_int = 512;
2719 pub const S_IFIFO : mode_t = 4096;
2720 pub const S_IFCHR : mode_t = 8192;
2721 pub const S_IFBLK : mode_t = 24576;
2722 pub const S_IFDIR : mode_t = 16384;
2723 pub const S_IFREG : mode_t = 32768;
2724 pub const S_IFLNK : mode_t = 40960;
2725 pub const S_IFMT : mode_t = 61440;
2726 pub const S_IEXEC : mode_t = 64;
2727 pub const S_IWRITE : mode_t = 128;
2728 pub const S_IREAD : mode_t = 256;
2729 pub const S_IRWXU : mode_t = 448;
2730 pub const S_IXUSR : mode_t = 64;
2731 pub const S_IWUSR : mode_t = 128;
2732 pub const S_IRUSR : mode_t = 256;
2733 pub const F_OK : c_int = 0;
2734 pub const R_OK : c_int = 4;
2735 pub const W_OK : c_int = 2;
2736 pub const X_OK : c_int = 1;
2737 pub const STDIN_FILENO : c_int = 0;
2738 pub const STDOUT_FILENO : c_int = 1;
2739 pub const STDERR_FILENO : c_int = 2;
2740 pub const F_LOCK : c_int = 1;
2741 pub const F_TEST : c_int = 3;
2742 pub const F_TLOCK : c_int = 2;
2743 pub const F_ULOCK : c_int = 0;
2744 pub const SIGHUP : c_int = 1;
2745 pub const SIGINT : c_int = 2;
2746 pub const SIGQUIT : c_int = 3;
2747 pub const SIGILL : c_int = 4;
2748 pub const SIGABRT : c_int = 6;
2749 pub const SIGFPE : c_int = 8;
2750 pub const SIGKILL : c_int = 9;
2751 pub const SIGSEGV : c_int = 11;
2752 pub const SIGPIPE : c_int = 13;
2753 pub const SIGALRM : c_int = 14;
2754 pub const SIGTERM : c_int = 15;
2756 pub const PROT_NONE : c_int = 0;
2757 pub const PROT_READ : c_int = 1;
2758 pub const PROT_WRITE : c_int = 2;
2759 pub const PROT_EXEC : c_int = 4;
2761 pub const MAP_FILE : c_int = 0x0000;
2762 pub const MAP_SHARED : c_int = 0x0001;
2763 pub const MAP_PRIVATE : c_int = 0x0002;
2764 pub const MAP_FIXED : c_int = 0x0010;
2765 pub const MAP_ANON : c_int = 0x0800;
2767 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
2769 pub const MCL_CURRENT : c_int = 0x0001;
2770 pub const MCL_FUTURE : c_int = 0x0002;
2772 pub const MS_ASYNC : c_int = 0x0001;
2773 pub const MS_INVALIDATE : c_int = 0x0002;
2774 pub const MS_SYNC : c_int = 0x0004;
2776 pub const EPERM : c_int = 1;
2777 pub const ENOENT : c_int = 2;
2778 pub const ESRCH : c_int = 3;
2779 pub const EINTR : c_int = 4;
2780 pub const EIO : c_int = 5;
2781 pub const ENXIO : c_int = 6;
2782 pub const E2BIG : c_int = 7;
2783 pub const ENOEXEC : c_int = 8;
2784 pub const EBADF : c_int = 9;
2785 pub const ECHILD : c_int = 10;
2786 pub const EAGAIN : c_int = 11;
2787 pub const ENOMEM : c_int = 12;
2788 pub const EACCES : c_int = 13;
2789 pub const EFAULT : c_int = 14;
2790 pub const ENOTBLK : c_int = 15;
2791 pub const EBUSY : c_int = 16;
2792 pub const EEXIST : c_int = 17;
2793 pub const EXDEV : c_int = 18;
2794 pub const ENODEV : c_int = 19;
2795 pub const ENOTDIR : c_int = 20;
2796 pub const EISDIR : c_int = 21;
2797 pub const EINVAL : c_int = 22;
2798 pub const ENFILE : c_int = 23;
2799 pub const EMFILE : c_int = 24;
2800 pub const ENOTTY : c_int = 25;
2801 pub const ETXTBSY : c_int = 26;
2802 pub const EFBIG : c_int = 27;
2803 pub const ENOSPC : c_int = 28;
2804 pub const ESPIPE : c_int = 29;
2805 pub const EROFS : c_int = 30;
2806 pub const EMLINK : c_int = 31;
2807 pub const EPIPE : c_int = 32;
2808 pub const EDOM : c_int = 33;
2809 pub const ERANGE : c_int = 34;
2811 pub const ENOMSG: c_int = 35;
2812 pub const EIDRM: c_int = 36;
2813 pub const ECHRNG: c_int = 37;
2814 pub const EL2NSYNC: c_int = 38;
2815 pub const EL3HLT: c_int = 39;
2816 pub const EL3RST: c_int = 40;
2817 pub const ELNRNG: c_int = 41;
2818 pub const EUNATCH: c_int = 42;
2819 pub const ENOCSI: c_int = 43;
2820 pub const EL2HLT: c_int = 44;
2821 pub const EDEADLK: c_int = 45;
2822 pub const ENOLCK: c_int = 46;
2823 pub const EBADE: c_int = 50;
2824 pub const EBADR: c_int = 51;
2825 pub const EXFULL: c_int = 52;
2826 pub const ENOANO: c_int = 53;
2827 pub const EBADRQC: c_int = 54;
2828 pub const EBADSLT: c_int = 55;
2829 pub const EDEADLOCK: c_int = 56;
2830 pub const EBFONT: c_int = 59;
2831 pub const ENOSTR: c_int = 60;
2832 pub const ENODATA: c_int = 61;
2833 pub const ETIME: c_int = 62;
2834 pub const ENOSR: c_int = 63;
2835 pub const ENONET: c_int = 64;
2836 pub const ENOPKG: c_int = 65;
2837 pub const EREMOTE: c_int = 66;
2838 pub const ENOLINK: c_int = 67;
2839 pub const EADV: c_int = 68;
2840 pub const ESRMNT: c_int = 69;
2841 pub const ECOMM: c_int = 70;
2842 pub const EPROTO: c_int = 71;
2843 pub const EDOTDOT: c_int = 73;
2844 pub const EMULTIHOP: c_int = 74;
2845 pub const EBADMSG: c_int = 77;
2846 pub const ENAMETOOLONG: c_int = 78;
2847 pub const EOVERFLOW: c_int = 79;
2848 pub const ENOTUNIQ: c_int = 80;
2849 pub const EBADFD: c_int = 81;
2850 pub const EREMCHG: c_int = 82;
2851 pub const ELIBACC: c_int = 83;
2852 pub const ELIBBAD: c_int = 84;
2853 pub const ELIBSCN: c_int = 95;
2854 pub const ELIBMAX: c_int = 86;
2855 pub const ELIBEXEC: c_int = 87;
2856 pub const EILSEQ: c_int = 88;
2857 pub const ENOSYS: c_int = 89;
2858 pub const ELOOP: c_int = 90;
2859 pub const ERESTART: c_int = 91;
2860 pub const ESTRPIPE: c_int = 92;
2861 pub const ENOTEMPTY: c_int = 93;
2862 pub const EUSERS: c_int = 94;
2863 pub const ENOTSOCK: c_int = 95;
2864 pub const EDESTADDRREQ: c_int = 96;
2865 pub const EMSGSIZE: c_int = 97;
2866 pub const EPROTOTYPE: c_int = 98;
2867 pub const ENOPROTOOPT: c_int = 99;
2868 pub const EPROTONOSUPPORT: c_int = 120;
2869 pub const ESOCKTNOSUPPORT: c_int = 121;
2870 pub const EOPNOTSUPP: c_int = 122;
2871 pub const EPFNOSUPPORT: c_int = 123;
2872 pub const EAFNOSUPPORT: c_int = 124;
2873 pub const EADDRINUSE: c_int = 125;
2874 pub const EADDRNOTAVAIL: c_int = 126;
2875 pub const ENETDOWN: c_int = 127;
2876 pub const ENETUNREACH: c_int = 128;
2877 pub const ENETRESET: c_int = 129;
2878 pub const ECONNABORTED: c_int = 130;
2879 pub const ECONNRESET: c_int = 131;
2880 pub const ENOBUFS: c_int = 132;
2881 pub const EISCONN: c_int = 133;
2882 pub const ENOTCONN: c_int = 134;
2883 pub const EUCLEAN: c_int = 135;
2884 pub const ENOTNAM: c_int = 137;
2885 pub const ENAVAIL: c_int = 138;
2886 pub const EISNAM: c_int = 139;
2887 pub const EREMOTEIO: c_int = 140;
2888 pub const ESHUTDOWN: c_int = 143;
2889 pub const ETOOMANYREFS: c_int = 144;
2890 pub const ETIMEDOUT: c_int = 145;
2891 pub const ECONNREFUSED: c_int = 146;
2892 pub const EHOSTDOWN: c_int = 147;
2893 pub const EHOSTUNREACH: c_int = 148;
2894 pub const EWOULDBLOCK: c_int = EAGAIN;
2895 pub const EALREADY: c_int = 149;
2896 pub const EINPROGRESS: c_int = 150;
2897 pub const ESTALE: c_int = 151;
2898 pub const ECANCELED: c_int = 158;
2900 pub const ENOMEDIUM: c_int = 159;
2901 pub const EMEDIUMTYPE: c_int = 160;
2902 pub const ENOKEY: c_int = 161;
2903 pub const EKEYEXPIRED: c_int = 162;
2904 pub const EKEYREVOKED: c_int = 163;
2905 pub const EKEYREJECTED: c_int = 164;
2907 pub const EOWNERDEAD: c_int = 165;
2908 pub const ENOTRECOVERABLE: c_int = 166;
2910 pub const ERFKILL: c_int = 167;
2912 pub const EHWPOISON: c_int = 168;
2914 pub const EDQUOT: c_int = 1133;
2917 use types::os::arch::c95::{c_int, size_t};
2919 pub const F_DUPFD : c_int = 0;
2920 pub const F_GETFD : c_int = 1;
2921 pub const F_SETFD : c_int = 2;
2922 pub const F_GETFL : c_int = 3;
2923 pub const F_SETFL : c_int = 4;
2925 pub const SIGTRAP : c_int = 5;
2926 pub const SIGPIPE: c_int = 13;
2927 pub const SIG_IGN: size_t = 1;
2929 pub const GLOB_ERR : c_int = 1 << 0;
2930 pub const GLOB_MARK : c_int = 1 << 1;
2931 pub const GLOB_NOSORT : c_int = 1 << 2;
2932 pub const GLOB_DOOFFS : c_int = 1 << 3;
2933 pub const GLOB_NOCHECK : c_int = 1 << 4;
2934 pub const GLOB_APPEND : c_int = 1 << 5;
2935 pub const GLOB_NOESCAPE : c_int = 1 << 6;
2937 pub const GLOB_NOSPACE : c_int = 1;
2938 pub const GLOB_ABORTED : c_int = 2;
2939 pub const GLOB_NOMATCH : c_int = 3;
2941 pub const POSIX_MADV_NORMAL : c_int = 0;
2942 pub const POSIX_MADV_RANDOM : c_int = 1;
2943 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
2944 pub const POSIX_MADV_WILLNEED : c_int = 3;
2945 pub const POSIX_MADV_DONTNEED : c_int = 4;
2947 pub const _SC_MQ_PRIO_MAX : c_int = 28;
2948 pub const _SC_IOV_MAX : c_int = 60;
2949 pub const _SC_GETGR_R_SIZE_MAX : c_int = 69;
2950 pub const _SC_GETPW_R_SIZE_MAX : c_int = 70;
2951 pub const _SC_LOGIN_NAME_MAX : c_int = 71;
2952 pub const _SC_TTY_NAME_MAX : c_int = 72;
2953 pub const _SC_THREADS : c_int = 67;
2954 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
2955 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
2956 pub const _SC_THREAD_KEYS_MAX : c_int = 74;
2957 pub const _SC_THREAD_STACK_MIN : c_int = 75;
2958 pub const _SC_THREAD_THREADS_MAX : c_int = 76;
2959 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
2960 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
2961 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
2962 pub const _SC_THREAD_PRIO_INHERIT : c_int = 80;
2963 pub const _SC_THREAD_PRIO_PROTECT : c_int = 81;
2964 pub const _SC_THREAD_PROCESS_SHARED : c_int = 82;
2965 pub const _SC_ATEXIT_MAX : c_int = 87;
2966 pub const _SC_XOPEN_VERSION : c_int = 89;
2967 pub const _SC_XOPEN_XCU_VERSION : c_int = 90;
2968 pub const _SC_XOPEN_UNIX : c_int = 91;
2969 pub const _SC_XOPEN_CRYPT : c_int = 92;
2970 pub const _SC_XOPEN_ENH_I18N : c_int = 93;
2971 pub const _SC_XOPEN_SHM : c_int = 94;
2972 pub const _SC_XOPEN_LEGACY : c_int = 129;
2973 pub const _SC_XOPEN_REALTIME : c_int = 130;
2974 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 131;
2976 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
2977 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
2979 #[cfg(target_os = "android")]
2980 pub const PTHREAD_STACK_MIN: size_t = 8192;
2982 #[cfg(all(target_os = "linux",
2983 any(target_arch = "arm",
2984 target_arch = "x86",
2985 target_arch = "x86_64")))]
2986 pub const PTHREAD_STACK_MIN: size_t = 16384;
2988 #[cfg(all(target_os = "linux",
2989 any(target_arch = "mips",
2990 target_arch = "mipsel",
2991 target_arch = "aarch64",
2992 target_arch = "powerpc")))]
2993 pub const PTHREAD_STACK_MIN: size_t = 131072;
2995 pub const CLOCK_REALTIME: c_int = 0;
2996 pub const CLOCK_MONOTONIC: c_int = 1;
3000 #[cfg(any(target_arch = "arm",
3001 target_arch = "aarch64",
3002 target_arch = "x86",
3003 target_arch = "x86_64"))]
3005 use types::os::arch::c95::c_int;
3007 pub const MADV_NORMAL : c_int = 0;
3008 pub const MADV_RANDOM : c_int = 1;
3009 pub const MADV_SEQUENTIAL : c_int = 2;
3010 pub const MADV_WILLNEED : c_int = 3;
3011 pub const MADV_DONTNEED : c_int = 4;
3012 pub const MADV_REMOVE : c_int = 9;
3013 pub const MADV_DONTFORK : c_int = 10;
3014 pub const MADV_DOFORK : c_int = 11;
3015 pub const MADV_MERGEABLE : c_int = 12;
3016 pub const MADV_UNMERGEABLE : c_int = 13;
3017 pub const MADV_HWPOISON : c_int = 100;
3019 pub const IFF_LOOPBACK: c_int = 0x8;
3021 pub const AF_UNIX: c_int = 1;
3022 pub const AF_INET: c_int = 2;
3023 pub const AF_INET6: c_int = 10;
3024 pub const SOCK_STREAM: c_int = 1;
3025 pub const SOCK_DGRAM: c_int = 2;
3026 pub const SOCK_RAW: c_int = 3;
3027 pub const IPPROTO_TCP: c_int = 6;
3028 pub const IPPROTO_IP: c_int = 0;
3029 pub const IPPROTO_IPV6: c_int = 41;
3030 pub const IP_MULTICAST_TTL: c_int = 33;
3031 pub const IP_MULTICAST_LOOP: c_int = 34;
3032 pub const IP_TTL: c_int = 2;
3033 pub const IP_HDRINCL: c_int = 3;
3034 pub const IP_ADD_MEMBERSHIP: c_int = 35;
3035 pub const IP_DROP_MEMBERSHIP: c_int = 36;
3036 pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
3037 pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
3039 pub const TCP_NODELAY: c_int = 1;
3040 pub const SOL_SOCKET: c_int = 1;
3041 pub const SO_KEEPALIVE: c_int = 9;
3042 pub const SO_BROADCAST: c_int = 6;
3043 pub const SO_REUSEADDR: c_int = 2;
3044 pub const SO_ERROR: c_int = 4;
3046 pub const SHUT_RD: c_int = 0;
3047 pub const SHUT_WR: c_int = 1;
3048 pub const SHUT_RDWR: c_int = 2;
3050 #[cfg(any(target_arch = "mips",
3051 target_arch = "mipsel",
3052 target_arch = "powerpc"))]
3054 use types::os::arch::c95::c_int;
3056 pub const MADV_NORMAL : c_int = 0;
3057 pub const MADV_RANDOM : c_int = 1;
3058 pub const MADV_SEQUENTIAL : c_int = 2;
3059 pub const MADV_WILLNEED : c_int = 3;
3060 pub const MADV_DONTNEED : c_int = 4;
3061 pub const MADV_REMOVE : c_int = 9;
3062 pub const MADV_DONTFORK : c_int = 10;
3063 pub const MADV_DOFORK : c_int = 11;
3064 pub const MADV_MERGEABLE : c_int = 12;
3065 pub const MADV_UNMERGEABLE : c_int = 13;
3066 pub const MADV_HWPOISON : c_int = 100;
3068 pub const AF_UNIX: c_int = 1;
3069 pub const AF_INET: c_int = 2;
3070 pub const AF_INET6: c_int = 10;
3071 pub const SOCK_STREAM: c_int = 2;
3072 pub const SOCK_DGRAM: c_int = 1;
3073 pub const SOCK_RAW: c_int = 3;
3074 pub const IPPROTO_TCP: c_int = 6;
3075 pub const IPPROTO_IP: c_int = 0;
3076 pub const IPPROTO_IPV6: c_int = 41;
3077 pub const IP_MULTICAST_TTL: c_int = 33;
3078 pub const IP_MULTICAST_LOOP: c_int = 34;
3079 pub const IP_TTL: c_int = 2;
3080 pub const IP_HDRINCL: c_int = 3;
3081 pub const IP_ADD_MEMBERSHIP: c_int = 35;
3082 pub const IP_DROP_MEMBERSHIP: c_int = 36;
3083 pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
3084 pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
3086 pub const TCP_NODELAY: c_int = 1;
3087 pub const SOL_SOCKET: c_int = 65535;
3088 pub const SO_KEEPALIVE: c_int = 8;
3089 pub const SO_BROADCAST: c_int = 32;
3090 pub const SO_REUSEADDR: c_int = 4;
3091 pub const SO_ERROR: c_int = 4103;
3093 pub const SHUT_RD: c_int = 0;
3094 pub const SHUT_WR: c_int = 1;
3095 pub const SHUT_RDWR: c_int = 2;
3097 #[cfg(any(target_arch = "x86",
3098 target_arch = "x86_64",
3099 target_arch = "arm",
3100 target_arch = "aarch64"))]
3102 use types::os::arch::c95::c_int;
3104 pub const AF_PACKET : c_int = 17;
3105 pub const IPPROTO_RAW : c_int = 255;
3107 pub const O_RSYNC : c_int = 1052672;
3108 pub const O_DSYNC : c_int = 4096;
3109 pub const O_NONBLOCK : c_int = 2048;
3110 pub const O_SYNC : c_int = 1052672;
3112 pub const PROT_GROWSDOWN : c_int = 0x010000000;
3113 pub const PROT_GROWSUP : c_int = 0x020000000;
3115 pub const MAP_TYPE : c_int = 0x000f;
3116 pub const MAP_ANONYMOUS : c_int = 0x0020;
3117 pub const MAP_32BIT : c_int = 0x0040;
3118 pub const MAP_GROWSDOWN : c_int = 0x0100;
3119 pub const MAP_DENYWRITE : c_int = 0x0800;
3120 pub const MAP_EXECUTABLE : c_int = 0x01000;
3121 pub const MAP_LOCKED : c_int = 0x02000;
3122 pub const MAP_NONRESERVE : c_int = 0x04000;
3123 pub const MAP_POPULATE : c_int = 0x08000;
3124 pub const MAP_NONBLOCK : c_int = 0x010000;
3125 pub const MAP_STACK : c_int = 0x020000;
3127 #[cfg(any(target_arch = "mips",
3128 target_arch = "mipsel",
3129 target_arch = "powerpc"))]
3131 use types::os::arch::c95::c_int;
3133 pub const AF_PACKET : c_int = 17;
3134 pub const IPPROTO_RAW : c_int = 255;
3136 pub const O_RSYNC : c_int = 16400;
3137 pub const O_DSYNC : c_int = 16;
3138 pub const O_NONBLOCK : c_int = 128;
3139 pub const O_SYNC : c_int = 16400;
3141 pub const PROT_GROWSDOWN : c_int = 0x01000000;
3142 pub const PROT_GROWSUP : c_int = 0x02000000;
3144 pub const MAP_TYPE : c_int = 0x000f;
3145 pub const MAP_ANONYMOUS : c_int = 0x0800;
3146 pub const MAP_GROWSDOWN : c_int = 0x01000;
3147 pub const MAP_DENYWRITE : c_int = 0x02000;
3148 pub const MAP_EXECUTABLE : c_int = 0x04000;
3149 pub const MAP_LOCKED : c_int = 0x08000;
3150 pub const MAP_NONRESERVE : c_int = 0x0400;
3151 pub const MAP_POPULATE : c_int = 0x010000;
3152 pub const MAP_NONBLOCK : c_int = 0x020000;
3153 pub const MAP_STACK : c_int = 0x040000;
3155 #[cfg(target_os = "linux")]
3157 use types::os::arch::c95::c_int;
3159 pub const _SC_ARG_MAX : c_int = 0;
3160 pub const _SC_CHILD_MAX : c_int = 1;
3161 pub const _SC_CLK_TCK : c_int = 2;
3162 pub const _SC_NGROUPS_MAX : c_int = 3;
3163 pub const _SC_OPEN_MAX : c_int = 4;
3164 pub const _SC_STREAM_MAX : c_int = 5;
3165 pub const _SC_TZNAME_MAX : c_int = 6;
3166 pub const _SC_JOB_CONTROL : c_int = 7;
3167 pub const _SC_SAVED_IDS : c_int = 8;
3168 pub const _SC_REALTIME_SIGNALS : c_int = 9;
3169 pub const _SC_PRIORITY_SCHEDULING : c_int = 10;
3170 pub const _SC_TIMERS : c_int = 11;
3171 pub const _SC_ASYNCHRONOUS_IO : c_int = 12;
3172 pub const _SC_PRIORITIZED_IO : c_int = 13;
3173 pub const _SC_SYNCHRONIZED_IO : c_int = 14;
3174 pub const _SC_FSYNC : c_int = 15;
3175 pub const _SC_MAPPED_FILES : c_int = 16;
3176 pub const _SC_MEMLOCK : c_int = 17;
3177 pub const _SC_MEMLOCK_RANGE : c_int = 18;
3178 pub const _SC_MEMORY_PROTECTION : c_int = 19;
3179 pub const _SC_MESSAGE_PASSING : c_int = 20;
3180 pub const _SC_SEMAPHORES : c_int = 21;
3181 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 22;
3182 pub const _SC_AIO_LISTIO_MAX : c_int = 23;
3183 pub const _SC_AIO_MAX : c_int = 24;
3184 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 25;
3185 pub const _SC_DELAYTIMER_MAX : c_int = 26;
3186 pub const _SC_MQ_OPEN_MAX : c_int = 27;
3187 pub const _SC_VERSION : c_int = 29;
3188 pub const _SC_PAGESIZE : c_int = 30;
3189 pub const _SC_RTSIG_MAX : c_int = 31;
3190 pub const _SC_SEM_NSEMS_MAX : c_int = 32;
3191 pub const _SC_SEM_VALUE_MAX : c_int = 33;
3192 pub const _SC_SIGQUEUE_MAX : c_int = 34;
3193 pub const _SC_TIMER_MAX : c_int = 35;
3194 pub const _SC_BC_BASE_MAX : c_int = 36;
3195 pub const _SC_BC_DIM_MAX : c_int = 37;
3196 pub const _SC_BC_SCALE_MAX : c_int = 38;
3197 pub const _SC_BC_STRING_MAX : c_int = 39;
3198 pub const _SC_COLL_WEIGHTS_MAX : c_int = 40;
3199 pub const _SC_EXPR_NEST_MAX : c_int = 42;
3200 pub const _SC_LINE_MAX : c_int = 43;
3201 pub const _SC_RE_DUP_MAX : c_int = 44;
3202 pub const _SC_2_VERSION : c_int = 46;
3203 pub const _SC_2_C_BIND : c_int = 47;
3204 pub const _SC_2_C_DEV : c_int = 48;
3205 pub const _SC_2_FORT_DEV : c_int = 49;
3206 pub const _SC_2_FORT_RUN : c_int = 50;
3207 pub const _SC_2_SW_DEV : c_int = 51;
3208 pub const _SC_2_LOCALEDEF : c_int = 52;
3209 pub const _SC_2_CHAR_TERM : c_int = 95;
3210 pub const _SC_2_C_VERSION : c_int = 96;
3211 pub const _SC_2_UPE : c_int = 97;
3212 pub const _SC_XBS5_ILP32_OFF32 : c_int = 125;
3213 pub const _SC_XBS5_ILP32_OFFBIG : c_int = 126;
3214 pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 128;
3216 #[cfg(target_os = "android")]
3218 use types::os::arch::c95::c_int;
3220 pub const _SC_ARG_MAX : c_int = 0;
3221 pub const _SC_BC_BASE_MAX : c_int = 1;
3222 pub const _SC_BC_DIM_MAX : c_int = 2;
3223 pub const _SC_BC_SCALE_MAX : c_int = 3;
3224 pub const _SC_BC_STRING_MAX : c_int = 4;
3225 pub const _SC_CHILD_MAX : c_int = 5;
3226 pub const _SC_CLK_TCK : c_int = 6;
3227 pub const _SC_COLL_WEIGHTS_MAX : c_int = 7;
3228 pub const _SC_EXPR_NEST_MAX : c_int = 8;
3229 pub const _SC_LINE_MAX : c_int = 9;
3230 pub const _SC_NGROUPS_MAX : c_int = 10;
3231 pub const _SC_OPEN_MAX : c_int = 11;
3232 pub const _SC_2_C_BIND : c_int = 13;
3233 pub const _SC_2_C_DEV : c_int = 14;
3234 pub const _SC_2_C_VERSION : c_int = 15;
3235 pub const _SC_2_CHAR_TERM : c_int = 16;
3236 pub const _SC_2_FORT_DEV : c_int = 17;
3237 pub const _SC_2_FORT_RUN : c_int = 18;
3238 pub const _SC_2_LOCALEDEF : c_int = 19;
3239 pub const _SC_2_SW_DEV : c_int = 20;
3240 pub const _SC_2_UPE : c_int = 21;
3241 pub const _SC_2_VERSION : c_int = 22;
3242 pub const _SC_JOB_CONTROL : c_int = 23;
3243 pub const _SC_SAVED_IDS : c_int = 24;
3244 pub const _SC_VERSION : c_int = 25;
3245 pub const _SC_RE_DUP_MAX : c_int = 26;
3246 pub const _SC_STREAM_MAX : c_int = 27;
3247 pub const _SC_TZNAME_MAX : c_int = 28;
3248 pub const _SC_PAGESIZE : c_int = 39;
3252 #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
3255 use types::os::arch::c95::{c_int, c_uint};
3257 pub const EXIT_FAILURE : c_int = 1;
3258 pub const EXIT_SUCCESS : c_int = 0;
3259 pub const RAND_MAX : c_int = 2147483647;
3260 pub const EOF : c_int = -1;
3261 pub const SEEK_SET : c_int = 0;
3262 pub const SEEK_CUR : c_int = 1;
3263 pub const SEEK_END : c_int = 2;
3264 pub const _IOFBF : c_int = 0;
3265 pub const _IONBF : c_int = 2;
3266 pub const _IOLBF : c_int = 1;
3267 pub const BUFSIZ : c_uint = 1024_u32;
3268 pub const FOPEN_MAX : c_uint = 20_u32;
3269 pub const FILENAME_MAX : c_uint = 1024_u32;
3270 pub const L_tmpnam : c_uint = 1024_u32;
3271 pub const TMP_MAX : c_uint = 308915776_u32;
3276 use types::common::c95::c_void;
3277 use types::os::arch::c95::c_int;
3278 use types::os::arch::posix88::mode_t;
3280 pub const O_RDONLY : c_int = 0;
3281 pub const O_WRONLY : c_int = 1;
3282 pub const O_RDWR : c_int = 2;
3283 pub const O_APPEND : c_int = 8;
3284 pub const O_CREAT : c_int = 512;
3285 pub const O_EXCL : c_int = 2048;
3286 pub const O_TRUNC : c_int = 1024;
3287 pub const S_IFIFO : mode_t = 4096;
3288 pub const S_IFCHR : mode_t = 8192;
3289 pub const S_IFBLK : mode_t = 24576;
3290 pub const S_IFDIR : mode_t = 16384;
3291 pub const S_IFREG : mode_t = 32768;
3292 pub const S_IFLNK : mode_t = 40960;
3293 pub const S_IFMT : mode_t = 61440;
3294 pub const S_IEXEC : mode_t = 64;
3295 pub const S_IWRITE : mode_t = 128;
3296 pub const S_IREAD : mode_t = 256;
3297 pub const S_IRWXU : mode_t = 448;
3298 pub const S_IXUSR : mode_t = 64;
3299 pub const S_IWUSR : mode_t = 128;
3300 pub const S_IRUSR : mode_t = 256;
3301 pub const F_OK : c_int = 0;
3302 pub const R_OK : c_int = 4;
3303 pub const W_OK : c_int = 2;
3304 pub const X_OK : c_int = 1;
3305 pub const STDIN_FILENO : c_int = 0;
3306 pub const STDOUT_FILENO : c_int = 1;
3307 pub const STDERR_FILENO : c_int = 2;
3308 pub const F_LOCK : c_int = 1;
3309 pub const F_TEST : c_int = 3;
3310 pub const F_TLOCK : c_int = 2;
3311 pub const F_ULOCK : c_int = 0;
3312 pub const SIGHUP : c_int = 1;
3313 pub const SIGINT : c_int = 2;
3314 pub const SIGQUIT : c_int = 3;
3315 pub const SIGILL : c_int = 4;
3316 pub const SIGABRT : c_int = 6;
3317 pub const SIGFPE : c_int = 8;
3318 pub const SIGKILL : c_int = 9;
3319 pub const SIGSEGV : c_int = 11;
3320 pub const SIGPIPE : c_int = 13;
3321 pub const SIGALRM : c_int = 14;
3322 pub const SIGTERM : c_int = 15;
3324 pub const PROT_NONE : c_int = 0;
3325 pub const PROT_READ : c_int = 1;
3326 pub const PROT_WRITE : c_int = 2;
3327 pub const PROT_EXEC : c_int = 4;
3329 pub const MAP_FILE : c_int = 0x0000;
3330 pub const MAP_SHARED : c_int = 0x0001;
3331 pub const MAP_PRIVATE : c_int = 0x0002;
3332 pub const MAP_FIXED : c_int = 0x0010;
3333 pub const MAP_ANON : c_int = 0x1000;
3335 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
3337 pub const MCL_CURRENT : c_int = 0x0001;
3338 pub const MCL_FUTURE : c_int = 0x0002;
3340 pub const MS_SYNC : c_int = 0x0000;
3341 pub const MS_ASYNC : c_int = 0x0001;
3342 pub const MS_INVALIDATE : c_int = 0x0002;
3344 pub const EPERM : c_int = 1;
3345 pub const ENOENT : c_int = 2;
3346 pub const ESRCH : c_int = 3;
3347 pub const EINTR : c_int = 4;
3348 pub const EIO : c_int = 5;
3349 pub const ENXIO : c_int = 6;
3350 pub const E2BIG : c_int = 7;
3351 pub const ENOEXEC : c_int = 8;
3352 pub const EBADF : c_int = 9;
3353 pub const ECHILD : c_int = 10;
3354 pub const EDEADLK : c_int = 11;
3355 pub const ENOMEM : c_int = 12;
3356 pub const EACCES : c_int = 13;
3357 pub const EFAULT : c_int = 14;
3358 pub const ENOTBLK : c_int = 15;
3359 pub const EBUSY : c_int = 16;
3360 pub const EEXIST : c_int = 17;
3361 pub const EXDEV : c_int = 18;
3362 pub const ENODEV : c_int = 19;
3363 pub const ENOTDIR : c_int = 20;
3364 pub const EISDIR : c_int = 21;
3365 pub const EINVAL : c_int = 22;
3366 pub const ENFILE : c_int = 23;
3367 pub const EMFILE : c_int = 24;
3368 pub const ENOTTY : c_int = 25;
3369 pub const ETXTBSY : c_int = 26;
3370 pub const EFBIG : c_int = 27;
3371 pub const ENOSPC : c_int = 28;
3372 pub const ESPIPE : c_int = 29;
3373 pub const EROFS : c_int = 30;
3374 pub const EMLINK : c_int = 31;
3375 pub const EPIPE : c_int = 32;
3376 pub const EDOM : c_int = 33;
3377 pub const ERANGE : c_int = 34;
3378 pub const EAGAIN : c_int = 35;
3379 pub const EWOULDBLOCK : c_int = 35;
3380 pub const EINPROGRESS : c_int = 36;
3381 pub const EALREADY : c_int = 37;
3382 pub const ENOTSOCK : c_int = 38;
3383 pub const EDESTADDRREQ : c_int = 39;
3384 pub const EMSGSIZE : c_int = 40;
3385 pub const EPROTOTYPE : c_int = 41;
3386 pub const ENOPROTOOPT : c_int = 42;
3387 pub const EPROTONOSUPPORT : c_int = 43;
3388 pub const ESOCKTNOSUPPORT : c_int = 44;
3389 pub const EOPNOTSUPP : c_int = 45;
3390 pub const EPFNOSUPPORT : c_int = 46;
3391 pub const EAFNOSUPPORT : c_int = 47;
3392 pub const EADDRINUSE : c_int = 48;
3393 pub const EADDRNOTAVAIL : c_int = 49;
3394 pub const ENETDOWN : c_int = 50;
3395 pub const ENETUNREACH : c_int = 51;
3396 pub const ENETRESET : c_int = 52;
3397 pub const ECONNABORTED : c_int = 53;
3398 pub const ECONNRESET : c_int = 54;
3399 pub const ENOBUFS : c_int = 55;
3400 pub const EISCONN : c_int = 56;
3401 pub const ENOTCONN : c_int = 57;
3402 pub const ESHUTDOWN : c_int = 58;
3403 pub const ETOOMANYREFS : c_int = 59;
3404 pub const ETIMEDOUT : c_int = 60;
3405 pub const ECONNREFUSED : c_int = 61;
3406 pub const ELOOP : c_int = 62;
3407 pub const ENAMETOOLONG : c_int = 63;
3408 pub const EHOSTDOWN : c_int = 64;
3409 pub const EHOSTUNREACH : c_int = 65;
3410 pub const ENOTEMPTY : c_int = 66;
3411 pub const EPROCLIM : c_int = 67;
3412 pub const EUSERS : c_int = 68;
3413 pub const EDQUOT : c_int = 69;
3414 pub const ESTALE : c_int = 70;
3415 pub const EREMOTE : c_int = 71;
3416 pub const EBADRPC : c_int = 72;
3417 pub const ERPCMISMATCH : c_int = 73;
3418 pub const EPROGUNAVAIL : c_int = 74;
3419 pub const EPROGMISMATCH : c_int = 75;
3420 pub const EPROCUNAVAIL : c_int = 76;
3421 pub const ENOLCK : c_int = 77;
3422 pub const ENOSYS : c_int = 78;
3423 pub const EFTYPE : c_int = 79;
3424 pub const EAUTH : c_int = 80;
3425 pub const ENEEDAUTH : c_int = 81;
3426 pub const EIDRM : c_int = 82;
3427 pub const ENOMSG : c_int = 83;
3428 pub const EOVERFLOW : c_int = 84;
3429 pub const ECANCELED : c_int = 85;
3430 pub const EILSEQ : c_int = 86;
3431 pub const ENOATTR : c_int = 87;
3432 pub const EDOOFUS : c_int = 88;
3433 pub const EBADMSG : c_int = 89;
3434 pub const EMULTIHOP : c_int = 90;
3435 pub const ENOLINK : c_int = 91;
3436 pub const EPROTO : c_int = 92;
3437 pub const ENOMEDIUM : c_int = 93;
3438 pub const EUNUSED94 : c_int = 94;
3439 pub const EUNUSED95 : c_int = 95;
3440 pub const EUNUSED96 : c_int = 96;
3441 pub const EUNUSED97 : c_int = 97;
3442 pub const EUNUSED98 : c_int = 98;
3443 pub const EASYNC : c_int = 99;
3444 pub const ELAST : c_int = 99;
3447 use types::os::arch::c95::{c_int, size_t};
3449 pub const F_DUPFD : c_int = 0;
3450 pub const F_GETFD : c_int = 1;
3451 pub const F_SETFD : c_int = 2;
3452 pub const F_GETFL : c_int = 3;
3453 pub const F_SETFL : c_int = 4;
3455 pub const SIGTRAP : c_int = 5;
3456 pub const SIGPIPE: c_int = 13;
3457 pub const SIG_IGN: size_t = 1;
3459 pub const GLOB_APPEND : c_int = 0x0001;
3460 pub const GLOB_DOOFFS : c_int = 0x0002;
3461 pub const GLOB_ERR : c_int = 0x0004;
3462 pub const GLOB_MARK : c_int = 0x0008;
3463 pub const GLOB_NOCHECK : c_int = 0x0010;
3464 pub const GLOB_NOSORT : c_int = 0x0020;
3465 pub const GLOB_NOESCAPE : c_int = 0x2000;
3467 pub const GLOB_NOSPACE : c_int = -1;
3468 pub const GLOB_ABORTED : c_int = -2;
3469 pub const GLOB_NOMATCH : c_int = -3;
3471 pub const POSIX_MADV_NORMAL : c_int = 0;
3472 pub const POSIX_MADV_RANDOM : c_int = 1;
3473 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3474 pub const POSIX_MADV_WILLNEED : c_int = 3;
3475 pub const POSIX_MADV_DONTNEED : c_int = 4;
3477 pub const _SC_IOV_MAX : c_int = 56;
3478 pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
3479 pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
3480 pub const _SC_LOGIN_NAME_MAX : c_int = 73;
3481 pub const _SC_MQ_PRIO_MAX : c_int = 75;
3482 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
3483 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
3484 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
3485 pub const _SC_THREAD_KEYS_MAX : c_int = 86;
3486 pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
3487 pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
3488 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
3489 pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
3490 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
3491 pub const _SC_THREAD_STACK_MIN : c_int = 93;
3492 pub const _SC_THREAD_THREADS_MAX : c_int = 94;
3493 pub const _SC_THREADS : c_int = 96;
3494 pub const _SC_TTY_NAME_MAX : c_int = 101;
3495 pub const _SC_ATEXIT_MAX : c_int = 107;
3496 pub const _SC_XOPEN_CRYPT : c_int = 108;
3497 pub const _SC_XOPEN_ENH_I18N : c_int = 109;
3498 pub const _SC_XOPEN_LEGACY : c_int = 110;
3499 pub const _SC_XOPEN_REALTIME : c_int = 111;
3500 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
3501 pub const _SC_XOPEN_SHM : c_int = 113;
3502 pub const _SC_XOPEN_UNIX : c_int = 115;
3503 pub const _SC_XOPEN_VERSION : c_int = 116;
3504 pub const _SC_XOPEN_XCU_VERSION : c_int = 117;
3506 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
3507 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
3509 #[cfg(target_arch = "arm")]
3510 pub const PTHREAD_STACK_MIN: size_t = 4096;
3512 #[cfg(all(target_os = "freebsd",
3513 any(target_arch = "mips",
3514 target_arch = "mipsel",
3515 target_arch = "x86",
3516 target_arch = "x86_64")))]
3517 pub const PTHREAD_STACK_MIN: size_t = 2048;
3519 #[cfg(target_os = "dragonfly")]
3520 pub const PTHREAD_STACK_MIN: size_t = 1024;
3522 pub const CLOCK_REALTIME: c_int = 0;
3523 pub const CLOCK_MONOTONIC: c_int = 4;
3528 use types::os::arch::c95::c_int;
3530 pub const MADV_NORMAL : c_int = 0;
3531 pub const MADV_RANDOM : c_int = 1;
3532 pub const MADV_SEQUENTIAL : c_int = 2;
3533 pub const MADV_WILLNEED : c_int = 3;
3534 pub const MADV_DONTNEED : c_int = 4;
3535 pub const MADV_FREE : c_int = 5;
3536 pub const MADV_NOSYNC : c_int = 6;
3537 pub const MADV_AUTOSYNC : c_int = 7;
3538 pub const MADV_NOCORE : c_int = 8;
3539 pub const MADV_CORE : c_int = 9;
3540 pub const MADV_PROTECT : c_int = 10;
3542 pub const MINCORE_INCORE : c_int = 0x1;
3543 pub const MINCORE_REFERENCED : c_int = 0x2;
3544 pub const MINCORE_MODIFIED : c_int = 0x4;
3545 pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
3546 pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
3547 pub const MINCORE_SUPER : c_int = 0x20;
3549 pub const AF_INET: c_int = 2;
3550 pub const AF_INET6: c_int = 28;
3551 pub const AF_UNIX: c_int = 1;
3552 pub const SOCK_STREAM: c_int = 1;
3553 pub const SOCK_DGRAM: c_int = 2;
3554 pub const SOCK_RAW: c_int = 3;
3555 pub const IPPROTO_TCP: c_int = 6;
3556 pub const IPPROTO_IP: c_int = 0;
3557 pub const IPPROTO_IPV6: c_int = 41;
3558 pub const IP_MULTICAST_TTL: c_int = 10;
3559 pub const IP_MULTICAST_LOOP: c_int = 11;
3560 pub const IP_TTL: c_int = 4;
3561 pub const IP_HDRINCL: c_int = 2;
3562 pub const IP_ADD_MEMBERSHIP: c_int = 12;
3563 pub const IP_DROP_MEMBERSHIP: c_int = 13;
3564 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
3565 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
3567 pub const TCP_NODELAY: c_int = 1;
3568 pub const TCP_KEEPIDLE: c_int = 256;
3569 pub const SOL_SOCKET: c_int = 0xffff;
3570 pub const SO_KEEPALIVE: c_int = 0x0008;
3571 pub const SO_BROADCAST: c_int = 0x0020;
3572 pub const SO_REUSEADDR: c_int = 0x0004;
3573 pub const SO_ERROR: c_int = 0x1007;
3575 pub const IFF_LOOPBACK: c_int = 0x8;
3577 pub const SHUT_RD: c_int = 0;
3578 pub const SHUT_WR: c_int = 1;
3579 pub const SHUT_RDWR: c_int = 2;
3582 use types::os::arch::c95::c_int;
3584 pub const O_SYNC : c_int = 128;
3585 pub const O_NONBLOCK : c_int = 4;
3586 pub const CTL_KERN: c_int = 1;
3587 pub const KERN_PROC: c_int = 14;
3588 #[cfg(target_os = "freebsd")]
3589 pub const KERN_PROC_PATHNAME: c_int = 12;
3590 #[cfg(target_os = "dragonfly")]
3591 pub const KERN_PROC_PATHNAME: c_int = 9;
3593 pub const MAP_COPY : c_int = 0x0002;
3594 pub const MAP_RENAME : c_int = 0x0020;
3595 pub const MAP_NORESERVE : c_int = 0x0040;
3596 pub const MAP_HASSEMAPHORE : c_int = 0x0200;
3597 pub const MAP_STACK : c_int = 0x0400;
3598 pub const MAP_NOSYNC : c_int = 0x0800;
3599 pub const MAP_NOCORE : c_int = 0x020000;
3601 pub const IPPROTO_RAW : c_int = 255;
3604 use types::os::arch::c95::c_int;
3606 pub const _SC_ARG_MAX : c_int = 1;
3607 pub const _SC_CHILD_MAX : c_int = 2;
3608 pub const _SC_CLK_TCK : c_int = 3;
3609 pub const _SC_NGROUPS_MAX : c_int = 4;
3610 pub const _SC_OPEN_MAX : c_int = 5;
3611 pub const _SC_JOB_CONTROL : c_int = 6;
3612 pub const _SC_SAVED_IDS : c_int = 7;
3613 pub const _SC_VERSION : c_int = 8;
3614 pub const _SC_BC_BASE_MAX : c_int = 9;
3615 pub const _SC_BC_DIM_MAX : c_int = 10;
3616 pub const _SC_BC_SCALE_MAX : c_int = 11;
3617 pub const _SC_BC_STRING_MAX : c_int = 12;
3618 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
3619 pub const _SC_EXPR_NEST_MAX : c_int = 14;
3620 pub const _SC_LINE_MAX : c_int = 15;
3621 pub const _SC_RE_DUP_MAX : c_int = 16;
3622 pub const _SC_2_VERSION : c_int = 17;
3623 pub const _SC_2_C_BIND : c_int = 18;
3624 pub const _SC_2_C_DEV : c_int = 19;
3625 pub const _SC_2_CHAR_TERM : c_int = 20;
3626 pub const _SC_2_FORT_DEV : c_int = 21;
3627 pub const _SC_2_FORT_RUN : c_int = 22;
3628 pub const _SC_2_LOCALEDEF : c_int = 23;
3629 pub const _SC_2_SW_DEV : c_int = 24;
3630 pub const _SC_2_UPE : c_int = 25;
3631 pub const _SC_STREAM_MAX : c_int = 26;
3632 pub const _SC_TZNAME_MAX : c_int = 27;
3633 pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
3634 pub const _SC_MAPPED_FILES : c_int = 29;
3635 pub const _SC_MEMLOCK : c_int = 30;
3636 pub const _SC_MEMLOCK_RANGE : c_int = 31;
3637 pub const _SC_MEMORY_PROTECTION : c_int = 32;
3638 pub const _SC_MESSAGE_PASSING : c_int = 33;
3639 pub const _SC_PRIORITIZED_IO : c_int = 34;
3640 pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
3641 pub const _SC_REALTIME_SIGNALS : c_int = 36;
3642 pub const _SC_SEMAPHORES : c_int = 37;
3643 pub const _SC_FSYNC : c_int = 38;
3644 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
3645 pub const _SC_SYNCHRONIZED_IO : c_int = 40;
3646 pub const _SC_TIMERS : c_int = 41;
3647 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
3648 pub const _SC_AIO_MAX : c_int = 43;
3649 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
3650 pub const _SC_DELAYTIMER_MAX : c_int = 45;
3651 pub const _SC_MQ_OPEN_MAX : c_int = 46;
3652 pub const _SC_PAGESIZE : c_int = 47;
3653 pub const _SC_RTSIG_MAX : c_int = 48;
3654 pub const _SC_SEM_NSEMS_MAX : c_int = 49;
3655 pub const _SC_SEM_VALUE_MAX : c_int = 50;
3656 pub const _SC_SIGQUEUE_MAX : c_int = 51;
3657 pub const _SC_TIMER_MAX : c_int = 52;
3661 #[cfg(any(target_os = "macos", target_os = "ios"))]
3664 use types::os::arch::c95::{c_int, c_uint};
3666 pub const EXIT_FAILURE : c_int = 1;
3667 pub const EXIT_SUCCESS : c_int = 0;
3668 pub const RAND_MAX : c_int = 2147483647;
3669 pub const EOF : c_int = -1;
3670 pub const SEEK_SET : c_int = 0;
3671 pub const SEEK_CUR : c_int = 1;
3672 pub const SEEK_END : c_int = 2;
3673 pub const _IOFBF : c_int = 0;
3674 pub const _IONBF : c_int = 2;
3675 pub const _IOLBF : c_int = 1;
3676 pub const BUFSIZ : c_uint = 1024_u32;
3677 pub const FOPEN_MAX : c_uint = 20_u32;
3678 pub const FILENAME_MAX : c_uint = 1024_u32;
3679 pub const L_tmpnam : c_uint = 1024_u32;
3680 pub const TMP_MAX : c_uint = 308915776_u32;
3685 use types::common::c95::c_void;
3686 use types::os::arch::c95::c_int;
3687 use types::os::arch::posix88::mode_t;
3689 pub const O_RDONLY : c_int = 0;
3690 pub const O_WRONLY : c_int = 1;
3691 pub const O_RDWR : c_int = 2;
3692 pub const O_APPEND : c_int = 8;
3693 pub const O_CREAT : c_int = 512;
3694 pub const O_EXCL : c_int = 2048;
3695 pub const O_TRUNC : c_int = 1024;
3696 pub const S_IFIFO : mode_t = 4096;
3697 pub const S_IFCHR : mode_t = 8192;
3698 pub const S_IFBLK : mode_t = 24576;
3699 pub const S_IFDIR : mode_t = 16384;
3700 pub const S_IFREG : mode_t = 32768;
3701 pub const S_IFLNK : mode_t = 40960;
3702 pub const S_IFMT : mode_t = 61440;
3703 pub const S_IEXEC : mode_t = 64;
3704 pub const S_IWRITE : mode_t = 128;
3705 pub const S_IREAD : mode_t = 256;
3706 pub const S_IRWXU : mode_t = 448;
3707 pub const S_IXUSR : mode_t = 64;
3708 pub const S_IWUSR : mode_t = 128;
3709 pub const S_IRUSR : mode_t = 256;
3710 pub const F_OK : c_int = 0;
3711 pub const R_OK : c_int = 4;
3712 pub const W_OK : c_int = 2;
3713 pub const X_OK : c_int = 1;
3714 pub const STDIN_FILENO : c_int = 0;
3715 pub const STDOUT_FILENO : c_int = 1;
3716 pub const STDERR_FILENO : c_int = 2;
3717 pub const F_LOCK : c_int = 1;
3718 pub const F_TEST : c_int = 3;
3719 pub const F_TLOCK : c_int = 2;
3720 pub const F_ULOCK : c_int = 0;
3721 pub const SIGHUP : c_int = 1;
3722 pub const SIGINT : c_int = 2;
3723 pub const SIGQUIT : c_int = 3;
3724 pub const SIGILL : c_int = 4;
3725 pub const SIGABRT : c_int = 6;
3726 pub const SIGFPE : c_int = 8;
3727 pub const SIGKILL : c_int = 9;
3728 pub const SIGSEGV : c_int = 11;
3729 pub const SIGPIPE : c_int = 13;
3730 pub const SIGALRM : c_int = 14;
3731 pub const SIGTERM : c_int = 15;
3733 pub const PROT_NONE : c_int = 0;
3734 pub const PROT_READ : c_int = 1;
3735 pub const PROT_WRITE : c_int = 2;
3736 pub const PROT_EXEC : c_int = 4;
3738 pub const MAP_FILE : c_int = 0x0000;
3739 pub const MAP_SHARED : c_int = 0x0001;
3740 pub const MAP_PRIVATE : c_int = 0x0002;
3741 pub const MAP_FIXED : c_int = 0x0010;
3742 pub const MAP_ANON : c_int = 0x1000;
3744 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
3746 pub const MCL_CURRENT : c_int = 0x0001;
3747 pub const MCL_FUTURE : c_int = 0x0002;
3749 pub const MS_ASYNC : c_int = 0x0001;
3750 pub const MS_INVALIDATE : c_int = 0x0002;
3751 pub const MS_SYNC : c_int = 0x0010;
3753 pub const MS_KILLPAGES : c_int = 0x0004;
3754 pub const MS_DEACTIVATE : c_int = 0x0008;
3756 pub const EPERM : c_int = 1;
3757 pub const ENOENT : c_int = 2;
3758 pub const ESRCH : c_int = 3;
3759 pub const EINTR : c_int = 4;
3760 pub const EIO : c_int = 5;
3761 pub const ENXIO : c_int = 6;
3762 pub const E2BIG : c_int = 7;
3763 pub const ENOEXEC : c_int = 8;
3764 pub const EBADF : c_int = 9;
3765 pub const ECHILD : c_int = 10;
3766 pub const EDEADLK : c_int = 11;
3767 pub const ENOMEM : c_int = 12;
3768 pub const EACCES : c_int = 13;
3769 pub const EFAULT : c_int = 14;
3770 pub const ENOTBLK : c_int = 15;
3771 pub const EBUSY : c_int = 16;
3772 pub const EEXIST : c_int = 17;
3773 pub const EXDEV : c_int = 18;
3774 pub const ENODEV : c_int = 19;
3775 pub const ENOTDIR : c_int = 20;
3776 pub const EISDIR : c_int = 21;
3777 pub const EINVAL : c_int = 22;
3778 pub const ENFILE : c_int = 23;
3779 pub const EMFILE : c_int = 24;
3780 pub const ENOTTY : c_int = 25;
3781 pub const ETXTBSY : c_int = 26;
3782 pub const EFBIG : c_int = 27;
3783 pub const ENOSPC : c_int = 28;
3784 pub const ESPIPE : c_int = 29;
3785 pub const EROFS : c_int = 30;
3786 pub const EMLINK : c_int = 31;
3787 pub const EPIPE : c_int = 32;
3788 pub const EDOM : c_int = 33;
3789 pub const ERANGE : c_int = 34;
3790 pub const EAGAIN : c_int = 35;
3791 pub const EWOULDBLOCK : c_int = EAGAIN;
3792 pub const EINPROGRESS : c_int = 36;
3793 pub const EALREADY : c_int = 37;
3794 pub const ENOTSOCK : c_int = 38;
3795 pub const EDESTADDRREQ : c_int = 39;
3796 pub const EMSGSIZE : c_int = 40;
3797 pub const EPROTOTYPE : c_int = 41;
3798 pub const ENOPROTOOPT : c_int = 42;
3799 pub const EPROTONOSUPPORT : c_int = 43;
3800 pub const ESOCKTNOSUPPORT : c_int = 44;
3801 pub const ENOTSUP : c_int = 45;
3802 pub const EPFNOSUPPORT : c_int = 46;
3803 pub const EAFNOSUPPORT : c_int = 47;
3804 pub const EADDRINUSE : c_int = 48;
3805 pub const EADDRNOTAVAIL : c_int = 49;
3806 pub const ENETDOWN : c_int = 50;
3807 pub const ENETUNREACH : c_int = 51;
3808 pub const ENETRESET : c_int = 52;
3809 pub const ECONNABORTED : c_int = 53;
3810 pub const ECONNRESET : c_int = 54;
3811 pub const ENOBUFS : c_int = 55;
3812 pub const EISCONN : c_int = 56;
3813 pub const ENOTCONN : c_int = 57;
3814 pub const ESHUTDOWN : c_int = 58;
3815 pub const ETOOMANYREFS : c_int = 59;
3816 pub const ETIMEDOUT : c_int = 60;
3817 pub const ECONNREFUSED : c_int = 61;
3818 pub const ELOOP : c_int = 62;
3819 pub const ENAMETOOLONG : c_int = 63;
3820 pub const EHOSTDOWN : c_int = 64;
3821 pub const EHOSTUNREACH : c_int = 65;
3822 pub const ENOTEMPTY : c_int = 66;
3823 pub const EPROCLIM : c_int = 67;
3824 pub const EUSERS : c_int = 68;
3825 pub const EDQUOT : c_int = 69;
3826 pub const ESTALE : c_int = 70;
3827 pub const EREMOTE : c_int = 71;
3828 pub const EBADRPC : c_int = 72;
3829 pub const ERPCMISMATCH : c_int = 73;
3830 pub const EPROGUNAVAIL : c_int = 74;
3831 pub const EPROGMISMATCH : c_int = 75;
3832 pub const EPROCUNAVAIL : c_int = 76;
3833 pub const ENOLCK : c_int = 77;
3834 pub const ENOSYS : c_int = 78;
3835 pub const EFTYPE : c_int = 79;
3836 pub const EAUTH : c_int = 80;
3837 pub const ENEEDAUTH : c_int = 81;
3838 pub const EPWROFF : c_int = 82;
3839 pub const EDEVERR : c_int = 83;
3840 pub const EOVERFLOW : c_int = 84;
3841 pub const EBADEXEC : c_int = 85;
3842 pub const EBADARCH : c_int = 86;
3843 pub const ESHLIBVERS : c_int = 87;
3844 pub const EBADMACHO : c_int = 88;
3845 pub const ECANCELED : c_int = 89;
3846 pub const EIDRM : c_int = 90;
3847 pub const ENOMSG : c_int = 91;
3848 pub const EILSEQ : c_int = 92;
3849 pub const ENOATTR : c_int = 93;
3850 pub const EBADMSG : c_int = 94;
3851 pub const EMULTIHOP : c_int = 95;
3852 pub const ENODATA : c_int = 96;
3853 pub const ENOLINK : c_int = 97;
3854 pub const ENOSR : c_int = 98;
3855 pub const ENOSTR : c_int = 99;
3856 pub const EPROTO : c_int = 100;
3857 pub const ETIME : c_int = 101;
3858 pub const EOPNOTSUPP : c_int = 102;
3859 pub const ENOPOLICY : c_int = 103;
3860 pub const ENOTRECOVERABLE : c_int = 104;
3861 pub const EOWNERDEAD : c_int = 105;
3862 pub const EQFULL : c_int = 106;
3863 pub const ELAST : c_int = 106;
3866 use types::os::arch::c95::{c_int, size_t};
3868 pub const F_DUPFD : c_int = 0;
3869 pub const F_GETFD : c_int = 1;
3870 pub const F_SETFD : c_int = 2;
3871 pub const F_GETFL : c_int = 3;
3872 pub const F_SETFL : c_int = 4;
3874 pub const SIGTRAP : c_int = 5;
3875 pub const SIGPIPE: c_int = 13;
3876 pub const SIG_IGN: size_t = 1;
3878 pub const GLOB_APPEND : c_int = 0x0001;
3879 pub const GLOB_DOOFFS : c_int = 0x0002;
3880 pub const GLOB_ERR : c_int = 0x0004;
3881 pub const GLOB_MARK : c_int = 0x0008;
3882 pub const GLOB_NOCHECK : c_int = 0x0010;
3883 pub const GLOB_NOSORT : c_int = 0x0020;
3884 pub const GLOB_NOESCAPE : c_int = 0x2000;
3886 pub const GLOB_NOSPACE : c_int = -1;
3887 pub const GLOB_ABORTED : c_int = -2;
3888 pub const GLOB_NOMATCH : c_int = -3;
3890 pub const POSIX_MADV_NORMAL : c_int = 0;
3891 pub const POSIX_MADV_RANDOM : c_int = 1;
3892 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3893 pub const POSIX_MADV_WILLNEED : c_int = 3;
3894 pub const POSIX_MADV_DONTNEED : c_int = 4;
3896 pub const _SC_IOV_MAX : c_int = 56;
3897 pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
3898 pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
3899 pub const _SC_LOGIN_NAME_MAX : c_int = 73;
3900 pub const _SC_MQ_PRIO_MAX : c_int = 75;
3901 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
3902 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
3903 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
3904 pub const _SC_THREAD_KEYS_MAX : c_int = 86;
3905 pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
3906 pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
3907 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
3908 pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
3909 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
3910 pub const _SC_THREAD_STACK_MIN : c_int = 93;
3911 pub const _SC_THREAD_THREADS_MAX : c_int = 94;
3912 pub const _SC_THREADS : c_int = 96;
3913 pub const _SC_TTY_NAME_MAX : c_int = 101;
3914 pub const _SC_ATEXIT_MAX : c_int = 107;
3915 pub const _SC_XOPEN_CRYPT : c_int = 108;
3916 pub const _SC_XOPEN_ENH_I18N : c_int = 109;
3917 pub const _SC_XOPEN_LEGACY : c_int = 110;
3918 pub const _SC_XOPEN_REALTIME : c_int = 111;
3919 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
3920 pub const _SC_XOPEN_SHM : c_int = 113;
3921 pub const _SC_XOPEN_UNIX : c_int = 115;
3922 pub const _SC_XOPEN_VERSION : c_int = 116;
3923 pub const _SC_XOPEN_XCU_VERSION : c_int = 121;
3925 pub const PTHREAD_CREATE_JOINABLE: c_int = 1;
3926 pub const PTHREAD_CREATE_DETACHED: c_int = 2;
3927 pub const PTHREAD_STACK_MIN: size_t = 8192;
3932 use types::os::arch::c95::c_int;
3934 pub const MADV_NORMAL : c_int = 0;
3935 pub const MADV_RANDOM : c_int = 1;
3936 pub const MADV_SEQUENTIAL : c_int = 2;
3937 pub const MADV_WILLNEED : c_int = 3;
3938 pub const MADV_DONTNEED : c_int = 4;
3939 pub const MADV_FREE : c_int = 5;
3940 pub const MADV_ZERO_WIRED_PAGES : c_int = 6;
3941 pub const MADV_FREE_REUSABLE : c_int = 7;
3942 pub const MADV_FREE_REUSE : c_int = 8;
3943 pub const MADV_CAN_REUSE : c_int = 9;
3945 pub const MINCORE_INCORE : c_int = 0x1;
3946 pub const MINCORE_REFERENCED : c_int = 0x2;
3947 pub const MINCORE_MODIFIED : c_int = 0x4;
3948 pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
3949 pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
3951 pub const AF_UNIX: c_int = 1;
3952 pub const AF_INET: c_int = 2;
3953 pub const AF_INET6: c_int = 30;
3954 pub const SOCK_STREAM: c_int = 1;
3955 pub const SOCK_DGRAM: c_int = 2;
3956 pub const SOCK_RAW: c_int = 3;
3957 pub const IPPROTO_TCP: c_int = 6;
3958 pub const IPPROTO_IP: c_int = 0;
3959 pub const IPPROTO_IPV6: c_int = 41;
3960 pub const IP_MULTICAST_TTL: c_int = 10;
3961 pub const IP_MULTICAST_LOOP: c_int = 11;
3962 pub const IP_TTL: c_int = 4;
3963 pub const IP_HDRINCL: c_int = 2;
3964 pub const IP_ADD_MEMBERSHIP: c_int = 12;
3965 pub const IP_DROP_MEMBERSHIP: c_int = 13;
3966 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
3967 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
3969 pub const TCP_NODELAY: c_int = 0x01;
3970 pub const TCP_KEEPALIVE: c_int = 0x10;
3971 pub const SOL_SOCKET: c_int = 0xffff;
3972 pub const SO_KEEPALIVE: c_int = 0x0008;
3973 pub const SO_BROADCAST: c_int = 0x0020;
3974 pub const SO_REUSEADDR: c_int = 0x0004;
3975 pub const SO_ERROR: c_int = 0x1007;
3977 pub const IFF_LOOPBACK: c_int = 0x8;
3979 pub const SHUT_RD: c_int = 0;
3980 pub const SHUT_WR: c_int = 1;
3981 pub const SHUT_RDWR: c_int = 2;
3984 use types::os::arch::c95::c_int;
3986 pub const O_DSYNC : c_int = 4194304;
3987 pub const O_SYNC : c_int = 128;
3988 pub const O_NONBLOCK : c_int = 4;
3989 pub const F_FULLFSYNC : c_int = 51;
3991 pub const MAP_COPY : c_int = 0x0002;
3992 pub const MAP_RENAME : c_int = 0x0020;
3993 pub const MAP_NORESERVE : c_int = 0x0040;
3994 pub const MAP_NOEXTEND : c_int = 0x0100;
3995 pub const MAP_HASSEMAPHORE : c_int = 0x0200;
3996 pub const MAP_NOCACHE : c_int = 0x0400;
3997 pub const MAP_JIT : c_int = 0x0800;
3998 pub const MAP_STACK : c_int = 0;
4000 pub const IPPROTO_RAW : c_int = 255;
4003 use types::os::arch::c95::c_int;
4005 pub const _SC_ARG_MAX : c_int = 1;
4006 pub const _SC_CHILD_MAX : c_int = 2;
4007 pub const _SC_CLK_TCK : c_int = 3;
4008 pub const _SC_NGROUPS_MAX : c_int = 4;
4009 pub const _SC_OPEN_MAX : c_int = 5;
4010 pub const _SC_JOB_CONTROL : c_int = 6;
4011 pub const _SC_SAVED_IDS : c_int = 7;
4012 pub const _SC_VERSION : c_int = 8;
4013 pub const _SC_BC_BASE_MAX : c_int = 9;
4014 pub const _SC_BC_DIM_MAX : c_int = 10;
4015 pub const _SC_BC_SCALE_MAX : c_int = 11;
4016 pub const _SC_BC_STRING_MAX : c_int = 12;
4017 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
4018 pub const _SC_EXPR_NEST_MAX : c_int = 14;
4019 pub const _SC_LINE_MAX : c_int = 15;
4020 pub const _SC_RE_DUP_MAX : c_int = 16;
4021 pub const _SC_2_VERSION : c_int = 17;
4022 pub const _SC_2_C_BIND : c_int = 18;
4023 pub const _SC_2_C_DEV : c_int = 19;
4024 pub const _SC_2_CHAR_TERM : c_int = 20;
4025 pub const _SC_2_FORT_DEV : c_int = 21;
4026 pub const _SC_2_FORT_RUN : c_int = 22;
4027 pub const _SC_2_LOCALEDEF : c_int = 23;
4028 pub const _SC_2_SW_DEV : c_int = 24;
4029 pub const _SC_2_UPE : c_int = 25;
4030 pub const _SC_STREAM_MAX : c_int = 26;
4031 pub const _SC_TZNAME_MAX : c_int = 27;
4032 pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
4033 pub const _SC_PAGESIZE : c_int = 29;
4034 pub const _SC_MEMLOCK : c_int = 30;
4035 pub const _SC_MEMLOCK_RANGE : c_int = 31;
4036 pub const _SC_MEMORY_PROTECTION : c_int = 32;
4037 pub const _SC_MESSAGE_PASSING : c_int = 33;
4038 pub const _SC_PRIORITIZED_IO : c_int = 34;
4039 pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
4040 pub const _SC_REALTIME_SIGNALS : c_int = 36;
4041 pub const _SC_SEMAPHORES : c_int = 37;
4042 pub const _SC_FSYNC : c_int = 38;
4043 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
4044 pub const _SC_SYNCHRONIZED_IO : c_int = 40;
4045 pub const _SC_TIMERS : c_int = 41;
4046 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
4047 pub const _SC_AIO_MAX : c_int = 43;
4048 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
4049 pub const _SC_DELAYTIMER_MAX : c_int = 45;
4050 pub const _SC_MQ_OPEN_MAX : c_int = 46;
4051 pub const _SC_MAPPED_FILES : c_int = 47;
4052 pub const _SC_RTSIG_MAX : c_int = 48;
4053 pub const _SC_SEM_NSEMS_MAX : c_int = 49;
4054 pub const _SC_SEM_VALUE_MAX : c_int = 50;
4055 pub const _SC_SIGQUEUE_MAX : c_int = 51;
4056 pub const _SC_TIMER_MAX : c_int = 52;
4057 pub const _SC_XBS5_ILP32_OFF32 : c_int = 122;
4058 pub const _SC_XBS5_ILP32_OFFBIG : c_int = 123;
4059 pub const _SC_XBS5_LP64_OFF64 : c_int = 124;
4060 pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 125;
4067 // Thankfully most of c95 is universally available and does not vary by OS
4068 // or anything. The same is not true of POSIX.
4072 use types::os::arch::c95::{c_char, c_int};
4075 pub fn isalnum(c: c_int) -> c_int;
4076 pub fn isalpha(c: c_int) -> c_int;
4077 pub fn iscntrl(c: c_int) -> c_int;
4078 pub fn isdigit(c: c_int) -> c_int;
4079 pub fn isgraph(c: c_int) -> c_int;
4080 pub fn islower(c: c_int) -> c_int;
4081 pub fn isprint(c: c_int) -> c_int;
4082 pub fn ispunct(c: c_int) -> c_int;
4083 pub fn isspace(c: c_int) -> c_int;
4084 pub fn isupper(c: c_int) -> c_int;
4085 pub fn isxdigit(c: c_int) -> c_int;
4086 pub fn tolower(c: c_char) -> c_char;
4087 pub fn toupper(c: c_char) -> c_char;
4092 use types::common::c95::{FILE, c_void, fpos_t};
4093 use types::os::arch::c95::{c_char, c_int, c_long, size_t};
4096 pub fn fopen(filename: *const c_char,
4097 mode: *const c_char) -> *mut FILE;
4098 pub fn freopen(filename: *const c_char, mode: *const c_char,
4101 pub fn fflush(file: *mut FILE) -> c_int;
4102 pub fn fclose(file: *mut FILE) -> c_int;
4103 pub fn remove(filename: *const c_char) -> c_int;
4104 pub fn rename(oldname: *const c_char,
4105 newname: *const c_char) -> c_int;
4106 pub fn tmpfile() -> *mut FILE;
4107 pub fn setvbuf(stream: *mut FILE,
4108 buffer: *mut c_char,
4112 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
4113 // Omitted: printf and scanf variants.
4114 pub fn fgetc(stream: *mut FILE) -> c_int;
4115 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
4117 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
4118 pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int;
4119 // Omitted: getc, getchar (might be macros).
4121 // Omitted: gets, so ridiculously unsafe that it should not
4124 // Omitted: putc, putchar (might be macros).
4125 pub fn puts(s: *const c_char) -> c_int;
4126 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
4127 pub fn fread(ptr: *mut c_void,
4132 pub fn fwrite(ptr: *const c_void,
4137 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int)
4139 pub fn ftell(stream: *mut FILE) -> c_long;
4140 pub fn rewind(stream: *mut FILE);
4141 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
4142 pub fn fsetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
4143 pub fn feof(stream: *mut FILE) -> c_int;
4144 pub fn ferror(stream: *mut FILE) -> c_int;
4145 pub fn perror(s: *const c_char);
4150 use types::common::c95::c_void;
4151 use types::os::arch::c95::{c_char, c_double, c_int};
4152 use types::os::arch::c95::{c_long, c_uint, c_ulong};
4153 use types::os::arch::c95::{size_t};
4156 pub fn abs(i: c_int) -> c_int;
4157 pub fn labs(i: c_long) -> c_long;
4158 // Omitted: div, ldiv (return pub type incomplete).
4159 pub fn atof(s: *const c_char) -> c_double;
4160 pub fn atoi(s: *const c_char) -> c_int;
4161 pub fn strtod(s: *const c_char,
4162 endp: *mut *mut c_char) -> c_double;
4163 pub fn strtol(s: *const c_char,
4164 endp: *mut *mut c_char, base: c_int) -> c_long;
4165 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
4166 base: c_int) -> c_ulong;
4167 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
4168 pub fn malloc(size: size_t) -> *mut c_void;
4169 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
4170 pub fn free(p: *mut c_void);
4171 pub fn exit(status: c_int) -> !;
4172 pub fn _exit(status: c_int) -> !;
4173 pub fn atexit(cb: extern fn()) -> c_int;
4174 pub fn system(s: *const c_char) -> c_int;
4175 pub fn getenv(s: *const c_char) -> *mut c_char;
4176 // Omitted: bsearch, qsort
4177 pub fn rand() -> c_int;
4178 pub fn srand(seed: c_uint);
4183 use types::common::c95::c_void;
4184 use types::os::arch::c95::{c_char, c_int, size_t};
4185 use types::os::arch::c95::{wchar_t};
4188 pub fn strcpy(dst: *mut c_char,
4189 src: *const c_char) -> *mut c_char;
4190 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t)
4192 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
4193 pub fn strncat(s: *mut c_char, ct: *const c_char,
4194 n: size_t) -> *mut c_char;
4195 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
4196 pub fn strncmp(cs: *const c_char, ct: *const c_char,
4197 n: size_t) -> c_int;
4198 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
4199 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
4200 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
4201 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
4202 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
4203 pub fn strpbrk(cs: *const c_char,
4204 ct: *const c_char) -> *mut c_char;
4205 pub fn strstr(cs: *const c_char,
4206 ct: *const c_char) -> *mut c_char;
4207 pub fn strlen(cs: *const c_char) -> size_t;
4208 pub fn strerror(n: c_int) -> *mut c_char;
4209 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
4210 pub fn strxfrm(s: *mut c_char, ct: *const c_char,
4211 n: size_t) -> size_t;
4212 pub fn wcslen(buf: *const wchar_t) -> size_t;
4214 // Omitted: memcpy, memmove, memset (provided by LLVM)
4216 // These are fine to execute on the Rust stack. They must be,
4217 // in fact, because LLVM generates calls to them!
4218 pub fn memcmp(cx: *const c_void, ct: *const c_void,
4219 n: size_t) -> c_int;
4220 pub fn memchr(cx: *const c_void, c: c_int,
4221 n: size_t) -> *mut c_void;
4226 // Microsoft helpfully underscore-qualifies all of its POSIX-like symbols
4227 // to make sure you don't use them accidentally. It also randomly deviates
4228 // from the exact signatures you might otherwise expect, and omits much,
4229 // so be careful when trying to write portable code; it won't always work
4230 // with the same POSIX functions and types as other platforms.
4232 #[cfg(target_os = "windows")]
4235 use types::os::common::posix01::{stat, utimbuf};
4236 use types::os::arch::c95::{c_int, c_char, wchar_t};
4239 #[link_name = "_chmod"]
4240 pub fn chmod(path: *const c_char, mode: c_int) -> c_int;
4241 #[link_name = "_wchmod"]
4242 pub fn wchmod(path: *const wchar_t, mode: c_int) -> c_int;
4243 #[link_name = "_mkdir"]
4244 pub fn mkdir(path: *const c_char) -> c_int;
4245 #[link_name = "_wrmdir"]
4246 pub fn wrmdir(path: *const wchar_t) -> c_int;
4247 #[link_name = "_fstat64"]
4248 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
4249 #[link_name = "_stat64"]
4250 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
4251 #[link_name = "_wstat64"]
4252 pub fn wstat(path: *const wchar_t, buf: *mut stat) -> c_int;
4253 #[link_name = "_wutime64"]
4254 pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> c_int;
4259 use types::common::c95::FILE;
4260 use types::os::arch::c95::{c_int, c_char};
4263 #[link_name = "_popen"]
4264 pub fn popen(command: *const c_char,
4265 mode: *const c_char) -> *mut FILE;
4266 #[link_name = "_pclose"]
4267 pub fn pclose(stream: *mut FILE) -> c_int;
4268 #[link_name = "_fdopen"]
4269 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
4270 #[link_name = "_fileno"]
4271 pub fn fileno(stream: *mut FILE) -> c_int;
4276 use types::os::arch::c95::{c_int, c_char, wchar_t};
4278 #[link_name = "_open"]
4279 pub fn open(path: *const c_char, oflag: c_int, mode: c_int)
4281 #[link_name = "_wopen"]
4282 pub fn wopen(path: *const wchar_t, oflag: c_int, mode: c_int)
4284 #[link_name = "_creat"]
4285 pub fn creat(path: *const c_char, mode: c_int) -> c_int;
4290 // Not supplied at all.
4294 use types::common::c95::c_void;
4295 use types::os::arch::c95::{c_int, c_uint, c_char,
4297 use types::os::arch::c99::intptr_t;
4300 #[link_name = "_access"]
4301 pub fn access(path: *const c_char, amode: c_int) -> c_int;
4302 #[link_name = "_chdir"]
4303 pub fn chdir(dir: *const c_char) -> c_int;
4304 #[link_name = "_close"]
4305 pub fn close(fd: c_int) -> c_int;
4306 #[link_name = "_dup"]
4307 pub fn dup(fd: c_int) -> c_int;
4308 #[link_name = "_dup2"]
4309 pub fn dup2(src: c_int, dst: c_int) -> c_int;
4310 #[link_name = "_execv"]
4311 pub fn execv(prog: *const c_char,
4312 argv: *mut *const c_char) -> intptr_t;
4313 #[link_name = "_execve"]
4314 pub fn execve(prog: *const c_char, argv: *mut *const c_char,
4315 envp: *mut *const c_char)
4317 #[link_name = "_execvp"]
4318 pub fn execvp(c: *const c_char,
4319 argv: *mut *const c_char) -> c_int;
4320 #[link_name = "_execvpe"]
4321 pub fn execvpe(c: *const c_char, argv: *mut *const c_char,
4322 envp: *mut *const c_char) -> c_int;
4323 #[link_name = "_getcwd"]
4324 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
4325 #[link_name = "_getpid"]
4326 pub fn getpid() -> c_int;
4327 #[link_name = "_isatty"]
4328 pub fn isatty(fd: c_int) -> c_int;
4329 #[link_name = "_lseek"]
4330 pub fn lseek(fd: c_int, offset: c_long, origin: c_int)
4332 #[link_name = "_pipe"]
4333 pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
4335 #[link_name = "_read"]
4336 pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
4338 #[link_name = "_rmdir"]
4339 pub fn rmdir(path: *const c_char) -> c_int;
4340 #[link_name = "_unlink"]
4341 pub fn unlink(c: *const c_char) -> c_int;
4342 #[link_name = "_write"]
4343 pub fn write(fd: c_int, buf: *const c_void,
4344 count: c_uint) -> c_int;
4352 #[cfg(any(target_os = "linux",
4353 target_os = "android",
4354 target_os = "macos",
4356 target_os = "freebsd",
4357 target_os = "dragonfly"))]
4360 use types::os::arch::c95::{c_char, c_int};
4361 use types::os::arch::posix01::stat;
4362 use types::os::arch::posix88::mode_t;
4365 pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
4366 pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
4368 #[cfg(any(target_os = "linux",
4369 target_os = "freebsd",
4370 target_os = "dragonfly",
4371 target_os = "android",
4372 target_os = "ios"))]
4373 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
4375 #[cfg(target_os = "macos")]
4376 #[link_name = "fstat64"]
4377 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
4379 pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
4380 pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
4382 #[cfg(any(target_os = "linux",
4383 target_os = "freebsd",
4384 target_os = "dragonfly",
4385 target_os = "android",
4386 target_os = "ios"))]
4387 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
4389 #[cfg(target_os = "macos")]
4390 #[link_name = "stat64"]
4391 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
4396 use types::common::c95::FILE;
4397 use types::os::arch::c95::{c_char, c_int};
4400 pub fn popen(command: *const c_char,
4401 mode: *const c_char) -> *mut FILE;
4402 pub fn pclose(stream: *mut FILE) -> c_int;
4403 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
4404 pub fn fileno(stream: *mut FILE) -> c_int;
4409 use types::os::arch::c95::{c_char, c_int};
4410 use types::os::arch::posix88::mode_t;
4413 pub fn open(path: *const c_char, oflag: c_int, mode: mode_t)
4415 pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
4416 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
4421 use types::common::posix88::{DIR, dirent_t};
4422 use types::os::arch::c95::{c_char, c_int, c_long};
4424 // NB: On OS X opendir and readdir have two versions,
4425 // one for 32-bit kernelspace and one for 64.
4426 // We should be linking to the 64-bit ones, called
4427 // opendir$INODE64, etc. but for some reason rustc
4428 // doesn't link it correctly on i686, so we're going
4429 // through a C function that mysteriously does work.
4432 #[link_name="rust_opendir"]
4433 pub fn opendir(dirname: *const c_char) -> *mut DIR;
4434 #[link_name="rust_readdir_r"]
4435 pub fn readdir_r(dirp: *mut DIR, entry: *mut dirent_t,
4436 result: *mut *mut dirent_t) -> c_int;
4440 pub fn closedir(dirp: *mut DIR) -> c_int;
4441 pub fn rewinddir(dirp: *mut DIR);
4442 pub fn seekdir(dirp: *mut DIR, loc: c_long);
4443 pub fn telldir(dirp: *mut DIR) -> c_long;
4448 use types::common::c95::c_void;
4449 use types::os::arch::c95::{c_char, c_int, c_long, c_uint};
4450 use types::os::arch::c95::{size_t};
4451 use types::os::common::posix01::timespec;
4452 use types::os::arch::posix01::utimbuf;
4453 use types::os::arch::posix88::{gid_t, off_t, pid_t};
4454 use types::os::arch::posix88::{ssize_t, uid_t};
4456 pub const _PC_NAME_MAX: c_int = 4;
4459 pub fn access(path: *const c_char, amode: c_int) -> c_int;
4460 pub fn alarm(seconds: c_uint) -> c_uint;
4461 pub fn chdir(dir: *const c_char) -> c_int;
4462 pub fn chown(path: *const c_char, uid: uid_t,
4463 gid: gid_t) -> c_int;
4464 pub fn close(fd: c_int) -> c_int;
4465 pub fn dup(fd: c_int) -> c_int;
4466 pub fn dup2(src: c_int, dst: c_int) -> c_int;
4467 pub fn execv(prog: *const c_char,
4468 argv: *mut *const c_char) -> c_int;
4469 pub fn execve(prog: *const c_char, argv: *mut *const c_char,
4470 envp: *mut *const c_char)
4472 pub fn execvp(c: *const c_char,
4473 argv: *mut *const c_char) -> c_int;
4474 pub fn fork() -> pid_t;
4475 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
4476 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
4477 pub fn getegid() -> gid_t;
4478 pub fn geteuid() -> uid_t;
4479 pub fn getgid() -> gid_t ;
4480 pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
4482 pub fn getlogin() -> *mut c_char;
4483 pub fn getopt(argc: c_int, argv: *mut *const c_char,
4484 optstr: *const c_char) -> c_int;
4485 pub fn getpgrp() -> pid_t;
4486 pub fn getpid() -> pid_t;
4487 pub fn getppid() -> pid_t;
4488 pub fn getuid() -> uid_t;
4489 pub fn getsid(pid: pid_t) -> pid_t;
4490 pub fn isatty(fd: c_int) -> c_int;
4491 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
4492 pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
4494 pub fn pathconf(path: *mut c_char, name: c_int) -> c_long;
4495 pub fn pause() -> c_int;
4496 pub fn pipe(fds: *mut c_int) -> c_int;
4497 pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
4499 pub fn rmdir(path: *const c_char) -> c_int;
4500 pub fn setgid(gid: gid_t) -> c_int;
4501 pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
4502 pub fn setsid() -> pid_t;
4503 pub fn setuid(uid: uid_t) -> c_int;
4504 pub fn sleep(secs: c_uint) -> c_uint;
4505 pub fn usleep(secs: c_uint) -> c_int;
4506 pub fn nanosleep(rqtp: *const timespec,
4507 rmtp: *mut timespec) -> c_int;
4508 pub fn sysconf(name: c_int) -> c_long;
4509 pub fn tcgetpgrp(fd: c_int) -> pid_t;
4510 pub fn ttyname(fd: c_int) -> *mut c_char;
4511 pub fn unlink(c: *const c_char) -> c_int;
4512 pub fn write(fd: c_int, buf: *const c_void, count: size_t)
4514 pub fn pread(fd: c_int, buf: *mut c_void, count: size_t,
4515 offset: off_t) -> ssize_t;
4516 pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t,
4517 offset: off_t) -> ssize_t;
4518 pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
4523 use types::os::arch::c95::{c_int};
4524 use types::os::arch::posix88::{pid_t};
4527 pub fn kill(pid: pid_t, sig: c_int) -> c_int;
4532 use types::common::c95::{c_void};
4533 use types::os::arch::c95::{size_t, c_int, c_char};
4534 use types::os::arch::posix88::{mode_t, off_t};
4537 pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
4538 pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
4539 pub fn mlockall(flags: c_int) -> c_int;
4540 pub fn munlockall() -> c_int;
4542 pub fn mmap(addr: *mut c_void,
4549 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
4551 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int)
4554 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int)
4556 pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t)
4558 pub fn shm_unlink(name: *const c_char) -> c_int;
4563 use types::os::arch::c95::{c_char, c_uint};
4566 pub fn if_nametoindex(ifname: *const c_char) -> c_uint;
4572 #[cfg(any(target_os = "linux",
4573 target_os = "android",
4574 target_os = "macos",
4576 target_os = "freebsd",
4577 target_os = "dragonfly"))]
4580 use types::os::arch::c95::{c_char, c_int};
4581 use types::os::arch::posix01::stat;
4584 #[cfg(any(target_os = "linux",
4585 target_os = "freebsd",
4586 target_os = "dragonfly",
4587 target_os = "android",
4588 target_os = "ios"))]
4589 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
4591 #[cfg(target_os = "macos")]
4592 #[link_name = "lstat64"]
4593 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
4598 use types::os::arch::c95::{c_char, c_int, size_t};
4599 use types::os::arch::posix88::{ssize_t, off_t};
4602 pub fn readlink(path: *const c_char,
4607 pub fn fsync(fd: c_int) -> c_int;
4609 #[cfg(any(target_os = "linux", target_os = "android"))]
4610 pub fn fdatasync(fd: c_int) -> c_int;
4612 pub fn setenv(name: *const c_char, val: *const c_char,
4613 overwrite: c_int) -> c_int;
4614 pub fn unsetenv(name: *const c_char) -> c_int;
4615 pub fn putenv(string: *mut c_char) -> c_int;
4617 pub fn symlink(path1: *const c_char,
4618 path2: *const c_char) -> c_int;
4620 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
4625 use types::os::arch::c95::c_int;
4626 use types::os::common::posix01::sighandler_t;
4628 #[cfg(not(target_os = "android"))]
4630 pub fn signal(signum: c_int,
4631 handler: sighandler_t) -> sighandler_t;
4634 #[cfg(target_os = "android")]
4636 #[link_name = "bsd_signal"]
4637 pub fn signal(signum: c_int,
4638 handler: sighandler_t) -> sighandler_t;
4643 use types::os::arch::c95::{c_char, c_int};
4644 use types::os::common::posix01::{glob_t};
4647 pub fn glob(pattern: *const c_char,
4649 errfunc: ::core::option::Option<extern "C" fn(epath: *const c_char,
4650 errno: c_int) -> c_int>,
4651 pglob: *mut glob_t);
4652 pub fn globfree(pglob: *mut glob_t);
4657 use types::common::c95::{c_void};
4658 use types::os::arch::c95::{c_int, size_t};
4661 pub fn posix_madvise(addr: *mut c_void,
4669 #[cfg(target_os = "windows")]
4688 #[cfg(any(target_os = "windows",
4689 target_os = "linux",
4690 target_os = "android",
4691 target_os = "macos",
4693 target_os = "freebsd",
4694 target_os = "dragonfly"))]
4700 #[cfg(not(windows))]
4702 use types::common::c95::{c_void};
4703 use types::os::common::bsd44::{socklen_t, sockaddr, ifaddrs};
4704 use types::os::arch::c95::{c_int, size_t};
4705 use types::os::arch::posix88::ssize_t;
4708 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int;
4709 pub fn connect(socket: c_int, address: *const sockaddr,
4710 len: socklen_t) -> c_int;
4711 pub fn bind(socket: c_int, address: *const sockaddr,
4712 address_len: socklen_t) -> c_int;
4713 pub fn listen(socket: c_int, backlog: c_int) -> c_int;
4714 pub fn accept(socket: c_int, address: *mut sockaddr,
4715 address_len: *mut socklen_t) -> c_int;
4716 pub fn getpeername(socket: c_int, address: *mut sockaddr,
4717 address_len: *mut socklen_t) -> c_int;
4718 pub fn getsockname(socket: c_int, address: *mut sockaddr,
4719 address_len: *mut socklen_t) -> c_int;
4720 pub fn setsockopt(socket: c_int, level: c_int, name: c_int,
4721 value: *const c_void,
4722 option_len: socklen_t) -> c_int;
4723 pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
4724 flags: c_int) -> ssize_t;
4725 pub fn send(socket: c_int, buf: *const c_void, len: size_t,
4726 flags: c_int) -> ssize_t;
4727 pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
4728 flags: c_int, addr: *mut sockaddr,
4729 addrlen: *mut socklen_t) -> ssize_t;
4730 pub fn sendto(socket: c_int, buf: *const c_void, len: size_t,
4731 flags: c_int, addr: *const sockaddr,
4732 addrlen: socklen_t) -> ssize_t;
4733 pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> c_int;
4734 pub fn freeifaddrs(ifa: *mut ifaddrs);
4735 pub fn shutdown(socket: c_int, how: c_int) -> c_int;
4741 use types::common::c95::{c_void};
4742 use types::os::common::bsd44::{socklen_t, sockaddr, SOCKET};
4743 use types::os::arch::c95::c_int;
4744 use types::os::arch::posix88::ssize_t;
4747 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> SOCKET;
4748 pub fn connect(socket: SOCKET, address: *const sockaddr,
4749 len: socklen_t) -> c_int;
4750 pub fn bind(socket: SOCKET, address: *const sockaddr,
4751 address_len: socklen_t) -> c_int;
4752 pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
4753 pub fn accept(socket: SOCKET, address: *mut sockaddr,
4754 address_len: *mut socklen_t) -> SOCKET;
4755 pub fn getpeername(socket: SOCKET, address: *mut sockaddr,
4756 address_len: *mut socklen_t) -> c_int;
4757 pub fn getsockname(socket: SOCKET, address: *mut sockaddr,
4758 address_len: *mut socklen_t) -> c_int;
4759 pub fn setsockopt(socket: SOCKET, level: c_int, name: c_int,
4760 value: *const c_void,
4761 option_len: socklen_t) -> c_int;
4762 pub fn closesocket(socket: SOCKET) -> c_int;
4763 pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
4764 flags: c_int) -> c_int;
4765 pub fn send(socket: SOCKET, buf: *const c_void, len: c_int,
4766 flags: c_int) -> c_int;
4767 pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
4768 flags: c_int, addr: *mut sockaddr,
4769 addrlen: *mut c_int) -> ssize_t;
4770 pub fn sendto(socket: SOCKET, buf: *const c_void, len: c_int,
4771 flags: c_int, addr: *const sockaddr,
4772 addrlen: c_int) -> c_int;
4773 pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
4777 #[cfg(any(target_os = "macos",
4779 target_os = "freebsd",
4780 target_os = "dragonfly"))]
4782 use types::common::c95::{c_void};
4783 use types::os::arch::c95::{c_char, c_uchar, c_int, c_uint, c_ulong, size_t};
4786 pub fn ioctl(d: c_int, request: c_ulong, ...) -> c_int;
4787 pub fn sysctl(name: *mut c_int,
4790 oldlenp: *mut size_t,
4794 pub fn sysctlbyname(name: *const c_char,
4796 oldlenp: *mut size_t,
4800 pub fn sysctlnametomib(name: *const c_char,
4804 pub fn getdtablesize() -> c_int;
4805 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
4807 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
4813 #[cfg(any(target_os = "linux", target_os = "android"))]
4815 use types::common::c95::{c_void};
4816 use types::os::arch::c95::{c_uchar, c_int, size_t};
4819 pub fn getdtablesize() -> c_int;
4820 pub fn ioctl(d: c_int, request: c_int, ...) -> c_int;
4821 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
4823 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
4829 #[cfg(target_os = "windows")]
4833 #[cfg(any(target_os = "macos", target_os = "ios"))]
4835 use types::os::arch::c95::{c_char, c_int};
4838 pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32)
4843 #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
4847 #[cfg(any(target_os = "linux", target_os = "android"))]
4852 #[cfg(target_os = "windows")]
4856 use types::os::arch::c95::{c_uint};
4857 use types::os::arch::extra::{BOOL, DWORD, SIZE_T, HMODULE,
4859 LPWCH, LPDWORD, LPVOID,
4860 LPCVOID, LPOVERLAPPED,
4861 LPSECURITY_ATTRIBUTES,
4863 LPPROCESS_INFORMATION,
4864 LPMEMORY_BASIC_INFORMATION,
4865 LPSYSTEM_INFO, HANDLE, LPHANDLE,
4866 LARGE_INTEGER, PLARGE_INTEGER,
4867 LPFILETIME, LPWIN32_FIND_DATAW};
4870 pub fn GetEnvironmentVariableW(n: LPCWSTR,
4874 pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
4876 pub fn GetEnvironmentStringsW() -> LPWCH;
4877 pub fn FreeEnvironmentStringsW(env_ptr: LPWCH) -> BOOL;
4878 pub fn GetModuleFileNameW(hModule: HMODULE,
4882 pub fn CreateDirectoryW(lpPathName: LPCWSTR,
4883 lpSecurityAttributes:
4884 LPSECURITY_ATTRIBUTES)
4886 pub fn CopyFileW(lpExistingFileName: LPCWSTR,
4887 lpNewFileName: LPCWSTR,
4888 bFailIfExists: BOOL)
4890 pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
4891 pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
4892 pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
4895 pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
4896 pub fn GetLastError() -> DWORD;
4897 pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW)
4899 pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW)
4901 pub fn FindClose(findFile: HANDLE) -> BOOL;
4902 pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
4903 hSourceHandle: HANDLE,
4904 hTargetProcessHandle: HANDLE,
4905 lpTargetHandle: LPHANDLE,
4906 dwDesiredAccess: DWORD,
4907 bInheritHandle: BOOL,
4910 pub fn CloseHandle(hObject: HANDLE) -> BOOL;
4911 pub fn OpenProcess(dwDesiredAccess: DWORD,
4912 bInheritHandle: BOOL,
4915 pub fn GetCurrentProcess() -> HANDLE;
4916 pub fn CreateProcessW(lpApplicationName: LPCWSTR,
4917 lpCommandLine: LPWSTR,
4918 lpProcessAttributes:
4919 LPSECURITY_ATTRIBUTES,
4921 LPSECURITY_ATTRIBUTES,
4922 bInheritHandles: BOOL,
4923 dwCreationFlags: DWORD,
4924 lpEnvironment: LPVOID,
4925 lpCurrentDirectory: LPCWSTR,
4926 lpStartupInfo: LPSTARTUPINFO,
4927 lpProcessInformation:
4928 LPPROCESS_INFORMATION)
4930 pub fn WaitForSingleObject(hHandle: HANDLE,
4931 dwMilliseconds: DWORD)
4933 pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
4935 pub fn GetExitCodeProcess(hProcess: HANDLE,
4936 lpExitCode: LPDWORD)
4938 pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
4939 pub fn VirtualAlloc(lpAddress: LPVOID,
4941 flAllocationType: DWORD,
4944 pub fn VirtualFree(lpAddress: LPVOID,
4948 pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
4949 pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
4951 pub fn VirtualProtect(lpAddress: LPVOID,
4953 flNewProtect: DWORD,
4954 lpflOldProtect: LPDWORD)
4956 pub fn VirtualQuery(lpAddress: LPCVOID,
4957 lpBuffer: LPMEMORY_BASIC_INFORMATION,
4960 pub fn CreateFileMappingW(hFile: HANDLE,
4961 lpAttributes: LPSECURITY_ATTRIBUTES,
4963 dwMaximumSizeHigh: DWORD,
4964 dwMaximumSizeLow: DWORD,
4967 pub fn MapViewOfFile(hFileMappingObject: HANDLE,
4968 dwDesiredAccess: DWORD,
4969 dwFileOffsetHigh: DWORD,
4970 dwFileOffsetLow: DWORD,
4971 dwNumberOfBytesToMap: SIZE_T)
4973 pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
4974 pub fn MoveFileExW(lpExistingFileName: LPCWSTR,
4975 lpNewFileName: LPCWSTR,
4976 dwFlags: DWORD) -> BOOL;
4977 pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
4978 lpTargetFileName: LPCWSTR,
4979 lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
4981 pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL;
4982 pub fn CreateFileW(lpFileName: LPCWSTR,
4983 dwDesiredAccess: DWORD,
4985 lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
4986 dwCreationDisposition: DWORD,
4987 dwFlagsAndAttributes: DWORD,
4988 hTemplateFile: HANDLE) -> HANDLE;
4989 pub fn ReadFile(hFile: HANDLE,
4991 nNumberOfBytesToRead: DWORD,
4992 lpNumberOfBytesRead: LPDWORD,
4993 lpOverlapped: LPOVERLAPPED) -> BOOL;
4994 pub fn WriteFile(hFile: HANDLE,
4996 nNumberOfBytesToRead: DWORD,
4997 lpNumberOfBytesRead: LPDWORD,
4998 lpOverlapped: LPOVERLAPPED) -> BOOL;
4999 pub fn SetFilePointerEx(hFile: HANDLE,
5000 liDistanceToMove: LARGE_INTEGER,
5001 lpNewFilePointer: PLARGE_INTEGER,
5002 dwMoveMethod: DWORD) -> BOOL;
5003 pub fn SetEndOfFile(hFile: HANDLE) -> BOOL;
5005 pub fn GetSystemTimeAsFileTime(
5006 lpSystemTimeAsFileTime: LPFILETIME);
5008 pub fn QueryPerformanceFrequency(
5009 lpFrequency: *mut LARGE_INTEGER) -> BOOL;
5010 pub fn QueryPerformanceCounter(
5011 lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL;
5013 pub fn GetCurrentProcessId() -> DWORD;
5014 pub fn CreateNamedPipeW(
5018 nMaxInstances: DWORD,
5019 nOutBufferSize: DWORD,
5020 nInBufferSize: DWORD,
5021 nDefaultTimeOut: DWORD,
5022 lpSecurityAttributes: LPSECURITY_ATTRIBUTES
5024 pub fn ConnectNamedPipe(hNamedPipe: HANDLE,
5025 lpOverlapped: LPOVERLAPPED) -> BOOL;
5026 pub fn WaitNamedPipeW(lpNamedPipeName: LPCWSTR,
5027 nTimeOut: DWORD) -> BOOL;
5028 pub fn SetNamedPipeHandleState(hNamedPipe: HANDLE,
5030 lpMaxCollectionCount: LPDWORD,
5031 lpCollectDataTimeout: LPDWORD)
5033 pub fn CreateEventW(lpEventAttributes: LPSECURITY_ATTRIBUTES,
5035 bInitialState: BOOL,
5036 lpName: LPCWSTR) -> HANDLE;
5037 pub fn GetOverlappedResult(hFile: HANDLE,
5038 lpOverlapped: LPOVERLAPPED,
5039 lpNumberOfBytesTransferred: LPDWORD,
5040 bWait: BOOL) -> BOOL;
5041 pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL;
5046 use types::os::arch::c95::{c_int, c_long};
5047 use types::os::arch::c99::intptr_t;
5050 #[link_name = "_commit"]
5051 pub fn commit(fd: c_int) -> c_int;
5053 #[link_name = "_get_osfhandle"]
5054 pub fn get_osfhandle(fd: c_int) -> c_long;
5056 #[link_name = "_open_osfhandle"]
5057 pub fn open_osfhandle(osfhandle: intptr_t,
5058 flags: c_int) -> c_int;
5063 use types::os::arch::c95::{c_int, c_long, c_ulong};
5064 use types::os::common::bsd44::SOCKET;
5067 pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int;
5074 pub fn issue_14344_workaround() {} // FIXME #14344 force linkage to happen correctly
5076 #[test] fn work_on_windows() { } // FIXME #10872 needed for a happy windows
5081 pub use core::marker;