1 // Copyright 2012-2014 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.
12 #![crate_name = "libc"]
14 #![no_std] // we don't need std, and we can't have std, since it doesn't exist
15 // yet. std depends on us.
16 #![crate_type = "rlib"]
17 #![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(non_camel_case_types)]
75 #![allow(non_snake_case)]
76 #![allow(non_upper_case_globals)]
77 #![allow(missing_docs)]
78 #![allow(non_snake_case)]
79 #![allow(raw_pointer_deriving)]
83 #[cfg(test)] extern crate std;
84 #[cfg(test)] extern crate test;
86 pub use self::Nullable::*;
88 // Explicit export lists for the intersection (provided here) mean that
89 // you can write more-platform-agnostic code if you stick to just these
92 pub use types::common::c95::{FILE, c_void, fpos_t};
93 pub use types::common::c99::{int8_t, int16_t, int32_t, int64_t};
94 pub use types::common::c99::{uint8_t, uint16_t, uint32_t, uint64_t};
95 pub use types::common::posix88::{DIR, dirent_t};
96 pub use types::os::common::posix01::{timeval};
97 pub use types::os::common::bsd44::{addrinfo, in_addr, in6_addr, sockaddr_storage};
98 pub use types::os::common::bsd44::{ip_mreq, ip6_mreq, sockaddr, sockaddr_un};
99 pub use types::os::common::bsd44::{sa_family_t, sockaddr_in, sockaddr_in6, socklen_t};
100 pub use types::os::arch::c95::{c_char, c_double, c_float, c_int, c_uint};
101 pub use types::os::arch::c95::{c_long, c_short, c_uchar, c_ulong, wchar_t};
102 pub use types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t, c_schar};
103 pub use types::os::arch::c95::{size_t, time_t, suseconds_t};
104 pub use types::os::arch::c99::{c_longlong, c_ulonglong};
105 pub use types::os::arch::c99::{intptr_t, uintptr_t};
106 pub use types::os::arch::c99::{intmax_t, uintmax_t};
107 pub use types::os::arch::posix88::{dev_t, ino_t, mode_t};
108 pub use types::os::arch::posix88::{off_t, pid_t, ssize_t};
110 pub use consts::os::c95::{_IOFBF, _IOLBF, _IONBF, BUFSIZ, EOF};
111 pub use consts::os::c95::{EXIT_FAILURE, EXIT_SUCCESS};
112 pub use consts::os::c95::{FILENAME_MAX, FOPEN_MAX, L_tmpnam};
113 pub use consts::os::c95::{RAND_MAX, SEEK_CUR, SEEK_END};
114 pub use consts::os::c95::{SEEK_SET, TMP_MAX};
115 pub use consts::os::posix88::{F_OK, O_APPEND, O_CREAT, O_EXCL};
116 pub use consts::os::posix88::{O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY};
117 pub use consts::os::posix88::{R_OK, S_IEXEC, S_IFBLK, S_IFCHR};
118 pub use consts::os::posix88::{S_IFDIR, S_IFIFO, S_IFMT, S_IFREG, S_IFLNK};
119 pub use consts::os::posix88::{S_IREAD, S_IRUSR, S_IRWXU, S_IWUSR};
120 pub use consts::os::posix88::{STDERR_FILENO, STDIN_FILENO, S_IXUSR};
121 pub use consts::os::posix88::{STDOUT_FILENO, W_OK, X_OK};
122 pub use consts::os::bsd44::{AF_INET, AF_INET6, SOCK_STREAM, SOCK_DGRAM, SOCK_RAW};
123 pub use consts::os::bsd44::{IPPROTO_IP, IPPROTO_IPV6, IPPROTO_TCP, TCP_NODELAY};
124 pub use consts::os::bsd44::{SOL_SOCKET, SO_KEEPALIVE, SO_ERROR};
125 pub use consts::os::bsd44::{SO_REUSEADDR, SO_BROADCAST, SHUT_WR, IP_MULTICAST_LOOP};
126 pub use consts::os::bsd44::{IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP};
127 pub use consts::os::bsd44::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP};
128 pub use consts::os::bsd44::{IP_MULTICAST_TTL, IP_TTL, IP_HDRINCL, SHUT_RD};
129 pub use consts::os::extra::{IPPROTO_RAW};
131 pub use funcs::c95::ctype::{isalnum, isalpha, iscntrl, isdigit};
132 pub use funcs::c95::ctype::{islower, isprint, ispunct, isspace};
133 pub use funcs::c95::ctype::{isupper, isxdigit, tolower, toupper};
135 pub use funcs::c95::stdio::{fclose, feof, ferror, fflush, fgetc};
136 pub use funcs::c95::stdio::{fgetpos, fgets, fopen, fputc, fputs};
137 pub use funcs::c95::stdio::{fread, freopen, fseek, fsetpos, ftell};
138 pub use funcs::c95::stdio::{fwrite, perror, puts, remove, rename, rewind};
139 pub use funcs::c95::stdio::{setbuf, setvbuf, tmpfile, ungetc};
141 pub use funcs::c95::stdlib::{abs, atof, atoi, calloc, exit, _exit};
142 pub use funcs::c95::stdlib::{free, getenv, labs, malloc, rand};
143 pub use funcs::c95::stdlib::{realloc, srand, strtod, strtol};
144 pub use funcs::c95::stdlib::{strtoul, system};
146 pub use funcs::c95::string::{memchr, memcmp};
147 pub use funcs::c95::string::{strcat, strchr, strcmp};
148 pub use funcs::c95::string::{strcoll, strcpy, strcspn, strerror};
149 pub use funcs::c95::string::{strlen, strncat, strncmp, strncpy};
150 pub use funcs::c95::string::{strpbrk, strrchr, strspn, strstr};
151 pub use funcs::c95::string::{strtok, strxfrm};
153 pub use funcs::posix88::fcntl::{open, creat};
154 pub use funcs::posix88::stat_::{chmod, fstat, mkdir, stat};
155 pub use funcs::posix88::stdio::{fdopen, fileno, pclose, popen};
156 pub use funcs::posix88::unistd::{access, chdir, close, dup, dup2};
157 pub use funcs::posix88::unistd::{execv, execve, execvp, getcwd};
158 pub use funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read};
159 pub use funcs::posix88::unistd::{rmdir, unlink, write};
161 pub use funcs::bsd43::{socket, setsockopt, bind, send, recv, recvfrom};
162 pub use funcs::bsd43::{listen, sendto, accept, connect, getpeername, getsockname};
163 pub use funcs::bsd43::{shutdown};
165 // But we also reexport most everything
166 // if you're interested in writing platform-specific code.
168 // FIXME: This is a mess, but the design of this entire module needs to be
169 // reconsidered, so I'm not inclined to do better right now. As part of
170 // #11870 I removed all the pub globs here, leaving explicit reexports
171 // of everything that is actually used in-tree.
173 // So the following exports don't follow any particular plan.
175 #[cfg(unix)] pub use consts::os::sysconf::{_SC_PAGESIZE};
176 #[cfg(unix)] pub use consts::os::posix88::{PROT_READ, PROT_WRITE, PROT_EXEC};
177 #[cfg(unix)] pub use consts::os::posix88::{MAP_FIXED, MAP_FILE, MAP_ANON, MAP_PRIVATE, MAP_FAILED};
178 #[cfg(unix)] pub use consts::os::posix88::{EACCES, EBADF, EINVAL, ENODEV, ENOMEM};
179 #[cfg(unix)] pub use consts::os::posix88::{ECONNREFUSED, ECONNRESET, EPERM, EPIPE};
180 #[cfg(unix)] pub use consts::os::posix88::{ENOTCONN, ECONNABORTED, EADDRNOTAVAIL, EINTR};
181 #[cfg(unix)] pub use consts::os::posix88::{EADDRINUSE, ENOENT, EISDIR, EAGAIN, EWOULDBLOCK};
182 #[cfg(unix)] pub use consts::os::posix88::{ECANCELED, SIGINT, EINPROGRESS};
183 #[cfg(unix)] pub use consts::os::posix88::{ENOSYS, ENOTTY, ETIMEDOUT, EMFILE};
184 #[cfg(unix)] pub use consts::os::posix88::{SIGTERM, SIGKILL, SIGPIPE, PROT_NONE};
185 #[cfg(unix)] pub use consts::os::posix01::{SIG_IGN, F_GETFL, F_SETFL};
186 #[cfg(unix)] pub use consts::os::bsd44::{AF_UNIX};
187 #[cfg(unix)] pub use consts::os::extra::{O_NONBLOCK};
189 #[cfg(unix)] pub use types::os::common::posix01::{pthread_t, timespec, timezone};
191 #[cfg(unix)] pub use types::os::arch::posix88::{uid_t, gid_t};
192 #[cfg(unix)] pub use types::os::arch::posix01::{pthread_attr_t};
193 #[cfg(unix)] pub use types::os::arch::posix01::{stat, utimbuf};
194 #[cfg(unix)] pub use types::os::common::bsd44::{ifaddrs};
195 #[cfg(unix)] pub use funcs::posix88::unistd::{sysconf, setgid, setsid, setuid, pread, pwrite};
196 #[cfg(unix)] pub use funcs::posix88::unistd::{getgid, getuid, getsid};
197 #[cfg(unix)] pub use funcs::posix88::unistd::{_PC_NAME_MAX, utime, nanosleep, pathconf, link};
198 #[cfg(unix)] pub use funcs::posix88::unistd::{chown};
199 #[cfg(unix)] pub use funcs::posix88::mman::{mmap, munmap, mprotect};
200 #[cfg(unix)] pub use funcs::posix88::dirent::{opendir, readdir_r, closedir};
201 #[cfg(unix)] pub use funcs::posix88::fcntl::{fcntl};
202 #[cfg(unix)] pub use funcs::posix88::net::{if_nametoindex};
203 #[cfg(unix)] pub use funcs::posix01::stat_::{lstat};
204 #[cfg(unix)] pub use funcs::posix01::unistd::{fsync, ftruncate};
205 #[cfg(unix)] pub use funcs::posix01::unistd::{readlink, symlink};
206 #[cfg(unix)] pub use funcs::bsd43::{getifaddrs, freeifaddrs};
208 #[cfg(windows)] pub use consts::os::c95::{WSAECONNREFUSED, WSAECONNRESET, WSAEACCES};
209 #[cfg(windows)] pub use consts::os::c95::{WSAEWOULDBLOCK, WSAENOTCONN, WSAECONNABORTED};
210 #[cfg(windows)] pub use consts::os::c95::{WSAEADDRNOTAVAIL, WSAEADDRINUSE, WSAEINTR};
211 #[cfg(windows)] pub use consts::os::c95::{WSAEINPROGRESS, WSAEINVAL, WSAEMFILE};
212 #[cfg(windows)] pub use consts::os::extra::{ERROR_INSUFFICIENT_BUFFER};
213 #[cfg(windows)] pub use consts::os::extra::{O_BINARY, O_NOINHERIT, PAGE_NOACCESS};
214 #[cfg(windows)] pub use consts::os::extra::{PAGE_READONLY, PAGE_READWRITE, PAGE_EXECUTE};
215 #[cfg(windows)] pub use consts::os::extra::{PAGE_EXECUTE_READ, PAGE_EXECUTE_READWRITE};
216 #[cfg(windows)] pub use consts::os::extra::{MEM_COMMIT, MEM_RESERVE, MEM_RELEASE};
217 #[cfg(windows)] pub use consts::os::extra::{FILE_MAP_READ, FILE_MAP_WRITE, FILE_MAP_EXECUTE};
218 #[cfg(windows)] pub use consts::os::extra::{ERROR_ALREADY_EXISTS, ERROR_NO_DATA};
219 #[cfg(windows)] pub use consts::os::extra::{ERROR_FILE_NOT_FOUND, ERROR_INVALID_NAME};
220 #[cfg(windows)] pub use consts::os::extra::{ERROR_BROKEN_PIPE, ERROR_INVALID_FUNCTION};
221 #[cfg(windows)] pub use consts::os::extra::{ERROR_CALL_NOT_IMPLEMENTED};
222 #[cfg(windows)] pub use consts::os::extra::{ERROR_NOTHING_TO_TERMINATE};
223 #[cfg(windows)] pub use consts::os::extra::{ERROR_INVALID_HANDLE};
224 #[cfg(windows)] pub use consts::os::extra::{TRUE, FALSE, INFINITE};
225 #[cfg(windows)] pub use consts::os::extra::{PROCESS_TERMINATE, PROCESS_QUERY_INFORMATION};
226 #[cfg(windows)] pub use consts::os::extra::{STILL_ACTIVE, DETACHED_PROCESS};
227 #[cfg(windows)] pub use consts::os::extra::{CREATE_NEW_PROCESS_GROUP, CREATE_UNICODE_ENVIRONMENT};
228 #[cfg(windows)] pub use consts::os::extra::{FILE_BEGIN, FILE_END, FILE_CURRENT};
229 #[cfg(windows)] pub use consts::os::extra::{FILE_GENERIC_READ, FILE_GENERIC_WRITE};
230 #[cfg(windows)] pub use consts::os::extra::{FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_DELETE};
231 #[cfg(windows)] pub use consts::os::extra::{TRUNCATE_EXISTING, CREATE_ALWAYS, OPEN_EXISTING};
232 #[cfg(windows)] pub use consts::os::extra::{CREATE_NEW, FILE_APPEND_DATA, FILE_WRITE_DATA};
233 #[cfg(windows)] pub use consts::os::extra::{OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL};
234 #[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_BACKUP_SEMANTICS, INVALID_HANDLE_VALUE};
235 #[cfg(windows)] pub use consts::os::extra::{MOVEFILE_REPLACE_EXISTING};
236 #[cfg(windows)] pub use consts::os::extra::{GENERIC_READ, GENERIC_WRITE};
237 #[cfg(windows)] pub use consts::os::extra::{VOLUME_NAME_DOS};
238 #[cfg(windows)] pub use consts::os::extra::{PIPE_ACCESS_DUPLEX, FILE_FLAG_FIRST_PIPE_INSTANCE};
239 #[cfg(windows)] pub use consts::os::extra::{FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE};
240 #[cfg(windows)] pub use consts::os::extra::{PIPE_READMODE_BYTE, PIPE_WAIT};
241 #[cfg(windows)] pub use consts::os::extra::{PIPE_UNLIMITED_INSTANCES, ERROR_ACCESS_DENIED};
242 #[cfg(windows)] pub use consts::os::extra::{FILE_WRITE_ATTRIBUTES, FILE_READ_ATTRIBUTES};
243 #[cfg(windows)] pub use consts::os::extra::{ERROR_PIPE_BUSY, ERROR_IO_PENDING};
244 #[cfg(windows)] pub use consts::os::extra::{ERROR_PIPE_CONNECTED, WAIT_OBJECT_0};
245 #[cfg(windows)] pub use consts::os::extra::{ERROR_NOT_FOUND};
246 #[cfg(windows)] pub use consts::os::extra::{ERROR_OPERATION_ABORTED};
247 #[cfg(windows)] pub use consts::os::extra::{FIONBIO};
248 #[cfg(windows)] pub use types::os::common::bsd44::{SOCKET};
249 #[cfg(windows)] pub use types::os::common::posix01::{stat, utimbuf};
250 #[cfg(windows)] pub use types::os::arch::extra::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES};
251 #[cfg(windows)] pub use types::os::arch::extra::{LPCSTR, WORD, DWORD, BYTE, FILETIME};
252 #[cfg(windows)] pub use types::os::arch::extra::{LARGE_INTEGER, LPVOID, LONG};
253 #[cfg(windows)] pub use types::os::arch::extra::{time64_t, OVERLAPPED, LPCWSTR};
254 #[cfg(windows)] pub use types::os::arch::extra::{LPOVERLAPPED, SIZE_T, LPDWORD};
255 #[cfg(windows)] pub use types::os::arch::extra::{SECURITY_ATTRIBUTES, WIN32_FIND_DATAW};
256 #[cfg(windows)] pub use funcs::c95::string::{wcslen};
257 #[cfg(windows)] pub use funcs::posix88::stat_::{wstat, wutime, wchmod, wrmdir};
258 #[cfg(windows)] pub use funcs::bsd43::{closesocket};
259 #[cfg(windows)] pub use funcs::extra::kernel32::{GetCurrentDirectoryW, GetLastError};
260 #[cfg(windows)] pub use funcs::extra::kernel32::{GetEnvironmentVariableW, SetEnvironmentVariableW};
261 #[cfg(windows)] pub use funcs::extra::kernel32::{GetModuleFileNameW, SetCurrentDirectoryW};
262 #[cfg(windows)] pub use funcs::extra::kernel32::{GetSystemInfo, VirtualAlloc, VirtualFree};
263 #[cfg(windows)] pub use funcs::extra::kernel32::{CreateFileMappingW, MapViewOfFile};
264 #[cfg(windows)] pub use funcs::extra::kernel32::{UnmapViewOfFile, CloseHandle};
265 #[cfg(windows)] pub use funcs::extra::kernel32::{WaitForSingleObject, GetSystemTimeAsFileTime};
266 #[cfg(windows)] pub use funcs::extra::kernel32::{QueryPerformanceCounter};
267 #[cfg(windows)] pub use funcs::extra::kernel32::{QueryPerformanceFrequency};
268 #[cfg(windows)] pub use funcs::extra::kernel32::{GetExitCodeProcess, TerminateProcess};
269 #[cfg(windows)] pub use funcs::extra::kernel32::{ReadFile, WriteFile, SetFilePointerEx};
270 #[cfg(windows)] pub use funcs::extra::kernel32::{SetEndOfFile, CreateFileW};
271 #[cfg(windows)] pub use funcs::extra::kernel32::{CreateDirectoryW, FindFirstFileW};
272 #[cfg(windows)] pub use funcs::extra::kernel32::{FindNextFileW, FindClose, DeleteFileW};
273 #[cfg(windows)] pub use funcs::extra::kernel32::{CreateHardLinkW, CreateEventW};
274 #[cfg(windows)] pub use funcs::extra::kernel32::{FlushFileBuffers, CreateNamedPipeW};
275 #[cfg(windows)] pub use funcs::extra::kernel32::{SetNamedPipeHandleState, WaitNamedPipeW};
276 #[cfg(windows)] pub use funcs::extra::kernel32::{GetOverlappedResult, ConnectNamedPipe};
277 #[cfg(windows)] pub use funcs::extra::kernel32::{DisconnectNamedPipe, OpenProcess};
278 #[cfg(windows)] pub use funcs::extra::kernel32::{MoveFileExW, VirtualProtect};
279 #[cfg(windows)] pub use funcs::extra::msvcrt::{get_osfhandle, open_osfhandle};
280 #[cfg(windows)] pub use funcs::extra::winsock::{ioctlsocket};
282 #[cfg(any(target_os = "linux",
283 target_os = "android",
284 target_os = "freebsd",
285 target_os = "dragonfly"))]
286 pub use consts::os::posix01::{CLOCK_REALTIME, CLOCK_MONOTONIC};
288 #[cfg(any(target_os = "linux", target_os = "android"))]
289 pub use funcs::posix01::unistd::{fdatasync};
290 #[cfg(any(target_os = "linux", target_os = "android"))]
291 pub use types::os::arch::extra::{sockaddr_ll};
292 #[cfg(any(target_os = "linux", target_os = "android"))]
293 pub use consts::os::extra::{AF_PACKET};
295 #[cfg(all(unix, not(target_os = "freebsd")))]
296 pub use consts::os::extra::{MAP_STACK};
298 #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
299 pub use consts::os::bsd44::{TCP_KEEPIDLE};
301 #[cfg(any(target_os = "macos", target_os = "ios"))]
302 pub use consts::os::bsd44::{TCP_KEEPALIVE};
303 #[cfg(any(target_os = "macos", target_os = "ios"))]
304 pub use consts::os::extra::{F_FULLFSYNC};
306 #[cfg(any(target_os = "macos", target_os = "ios"))]
307 pub use types::os::arch::extra::{mach_timebase_info};
315 /// A wrapper for a nullable pointer. Don't use this except for interacting
316 /// with libc. Basically Option, but without the dependence on libstd.
317 // If/when libprim happens, this can be removed in favor of that
318 pub enum Nullable<T> {
325 // Types tend to vary *per architecture* so we pull their definitions out
328 // Standard types that are opaque or common, so are not per-target.
331 /// Type used to construct void pointers for use with C.
333 /// This type is only useful as a pointer target. Do not use it as a
334 /// return type for FFI functions which have the `void` return type in
335 /// C. Use the unit type `()` or omit the return type instead.
337 /// For LLVM to recognize the void pointer type and by extension
338 /// functions like malloc(), we need to have it represented as i8* in
339 /// LLVM bitcode. The enum used here ensures this and prevents misuse
340 /// of the "raw" type by only having private variants.. We need two
341 /// variants, because the compiler complains about the repr attribute
344 #[allow(missing_copy_implementations)]
350 #[allow(missing_copy_implementations)]
352 #[allow(missing_copy_implementations)]
356 pub type int8_t = i8;
357 pub type int16_t = i16;
358 pub type int32_t = i32;
359 pub type int64_t = i64;
360 pub type uint8_t = u8;
361 pub type uint16_t = u16;
362 pub type uint32_t = u32;
363 pub type uint64_t = u64;
366 #[allow(missing_copy_implementations)]
368 #[allow(missing_copy_implementations)]
376 // Standard types that are scalar but vary by OS and arch.
378 #[cfg(any(target_os = "linux", target_os = "android"))]
382 use types::common::c95::{c_void};
383 use types::os::arch::c95::{c_char, c_ulong, size_t,
384 time_t, suseconds_t, c_long};
386 pub type pthread_t = c_ulong;
389 #[deriving(Copy)] pub struct glob_t {
390 pub gl_pathc: size_t,
391 pub gl_pathv: *mut *mut c_char,
394 pub __unused1: *mut c_void,
395 pub __unused2: *mut c_void,
396 pub __unused3: *mut c_void,
397 pub __unused4: *mut c_void,
398 pub __unused5: *mut c_void,
402 #[deriving(Copy)] pub struct timeval {
404 pub tv_usec: suseconds_t,
408 #[deriving(Copy)] pub struct timespec {
413 #[deriving(Copy)] pub enum timezone {}
415 pub type sighandler_t = size_t;
418 use types::common::c95::{c_void};
419 use types::os::arch::c95::{c_char, c_int, c_uint};
421 pub type socklen_t = u32;
422 pub type sa_family_t = u16;
423 pub type in_port_t = u16;
424 pub type in_addr_t = u32;
426 #[deriving(Copy)] pub struct sockaddr {
427 pub sa_family: sa_family_t,
428 pub sa_data: [u8, ..14],
431 #[deriving(Copy)] pub struct sockaddr_storage {
432 pub ss_family: sa_family_t,
434 pub __ss_pad2: [u8, ..112],
437 #[deriving(Copy)] pub struct sockaddr_in {
438 pub sin_family: sa_family_t,
439 pub sin_port: in_port_t,
440 pub sin_addr: in_addr,
441 pub sin_zero: [u8, ..8],
444 #[deriving(Copy)] pub struct in_addr {
445 pub s_addr: in_addr_t,
448 #[deriving(Copy)] pub struct sockaddr_in6 {
449 pub sin6_family: sa_family_t,
450 pub sin6_port: in_port_t,
451 pub sin6_flowinfo: u32,
452 pub sin6_addr: in6_addr,
453 pub sin6_scope_id: u32,
456 #[deriving(Copy)] pub struct in6_addr {
457 pub s6_addr: [u16, ..8]
460 #[deriving(Copy)] pub struct ip_mreq {
461 pub imr_multiaddr: in_addr,
462 pub imr_interface: in_addr,
465 #[deriving(Copy)] pub struct ip6_mreq {
466 pub ipv6mr_multiaddr: in6_addr,
467 pub ipv6mr_interface: c_uint,
470 #[deriving(Copy)] pub struct addrinfo {
472 pub ai_family: c_int,
473 pub ai_socktype: c_int,
474 pub ai_protocol: c_int,
475 pub ai_addrlen: socklen_t,
477 #[cfg(target_os = "linux")]
478 pub ai_addr: *mut sockaddr,
480 #[cfg(target_os = "linux")]
481 pub ai_canonname: *mut c_char,
483 #[cfg(target_os = "android")]
484 pub ai_canonname: *mut c_char,
486 #[cfg(target_os = "android")]
487 pub ai_addr: *mut sockaddr,
489 pub ai_next: *mut addrinfo,
492 #[deriving(Copy)] pub struct sockaddr_un {
493 pub sun_family: sa_family_t,
494 pub sun_path: [c_char, ..108]
498 #[deriving(Copy)] pub struct ifaddrs {
499 pub ifa_next: *mut ifaddrs,
500 pub ifa_name: *mut c_char,
501 pub ifa_flags: c_uint,
502 pub ifa_addr: *mut sockaddr,
503 pub ifa_netmask: *mut sockaddr,
504 pub ifa_ifu: *mut sockaddr, // FIXME This should be a union
505 pub ifa_data: *mut c_void
511 #[cfg(any(target_arch = "x86",
513 target_arch = "mips",
514 target_arch = "mipsel"))]
517 pub type c_char = i8;
518 pub type c_schar = i8;
519 pub type c_uchar = u8;
520 pub type c_short = i16;
521 pub type c_ushort = u16;
522 pub type c_int = i32;
523 pub type c_uint = u32;
524 pub type c_long = i32;
525 pub type c_ulong = u32;
526 pub type c_float = f32;
527 pub type c_double = f64;
528 pub type size_t = u32;
529 pub type ptrdiff_t = i32;
530 pub type clock_t = i32;
531 pub type time_t = i32;
532 pub type suseconds_t = i32;
533 pub type wchar_t = i32;
536 pub type c_longlong = i64;
537 pub type c_ulonglong = u64;
538 pub type intptr_t = i32;
539 pub type uintptr_t = u32;
540 pub type intmax_t = i64;
541 pub type uintmax_t = u64;
543 #[cfg(any(target_arch = "x86",
544 target_arch = "mips",
545 target_arch = "mipsel"))]
547 pub type off_t = i32;
548 pub type dev_t = u64;
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 = u32;
555 pub type ssize_t = i32;
557 #[cfg(target_arch = "arm")]
559 pub type off_t = i32;
560 pub type dev_t = u32;
561 pub type ino_t = u32;
562 pub type pid_t = i32;
563 pub type uid_t = u32;
564 pub type gid_t = u32;
565 pub type useconds_t = u32;
566 pub type mode_t = u16;
567 pub type ssize_t = i32;
569 #[cfg(target_arch = "x86")]
571 use types::os::arch::c95::{c_short, c_long, time_t};
572 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
573 use types::os::arch::posix88::{mode_t, off_t};
574 use types::os::arch::posix88::{uid_t};
576 pub type nlink_t = u32;
577 pub type blksize_t = i32;
578 pub type blkcnt_t = i32;
581 #[deriving(Copy)] pub struct stat {
586 pub st_nlink: nlink_t,
592 pub st_blksize: blksize_t,
593 pub st_blocks: blkcnt_t,
594 pub st_atime: time_t,
595 pub st_atime_nsec: c_long,
596 pub st_mtime: time_t,
597 pub st_mtime_nsec: c_long,
598 pub st_ctime: time_t,
599 pub st_ctime_nsec: c_long,
600 pub __unused4: c_long,
601 pub __unused5: c_long,
605 #[deriving(Copy)] pub struct utimbuf {
611 #[deriving(Copy)] pub struct pthread_attr_t {
612 pub __size: [u32, ..9]
615 #[cfg(target_arch = "arm")]
617 use types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
618 use types::os::arch::c99::{c_longlong, c_ulonglong};
619 use types::os::arch::posix88::{uid_t, gid_t, ino_t};
621 pub type nlink_t = u16;
622 pub type blksize_t = u32;
623 pub type blkcnt_t = u32;
626 #[deriving(Copy)] pub struct stat {
627 pub st_dev: c_ulonglong,
628 pub __pad0: [c_uchar, ..4],
631 pub st_nlink: c_uint,
634 pub st_rdev: c_ulonglong,
635 pub __pad3: [c_uchar, ..4],
636 pub st_size: c_longlong,
637 pub st_blksize: blksize_t,
638 pub st_blocks: c_ulonglong,
639 pub st_atime: time_t,
640 pub st_atime_nsec: c_ulong,
641 pub st_mtime: time_t,
642 pub st_mtime_nsec: c_ulong,
643 pub st_ctime: time_t,
644 pub st_ctime_nsec: c_ulong,
645 pub st_ino: c_ulonglong,
649 #[deriving(Copy)] pub struct utimbuf {
655 #[deriving(Copy)] pub struct pthread_attr_t {
656 pub __size: [u32, ..9]
659 #[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
661 use types::os::arch::c95::{c_long, c_ulong, time_t};
662 use types::os::arch::posix88::{gid_t, ino_t};
663 use types::os::arch::posix88::{mode_t, off_t};
664 use types::os::arch::posix88::{uid_t};
666 pub type nlink_t = u32;
667 pub type blksize_t = i32;
668 pub type blkcnt_t = i32;
671 #[deriving(Copy)] pub struct stat {
673 pub st_pad1: [c_long, ..3],
676 pub st_nlink: nlink_t,
679 pub st_rdev: c_ulong,
680 pub st_pad2: [c_long, ..2],
683 pub st_atime: time_t,
684 pub st_atime_nsec: c_long,
685 pub st_mtime: time_t,
686 pub st_mtime_nsec: c_long,
687 pub st_ctime: time_t,
688 pub st_ctime_nsec: c_long,
689 pub st_blksize: blksize_t,
690 pub st_blocks: blkcnt_t,
691 pub st_pad5: [c_long, ..14],
695 #[deriving(Copy)] pub struct utimbuf {
701 #[deriving(Copy)] pub struct pthread_attr_t {
702 pub __size: [u32, ..9]
708 use types::os::arch::c95::{c_ushort, c_int, c_uchar};
710 #[deriving(Copy)] pub struct sockaddr_ll {
711 pub sll_family: c_ushort,
712 pub sll_protocol: c_ushort,
713 pub sll_ifindex: c_int,
714 pub sll_hatype: c_ushort,
715 pub sll_pkttype: c_uchar,
716 pub sll_halen: c_uchar,
717 pub sll_addr: [c_uchar, ..8]
723 #[cfg(target_arch = "x86_64")]
726 pub type c_char = i8;
727 pub type c_schar = i8;
728 pub type c_uchar = u8;
729 pub type c_short = i16;
730 pub type c_ushort = u16;
731 pub type c_int = i32;
732 pub type c_uint = u32;
733 pub type c_long = i64;
734 pub type c_ulong = u64;
735 pub type c_float = f32;
736 pub type c_double = f64;
737 pub type size_t = u64;
738 pub type ptrdiff_t = i64;
739 pub type clock_t = i64;
740 pub type time_t = i64;
741 pub type suseconds_t = i64;
742 pub type wchar_t = i32;
745 pub type c_longlong = i64;
746 pub type c_ulonglong = u64;
747 pub type intptr_t = i64;
748 pub type uintptr_t = u64;
749 pub type intmax_t = i64;
750 pub type uintmax_t = u64;
753 pub type off_t = i64;
754 pub type dev_t = u64;
755 pub type ino_t = u64;
756 pub type pid_t = i32;
757 pub type uid_t = u32;
758 pub type gid_t = u32;
759 pub type useconds_t = u32;
760 pub type mode_t = u32;
761 pub type ssize_t = i64;
764 use types::os::arch::c95::{c_int, c_long, time_t};
765 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
766 use types::os::arch::posix88::{mode_t, off_t};
767 use types::os::arch::posix88::{uid_t};
769 pub type nlink_t = u64;
770 pub type blksize_t = i64;
771 pub type blkcnt_t = i64;
773 #[deriving(Copy)] pub struct stat {
776 pub st_nlink: nlink_t,
783 pub st_blksize: blksize_t,
784 pub st_blocks: blkcnt_t,
785 pub st_atime: time_t,
786 pub st_atime_nsec: c_long,
787 pub st_mtime: time_t,
788 pub st_mtime_nsec: c_long,
789 pub st_ctime: time_t,
790 pub st_ctime_nsec: c_long,
791 pub __unused: [c_long, ..3],
795 #[deriving(Copy)] pub struct utimbuf {
801 #[deriving(Copy)] pub struct pthread_attr_t {
802 pub __size: [u64, ..7]
810 use types::os::arch::c95::{c_ushort, c_int, c_uchar};
811 #[deriving(Copy)] pub struct sockaddr_ll {
812 pub sll_family: c_ushort,
813 pub sll_protocol: c_ushort,
814 pub sll_ifindex: c_int,
815 pub sll_hatype: c_ushort,
816 pub sll_pkttype: c_uchar,
817 pub sll_halen: c_uchar,
818 pub sll_addr: [c_uchar, ..8]
825 #[cfg(target_os = "freebsd")]
829 use types::common::c95::{c_void};
830 use types::os::arch::c95::{c_char, c_int, size_t,
831 time_t, suseconds_t, c_long};
832 use types::os::arch::c99::{uintptr_t};
834 pub type pthread_t = uintptr_t;
837 #[deriving(Copy)] pub struct glob_t {
838 pub gl_pathc: size_t,
839 pub __unused1: size_t,
841 pub __unused2: c_int,
842 pub gl_pathv: *mut *mut c_char,
844 pub __unused3: *mut c_void,
846 pub __unused4: *mut c_void,
847 pub __unused5: *mut c_void,
848 pub __unused6: *mut c_void,
849 pub __unused7: *mut c_void,
850 pub __unused8: *mut c_void,
854 #[deriving(Copy)] pub struct timeval {
856 pub tv_usec: suseconds_t,
860 #[deriving(Copy)] pub struct timespec {
865 #[deriving(Copy)] pub enum timezone {}
867 pub type sighandler_t = size_t;
870 use types::common::c95::{c_void};
871 use types::os::arch::c95::{c_char, c_int, c_uint};
873 pub type socklen_t = u32;
874 pub type sa_family_t = u8;
875 pub type in_port_t = u16;
876 pub type in_addr_t = u32;
878 #[deriving(Copy)] pub struct sockaddr {
880 pub sa_family: sa_family_t,
881 pub sa_data: [u8, ..14],
884 #[deriving(Copy)] pub struct sockaddr_storage {
886 pub ss_family: sa_family_t,
887 pub __ss_pad1: [u8, ..6],
889 pub __ss_pad2: [u8, ..112],
892 #[deriving(Copy)] pub struct sockaddr_in {
894 pub sin_family: sa_family_t,
895 pub sin_port: in_port_t,
896 pub sin_addr: in_addr,
897 pub sin_zero: [u8, ..8],
900 #[deriving(Copy)] pub struct in_addr {
901 pub s_addr: in_addr_t,
904 #[deriving(Copy)] pub struct sockaddr_in6 {
906 pub sin6_family: sa_family_t,
907 pub sin6_port: in_port_t,
908 pub sin6_flowinfo: u32,
909 pub sin6_addr: in6_addr,
910 pub sin6_scope_id: u32,
913 #[deriving(Copy)] pub struct in6_addr {
914 pub s6_addr: [u16, ..8]
917 #[deriving(Copy)] pub struct ip_mreq {
918 pub imr_multiaddr: in_addr,
919 pub imr_interface: in_addr,
922 #[deriving(Copy)] pub struct ip6_mreq {
923 pub ipv6mr_multiaddr: in6_addr,
924 pub ipv6mr_interface: c_uint,
927 #[deriving(Copy)] pub struct addrinfo {
929 pub ai_family: c_int,
930 pub ai_socktype: c_int,
931 pub ai_protocol: c_int,
932 pub ai_addrlen: socklen_t,
933 pub ai_canonname: *mut c_char,
934 pub ai_addr: *mut sockaddr,
935 pub ai_next: *mut addrinfo,
938 #[deriving(Copy)] pub struct sockaddr_un {
940 pub sun_family: sa_family_t,
941 pub sun_path: [c_char, ..104]
944 #[deriving(Copy)] pub struct ifaddrs {
945 pub ifa_next: *mut ifaddrs,
946 pub ifa_name: *mut c_char,
947 pub ifa_flags: c_uint,
948 pub ifa_addr: *mut sockaddr,
949 pub ifa_netmask: *mut sockaddr,
950 pub ifa_dstaddr: *mut sockaddr,
951 pub ifa_data: *mut c_void
958 #[cfg(target_arch = "x86_64")]
961 pub type c_char = i8;
962 pub type c_schar = i8;
963 pub type c_uchar = u8;
964 pub type c_short = i16;
965 pub type c_ushort = u16;
966 pub type c_int = i32;
967 pub type c_uint = u32;
968 pub type c_long = i64;
969 pub type c_ulong = u64;
970 pub type c_float = f32;
971 pub type c_double = f64;
972 pub type size_t = u64;
973 pub type ptrdiff_t = i64;
974 pub type clock_t = i32;
975 pub type time_t = i64;
976 pub type suseconds_t = i64;
977 pub type wchar_t = i32;
980 pub type c_longlong = i64;
981 pub type c_ulonglong = u64;
982 pub type intptr_t = i64;
983 pub type uintptr_t = u64;
984 pub type intmax_t = i64;
985 pub type uintmax_t = u64;
988 pub type off_t = i64;
989 pub type dev_t = u32;
990 pub type ino_t = u32;
991 pub type pid_t = i32;
992 pub type uid_t = u32;
993 pub type gid_t = u32;
994 pub type useconds_t = u32;
995 pub type mode_t = u16;
996 pub type ssize_t = i64;
999 use types::common::c95::{c_void};
1000 use types::common::c99::{uint8_t, uint32_t, int32_t};
1001 use types::os::arch::c95::{c_long, time_t};
1002 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
1003 use types::os::arch::posix88::{mode_t, off_t};
1004 use types::os::arch::posix88::{uid_t};
1006 pub type nlink_t = u16;
1007 pub type blksize_t = i64;
1008 pub type blkcnt_t = i64;
1009 pub type fflags_t = u32;
1011 #[deriving(Copy)] pub struct stat {
1014 pub st_mode: mode_t,
1015 pub st_nlink: nlink_t,
1019 pub st_atime: time_t,
1020 pub st_atime_nsec: c_long,
1021 pub st_mtime: time_t,
1022 pub st_mtime_nsec: c_long,
1023 pub st_ctime: time_t,
1024 pub st_ctime_nsec: c_long,
1026 pub st_blocks: blkcnt_t,
1027 pub st_blksize: blksize_t,
1028 pub st_flags: fflags_t,
1029 pub st_gen: uint32_t,
1030 pub st_lspare: int32_t,
1031 pub st_birthtime: time_t,
1032 pub st_birthtime_nsec: c_long,
1033 pub __unused: [uint8_t, ..2],
1037 #[deriving(Copy)] pub struct utimbuf {
1039 pub modtime: time_t,
1042 pub type pthread_attr_t = *mut c_void;
1053 #[cfg(target_os = "dragonfly")]
1057 use types::common::c95::{c_void};
1058 use types::os::arch::c95::{c_char, c_int, size_t,
1059 time_t, suseconds_t, c_long};
1060 use types::os::arch::c99::{uintptr_t};
1062 pub type pthread_t = uintptr_t;
1065 #[deriving(Copy)] pub struct glob_t {
1066 pub gl_pathc: size_t,
1067 pub __unused1: size_t,
1068 pub gl_offs: size_t,
1069 pub __unused2: c_int,
1070 pub gl_pathv: *mut *mut c_char,
1072 pub __unused3: *mut c_void,
1074 pub __unused4: *mut c_void,
1075 pub __unused5: *mut c_void,
1076 pub __unused6: *mut c_void,
1077 pub __unused7: *mut c_void,
1078 pub __unused8: *mut c_void,
1082 #[deriving(Copy)] pub struct timeval {
1084 pub tv_usec: suseconds_t,
1088 #[deriving(Copy)] pub struct timespec {
1090 pub tv_nsec: c_long,
1093 #[deriving(Copy)] pub enum timezone {}
1095 pub type sighandler_t = size_t;
1098 use types::os::arch::c95::{c_char, c_int, c_uint};
1100 pub type socklen_t = u32;
1101 pub type sa_family_t = u8;
1102 pub type in_port_t = u16;
1103 pub type in_addr_t = u32;
1105 #[deriving(Copy)] pub struct sockaddr {
1107 pub sa_family: sa_family_t,
1108 pub sa_data: [u8, ..14],
1111 #[deriving(Copy)] pub struct sockaddr_storage {
1113 pub ss_family: sa_family_t,
1114 pub __ss_pad1: [u8, ..6],
1115 pub __ss_align: i64,
1116 pub __ss_pad2: [u8, ..112],
1119 #[deriving(Copy)] pub struct sockaddr_in {
1121 pub sin_family: sa_family_t,
1122 pub sin_port: in_port_t,
1123 pub sin_addr: in_addr,
1124 pub sin_zero: [u8, ..8],
1127 #[deriving(Copy)] pub struct in_addr {
1128 pub s_addr: in_addr_t,
1131 #[deriving(Copy)] pub struct sockaddr_in6 {
1133 pub sin6_family: sa_family_t,
1134 pub sin6_port: in_port_t,
1135 pub sin6_flowinfo: u32,
1136 pub sin6_addr: in6_addr,
1137 pub sin6_scope_id: u32,
1140 #[deriving(Copy)] pub struct in6_addr {
1141 pub s6_addr: [u16, ..8]
1144 #[deriving(Copy)] pub struct ip_mreq {
1145 pub imr_multiaddr: in_addr,
1146 pub imr_interface: in_addr,
1149 #[deriving(Copy)] pub struct ip6_mreq {
1150 pub ipv6mr_multiaddr: in6_addr,
1151 pub ipv6mr_interface: c_uint,
1154 #[deriving(Copy)] pub struct addrinfo {
1155 pub ai_flags: c_int,
1156 pub ai_family: c_int,
1157 pub ai_socktype: c_int,
1158 pub ai_protocol: c_int,
1159 pub ai_addrlen: socklen_t,
1160 pub ai_canonname: *mut c_char,
1161 pub ai_addr: *mut sockaddr,
1162 pub ai_next: *mut addrinfo,
1165 #[deriving(Copy)] pub struct sockaddr_un {
1167 pub sun_family: sa_family_t,
1168 pub sun_path: [c_char, ..104]
1173 #[cfg(target_arch = "x86_64")]
1176 pub type c_char = i8;
1177 pub type c_schar = i8;
1178 pub type c_uchar = u8;
1179 pub type c_short = i16;
1180 pub type c_ushort = u16;
1181 pub type c_int = i32;
1182 pub type c_uint = u32;
1183 pub type c_long = i64;
1184 pub type c_ulong = u64;
1185 pub type c_float = f32;
1186 pub type c_double = f64;
1187 pub type size_t = u64;
1188 pub type ptrdiff_t = i64;
1189 pub type clock_t = i32;
1190 pub type time_t = i64;
1191 pub type suseconds_t = i64;
1192 pub type wchar_t = i32;
1195 pub type c_longlong = i64;
1196 pub type c_ulonglong = u64;
1197 pub type intptr_t = i64;
1198 pub type uintptr_t = u64;
1199 pub type intmax_t = i64;
1200 pub type uintmax_t = u64;
1203 pub type off_t = i64;
1204 pub type dev_t = u32;
1205 pub type ino_t = u32;
1206 pub type pid_t = i32;
1207 pub type uid_t = u32;
1208 pub type gid_t = u32;
1209 pub type useconds_t = u32;
1210 pub type mode_t = u16;
1211 pub type ssize_t = i64;
1214 use types::common::c95::{c_void};
1215 use types::common::c99::{uint16_t, uint32_t, int32_t, uint64_t, int64_t};
1216 use types::os::arch::c95::{c_long, time_t};
1217 use types::os::arch::posix88::{dev_t, gid_t};
1218 use types::os::arch::posix88::{mode_t, off_t};
1219 use types::os::arch::posix88::{uid_t};
1221 pub type nlink_t = u16;
1222 pub type blksize_t = uint32_t;
1223 pub type ino_t = uint64_t;
1224 pub type blkcnt_t = i64;
1225 pub type fflags_t = u32;
1228 #[deriving(Copy)] pub struct stat {
1230 pub st_nlink: nlink_t,
1232 pub st_mode: mode_t,
1233 pub st_padding1: uint16_t,
1237 pub st_atime: time_t,
1238 pub st_atime_nsec: c_long,
1239 pub st_mtime: time_t,
1240 pub st_mtime_nsec: c_long,
1241 pub st_ctime: time_t,
1242 pub st_ctime_nsec: c_long,
1244 pub st_blocks: blkcnt_t,
1245 pub st_blksize: blksize_t,
1246 pub st_flags: fflags_t,
1247 pub st_gen: uint32_t,
1248 pub st_lspare: int32_t,
1249 pub st_qspare1: int64_t,
1250 pub st_qspare2: int64_t,
1253 #[deriving(Copy)] pub struct utimbuf {
1255 pub modtime: time_t,
1258 pub type pthread_attr_t = *mut c_void;
1269 #[cfg(target_os = "windows")]
1273 use types::os::arch::c95::{c_short, time_t, c_long};
1274 use types::os::arch::extra::{int64, time64_t};
1275 use types::os::arch::posix88::{dev_t, ino_t};
1277 // pub Note: this is the struct called stat64 in Windows. Not stat,
1280 #[deriving(Copy)] pub struct stat {
1284 pub st_nlink: c_short,
1285 pub st_uid: c_short,
1286 pub st_gid: c_short,
1289 pub st_atime: time64_t,
1290 pub st_mtime: time64_t,
1291 pub st_ctime: time64_t,
1294 // note that this is called utimbuf64 in Windows
1296 #[deriving(Copy)] pub struct utimbuf {
1297 pub actime: time64_t,
1298 pub modtime: time64_t,
1302 #[deriving(Copy)] pub struct timeval {
1304 pub tv_usec: c_long,
1308 #[deriving(Copy)] pub struct timespec {
1310 pub tv_nsec: c_long,
1313 #[deriving(Copy)] pub enum timezone {}
1317 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1318 use types::os::arch::c99::uintptr_t;
1320 pub type SOCKET = uintptr_t;
1321 pub type socklen_t = c_int;
1322 pub type sa_family_t = u16;
1323 pub type in_port_t = u16;
1324 pub type in_addr_t = u32;
1326 #[deriving(Copy)] pub struct sockaddr {
1327 pub sa_family: sa_family_t,
1328 pub sa_data: [u8, ..14],
1331 #[deriving(Copy)] pub struct sockaddr_storage {
1332 pub ss_family: sa_family_t,
1333 pub __ss_pad1: [u8, ..6],
1334 pub __ss_align: i64,
1335 pub __ss_pad2: [u8, ..112],
1338 #[deriving(Copy)] pub struct sockaddr_in {
1339 pub sin_family: sa_family_t,
1340 pub sin_port: in_port_t,
1341 pub sin_addr: in_addr,
1342 pub sin_zero: [u8, ..8],
1345 #[deriving(Copy)] pub struct in_addr {
1346 pub s_addr: in_addr_t,
1349 #[deriving(Copy)] pub struct sockaddr_in6 {
1350 pub sin6_family: sa_family_t,
1351 pub sin6_port: in_port_t,
1352 pub sin6_flowinfo: u32,
1353 pub sin6_addr: in6_addr,
1354 pub sin6_scope_id: u32,
1357 #[deriving(Copy)] pub struct in6_addr {
1358 pub s6_addr: [u16, ..8]
1361 #[deriving(Copy)] pub struct ip_mreq {
1362 pub imr_multiaddr: in_addr,
1363 pub imr_interface: in_addr,
1366 #[deriving(Copy)] pub struct ip6_mreq {
1367 pub ipv6mr_multiaddr: in6_addr,
1368 pub ipv6mr_interface: c_uint,
1371 #[deriving(Copy)] pub struct addrinfo {
1372 pub ai_flags: c_int,
1373 pub ai_family: c_int,
1374 pub ai_socktype: c_int,
1375 pub ai_protocol: c_int,
1376 pub ai_addrlen: size_t,
1377 pub ai_canonname: *mut c_char,
1378 pub ai_addr: *mut sockaddr,
1379 pub ai_next: *mut addrinfo,
1382 #[deriving(Copy)] pub struct sockaddr_un {
1383 pub sun_family: sa_family_t,
1384 pub sun_path: [c_char, ..108]
1391 pub type c_char = i8;
1392 pub type c_schar = i8;
1393 pub type c_uchar = u8;
1394 pub type c_short = i16;
1395 pub type c_ushort = u16;
1396 pub type c_int = i32;
1397 pub type c_uint = u32;
1398 pub type c_long = i32;
1399 pub type c_ulong = u32;
1400 pub type c_float = f32;
1401 pub type c_double = f64;
1403 #[cfg(target_arch = "x86")]
1404 pub type size_t = u32;
1405 #[cfg(target_arch = "x86_64")]
1406 pub type size_t = u64;
1408 #[cfg(target_arch = "x86")]
1409 pub type ptrdiff_t = i32;
1410 #[cfg(target_arch = "x86_64")]
1411 pub type ptrdiff_t = i64;
1413 pub type clock_t = i32;
1415 #[cfg(target_arch = "x86")]
1416 pub type time_t = i32;
1417 #[cfg(target_arch = "x86_64")]
1418 pub type time_t = i64;
1420 #[cfg(target_arch = "x86")]
1421 pub type suseconds_t = i32;
1422 #[cfg(target_arch = "x86_64")]
1423 pub type suseconds_t = i64;
1425 pub type wchar_t = u16;
1429 pub type c_longlong = i64;
1430 pub type c_ulonglong = u64;
1432 #[cfg(target_arch = "x86")]
1433 pub type intptr_t = i32;
1434 #[cfg(target_arch = "x86_64")]
1435 pub type intptr_t = i64;
1437 #[cfg(target_arch = "x86")]
1438 pub type uintptr_t = u32;
1439 #[cfg(target_arch = "x86_64")]
1440 pub type uintptr_t = u64;
1442 pub type intmax_t = i64;
1443 pub type uintmax_t = u64;
1447 pub type off_t = i32;
1448 pub type dev_t = u32;
1449 pub type ino_t = u16;
1451 pub type pid_t = u32;
1453 pub type useconds_t = u32;
1454 pub type mode_t = u16;
1456 #[cfg(target_arch = "x86")]
1457 pub type ssize_t = i32;
1458 #[cfg(target_arch = "x86_64")]
1459 pub type ssize_t = i64;
1469 use consts::os::extra::{MAX_PROTOCOL_CHAIN,
1471 use types::common::c95::c_void;
1472 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1473 use types::os::arch::c95::{c_long, c_ulong};
1474 use types::os::arch::c95::{wchar_t};
1475 use types::os::arch::c99::{c_ulonglong, c_longlong, uintptr_t};
1477 pub type BOOL = c_int;
1479 pub type BOOLEAN = BYTE;
1480 pub type CCHAR = c_char;
1481 pub type CHAR = c_char;
1483 pub type DWORD = c_ulong;
1484 pub type DWORDLONG = c_ulonglong;
1486 pub type HANDLE = LPVOID;
1487 pub type HMODULE = c_uint;
1489 pub type LONG = c_long;
1490 pub type PLONG = *mut c_long;
1492 #[cfg(target_arch = "x86")]
1493 pub type LONG_PTR = c_long;
1494 #[cfg(target_arch = "x86_64")]
1495 pub type LONG_PTR = i64;
1497 pub type LARGE_INTEGER = c_longlong;
1498 pub type PLARGE_INTEGER = *mut c_longlong;
1500 pub type LPCWSTR = *const WCHAR;
1501 pub type LPCSTR = *const CHAR;
1503 pub type LPWSTR = *mut WCHAR;
1504 pub type LPSTR = *mut CHAR;
1506 pub type LPWCH = *mut WCHAR;
1507 pub type LPCH = *mut CHAR;
1510 #[deriving(Copy)] pub struct SECURITY_ATTRIBUTES {
1512 pub lpSecurityDescriptor: LPVOID,
1513 pub bInheritHandle: BOOL,
1515 pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
1517 pub type LPVOID = *mut c_void;
1518 pub type LPCVOID = *const c_void;
1519 pub type LPBYTE = *mut BYTE;
1520 pub type LPWORD = *mut WORD;
1521 pub type LPDWORD = *mut DWORD;
1522 pub type LPHANDLE = *mut HANDLE;
1524 pub type LRESULT = LONG_PTR;
1525 pub type PBOOL = *mut BOOL;
1526 pub type WCHAR = wchar_t;
1527 pub type WORD = u16;
1528 pub type SIZE_T = size_t;
1530 pub type time64_t = i64;
1531 pub type int64 = i64;
1534 #[deriving(Copy)] pub struct STARTUPINFO {
1536 pub lpReserved: LPWSTR,
1537 pub lpDesktop: LPWSTR,
1538 pub lpTitle: LPWSTR,
1543 pub dwXCountChars: DWORD,
1544 pub dwYCountCharts: DWORD,
1545 pub dwFillAttribute: DWORD,
1547 pub wShowWindow: WORD,
1548 pub cbReserved2: WORD,
1549 pub lpReserved2: LPBYTE,
1550 pub hStdInput: HANDLE,
1551 pub hStdOutput: HANDLE,
1552 pub hStdError: HANDLE,
1554 pub type LPSTARTUPINFO = *mut STARTUPINFO;
1557 #[deriving(Copy)] pub struct PROCESS_INFORMATION {
1558 pub hProcess: HANDLE,
1559 pub hThread: HANDLE,
1560 pub dwProcessId: DWORD,
1561 pub dwThreadId: DWORD,
1563 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
1566 #[deriving(Copy)] pub struct SYSTEM_INFO {
1567 pub wProcessorArchitecture: WORD,
1568 pub wReserved: WORD,
1569 pub dwPageSize: DWORD,
1570 pub lpMinimumApplicationAddress: LPVOID,
1571 pub lpMaximumApplicationAddress: LPVOID,
1572 pub dwActiveProcessorMask: uintptr_t,
1573 pub dwNumberOfProcessors: DWORD,
1574 pub dwProcessorType: DWORD,
1575 pub dwAllocationGranularity: DWORD,
1576 pub wProcessorLevel: WORD,
1577 pub wProcessorRevision: WORD,
1579 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
1582 #[deriving(Copy)] pub struct MEMORY_BASIC_INFORMATION {
1583 pub BaseAddress: LPVOID,
1584 pub AllocationBase: LPVOID,
1585 pub AllocationProtect: DWORD,
1586 pub RegionSize: SIZE_T,
1591 pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
1594 #[deriving(Copy)] pub struct OVERLAPPED {
1595 pub Internal: *mut c_ulong,
1596 pub InternalHigh: *mut c_ulong,
1598 pub OffsetHigh: DWORD,
1602 pub type LPOVERLAPPED = *mut OVERLAPPED;
1605 #[deriving(Copy)] pub struct FILETIME {
1606 pub dwLowDateTime: DWORD,
1607 pub dwHighDateTime: DWORD,
1610 pub type LPFILETIME = *mut FILETIME;
1613 #[deriving(Copy)] pub struct GUID {
1617 pub Data4: [BYTE, ..8],
1621 #[deriving(Copy)] pub struct WSAPROTOCOLCHAIN {
1622 pub ChainLen: c_int,
1623 pub ChainEntries: [DWORD, ..MAX_PROTOCOL_CHAIN as uint],
1626 pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
1629 #[deriving(Copy)] pub struct WSAPROTOCOL_INFO {
1630 pub dwServiceFlags1: DWORD,
1631 pub dwServiceFlags2: DWORD,
1632 pub dwServiceFlags3: DWORD,
1633 pub dwServiceFlags4: DWORD,
1634 pub dwProviderFlags: DWORD,
1635 pub ProviderId: GUID,
1636 pub dwCatalogEntryId: DWORD,
1637 pub ProtocolChain: WSAPROTOCOLCHAIN,
1638 pub iVersion: c_int,
1639 pub iAddressFamily: c_int,
1640 pub iMaxSockAddr: c_int,
1641 pub iMinSockAddr: c_int,
1642 pub iSocketType: c_int,
1643 pub iProtocol: c_int,
1644 pub iProtocolMaxOffset: c_int,
1645 pub iNetworkByteOrder: c_int,
1646 pub iSecurityScheme: c_int,
1647 pub dwMessageSize: DWORD,
1648 pub dwProviderReserved: DWORD,
1649 pub szProtocol: [u8, ..(WSAPROTOCOL_LEN as uint) + 1u],
1652 pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
1654 pub type GROUP = c_uint;
1657 #[deriving(Copy)] pub struct WIN32_FIND_DATAW {
1658 pub dwFileAttributes: DWORD,
1659 pub ftCreationTime: FILETIME,
1660 pub ftLastAccessTime: FILETIME,
1661 pub ftLastWriteTime: FILETIME,
1662 pub nFileSizeHigh: DWORD,
1663 pub nFileSizeLow: DWORD,
1664 pub dwReserved0: DWORD,
1665 pub dwReserved1: DWORD,
1666 pub cFileName: [wchar_t, ..260], // #define MAX_PATH 260
1667 pub cAlternateFileName: [wchar_t, ..14],
1670 pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
1675 #[cfg(any(target_os = "macos", target_os = "ios"))]
1679 use types::common::c95::c_void;
1680 use types::os::arch::c95::{c_char, c_int, size_t, time_t};
1681 use types::os::arch::c95::{suseconds_t, c_long};
1682 use types::os::arch::c99::{uintptr_t};
1684 pub type pthread_t = uintptr_t;
1687 #[deriving(Copy)] pub struct glob_t {
1688 pub gl_pathc: size_t,
1689 pub __unused1: c_int,
1690 pub gl_offs: size_t,
1691 pub __unused2: c_int,
1692 pub gl_pathv: *mut *mut c_char,
1694 pub __unused3: *mut c_void,
1696 pub __unused4: *mut c_void,
1697 pub __unused5: *mut c_void,
1698 pub __unused6: *mut c_void,
1699 pub __unused7: *mut c_void,
1700 pub __unused8: *mut c_void,
1704 #[deriving(Copy)] pub struct timeval {
1706 pub tv_usec: suseconds_t,
1710 #[deriving(Copy)] pub struct timespec {
1712 pub tv_nsec: c_long,
1715 #[deriving(Copy)] pub enum timezone {}
1717 pub type sighandler_t = size_t;
1721 use types::common::c95::{c_void};
1722 use types::os::arch::c95::{c_char, c_int, c_uint};
1724 pub type socklen_t = c_int;
1725 pub type sa_family_t = u8;
1726 pub type in_port_t = u16;
1727 pub type in_addr_t = u32;
1729 #[deriving(Copy)] pub struct sockaddr {
1731 pub sa_family: sa_family_t,
1732 pub sa_data: [u8, ..14],
1736 #[deriving(Copy)] pub struct sockaddr_storage {
1738 pub ss_family: sa_family_t,
1739 pub __ss_pad1: [u8, ..6],
1740 pub __ss_align: i64,
1741 pub __ss_pad2: [u8, ..112],
1745 #[deriving(Copy)] pub struct sockaddr_in {
1747 pub sin_family: sa_family_t,
1748 pub sin_port: in_port_t,
1749 pub sin_addr: in_addr,
1750 pub sin_zero: [u8, ..8],
1754 #[deriving(Copy)] pub struct in_addr {
1755 pub s_addr: in_addr_t,
1759 #[deriving(Copy)] pub struct sockaddr_in6 {
1761 pub sin6_family: sa_family_t,
1762 pub sin6_port: in_port_t,
1763 pub sin6_flowinfo: u32,
1764 pub sin6_addr: in6_addr,
1765 pub sin6_scope_id: u32,
1769 #[deriving(Copy)] pub struct in6_addr {
1770 pub s6_addr: [u16, ..8]
1774 #[deriving(Copy)] pub struct ip_mreq {
1775 pub imr_multiaddr: in_addr,
1776 pub imr_interface: in_addr,
1780 #[deriving(Copy)] pub struct ip6_mreq {
1781 pub ipv6mr_multiaddr: in6_addr,
1782 pub ipv6mr_interface: c_uint,
1786 #[deriving(Copy)] pub struct addrinfo {
1787 pub ai_flags: c_int,
1788 pub ai_family: c_int,
1789 pub ai_socktype: c_int,
1790 pub ai_protocol: c_int,
1791 pub ai_addrlen: socklen_t,
1792 pub ai_canonname: *mut c_char,
1793 pub ai_addr: *mut sockaddr,
1794 pub ai_next: *mut addrinfo,
1798 #[deriving(Copy)] pub struct sockaddr_un {
1800 pub sun_family: sa_family_t,
1801 pub sun_path: [c_char, ..104]
1805 #[deriving(Copy)] pub struct ifaddrs {
1806 pub ifa_next: *mut ifaddrs,
1807 pub ifa_name: *mut c_char,
1808 pub ifa_flags: c_uint,
1809 pub ifa_addr: *mut sockaddr,
1810 pub ifa_netmask: *mut sockaddr,
1811 pub ifa_dstaddr: *mut sockaddr,
1812 pub ifa_data: *mut c_void
1817 #[cfg(any(target_arch = "arm", target_arch = "x86"))]
1820 pub type c_char = i8;
1821 pub type c_schar = i8;
1822 pub type c_uchar = u8;
1823 pub type c_short = i16;
1824 pub type c_ushort = u16;
1825 pub type c_int = i32;
1826 pub type c_uint = u32;
1827 pub type c_long = i32;
1828 pub type c_ulong = u32;
1829 pub type c_float = f32;
1830 pub type c_double = f64;
1831 pub type size_t = u32;
1832 pub type ptrdiff_t = i32;
1833 pub type clock_t = u32;
1834 pub type time_t = i32;
1835 pub type suseconds_t = i32;
1836 pub type wchar_t = i32;
1839 pub type c_longlong = i64;
1840 pub type c_ulonglong = u64;
1841 pub type intptr_t = i32;
1842 pub type uintptr_t = u32;
1843 pub type intmax_t = i64;
1844 pub type uintmax_t = u64;
1847 pub type off_t = i64;
1848 pub type dev_t = i32;
1849 pub type ino_t = u64;
1850 pub type pid_t = i32;
1851 pub type uid_t = u32;
1852 pub type gid_t = u32;
1853 pub type useconds_t = u32;
1854 pub type mode_t = u16;
1855 pub type ssize_t = i32;
1858 use types::common::c99::{int32_t, int64_t, uint32_t};
1859 use types::os::arch::c95::{c_char, c_long, time_t};
1860 use types::os::arch::posix88::{dev_t, gid_t, ino_t,
1861 mode_t, off_t, uid_t};
1863 pub type nlink_t = u16;
1864 pub type blksize_t = i64;
1865 pub type blkcnt_t = i32;
1868 #[deriving(Copy)] pub struct stat {
1870 pub st_mode: mode_t,
1871 pub st_nlink: nlink_t,
1876 pub st_atime: time_t,
1877 pub st_atime_nsec: c_long,
1878 pub st_mtime: time_t,
1879 pub st_mtime_nsec: c_long,
1880 pub st_ctime: time_t,
1881 pub st_ctime_nsec: c_long,
1882 pub st_birthtime: time_t,
1883 pub st_birthtime_nsec: c_long,
1885 pub st_blocks: blkcnt_t,
1886 pub st_blksize: blksize_t,
1887 pub st_flags: uint32_t,
1888 pub st_gen: uint32_t,
1889 pub st_lspare: int32_t,
1890 pub st_qspare: [int64_t, ..2],
1894 #[deriving(Copy)] pub struct utimbuf {
1896 pub modtime: time_t,
1900 #[deriving(Copy)] pub struct pthread_attr_t {
1902 pub __opaque: [c_char, ..36]
1911 #[deriving(Copy)] pub struct mach_timebase_info {
1916 pub type mach_timebase_info_data_t = mach_timebase_info;
1920 #[cfg(target_arch = "x86_64")]
1923 pub type c_char = i8;
1924 pub type c_schar = i8;
1925 pub type c_uchar = u8;
1926 pub type c_short = i16;
1927 pub type c_ushort = u16;
1928 pub type c_int = i32;
1929 pub type c_uint = u32;
1930 pub type c_long = i64;
1931 pub type c_ulong = u64;
1932 pub type c_float = f32;
1933 pub type c_double = f64;
1934 pub type size_t = u64;
1935 pub type ptrdiff_t = i64;
1936 pub type clock_t = u64;
1937 pub type time_t = i64;
1938 pub type suseconds_t = i32;
1939 pub type wchar_t = i32;
1942 pub type c_longlong = i64;
1943 pub type c_ulonglong = u64;
1944 pub type intptr_t = i64;
1945 pub type uintptr_t = u64;
1946 pub type intmax_t = i64;
1947 pub type uintmax_t = u64;
1950 pub type off_t = i64;
1951 pub type dev_t = i32;
1952 pub type ino_t = u64;
1953 pub type pid_t = i32;
1954 pub type uid_t = u32;
1955 pub type gid_t = u32;
1956 pub type useconds_t = u32;
1957 pub type mode_t = u16;
1958 pub type ssize_t = i64;
1961 use types::common::c99::{int32_t, int64_t};
1962 use types::common::c99::{uint32_t};
1963 use types::os::arch::c95::{c_char, c_long, time_t};
1964 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
1965 use types::os::arch::posix88::{mode_t, off_t, uid_t};
1967 pub type nlink_t = u16;
1968 pub type blksize_t = i64;
1969 pub type blkcnt_t = i32;
1972 #[deriving(Copy)] pub struct stat {
1974 pub st_mode: mode_t,
1975 pub st_nlink: nlink_t,
1980 pub st_atime: time_t,
1981 pub st_atime_nsec: c_long,
1982 pub st_mtime: time_t,
1983 pub st_mtime_nsec: c_long,
1984 pub st_ctime: time_t,
1985 pub st_ctime_nsec: c_long,
1986 pub st_birthtime: time_t,
1987 pub st_birthtime_nsec: c_long,
1989 pub st_blocks: blkcnt_t,
1990 pub st_blksize: blksize_t,
1991 pub st_flags: uint32_t,
1992 pub st_gen: uint32_t,
1993 pub st_lspare: int32_t,
1994 pub st_qspare: [int64_t, ..2],
1998 #[deriving(Copy)] pub struct utimbuf {
2000 pub modtime: time_t,
2004 #[deriving(Copy)] pub struct pthread_attr_t {
2006 pub __opaque: [c_char, ..56]
2015 #[deriving(Copy)] pub struct mach_timebase_info {
2020 pub type mach_timebase_info_data_t = mach_timebase_info;
2027 // Consts tend to vary per OS so we pull their definitions out
2028 // into this module.
2030 #[cfg(target_os = "windows")]
2033 use types::os::arch::c95::{c_int, c_uint};
2035 pub const EXIT_FAILURE : c_int = 1;
2036 pub const EXIT_SUCCESS : c_int = 0;
2037 pub const RAND_MAX : c_int = 32767;
2038 pub const EOF : c_int = -1;
2039 pub const SEEK_SET : c_int = 0;
2040 pub const SEEK_CUR : c_int = 1;
2041 pub const SEEK_END : c_int = 2;
2042 pub const _IOFBF : c_int = 0;
2043 pub const _IONBF : c_int = 4;
2044 pub const _IOLBF : c_int = 64;
2045 pub const BUFSIZ : c_uint = 512_u32;
2046 pub const FOPEN_MAX : c_uint = 20_u32;
2047 pub const FILENAME_MAX : c_uint = 260_u32;
2048 pub const L_tmpnam : c_uint = 16_u32;
2049 pub const TMP_MAX : c_uint = 32767_u32;
2051 pub const WSAEINTR: c_int = 10004;
2052 pub const WSAEBADF: c_int = 10009;
2053 pub const WSAEACCES: c_int = 10013;
2054 pub const WSAEFAULT: c_int = 10014;
2055 pub const WSAEINVAL: c_int = 10022;
2056 pub const WSAEMFILE: c_int = 10024;
2057 pub const WSAEWOULDBLOCK: c_int = 10035;
2058 pub const WSAEINPROGRESS: c_int = 10036;
2059 pub const WSAEALREADY: c_int = 10037;
2060 pub const WSAENOTSOCK: c_int = 10038;
2061 pub const WSAEDESTADDRREQ: c_int = 10039;
2062 pub const WSAEMSGSIZE: c_int = 10040;
2063 pub const WSAEPROTOTYPE: c_int = 10041;
2064 pub const WSAENOPROTOOPT: c_int = 10042;
2065 pub const WSAEPROTONOSUPPORT: c_int = 10043;
2066 pub const WSAESOCKTNOSUPPORT: c_int = 10044;
2067 pub const WSAEOPNOTSUPP: c_int = 10045;
2068 pub const WSAEPFNOSUPPORT: c_int = 10046;
2069 pub const WSAEAFNOSUPPORT: c_int = 10047;
2070 pub const WSAEADDRINUSE: c_int = 10048;
2071 pub const WSAEADDRNOTAVAIL: c_int = 10049;
2072 pub const WSAENETDOWN: c_int = 10050;
2073 pub const WSAENETUNREACH: c_int = 10051;
2074 pub const WSAENETRESET: c_int = 10052;
2075 pub const WSAECONNABORTED: c_int = 10053;
2076 pub const WSAECONNRESET: c_int = 10054;
2077 pub const WSAENOBUFS: c_int = 10055;
2078 pub const WSAEISCONN: c_int = 10056;
2079 pub const WSAENOTCONN: c_int = 10057;
2080 pub const WSAESHUTDOWN: c_int = 10058;
2081 pub const WSAETOOMANYREFS: c_int = 10059;
2082 pub const WSAETIMEDOUT: c_int = 10060;
2083 pub const WSAECONNREFUSED: c_int = 10061;
2084 pub const WSAELOOP: c_int = 10062;
2085 pub const WSAENAMETOOLONG: c_int = 10063;
2086 pub const WSAEHOSTDOWN: c_int = 10064;
2087 pub const WSAEHOSTUNREACH: c_int = 10065;
2088 pub const WSAENOTEMPTY: c_int = 10066;
2089 pub const WSAEPROCLIM: c_int = 10067;
2090 pub const WSAEUSERS: c_int = 10068;
2091 pub const WSAEDQUOT: c_int = 10069;
2092 pub const WSAESTALE: c_int = 10070;
2093 pub const WSAEREMOTE: c_int = 10071;
2094 pub const WSASYSNOTREADY: c_int = 10091;
2095 pub const WSAVERNOTSUPPORTED: c_int = 10092;
2096 pub const WSANOTINITIALISED: c_int = 10093;
2097 pub const WSAEDISCON: c_int = 10101;
2098 pub const WSAENOMORE: c_int = 10102;
2099 pub const WSAECANCELLED: c_int = 10103;
2100 pub const WSAEINVALIDPROCTABLE: c_int = 10104;
2101 pub const WSAEINVALIDPROVIDER: c_int = 10105;
2102 pub const WSAEPROVIDERFAILEDINIT: c_int = 10106;
2107 use types::os::arch::c95::c_int;
2109 pub const O_RDONLY : c_int = 0;
2110 pub const O_WRONLY : c_int = 1;
2111 pub const O_RDWR : c_int = 2;
2112 pub const O_APPEND : c_int = 8;
2113 pub const O_CREAT : c_int = 256;
2114 pub const O_EXCL : c_int = 1024;
2115 pub const O_TRUNC : c_int = 512;
2116 pub const S_IFIFO : c_int = 4096;
2117 pub const S_IFCHR : c_int = 8192;
2118 pub const S_IFBLK : c_int = 12288;
2119 pub const S_IFDIR : c_int = 16384;
2120 pub const S_IFREG : c_int = 32768;
2121 pub const S_IFLNK : c_int = 40960;
2122 pub const S_IFMT : c_int = 61440;
2123 pub const S_IEXEC : c_int = 64;
2124 pub const S_IWRITE : c_int = 128;
2125 pub const S_IREAD : c_int = 256;
2126 pub const S_IRWXU : c_int = 448;
2127 pub const S_IXUSR : c_int = 64;
2128 pub const S_IWUSR : c_int = 128;
2129 pub const S_IRUSR : c_int = 256;
2130 pub const F_OK : c_int = 0;
2131 pub const R_OK : c_int = 4;
2132 pub const W_OK : c_int = 2;
2133 pub const X_OK : c_int = 1;
2134 pub const STDIN_FILENO : c_int = 0;
2135 pub const STDOUT_FILENO : c_int = 1;
2136 pub const STDERR_FILENO : c_int = 2;
2143 use types::os::arch::c95::c_int;
2145 pub const AF_INET: c_int = 2;
2146 pub const AF_INET6: c_int = 23;
2147 pub const SOCK_STREAM: c_int = 1;
2148 pub const SOCK_DGRAM: c_int = 2;
2149 pub const SOCK_RAW: c_int = 3;
2150 pub const IPPROTO_TCP: c_int = 6;
2151 pub const IPPROTO_IP: c_int = 0;
2152 pub const IPPROTO_IPV6: c_int = 41;
2153 pub const IP_MULTICAST_TTL: c_int = 3;
2154 pub const IP_MULTICAST_LOOP: c_int = 4;
2155 pub const IP_ADD_MEMBERSHIP: c_int = 5;
2156 pub const IP_DROP_MEMBERSHIP: c_int = 6;
2157 pub const IPV6_ADD_MEMBERSHIP: c_int = 5;
2158 pub const IPV6_DROP_MEMBERSHIP: c_int = 6;
2159 pub const IP_TTL: c_int = 4;
2160 pub const IP_HDRINCL: c_int = 2;
2162 pub const TCP_NODELAY: c_int = 0x0001;
2163 pub const SOL_SOCKET: c_int = 0xffff;
2164 pub const SO_KEEPALIVE: c_int = 8;
2165 pub const SO_BROADCAST: c_int = 32;
2166 pub const SO_REUSEADDR: c_int = 4;
2167 pub const SO_ERROR: c_int = 0x1007;
2169 pub const IFF_LOOPBACK: c_int = 4;
2171 pub const SHUT_RD: c_int = 0;
2172 pub const SHUT_WR: c_int = 1;
2173 pub const SHUT_RDWR: c_int = 2;
2176 use types::os::arch::c95::{c_int, c_long};
2177 use types::os::arch::extra::{WORD, DWORD, BOOL, HANDLE};
2179 pub const TRUE : BOOL = 1;
2180 pub const FALSE : BOOL = 0;
2182 pub const O_TEXT : c_int = 16384;
2183 pub const O_BINARY : c_int = 32768;
2184 pub const O_NOINHERIT: c_int = 128;
2186 pub const ERROR_SUCCESS : c_int = 0;
2187 pub const ERROR_INVALID_FUNCTION: c_int = 1;
2188 pub const ERROR_FILE_NOT_FOUND: c_int = 2;
2189 pub const ERROR_ACCESS_DENIED: c_int = 5;
2190 pub const ERROR_INVALID_HANDLE : c_int = 6;
2191 pub const ERROR_BROKEN_PIPE: c_int = 109;
2192 pub const ERROR_DISK_FULL : c_int = 112;
2193 pub const ERROR_CALL_NOT_IMPLEMENTED : c_int = 120;
2194 pub const ERROR_INSUFFICIENT_BUFFER : c_int = 122;
2195 pub const ERROR_INVALID_NAME : c_int = 123;
2196 pub const ERROR_ALREADY_EXISTS : c_int = 183;
2197 pub const ERROR_PIPE_BUSY: c_int = 231;
2198 pub const ERROR_NO_DATA: c_int = 232;
2199 pub const ERROR_INVALID_ADDRESS : c_int = 487;
2200 pub const ERROR_PIPE_CONNECTED: c_int = 535;
2201 pub const ERROR_NOTHING_TO_TERMINATE: c_int = 758;
2202 pub const ERROR_OPERATION_ABORTED: c_int = 995;
2203 pub const ERROR_IO_PENDING: c_int = 997;
2204 pub const ERROR_FILE_INVALID : c_int = 1006;
2205 pub const ERROR_NOT_FOUND: c_int = 1168;
2206 pub const INVALID_HANDLE_VALUE: HANDLE = -1 as HANDLE;
2208 pub const DELETE : DWORD = 0x00010000;
2209 pub const READ_CONTROL : DWORD = 0x00020000;
2210 pub const SYNCHRONIZE : DWORD = 0x00100000;
2211 pub const WRITE_DAC : DWORD = 0x00040000;
2212 pub const WRITE_OWNER : DWORD = 0x00080000;
2214 pub const PROCESS_CREATE_PROCESS : DWORD = 0x0080;
2215 pub const PROCESS_CREATE_THREAD : DWORD = 0x0002;
2216 pub const PROCESS_DUP_HANDLE : DWORD = 0x0040;
2217 pub const PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
2218 pub const PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
2219 pub const PROCESS_SET_INFORMATION : DWORD = 0x0200;
2220 pub const PROCESS_SET_QUOTA : DWORD = 0x0100;
2221 pub const PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
2222 pub const PROCESS_TERMINATE : DWORD = 0x0001;
2223 pub const PROCESS_VM_OPERATION : DWORD = 0x0008;
2224 pub const PROCESS_VM_READ : DWORD = 0x0010;
2225 pub const PROCESS_VM_WRITE : DWORD = 0x0020;
2227 pub const STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
2228 pub const STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
2229 pub const STARTF_PREVENTPINNING : DWORD = 0x00002000;
2230 pub const STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
2231 pub const STARTF_TITLEISAPPID : DWORD = 0x00001000;
2232 pub const STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
2233 pub const STARTF_USECOUNTCHARS : DWORD = 0x00000008;
2234 pub const STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
2235 pub const STARTF_USEHOTKEY : DWORD = 0x00000200;
2236 pub const STARTF_USEPOSITION : DWORD = 0x00000004;
2237 pub const STARTF_USESHOWWINDOW : DWORD = 0x00000001;
2238 pub const STARTF_USESIZE : DWORD = 0x00000002;
2239 pub const STARTF_USESTDHANDLES : DWORD = 0x00000100;
2241 pub const WAIT_ABANDONED : DWORD = 0x00000080;
2242 pub const WAIT_OBJECT_0 : DWORD = 0x00000000;
2243 pub const WAIT_TIMEOUT : DWORD = 0x00000102;
2244 pub const WAIT_FAILED : DWORD = -1;
2246 pub const DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
2247 pub const DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;
2249 pub const INFINITE : DWORD = -1;
2250 pub const STILL_ACTIVE : DWORD = 259;
2252 pub const MEM_COMMIT : DWORD = 0x00001000;
2253 pub const MEM_RESERVE : DWORD = 0x00002000;
2254 pub const MEM_DECOMMIT : DWORD = 0x00004000;
2255 pub const MEM_RELEASE : DWORD = 0x00008000;
2256 pub const MEM_RESET : DWORD = 0x00080000;
2257 pub const MEM_RESET_UNDO : DWORD = 0x1000000;
2258 pub const MEM_LARGE_PAGES : DWORD = 0x20000000;
2259 pub const MEM_PHYSICAL : DWORD = 0x00400000;
2260 pub const MEM_TOP_DOWN : DWORD = 0x00100000;
2261 pub const MEM_WRITE_WATCH : DWORD = 0x00200000;
2263 pub const PAGE_EXECUTE : DWORD = 0x10;
2264 pub const PAGE_EXECUTE_READ : DWORD = 0x20;
2265 pub const PAGE_EXECUTE_READWRITE : DWORD = 0x40;
2266 pub const PAGE_EXECUTE_WRITECOPY : DWORD = 0x80;
2267 pub const PAGE_NOACCESS : DWORD = 0x01;
2268 pub const PAGE_READONLY : DWORD = 0x02;
2269 pub const PAGE_READWRITE : DWORD = 0x04;
2270 pub const PAGE_WRITECOPY : DWORD = 0x08;
2271 pub const PAGE_GUARD : DWORD = 0x100;
2272 pub const PAGE_NOCACHE : DWORD = 0x200;
2273 pub const PAGE_WRITECOMBINE : DWORD = 0x400;
2275 pub const SEC_COMMIT : DWORD = 0x8000000;
2276 pub const SEC_IMAGE : DWORD = 0x1000000;
2277 pub const SEC_IMAGE_NO_EXECUTE : DWORD = 0x11000000;
2278 pub const SEC_LARGE_PAGES : DWORD = 0x80000000;
2279 pub const SEC_NOCACHE : DWORD = 0x10000000;
2280 pub const SEC_RESERVE : DWORD = 0x4000000;
2281 pub const SEC_WRITECOMBINE : DWORD = 0x40000000;
2283 pub const FILE_MAP_ALL_ACCESS : DWORD = 0xf001f;
2284 pub const FILE_MAP_READ : DWORD = 0x4;
2285 pub const FILE_MAP_WRITE : DWORD = 0x2;
2286 pub const FILE_MAP_COPY : DWORD = 0x1;
2287 pub const FILE_MAP_EXECUTE : DWORD = 0x20;
2289 pub const PROCESSOR_ARCHITECTURE_INTEL : WORD = 0;
2290 pub const PROCESSOR_ARCHITECTURE_ARM : WORD = 5;
2291 pub const PROCESSOR_ARCHITECTURE_IA64 : WORD = 6;
2292 pub const PROCESSOR_ARCHITECTURE_AMD64 : WORD = 9;
2293 pub const PROCESSOR_ARCHITECTURE_UNKNOWN : WORD = 0xffff;
2295 pub const MOVEFILE_COPY_ALLOWED: DWORD = 2;
2296 pub const MOVEFILE_CREATE_HARDLINK: DWORD = 16;
2297 pub const MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 4;
2298 pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 32;
2299 pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1;
2300 pub const MOVEFILE_WRITE_THROUGH: DWORD = 8;
2302 pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 1;
2304 pub const FILE_SHARE_DELETE: DWORD = 0x4;
2305 pub const FILE_SHARE_READ: DWORD = 0x1;
2306 pub const FILE_SHARE_WRITE: DWORD = 0x2;
2308 pub const CREATE_ALWAYS: DWORD = 2;
2309 pub const CREATE_NEW: DWORD = 1;
2310 pub const OPEN_ALWAYS: DWORD = 4;
2311 pub const OPEN_EXISTING: DWORD = 3;
2312 pub const TRUNCATE_EXISTING: DWORD = 5;
2314 pub const FILE_APPEND_DATA: DWORD = 0x00000004;
2315 pub const FILE_READ_DATA: DWORD = 0x00000001;
2316 pub const FILE_WRITE_DATA: DWORD = 0x00000002;
2318 pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x20;
2319 pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x800;
2320 pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x40;
2321 pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
2322 pub const FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x4000;
2323 pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x2;
2324 pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x8000;
2325 pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x80;
2326 pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x2000;
2327 pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x20000;
2328 pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x1000;
2329 pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
2330 pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
2331 pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x200;
2332 pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x4;
2333 pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x100;
2334 pub const FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x10000;
2336 pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
2337 pub const FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000;
2338 pub const FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000;
2339 pub const FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000;
2340 pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
2341 pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
2342 pub const FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x0100000;
2343 pub const FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000;
2344 pub const FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000;
2345 pub const FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000;
2346 pub const FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000;
2347 pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
2349 pub const FILE_NAME_NORMALIZED: DWORD = 0x0;
2350 pub const FILE_NAME_OPENED: DWORD = 0x8;
2352 pub const VOLUME_NAME_DOS: DWORD = 0x0;
2353 pub const VOLUME_NAME_GUID: DWORD = 0x1;
2354 pub const VOLUME_NAME_NONE: DWORD = 0x4;
2355 pub const VOLUME_NAME_NT: DWORD = 0x2;
2357 pub const GENERIC_READ: DWORD = 0x80000000;
2358 pub const GENERIC_WRITE: DWORD = 0x40000000;
2359 pub const GENERIC_EXECUTE: DWORD = 0x20000000;
2360 pub const GENERIC_ALL: DWORD = 0x10000000;
2361 pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
2362 pub const FILE_READ_ATTRIBUTES: DWORD = 0x00000080;
2364 pub const STANDARD_RIGHTS_READ: DWORD = 0x20000;
2365 pub const STANDARD_RIGHTS_WRITE: DWORD = 0x20000;
2366 pub const FILE_WRITE_EA: DWORD = 0x00000010;
2367 pub const FILE_READ_EA: DWORD = 0x00000008;
2368 pub const FILE_GENERIC_READ: DWORD =
2369 STANDARD_RIGHTS_READ | FILE_READ_DATA |
2370 FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE;
2371 pub const FILE_GENERIC_WRITE: DWORD =
2372 STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA |
2373 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA |
2376 pub const FILE_BEGIN: DWORD = 0;
2377 pub const FILE_CURRENT: DWORD = 1;
2378 pub const FILE_END: DWORD = 2;
2380 pub const MAX_PROTOCOL_CHAIN: DWORD = 7;
2381 pub const WSAPROTOCOL_LEN: DWORD = 255;
2382 pub const INVALID_SOCKET: DWORD = !0;
2384 pub const DETACHED_PROCESS: DWORD = 0x00000008;
2385 pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
2386 pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
2388 pub const PIPE_ACCESS_DUPLEX: DWORD = 0x00000003;
2389 pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
2390 pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
2391 pub const PIPE_TYPE_BYTE: DWORD = 0x00000000;
2392 pub const PIPE_TYPE_MESSAGE: DWORD = 0x00000004;
2393 pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
2394 pub const PIPE_READMODE_MESSAGE: DWORD = 0x00000002;
2395 pub const PIPE_WAIT: DWORD = 0x00000000;
2396 pub const PIPE_NOWAIT: DWORD = 0x00000001;
2397 pub const PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000;
2398 pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
2399 pub const PIPE_UNLIMITED_INSTANCES: DWORD = 255;
2401 pub const IPPROTO_RAW: c_int = 255;
2403 pub const FIONBIO: c_long = -0x7FFB9982;
2410 #[cfg(any(target_os = "linux", target_os = "android"))]
2413 use types::os::arch::c95::{c_int, c_uint};
2415 pub const EXIT_FAILURE : c_int = 1;
2416 pub const EXIT_SUCCESS : c_int = 0;
2417 pub const RAND_MAX : c_int = 2147483647;
2418 pub const EOF : c_int = -1;
2419 pub const SEEK_SET : c_int = 0;
2420 pub const SEEK_CUR : c_int = 1;
2421 pub const SEEK_END : c_int = 2;
2422 pub const _IOFBF : c_int = 0;
2423 pub const _IONBF : c_int = 2;
2424 pub const _IOLBF : c_int = 1;
2425 pub const BUFSIZ : c_uint = 8192_u32;
2426 pub const FOPEN_MAX : c_uint = 16_u32;
2427 pub const FILENAME_MAX : c_uint = 4096_u32;
2428 pub const L_tmpnam : c_uint = 20_u32;
2429 pub const TMP_MAX : c_uint = 238328_u32;
2433 #[cfg(any(target_arch = "x86",
2434 target_arch = "x86_64",
2435 target_arch = "arm"))]
2437 use types::os::arch::c95::c_int;
2438 use types::common::c95::c_void;
2439 use types::os::arch::posix88::mode_t;
2441 pub const O_RDONLY : c_int = 0;
2442 pub const O_WRONLY : c_int = 1;
2443 pub const O_RDWR : c_int = 2;
2444 pub const O_APPEND : c_int = 1024;
2445 pub const O_CREAT : c_int = 64;
2446 pub const O_EXCL : c_int = 128;
2447 pub const O_TRUNC : c_int = 512;
2448 pub const S_IFIFO : mode_t = 4096;
2449 pub const S_IFCHR : mode_t = 8192;
2450 pub const S_IFBLK : mode_t = 24576;
2451 pub const S_IFDIR : mode_t = 16384;
2452 pub const S_IFREG : mode_t = 32768;
2453 pub const S_IFLNK : mode_t = 40960;
2454 pub const S_IFMT : mode_t = 61440;
2455 pub const S_IEXEC : mode_t = 64;
2456 pub const S_IWRITE : mode_t = 128;
2457 pub const S_IREAD : mode_t = 256;
2458 pub const S_IRWXU : mode_t = 448;
2459 pub const S_IXUSR : mode_t = 64;
2460 pub const S_IWUSR : mode_t = 128;
2461 pub const S_IRUSR : mode_t = 256;
2462 pub const F_OK : c_int = 0;
2463 pub const R_OK : c_int = 4;
2464 pub const W_OK : c_int = 2;
2465 pub const X_OK : c_int = 1;
2466 pub const STDIN_FILENO : c_int = 0;
2467 pub const STDOUT_FILENO : c_int = 1;
2468 pub const STDERR_FILENO : c_int = 2;
2469 pub const F_LOCK : c_int = 1;
2470 pub const F_TEST : c_int = 3;
2471 pub const F_TLOCK : c_int = 2;
2472 pub const F_ULOCK : c_int = 0;
2473 pub const SIGHUP : c_int = 1;
2474 pub const SIGINT : c_int = 2;
2475 pub const SIGQUIT : c_int = 3;
2476 pub const SIGILL : c_int = 4;
2477 pub const SIGABRT : c_int = 6;
2478 pub const SIGFPE : c_int = 8;
2479 pub const SIGKILL : c_int = 9;
2480 pub const SIGSEGV : c_int = 11;
2481 pub const SIGPIPE : c_int = 13;
2482 pub const SIGALRM : c_int = 14;
2483 pub const SIGTERM : c_int = 15;
2485 pub const PROT_NONE : c_int = 0;
2486 pub const PROT_READ : c_int = 1;
2487 pub const PROT_WRITE : c_int = 2;
2488 pub const PROT_EXEC : c_int = 4;
2490 pub const MAP_FILE : c_int = 0x0000;
2491 pub const MAP_SHARED : c_int = 0x0001;
2492 pub const MAP_PRIVATE : c_int = 0x0002;
2493 pub const MAP_FIXED : c_int = 0x0010;
2494 pub const MAP_ANON : c_int = 0x0020;
2496 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
2498 pub const MCL_CURRENT : c_int = 0x0001;
2499 pub const MCL_FUTURE : c_int = 0x0002;
2501 pub const MS_ASYNC : c_int = 0x0001;
2502 pub const MS_INVALIDATE : c_int = 0x0002;
2503 pub const MS_SYNC : c_int = 0x0004;
2505 pub const EPERM : c_int = 1;
2506 pub const ENOENT : c_int = 2;
2507 pub const ESRCH : c_int = 3;
2508 pub const EINTR : c_int = 4;
2509 pub const EIO : c_int = 5;
2510 pub const ENXIO : c_int = 6;
2511 pub const E2BIG : c_int = 7;
2512 pub const ENOEXEC : c_int = 8;
2513 pub const EBADF : c_int = 9;
2514 pub const ECHILD : c_int = 10;
2515 pub const EAGAIN : c_int = 11;
2516 pub const ENOMEM : c_int = 12;
2517 pub const EACCES : c_int = 13;
2518 pub const EFAULT : c_int = 14;
2519 pub const ENOTBLK : c_int = 15;
2520 pub const EBUSY : c_int = 16;
2521 pub const EEXIST : c_int = 17;
2522 pub const EXDEV : c_int = 18;
2523 pub const ENODEV : c_int = 19;
2524 pub const ENOTDIR : c_int = 20;
2525 pub const EISDIR : c_int = 21;
2526 pub const EINVAL : c_int = 22;
2527 pub const ENFILE : c_int = 23;
2528 pub const EMFILE : c_int = 24;
2529 pub const ENOTTY : c_int = 25;
2530 pub const ETXTBSY : c_int = 26;
2531 pub const EFBIG : c_int = 27;
2532 pub const ENOSPC : c_int = 28;
2533 pub const ESPIPE : c_int = 29;
2534 pub const EROFS : c_int = 30;
2535 pub const EMLINK : c_int = 31;
2536 pub const EPIPE : c_int = 32;
2537 pub const EDOM : c_int = 33;
2538 pub const ERANGE : c_int = 34;
2540 pub const EDEADLK: c_int = 35;
2541 pub const ENAMETOOLONG: c_int = 36;
2542 pub const ENOLCK: c_int = 37;
2543 pub const ENOSYS: c_int = 38;
2544 pub const ENOTEMPTY: c_int = 39;
2545 pub const ELOOP: c_int = 40;
2546 pub const EWOULDBLOCK: c_int = EAGAIN;
2547 pub const ENOMSG: c_int = 42;
2548 pub const EIDRM: c_int = 43;
2549 pub const ECHRNG: c_int = 44;
2550 pub const EL2NSYNC: c_int = 45;
2551 pub const EL3HLT: c_int = 46;
2552 pub const EL3RST: c_int = 47;
2553 pub const ELNRNG: c_int = 48;
2554 pub const EUNATCH: c_int = 49;
2555 pub const ENOCSI: c_int = 50;
2556 pub const EL2HLT: c_int = 51;
2557 pub const EBADE: c_int = 52;
2558 pub const EBADR: c_int = 53;
2559 pub const EXFULL: c_int = 54;
2560 pub const ENOANO: c_int = 55;
2561 pub const EBADRQC: c_int = 56;
2562 pub const EBADSLT: c_int = 57;
2564 pub const EDEADLOCK: c_int = EDEADLK;
2566 pub const EBFONT: c_int = 59;
2567 pub const ENOSTR: c_int = 60;
2568 pub const ENODATA: c_int = 61;
2569 pub const ETIME: c_int = 62;
2570 pub const ENOSR: c_int = 63;
2571 pub const ENONET: c_int = 64;
2572 pub const ENOPKG: c_int = 65;
2573 pub const EREMOTE: c_int = 66;
2574 pub const ENOLINK: c_int = 67;
2575 pub const EADV: c_int = 68;
2576 pub const ESRMNT: c_int = 69;
2577 pub const ECOMM: c_int = 70;
2578 pub const EPROTO: c_int = 71;
2579 pub const EMULTIHOP: c_int = 72;
2580 pub const EDOTDOT: c_int = 73;
2581 pub const EBADMSG: c_int = 74;
2582 pub const EOVERFLOW: c_int = 75;
2583 pub const ENOTUNIQ: c_int = 76;
2584 pub const EBADFD: c_int = 77;
2585 pub const EREMCHG: c_int = 78;
2586 pub const ELIBACC: c_int = 79;
2587 pub const ELIBBAD: c_int = 80;
2588 pub const ELIBSCN: c_int = 81;
2589 pub const ELIBMAX: c_int = 82;
2590 pub const ELIBEXEC: c_int = 83;
2591 pub const EILSEQ: c_int = 84;
2592 pub const ERESTART: c_int = 85;
2593 pub const ESTRPIPE: c_int = 86;
2594 pub const EUSERS: c_int = 87;
2595 pub const ENOTSOCK: c_int = 88;
2596 pub const EDESTADDRREQ: c_int = 89;
2597 pub const EMSGSIZE: c_int = 90;
2598 pub const EPROTOTYPE: c_int = 91;
2599 pub const ENOPROTOOPT: c_int = 92;
2600 pub const EPROTONOSUPPORT: c_int = 93;
2601 pub const ESOCKTNOSUPPORT: c_int = 94;
2602 pub const EOPNOTSUPP: c_int = 95;
2603 pub const EPFNOSUPPORT: c_int = 96;
2604 pub const EAFNOSUPPORT: c_int = 97;
2605 pub const EADDRINUSE: c_int = 98;
2606 pub const EADDRNOTAVAIL: c_int = 99;
2607 pub const ENETDOWN: c_int = 100;
2608 pub const ENETUNREACH: c_int = 101;
2609 pub const ENETRESET: c_int = 102;
2610 pub const ECONNABORTED: c_int = 103;
2611 pub const ECONNRESET: c_int = 104;
2612 pub const ENOBUFS: c_int = 105;
2613 pub const EISCONN: c_int = 106;
2614 pub const ENOTCONN: c_int = 107;
2615 pub const ESHUTDOWN: c_int = 108;
2616 pub const ETOOMANYREFS: c_int = 109;
2617 pub const ETIMEDOUT: c_int = 110;
2618 pub const ECONNREFUSED: c_int = 111;
2619 pub const EHOSTDOWN: c_int = 112;
2620 pub const EHOSTUNREACH: c_int = 113;
2621 pub const EALREADY: c_int = 114;
2622 pub const EINPROGRESS: c_int = 115;
2623 pub const ESTALE: c_int = 116;
2624 pub const EUCLEAN: c_int = 117;
2625 pub const ENOTNAM: c_int = 118;
2626 pub const ENAVAIL: c_int = 119;
2627 pub const EISNAM: c_int = 120;
2628 pub const EREMOTEIO: c_int = 121;
2629 pub const EDQUOT: c_int = 122;
2631 pub const ENOMEDIUM: c_int = 123;
2632 pub const EMEDIUMTYPE: c_int = 124;
2633 pub const ECANCELED: c_int = 125;
2634 pub const ENOKEY: c_int = 126;
2635 pub const EKEYEXPIRED: c_int = 127;
2636 pub const EKEYREVOKED: c_int = 128;
2637 pub const EKEYREJECTED: c_int = 129;
2639 pub const EOWNERDEAD: c_int = 130;
2640 pub const ENOTRECOVERABLE: c_int = 131;
2642 pub const ERFKILL: c_int = 132;
2644 pub const EHWPOISON: c_int = 133;
2647 #[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
2649 use types::os::arch::c95::c_int;
2650 use types::common::c95::c_void;
2651 use types::os::arch::posix88::mode_t;
2653 pub const O_RDONLY : c_int = 0;
2654 pub const O_WRONLY : c_int = 1;
2655 pub const O_RDWR : c_int = 2;
2656 pub const O_APPEND : c_int = 8;
2657 pub const O_CREAT : c_int = 256;
2658 pub const O_EXCL : c_int = 1024;
2659 pub const O_TRUNC : c_int = 512;
2660 pub const S_IFIFO : mode_t = 4096;
2661 pub const S_IFCHR : mode_t = 8192;
2662 pub const S_IFBLK : mode_t = 24576;
2663 pub const S_IFDIR : mode_t = 16384;
2664 pub const S_IFREG : mode_t = 32768;
2665 pub const S_IFLNK : mode_t = 40960;
2666 pub const S_IFMT : mode_t = 61440;
2667 pub const S_IEXEC : mode_t = 64;
2668 pub const S_IWRITE : mode_t = 128;
2669 pub const S_IREAD : mode_t = 256;
2670 pub const S_IRWXU : mode_t = 448;
2671 pub const S_IXUSR : mode_t = 64;
2672 pub const S_IWUSR : mode_t = 128;
2673 pub const S_IRUSR : mode_t = 256;
2674 pub const F_OK : c_int = 0;
2675 pub const R_OK : c_int = 4;
2676 pub const W_OK : c_int = 2;
2677 pub const X_OK : c_int = 1;
2678 pub const STDIN_FILENO : c_int = 0;
2679 pub const STDOUT_FILENO : c_int = 1;
2680 pub const STDERR_FILENO : c_int = 2;
2681 pub const F_LOCK : c_int = 1;
2682 pub const F_TEST : c_int = 3;
2683 pub const F_TLOCK : c_int = 2;
2684 pub const F_ULOCK : c_int = 0;
2685 pub const SIGHUP : c_int = 1;
2686 pub const SIGINT : c_int = 2;
2687 pub const SIGQUIT : c_int = 3;
2688 pub const SIGILL : c_int = 4;
2689 pub const SIGABRT : c_int = 6;
2690 pub const SIGFPE : c_int = 8;
2691 pub const SIGKILL : c_int = 9;
2692 pub const SIGSEGV : c_int = 11;
2693 pub const SIGPIPE : c_int = 13;
2694 pub const SIGALRM : c_int = 14;
2695 pub const SIGTERM : c_int = 15;
2697 pub const PROT_NONE : c_int = 0;
2698 pub const PROT_READ : c_int = 1;
2699 pub const PROT_WRITE : c_int = 2;
2700 pub const PROT_EXEC : c_int = 4;
2702 pub const MAP_FILE : c_int = 0x0000;
2703 pub const MAP_SHARED : c_int = 0x0001;
2704 pub const MAP_PRIVATE : c_int = 0x0002;
2705 pub const MAP_FIXED : c_int = 0x0010;
2706 pub const MAP_ANON : c_int = 0x0800;
2708 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
2710 pub const MCL_CURRENT : c_int = 0x0001;
2711 pub const MCL_FUTURE : c_int = 0x0002;
2713 pub const MS_ASYNC : c_int = 0x0001;
2714 pub const MS_INVALIDATE : c_int = 0x0002;
2715 pub const MS_SYNC : c_int = 0x0004;
2717 pub const EPERM : c_int = 1;
2718 pub const ENOENT : c_int = 2;
2719 pub const ESRCH : c_int = 3;
2720 pub const EINTR : c_int = 4;
2721 pub const EIO : c_int = 5;
2722 pub const ENXIO : c_int = 6;
2723 pub const E2BIG : c_int = 7;
2724 pub const ENOEXEC : c_int = 8;
2725 pub const EBADF : c_int = 9;
2726 pub const ECHILD : c_int = 10;
2727 pub const EAGAIN : c_int = 11;
2728 pub const ENOMEM : c_int = 12;
2729 pub const EACCES : c_int = 13;
2730 pub const EFAULT : c_int = 14;
2731 pub const ENOTBLK : c_int = 15;
2732 pub const EBUSY : c_int = 16;
2733 pub const EEXIST : c_int = 17;
2734 pub const EXDEV : c_int = 18;
2735 pub const ENODEV : c_int = 19;
2736 pub const ENOTDIR : c_int = 20;
2737 pub const EISDIR : c_int = 21;
2738 pub const EINVAL : c_int = 22;
2739 pub const ENFILE : c_int = 23;
2740 pub const EMFILE : c_int = 24;
2741 pub const ENOTTY : c_int = 25;
2742 pub const ETXTBSY : c_int = 26;
2743 pub const EFBIG : c_int = 27;
2744 pub const ENOSPC : c_int = 28;
2745 pub const ESPIPE : c_int = 29;
2746 pub const EROFS : c_int = 30;
2747 pub const EMLINK : c_int = 31;
2748 pub const EPIPE : c_int = 32;
2749 pub const EDOM : c_int = 33;
2750 pub const ERANGE : c_int = 34;
2752 pub const ENOMSG: c_int = 35;
2753 pub const EIDRM: c_int = 36;
2754 pub const ECHRNG: c_int = 37;
2755 pub const EL2NSYNC: c_int = 38;
2756 pub const EL3HLT: c_int = 39;
2757 pub const EL3RST: c_int = 40;
2758 pub const ELNRNG: c_int = 41;
2759 pub const EUNATCH: c_int = 42;
2760 pub const ENOCSI: c_int = 43;
2761 pub const EL2HLT: c_int = 44;
2762 pub const EDEADLK: c_int = 45;
2763 pub const ENOLCK: c_int = 46;
2764 pub const EBADE: c_int = 50;
2765 pub const EBADR: c_int = 51;
2766 pub const EXFULL: c_int = 52;
2767 pub const ENOANO: c_int = 53;
2768 pub const EBADRQC: c_int = 54;
2769 pub const EBADSLT: c_int = 55;
2770 pub const EDEADLOCK: c_int = 56;
2771 pub const EBFONT: c_int = 59;
2772 pub const ENOSTR: c_int = 60;
2773 pub const ENODATA: c_int = 61;
2774 pub const ETIME: c_int = 62;
2775 pub const ENOSR: c_int = 63;
2776 pub const ENONET: c_int = 64;
2777 pub const ENOPKG: c_int = 65;
2778 pub const EREMOTE: c_int = 66;
2779 pub const ENOLINK: c_int = 67;
2780 pub const EADV: c_int = 68;
2781 pub const ESRMNT: c_int = 69;
2782 pub const ECOMM: c_int = 70;
2783 pub const EPROTO: c_int = 71;
2784 pub const EDOTDOT: c_int = 73;
2785 pub const EMULTIHOP: c_int = 74;
2786 pub const EBADMSG: c_int = 77;
2787 pub const ENAMETOOLONG: c_int = 78;
2788 pub const EOVERFLOW: c_int = 79;
2789 pub const ENOTUNIQ: c_int = 80;
2790 pub const EBADFD: c_int = 81;
2791 pub const EREMCHG: c_int = 82;
2792 pub const ELIBACC: c_int = 83;
2793 pub const ELIBBAD: c_int = 84;
2794 pub const ELIBSCN: c_int = 95;
2795 pub const ELIBMAX: c_int = 86;
2796 pub const ELIBEXEC: c_int = 87;
2797 pub const EILSEQ: c_int = 88;
2798 pub const ENOSYS: c_int = 89;
2799 pub const ELOOP: c_int = 90;
2800 pub const ERESTART: c_int = 91;
2801 pub const ESTRPIPE: c_int = 92;
2802 pub const ENOTEMPTY: c_int = 93;
2803 pub const EUSERS: c_int = 94;
2804 pub const ENOTSOCK: c_int = 95;
2805 pub const EDESTADDRREQ: c_int = 96;
2806 pub const EMSGSIZE: c_int = 97;
2807 pub const EPROTOTYPE: c_int = 98;
2808 pub const ENOPROTOOPT: c_int = 99;
2809 pub const EPROTONOSUPPORT: c_int = 120;
2810 pub const ESOCKTNOSUPPORT: c_int = 121;
2811 pub const EOPNOTSUPP: c_int = 122;
2812 pub const EPFNOSUPPORT: c_int = 123;
2813 pub const EAFNOSUPPORT: c_int = 124;
2814 pub const EADDRINUSE: c_int = 125;
2815 pub const EADDRNOTAVAIL: c_int = 126;
2816 pub const ENETDOWN: c_int = 127;
2817 pub const ENETUNREACH: c_int = 128;
2818 pub const ENETRESET: c_int = 129;
2819 pub const ECONNABORTED: c_int = 130;
2820 pub const ECONNRESET: c_int = 131;
2821 pub const ENOBUFS: c_int = 132;
2822 pub const EISCONN: c_int = 133;
2823 pub const ENOTCONN: c_int = 134;
2824 pub const EUCLEAN: c_int = 135;
2825 pub const ENOTNAM: c_int = 137;
2826 pub const ENAVAIL: c_int = 138;
2827 pub const EISNAM: c_int = 139;
2828 pub const EREMOTEIO: c_int = 140;
2829 pub const ESHUTDOWN: c_int = 143;
2830 pub const ETOOMANYREFS: c_int = 144;
2831 pub const ETIMEDOUT: c_int = 145;
2832 pub const ECONNREFUSED: c_int = 146;
2833 pub const EHOSTDOWN: c_int = 147;
2834 pub const EHOSTUNREACH: c_int = 148;
2835 pub const EWOULDBLOCK: c_int = EAGAIN;
2836 pub const EALREADY: c_int = 149;
2837 pub const EINPROGRESS: c_int = 150;
2838 pub const ESTALE: c_int = 151;
2839 pub const ECANCELED: c_int = 158;
2841 pub const ENOMEDIUM: c_int = 159;
2842 pub const EMEDIUMTYPE: c_int = 160;
2843 pub const ENOKEY: c_int = 161;
2844 pub const EKEYEXPIRED: c_int = 162;
2845 pub const EKEYREVOKED: c_int = 163;
2846 pub const EKEYREJECTED: c_int = 164;
2848 pub const EOWNERDEAD: c_int = 165;
2849 pub const ENOTRECOVERABLE: c_int = 166;
2851 pub const ERFKILL: c_int = 167;
2853 pub const EHWPOISON: c_int = 168;
2855 pub const EDQUOT: c_int = 1133;
2858 use types::os::arch::c95::{c_int, size_t};
2860 pub const F_DUPFD : c_int = 0;
2861 pub const F_GETFD : c_int = 1;
2862 pub const F_SETFD : c_int = 2;
2863 pub const F_GETFL : c_int = 3;
2864 pub const F_SETFL : c_int = 4;
2866 pub const SIGTRAP : c_int = 5;
2867 pub const SIGPIPE: c_int = 13;
2868 pub const SIG_IGN: size_t = 1;
2870 pub const GLOB_ERR : c_int = 1 << 0;
2871 pub const GLOB_MARK : c_int = 1 << 1;
2872 pub const GLOB_NOSORT : c_int = 1 << 2;
2873 pub const GLOB_DOOFFS : c_int = 1 << 3;
2874 pub const GLOB_NOCHECK : c_int = 1 << 4;
2875 pub const GLOB_APPEND : c_int = 1 << 5;
2876 pub const GLOB_NOESCAPE : c_int = 1 << 6;
2878 pub const GLOB_NOSPACE : c_int = 1;
2879 pub const GLOB_ABORTED : c_int = 2;
2880 pub const GLOB_NOMATCH : c_int = 3;
2882 pub const POSIX_MADV_NORMAL : c_int = 0;
2883 pub const POSIX_MADV_RANDOM : c_int = 1;
2884 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
2885 pub const POSIX_MADV_WILLNEED : c_int = 3;
2886 pub const POSIX_MADV_DONTNEED : c_int = 4;
2888 pub const _SC_MQ_PRIO_MAX : c_int = 28;
2889 pub const _SC_IOV_MAX : c_int = 60;
2890 pub const _SC_GETGR_R_SIZE_MAX : c_int = 69;
2891 pub const _SC_GETPW_R_SIZE_MAX : c_int = 70;
2892 pub const _SC_LOGIN_NAME_MAX : c_int = 71;
2893 pub const _SC_TTY_NAME_MAX : c_int = 72;
2894 pub const _SC_THREADS : c_int = 67;
2895 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
2896 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
2897 pub const _SC_THREAD_KEYS_MAX : c_int = 74;
2898 pub const _SC_THREAD_STACK_MIN : c_int = 75;
2899 pub const _SC_THREAD_THREADS_MAX : c_int = 76;
2900 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
2901 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
2902 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
2903 pub const _SC_THREAD_PRIO_INHERIT : c_int = 80;
2904 pub const _SC_THREAD_PRIO_PROTECT : c_int = 81;
2905 pub const _SC_THREAD_PROCESS_SHARED : c_int = 82;
2906 pub const _SC_ATEXIT_MAX : c_int = 87;
2907 pub const _SC_XOPEN_VERSION : c_int = 89;
2908 pub const _SC_XOPEN_XCU_VERSION : c_int = 90;
2909 pub const _SC_XOPEN_UNIX : c_int = 91;
2910 pub const _SC_XOPEN_CRYPT : c_int = 92;
2911 pub const _SC_XOPEN_ENH_I18N : c_int = 93;
2912 pub const _SC_XOPEN_SHM : c_int = 94;
2913 pub const _SC_XOPEN_LEGACY : c_int = 129;
2914 pub const _SC_XOPEN_REALTIME : c_int = 130;
2915 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 131;
2917 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
2918 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
2920 #[cfg(target_os = "android")]
2921 pub const PTHREAD_STACK_MIN: size_t = 8192;
2923 #[cfg(all(target_os = "linux",
2924 any(target_arch = "arm",
2925 target_arch = "x86",
2926 target_arch = "x86_64")))]
2927 pub const PTHREAD_STACK_MIN: size_t = 16384;
2929 #[cfg(all(target_os = "linux",
2930 any(target_arch = "mips", target_arch = "mipsel")))]
2931 pub const PTHREAD_STACK_MIN: size_t = 131072;
2933 pub const CLOCK_REALTIME: c_int = 0;
2934 pub const CLOCK_MONOTONIC: c_int = 1;
2938 #[cfg(any(target_arch = "arm",
2939 target_arch = "x86",
2940 target_arch = "x86_64"))]
2942 use types::os::arch::c95::c_int;
2944 pub const MADV_NORMAL : c_int = 0;
2945 pub const MADV_RANDOM : c_int = 1;
2946 pub const MADV_SEQUENTIAL : c_int = 2;
2947 pub const MADV_WILLNEED : c_int = 3;
2948 pub const MADV_DONTNEED : c_int = 4;
2949 pub const MADV_REMOVE : c_int = 9;
2950 pub const MADV_DONTFORK : c_int = 10;
2951 pub const MADV_DOFORK : c_int = 11;
2952 pub const MADV_MERGEABLE : c_int = 12;
2953 pub const MADV_UNMERGEABLE : c_int = 13;
2954 pub const MADV_HWPOISON : c_int = 100;
2956 pub const IFF_LOOPBACK: c_int = 0x8;
2958 pub const AF_UNIX: c_int = 1;
2959 pub const AF_INET: c_int = 2;
2960 pub const AF_INET6: c_int = 10;
2961 pub const SOCK_STREAM: c_int = 1;
2962 pub const SOCK_DGRAM: c_int = 2;
2963 pub const SOCK_RAW: c_int = 3;
2964 pub const IPPROTO_TCP: c_int = 6;
2965 pub const IPPROTO_IP: c_int = 0;
2966 pub const IPPROTO_IPV6: c_int = 41;
2967 pub const IP_MULTICAST_TTL: c_int = 33;
2968 pub const IP_MULTICAST_LOOP: c_int = 34;
2969 pub const IP_TTL: c_int = 2;
2970 pub const IP_HDRINCL: c_int = 3;
2971 pub const IP_ADD_MEMBERSHIP: c_int = 35;
2972 pub const IP_DROP_MEMBERSHIP: c_int = 36;
2973 pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
2974 pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
2976 pub const TCP_NODELAY: c_int = 1;
2977 pub const SOL_SOCKET: c_int = 1;
2978 pub const SO_KEEPALIVE: c_int = 9;
2979 pub const SO_BROADCAST: c_int = 6;
2980 pub const SO_REUSEADDR: c_int = 2;
2981 pub const SO_ERROR: c_int = 4;
2983 pub const SHUT_RD: c_int = 0;
2984 pub const SHUT_WR: c_int = 1;
2985 pub const SHUT_RDWR: c_int = 2;
2987 #[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
2989 use types::os::arch::c95::c_int;
2991 pub const MADV_NORMAL : c_int = 0;
2992 pub const MADV_RANDOM : c_int = 1;
2993 pub const MADV_SEQUENTIAL : c_int = 2;
2994 pub const MADV_WILLNEED : c_int = 3;
2995 pub const MADV_DONTNEED : c_int = 4;
2996 pub const MADV_REMOVE : c_int = 9;
2997 pub const MADV_DONTFORK : c_int = 10;
2998 pub const MADV_DOFORK : c_int = 11;
2999 pub const MADV_MERGEABLE : c_int = 12;
3000 pub const MADV_UNMERGEABLE : c_int = 13;
3001 pub const MADV_HWPOISON : c_int = 100;
3003 pub const AF_UNIX: c_int = 1;
3004 pub const AF_INET: c_int = 2;
3005 pub const AF_INET6: c_int = 10;
3006 pub const SOCK_STREAM: c_int = 2;
3007 pub const SOCK_DGRAM: c_int = 1;
3008 pub const SOCK_RAW: c_int = 3;
3009 pub const IPPROTO_TCP: c_int = 6;
3010 pub const IPPROTO_IP: c_int = 0;
3011 pub const IPPROTO_IPV6: c_int = 41;
3012 pub const IP_MULTICAST_TTL: c_int = 33;
3013 pub const IP_MULTICAST_LOOP: c_int = 34;
3014 pub const IP_TTL: c_int = 2;
3015 pub const IP_HDRINCL: c_int = 3;
3016 pub const IP_ADD_MEMBERSHIP: c_int = 35;
3017 pub const IP_DROP_MEMBERSHIP: c_int = 36;
3018 pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
3019 pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
3021 pub const TCP_NODELAY: c_int = 1;
3022 pub const SOL_SOCKET: c_int = 65535;
3023 pub const SO_KEEPALIVE: c_int = 8;
3024 pub const SO_BROADCAST: c_int = 32;
3025 pub const SO_REUSEADDR: c_int = 4;
3026 pub const SO_ERROR: c_int = 4103;
3028 pub const SHUT_RD: c_int = 0;
3029 pub const SHUT_WR: c_int = 1;
3030 pub const SHUT_RDWR: c_int = 2;
3032 #[cfg(any(target_arch = "x86",
3033 target_arch = "x86_64",
3034 target_arch = "arm"))]
3036 use types::os::arch::c95::c_int;
3038 pub const AF_PACKET : c_int = 17;
3039 pub const IPPROTO_RAW : c_int = 255;
3041 pub const O_RSYNC : c_int = 1052672;
3042 pub const O_DSYNC : c_int = 4096;
3043 pub const O_NONBLOCK : c_int = 2048;
3044 pub const O_SYNC : c_int = 1052672;
3046 pub const PROT_GROWSDOWN : c_int = 0x010000000;
3047 pub const PROT_GROWSUP : c_int = 0x020000000;
3049 pub const MAP_TYPE : c_int = 0x000f;
3050 pub const MAP_ANONYMOUS : c_int = 0x0020;
3051 pub const MAP_32BIT : c_int = 0x0040;
3052 pub const MAP_GROWSDOWN : c_int = 0x0100;
3053 pub const MAP_DENYWRITE : c_int = 0x0800;
3054 pub const MAP_EXECUTABLE : c_int = 0x01000;
3055 pub const MAP_LOCKED : c_int = 0x02000;
3056 pub const MAP_NONRESERVE : c_int = 0x04000;
3057 pub const MAP_POPULATE : c_int = 0x08000;
3058 pub const MAP_NONBLOCK : c_int = 0x010000;
3059 pub const MAP_STACK : c_int = 0x020000;
3061 #[cfg(any(target_arch = "mips", target_arch = "mipsel"))]
3063 use types::os::arch::c95::c_int;
3065 pub const AF_PACKET : c_int = 17;
3066 pub const IPPROTO_RAW : c_int = 255;
3068 pub const O_RSYNC : c_int = 16400;
3069 pub const O_DSYNC : c_int = 16;
3070 pub const O_NONBLOCK : c_int = 128;
3071 pub const O_SYNC : c_int = 16400;
3073 pub const PROT_GROWSDOWN : c_int = 0x01000000;
3074 pub const PROT_GROWSUP : c_int = 0x02000000;
3076 pub const MAP_TYPE : c_int = 0x000f;
3077 pub const MAP_ANONYMOUS : c_int = 0x0800;
3078 pub const MAP_GROWSDOWN : c_int = 0x01000;
3079 pub const MAP_DENYWRITE : c_int = 0x02000;
3080 pub const MAP_EXECUTABLE : c_int = 0x04000;
3081 pub const MAP_LOCKED : c_int = 0x08000;
3082 pub const MAP_NONRESERVE : c_int = 0x0400;
3083 pub const MAP_POPULATE : c_int = 0x010000;
3084 pub const MAP_NONBLOCK : c_int = 0x020000;
3085 pub const MAP_STACK : c_int = 0x040000;
3087 #[cfg(target_os = "linux")]
3089 use types::os::arch::c95::c_int;
3091 pub const _SC_ARG_MAX : c_int = 0;
3092 pub const _SC_CHILD_MAX : c_int = 1;
3093 pub const _SC_CLK_TCK : c_int = 2;
3094 pub const _SC_NGROUPS_MAX : c_int = 3;
3095 pub const _SC_OPEN_MAX : c_int = 4;
3096 pub const _SC_STREAM_MAX : c_int = 5;
3097 pub const _SC_TZNAME_MAX : c_int = 6;
3098 pub const _SC_JOB_CONTROL : c_int = 7;
3099 pub const _SC_SAVED_IDS : c_int = 8;
3100 pub const _SC_REALTIME_SIGNALS : c_int = 9;
3101 pub const _SC_PRIORITY_SCHEDULING : c_int = 10;
3102 pub const _SC_TIMERS : c_int = 11;
3103 pub const _SC_ASYNCHRONOUS_IO : c_int = 12;
3104 pub const _SC_PRIORITIZED_IO : c_int = 13;
3105 pub const _SC_SYNCHRONIZED_IO : c_int = 14;
3106 pub const _SC_FSYNC : c_int = 15;
3107 pub const _SC_MAPPED_FILES : c_int = 16;
3108 pub const _SC_MEMLOCK : c_int = 17;
3109 pub const _SC_MEMLOCK_RANGE : c_int = 18;
3110 pub const _SC_MEMORY_PROTECTION : c_int = 19;
3111 pub const _SC_MESSAGE_PASSING : c_int = 20;
3112 pub const _SC_SEMAPHORES : c_int = 21;
3113 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 22;
3114 pub const _SC_AIO_LISTIO_MAX : c_int = 23;
3115 pub const _SC_AIO_MAX : c_int = 24;
3116 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 25;
3117 pub const _SC_DELAYTIMER_MAX : c_int = 26;
3118 pub const _SC_MQ_OPEN_MAX : c_int = 27;
3119 pub const _SC_VERSION : c_int = 29;
3120 pub const _SC_PAGESIZE : c_int = 30;
3121 pub const _SC_RTSIG_MAX : c_int = 31;
3122 pub const _SC_SEM_NSEMS_MAX : c_int = 32;
3123 pub const _SC_SEM_VALUE_MAX : c_int = 33;
3124 pub const _SC_SIGQUEUE_MAX : c_int = 34;
3125 pub const _SC_TIMER_MAX : c_int = 35;
3126 pub const _SC_BC_BASE_MAX : c_int = 36;
3127 pub const _SC_BC_DIM_MAX : c_int = 37;
3128 pub const _SC_BC_SCALE_MAX : c_int = 38;
3129 pub const _SC_BC_STRING_MAX : c_int = 39;
3130 pub const _SC_COLL_WEIGHTS_MAX : c_int = 40;
3131 pub const _SC_EXPR_NEST_MAX : c_int = 42;
3132 pub const _SC_LINE_MAX : c_int = 43;
3133 pub const _SC_RE_DUP_MAX : c_int = 44;
3134 pub const _SC_2_VERSION : c_int = 46;
3135 pub const _SC_2_C_BIND : c_int = 47;
3136 pub const _SC_2_C_DEV : c_int = 48;
3137 pub const _SC_2_FORT_DEV : c_int = 49;
3138 pub const _SC_2_FORT_RUN : c_int = 50;
3139 pub const _SC_2_SW_DEV : c_int = 51;
3140 pub const _SC_2_LOCALEDEF : c_int = 52;
3141 pub const _SC_2_CHAR_TERM : c_int = 95;
3142 pub const _SC_2_C_VERSION : c_int = 96;
3143 pub const _SC_2_UPE : c_int = 97;
3144 pub const _SC_XBS5_ILP32_OFF32 : c_int = 125;
3145 pub const _SC_XBS5_ILP32_OFFBIG : c_int = 126;
3146 pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 128;
3148 #[cfg(target_os = "android")]
3150 use types::os::arch::c95::c_int;
3152 pub const _SC_ARG_MAX : c_int = 0;
3153 pub const _SC_BC_BASE_MAX : c_int = 1;
3154 pub const _SC_BC_DIM_MAX : c_int = 2;
3155 pub const _SC_BC_SCALE_MAX : c_int = 3;
3156 pub const _SC_BC_STRING_MAX : c_int = 4;
3157 pub const _SC_CHILD_MAX : c_int = 5;
3158 pub const _SC_CLK_TCK : c_int = 6;
3159 pub const _SC_COLL_WEIGHTS_MAX : c_int = 7;
3160 pub const _SC_EXPR_NEST_MAX : c_int = 8;
3161 pub const _SC_LINE_MAX : c_int = 9;
3162 pub const _SC_NGROUPS_MAX : c_int = 10;
3163 pub const _SC_OPEN_MAX : c_int = 11;
3164 pub const _SC_2_C_BIND : c_int = 13;
3165 pub const _SC_2_C_DEV : c_int = 14;
3166 pub const _SC_2_C_VERSION : c_int = 15;
3167 pub const _SC_2_CHAR_TERM : c_int = 16;
3168 pub const _SC_2_FORT_DEV : c_int = 17;
3169 pub const _SC_2_FORT_RUN : c_int = 18;
3170 pub const _SC_2_LOCALEDEF : c_int = 19;
3171 pub const _SC_2_SW_DEV : c_int = 20;
3172 pub const _SC_2_UPE : c_int = 21;
3173 pub const _SC_2_VERSION : c_int = 22;
3174 pub const _SC_JOB_CONTROL : c_int = 23;
3175 pub const _SC_SAVED_IDS : c_int = 24;
3176 pub const _SC_VERSION : c_int = 25;
3177 pub const _SC_RE_DUP_MAX : c_int = 26;
3178 pub const _SC_STREAM_MAX : c_int = 27;
3179 pub const _SC_TZNAME_MAX : c_int = 28;
3180 pub const _SC_PAGESIZE : c_int = 39;
3184 #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
3187 use types::os::arch::c95::{c_int, c_uint};
3189 pub const EXIT_FAILURE : c_int = 1;
3190 pub const EXIT_SUCCESS : c_int = 0;
3191 pub const RAND_MAX : c_int = 2147483647;
3192 pub const EOF : c_int = -1;
3193 pub const SEEK_SET : c_int = 0;
3194 pub const SEEK_CUR : c_int = 1;
3195 pub const SEEK_END : c_int = 2;
3196 pub const _IOFBF : c_int = 0;
3197 pub const _IONBF : c_int = 2;
3198 pub const _IOLBF : c_int = 1;
3199 pub const BUFSIZ : c_uint = 1024_u32;
3200 pub const FOPEN_MAX : c_uint = 20_u32;
3201 pub const FILENAME_MAX : c_uint = 1024_u32;
3202 pub const L_tmpnam : c_uint = 1024_u32;
3203 pub const TMP_MAX : c_uint = 308915776_u32;
3208 use types::common::c95::c_void;
3209 use types::os::arch::c95::c_int;
3210 use types::os::arch::posix88::mode_t;
3212 pub const O_RDONLY : c_int = 0;
3213 pub const O_WRONLY : c_int = 1;
3214 pub const O_RDWR : c_int = 2;
3215 pub const O_APPEND : c_int = 8;
3216 pub const O_CREAT : c_int = 512;
3217 pub const O_EXCL : c_int = 2048;
3218 pub const O_TRUNC : c_int = 1024;
3219 pub const S_IFIFO : mode_t = 4096;
3220 pub const S_IFCHR : mode_t = 8192;
3221 pub const S_IFBLK : mode_t = 24576;
3222 pub const S_IFDIR : mode_t = 16384;
3223 pub const S_IFREG : mode_t = 32768;
3224 pub const S_IFLNK : mode_t = 40960;
3225 pub const S_IFMT : mode_t = 61440;
3226 pub const S_IEXEC : mode_t = 64;
3227 pub const S_IWRITE : mode_t = 128;
3228 pub const S_IREAD : mode_t = 256;
3229 pub const S_IRWXU : mode_t = 448;
3230 pub const S_IXUSR : mode_t = 64;
3231 pub const S_IWUSR : mode_t = 128;
3232 pub const S_IRUSR : mode_t = 256;
3233 pub const F_OK : c_int = 0;
3234 pub const R_OK : c_int = 4;
3235 pub const W_OK : c_int = 2;
3236 pub const X_OK : c_int = 1;
3237 pub const STDIN_FILENO : c_int = 0;
3238 pub const STDOUT_FILENO : c_int = 1;
3239 pub const STDERR_FILENO : c_int = 2;
3240 pub const F_LOCK : c_int = 1;
3241 pub const F_TEST : c_int = 3;
3242 pub const F_TLOCK : c_int = 2;
3243 pub const F_ULOCK : c_int = 0;
3244 pub const SIGHUP : c_int = 1;
3245 pub const SIGINT : c_int = 2;
3246 pub const SIGQUIT : c_int = 3;
3247 pub const SIGILL : c_int = 4;
3248 pub const SIGABRT : c_int = 6;
3249 pub const SIGFPE : c_int = 8;
3250 pub const SIGKILL : c_int = 9;
3251 pub const SIGSEGV : c_int = 11;
3252 pub const SIGPIPE : c_int = 13;
3253 pub const SIGALRM : c_int = 14;
3254 pub const SIGTERM : c_int = 15;
3256 pub const PROT_NONE : c_int = 0;
3257 pub const PROT_READ : c_int = 1;
3258 pub const PROT_WRITE : c_int = 2;
3259 pub const PROT_EXEC : c_int = 4;
3261 pub const MAP_FILE : c_int = 0x0000;
3262 pub const MAP_SHARED : c_int = 0x0001;
3263 pub const MAP_PRIVATE : c_int = 0x0002;
3264 pub const MAP_FIXED : c_int = 0x0010;
3265 pub const MAP_ANON : c_int = 0x1000;
3267 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
3269 pub const MCL_CURRENT : c_int = 0x0001;
3270 pub const MCL_FUTURE : c_int = 0x0002;
3272 pub const MS_SYNC : c_int = 0x0000;
3273 pub const MS_ASYNC : c_int = 0x0001;
3274 pub const MS_INVALIDATE : c_int = 0x0002;
3276 pub const EPERM : c_int = 1;
3277 pub const ENOENT : c_int = 2;
3278 pub const ESRCH : c_int = 3;
3279 pub const EINTR : c_int = 4;
3280 pub const EIO : c_int = 5;
3281 pub const ENXIO : c_int = 6;
3282 pub const E2BIG : c_int = 7;
3283 pub const ENOEXEC : c_int = 8;
3284 pub const EBADF : c_int = 9;
3285 pub const ECHILD : c_int = 10;
3286 pub const EDEADLK : c_int = 11;
3287 pub const ENOMEM : c_int = 12;
3288 pub const EACCES : c_int = 13;
3289 pub const EFAULT : c_int = 14;
3290 pub const ENOTBLK : c_int = 15;
3291 pub const EBUSY : c_int = 16;
3292 pub const EEXIST : c_int = 17;
3293 pub const EXDEV : c_int = 18;
3294 pub const ENODEV : c_int = 19;
3295 pub const ENOTDIR : c_int = 20;
3296 pub const EISDIR : c_int = 21;
3297 pub const EINVAL : c_int = 22;
3298 pub const ENFILE : c_int = 23;
3299 pub const EMFILE : c_int = 24;
3300 pub const ENOTTY : c_int = 25;
3301 pub const ETXTBSY : c_int = 26;
3302 pub const EFBIG : c_int = 27;
3303 pub const ENOSPC : c_int = 28;
3304 pub const ESPIPE : c_int = 29;
3305 pub const EROFS : c_int = 30;
3306 pub const EMLINK : c_int = 31;
3307 pub const EPIPE : c_int = 32;
3308 pub const EDOM : c_int = 33;
3309 pub const ERANGE : c_int = 34;
3310 pub const EAGAIN : c_int = 35;
3311 pub const EWOULDBLOCK : c_int = 35;
3312 pub const EINPROGRESS : c_int = 36;
3313 pub const EALREADY : c_int = 37;
3314 pub const ENOTSOCK : c_int = 38;
3315 pub const EDESTADDRREQ : c_int = 39;
3316 pub const EMSGSIZE : c_int = 40;
3317 pub const EPROTOTYPE : c_int = 41;
3318 pub const ENOPROTOOPT : c_int = 42;
3319 pub const EPROTONOSUPPORT : c_int = 43;
3320 pub const ESOCKTNOSUPPORT : c_int = 44;
3321 pub const EOPNOTSUPP : c_int = 45;
3322 pub const EPFNOSUPPORT : c_int = 46;
3323 pub const EAFNOSUPPORT : c_int = 47;
3324 pub const EADDRINUSE : c_int = 48;
3325 pub const EADDRNOTAVAIL : c_int = 49;
3326 pub const ENETDOWN : c_int = 50;
3327 pub const ENETUNREACH : c_int = 51;
3328 pub const ENETRESET : c_int = 52;
3329 pub const ECONNABORTED : c_int = 53;
3330 pub const ECONNRESET : c_int = 54;
3331 pub const ENOBUFS : c_int = 55;
3332 pub const EISCONN : c_int = 56;
3333 pub const ENOTCONN : c_int = 57;
3334 pub const ESHUTDOWN : c_int = 58;
3335 pub const ETOOMANYREFS : c_int = 59;
3336 pub const ETIMEDOUT : c_int = 60;
3337 pub const ECONNREFUSED : c_int = 61;
3338 pub const ELOOP : c_int = 62;
3339 pub const ENAMETOOLONG : c_int = 63;
3340 pub const EHOSTDOWN : c_int = 64;
3341 pub const EHOSTUNREACH : c_int = 65;
3342 pub const ENOTEMPTY : c_int = 66;
3343 pub const EPROCLIM : c_int = 67;
3344 pub const EUSERS : c_int = 68;
3345 pub const EDQUOT : c_int = 69;
3346 pub const ESTALE : c_int = 70;
3347 pub const EREMOTE : c_int = 71;
3348 pub const EBADRPC : c_int = 72;
3349 pub const ERPCMISMATCH : c_int = 73;
3350 pub const EPROGUNAVAIL : c_int = 74;
3351 pub const EPROGMISMATCH : c_int = 75;
3352 pub const EPROCUNAVAIL : c_int = 76;
3353 pub const ENOLCK : c_int = 77;
3354 pub const ENOSYS : c_int = 78;
3355 pub const EFTYPE : c_int = 79;
3356 pub const EAUTH : c_int = 80;
3357 pub const ENEEDAUTH : c_int = 81;
3358 pub const EIDRM : c_int = 82;
3359 pub const ENOMSG : c_int = 83;
3360 pub const EOVERFLOW : c_int = 84;
3361 pub const ECANCELED : c_int = 85;
3362 pub const EILSEQ : c_int = 86;
3363 pub const ENOATTR : c_int = 87;
3364 pub const EDOOFUS : c_int = 88;
3365 pub const EBADMSG : c_int = 89;
3366 pub const EMULTIHOP : c_int = 90;
3367 pub const ENOLINK : c_int = 91;
3368 pub const EPROTO : c_int = 92;
3369 pub const ENOMEDIUM : c_int = 93;
3370 pub const EUNUSED94 : c_int = 94;
3371 pub const EUNUSED95 : c_int = 95;
3372 pub const EUNUSED96 : c_int = 96;
3373 pub const EUNUSED97 : c_int = 97;
3374 pub const EUNUSED98 : c_int = 98;
3375 pub const EASYNC : c_int = 99;
3376 pub const ELAST : c_int = 99;
3379 use types::os::arch::c95::{c_int, size_t};
3381 pub const F_DUPFD : c_int = 0;
3382 pub const F_GETFD : c_int = 1;
3383 pub const F_SETFD : c_int = 2;
3384 pub const F_GETFL : c_int = 3;
3385 pub const F_SETFL : c_int = 4;
3387 pub const SIGTRAP : c_int = 5;
3388 pub const SIGPIPE: c_int = 13;
3389 pub const SIG_IGN: size_t = 1;
3391 pub const GLOB_APPEND : c_int = 0x0001;
3392 pub const GLOB_DOOFFS : c_int = 0x0002;
3393 pub const GLOB_ERR : c_int = 0x0004;
3394 pub const GLOB_MARK : c_int = 0x0008;
3395 pub const GLOB_NOCHECK : c_int = 0x0010;
3396 pub const GLOB_NOSORT : c_int = 0x0020;
3397 pub const GLOB_NOESCAPE : c_int = 0x2000;
3399 pub const GLOB_NOSPACE : c_int = -1;
3400 pub const GLOB_ABORTED : c_int = -2;
3401 pub const GLOB_NOMATCH : c_int = -3;
3403 pub const POSIX_MADV_NORMAL : c_int = 0;
3404 pub const POSIX_MADV_RANDOM : c_int = 1;
3405 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3406 pub const POSIX_MADV_WILLNEED : c_int = 3;
3407 pub const POSIX_MADV_DONTNEED : c_int = 4;
3409 pub const _SC_IOV_MAX : c_int = 56;
3410 pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
3411 pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
3412 pub const _SC_LOGIN_NAME_MAX : c_int = 73;
3413 pub const _SC_MQ_PRIO_MAX : c_int = 75;
3414 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
3415 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
3416 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
3417 pub const _SC_THREAD_KEYS_MAX : c_int = 86;
3418 pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
3419 pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
3420 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
3421 pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
3422 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
3423 pub const _SC_THREAD_STACK_MIN : c_int = 93;
3424 pub const _SC_THREAD_THREADS_MAX : c_int = 94;
3425 pub const _SC_THREADS : c_int = 96;
3426 pub const _SC_TTY_NAME_MAX : c_int = 101;
3427 pub const _SC_ATEXIT_MAX : c_int = 107;
3428 pub const _SC_XOPEN_CRYPT : c_int = 108;
3429 pub const _SC_XOPEN_ENH_I18N : c_int = 109;
3430 pub const _SC_XOPEN_LEGACY : c_int = 110;
3431 pub const _SC_XOPEN_REALTIME : c_int = 111;
3432 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
3433 pub const _SC_XOPEN_SHM : c_int = 113;
3434 pub const _SC_XOPEN_UNIX : c_int = 115;
3435 pub const _SC_XOPEN_VERSION : c_int = 116;
3436 pub const _SC_XOPEN_XCU_VERSION : c_int = 117;
3438 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
3439 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
3441 #[cfg(target_arch = "arm")]
3442 pub const PTHREAD_STACK_MIN: size_t = 4096;
3444 #[cfg(all(target_os = "freebsd",
3445 any(target_arch = "mips",
3446 target_arch = "mipsel",
3447 target_arch = "x86",
3448 target_arch = "x86_64")))]
3449 pub const PTHREAD_STACK_MIN: size_t = 2048;
3451 #[cfg(target_os = "dragonfly")]
3452 pub const PTHREAD_STACK_MIN: size_t = 1024;
3454 pub const CLOCK_REALTIME: c_int = 0;
3455 pub const CLOCK_MONOTONIC: c_int = 4;
3460 use types::os::arch::c95::c_int;
3462 pub const MADV_NORMAL : c_int = 0;
3463 pub const MADV_RANDOM : c_int = 1;
3464 pub const MADV_SEQUENTIAL : c_int = 2;
3465 pub const MADV_WILLNEED : c_int = 3;
3466 pub const MADV_DONTNEED : c_int = 4;
3467 pub const MADV_FREE : c_int = 5;
3468 pub const MADV_NOSYNC : c_int = 6;
3469 pub const MADV_AUTOSYNC : c_int = 7;
3470 pub const MADV_NOCORE : c_int = 8;
3471 pub const MADV_CORE : c_int = 9;
3472 pub const MADV_PROTECT : c_int = 10;
3474 pub const MINCORE_INCORE : c_int = 0x1;
3475 pub const MINCORE_REFERENCED : c_int = 0x2;
3476 pub const MINCORE_MODIFIED : c_int = 0x4;
3477 pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
3478 pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
3479 pub const MINCORE_SUPER : c_int = 0x20;
3481 pub const AF_INET: c_int = 2;
3482 pub const AF_INET6: c_int = 28;
3483 pub const AF_UNIX: c_int = 1;
3484 pub const SOCK_STREAM: c_int = 1;
3485 pub const SOCK_DGRAM: c_int = 2;
3486 pub const SOCK_RAW: c_int = 3;
3487 pub const IPPROTO_TCP: c_int = 6;
3488 pub const IPPROTO_IP: c_int = 0;
3489 pub const IPPROTO_IPV6: c_int = 41;
3490 pub const IP_MULTICAST_TTL: c_int = 10;
3491 pub const IP_MULTICAST_LOOP: c_int = 11;
3492 pub const IP_TTL: c_int = 4;
3493 pub const IP_HDRINCL: c_int = 2;
3494 pub const IP_ADD_MEMBERSHIP: c_int = 12;
3495 pub const IP_DROP_MEMBERSHIP: c_int = 13;
3496 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
3497 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
3499 pub const TCP_NODELAY: c_int = 1;
3500 pub const TCP_KEEPIDLE: c_int = 256;
3501 pub const SOL_SOCKET: c_int = 0xffff;
3502 pub const SO_KEEPALIVE: c_int = 0x0008;
3503 pub const SO_BROADCAST: c_int = 0x0020;
3504 pub const SO_REUSEADDR: c_int = 0x0004;
3505 pub const SO_ERROR: c_int = 0x1007;
3507 pub const IFF_LOOPBACK: c_int = 0x8;
3509 pub const SHUT_RD: c_int = 0;
3510 pub const SHUT_WR: c_int = 1;
3511 pub const SHUT_RDWR: c_int = 2;
3514 use types::os::arch::c95::c_int;
3516 pub const O_SYNC : c_int = 128;
3517 pub const O_NONBLOCK : c_int = 4;
3518 pub const CTL_KERN: c_int = 1;
3519 pub const KERN_PROC: c_int = 14;
3520 #[cfg(target_os = "freebsd")]
3521 pub const KERN_PROC_PATHNAME: c_int = 12;
3522 #[cfg(target_os = "dragonfly")]
3523 pub const KERN_PROC_PATHNAME: c_int = 9;
3525 pub const MAP_COPY : c_int = 0x0002;
3526 pub const MAP_RENAME : c_int = 0x0020;
3527 pub const MAP_NORESERVE : c_int = 0x0040;
3528 pub const MAP_HASSEMAPHORE : c_int = 0x0200;
3529 pub const MAP_STACK : c_int = 0x0400;
3530 pub const MAP_NOSYNC : c_int = 0x0800;
3531 pub const MAP_NOCORE : c_int = 0x020000;
3533 pub const IPPROTO_RAW : c_int = 255;
3536 use types::os::arch::c95::c_int;
3538 pub const _SC_ARG_MAX : c_int = 1;
3539 pub const _SC_CHILD_MAX : c_int = 2;
3540 pub const _SC_CLK_TCK : c_int = 3;
3541 pub const _SC_NGROUPS_MAX : c_int = 4;
3542 pub const _SC_OPEN_MAX : c_int = 5;
3543 pub const _SC_JOB_CONTROL : c_int = 6;
3544 pub const _SC_SAVED_IDS : c_int = 7;
3545 pub const _SC_VERSION : c_int = 8;
3546 pub const _SC_BC_BASE_MAX : c_int = 9;
3547 pub const _SC_BC_DIM_MAX : c_int = 10;
3548 pub const _SC_BC_SCALE_MAX : c_int = 11;
3549 pub const _SC_BC_STRING_MAX : c_int = 12;
3550 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
3551 pub const _SC_EXPR_NEST_MAX : c_int = 14;
3552 pub const _SC_LINE_MAX : c_int = 15;
3553 pub const _SC_RE_DUP_MAX : c_int = 16;
3554 pub const _SC_2_VERSION : c_int = 17;
3555 pub const _SC_2_C_BIND : c_int = 18;
3556 pub const _SC_2_C_DEV : c_int = 19;
3557 pub const _SC_2_CHAR_TERM : c_int = 20;
3558 pub const _SC_2_FORT_DEV : c_int = 21;
3559 pub const _SC_2_FORT_RUN : c_int = 22;
3560 pub const _SC_2_LOCALEDEF : c_int = 23;
3561 pub const _SC_2_SW_DEV : c_int = 24;
3562 pub const _SC_2_UPE : c_int = 25;
3563 pub const _SC_STREAM_MAX : c_int = 26;
3564 pub const _SC_TZNAME_MAX : c_int = 27;
3565 pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
3566 pub const _SC_MAPPED_FILES : c_int = 29;
3567 pub const _SC_MEMLOCK : c_int = 30;
3568 pub const _SC_MEMLOCK_RANGE : c_int = 31;
3569 pub const _SC_MEMORY_PROTECTION : c_int = 32;
3570 pub const _SC_MESSAGE_PASSING : c_int = 33;
3571 pub const _SC_PRIORITIZED_IO : c_int = 34;
3572 pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
3573 pub const _SC_REALTIME_SIGNALS : c_int = 36;
3574 pub const _SC_SEMAPHORES : c_int = 37;
3575 pub const _SC_FSYNC : c_int = 38;
3576 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
3577 pub const _SC_SYNCHRONIZED_IO : c_int = 40;
3578 pub const _SC_TIMERS : c_int = 41;
3579 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
3580 pub const _SC_AIO_MAX : c_int = 43;
3581 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
3582 pub const _SC_DELAYTIMER_MAX : c_int = 45;
3583 pub const _SC_MQ_OPEN_MAX : c_int = 46;
3584 pub const _SC_PAGESIZE : c_int = 47;
3585 pub const _SC_RTSIG_MAX : c_int = 48;
3586 pub const _SC_SEM_NSEMS_MAX : c_int = 49;
3587 pub const _SC_SEM_VALUE_MAX : c_int = 50;
3588 pub const _SC_SIGQUEUE_MAX : c_int = 51;
3589 pub const _SC_TIMER_MAX : c_int = 52;
3593 #[cfg(any(target_os = "macos", target_os = "ios"))]
3596 use types::os::arch::c95::{c_int, c_uint};
3598 pub const EXIT_FAILURE : c_int = 1;
3599 pub const EXIT_SUCCESS : c_int = 0;
3600 pub const RAND_MAX : c_int = 2147483647;
3601 pub const EOF : c_int = -1;
3602 pub const SEEK_SET : c_int = 0;
3603 pub const SEEK_CUR : c_int = 1;
3604 pub const SEEK_END : c_int = 2;
3605 pub const _IOFBF : c_int = 0;
3606 pub const _IONBF : c_int = 2;
3607 pub const _IOLBF : c_int = 1;
3608 pub const BUFSIZ : c_uint = 1024_u32;
3609 pub const FOPEN_MAX : c_uint = 20_u32;
3610 pub const FILENAME_MAX : c_uint = 1024_u32;
3611 pub const L_tmpnam : c_uint = 1024_u32;
3612 pub const TMP_MAX : c_uint = 308915776_u32;
3617 use types::common::c95::c_void;
3618 use types::os::arch::c95::c_int;
3619 use types::os::arch::posix88::mode_t;
3621 pub const O_RDONLY : c_int = 0;
3622 pub const O_WRONLY : c_int = 1;
3623 pub const O_RDWR : c_int = 2;
3624 pub const O_APPEND : c_int = 8;
3625 pub const O_CREAT : c_int = 512;
3626 pub const O_EXCL : c_int = 2048;
3627 pub const O_TRUNC : c_int = 1024;
3628 pub const S_IFIFO : mode_t = 4096;
3629 pub const S_IFCHR : mode_t = 8192;
3630 pub const S_IFBLK : mode_t = 24576;
3631 pub const S_IFDIR : mode_t = 16384;
3632 pub const S_IFREG : mode_t = 32768;
3633 pub const S_IFLNK : mode_t = 40960;
3634 pub const S_IFMT : mode_t = 61440;
3635 pub const S_IEXEC : mode_t = 64;
3636 pub const S_IWRITE : mode_t = 128;
3637 pub const S_IREAD : mode_t = 256;
3638 pub const S_IRWXU : mode_t = 448;
3639 pub const S_IXUSR : mode_t = 64;
3640 pub const S_IWUSR : mode_t = 128;
3641 pub const S_IRUSR : mode_t = 256;
3642 pub const F_OK : c_int = 0;
3643 pub const R_OK : c_int = 4;
3644 pub const W_OK : c_int = 2;
3645 pub const X_OK : c_int = 1;
3646 pub const STDIN_FILENO : c_int = 0;
3647 pub const STDOUT_FILENO : c_int = 1;
3648 pub const STDERR_FILENO : c_int = 2;
3649 pub const F_LOCK : c_int = 1;
3650 pub const F_TEST : c_int = 3;
3651 pub const F_TLOCK : c_int = 2;
3652 pub const F_ULOCK : c_int = 0;
3653 pub const SIGHUP : c_int = 1;
3654 pub const SIGINT : c_int = 2;
3655 pub const SIGQUIT : c_int = 3;
3656 pub const SIGILL : c_int = 4;
3657 pub const SIGABRT : c_int = 6;
3658 pub const SIGFPE : c_int = 8;
3659 pub const SIGKILL : c_int = 9;
3660 pub const SIGSEGV : c_int = 11;
3661 pub const SIGPIPE : c_int = 13;
3662 pub const SIGALRM : c_int = 14;
3663 pub const SIGTERM : c_int = 15;
3665 pub const PROT_NONE : c_int = 0;
3666 pub const PROT_READ : c_int = 1;
3667 pub const PROT_WRITE : c_int = 2;
3668 pub const PROT_EXEC : c_int = 4;
3670 pub const MAP_FILE : c_int = 0x0000;
3671 pub const MAP_SHARED : c_int = 0x0001;
3672 pub const MAP_PRIVATE : c_int = 0x0002;
3673 pub const MAP_FIXED : c_int = 0x0010;
3674 pub const MAP_ANON : c_int = 0x1000;
3676 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
3678 pub const MCL_CURRENT : c_int = 0x0001;
3679 pub const MCL_FUTURE : c_int = 0x0002;
3681 pub const MS_ASYNC : c_int = 0x0001;
3682 pub const MS_INVALIDATE : c_int = 0x0002;
3683 pub const MS_SYNC : c_int = 0x0010;
3685 pub const MS_KILLPAGES : c_int = 0x0004;
3686 pub const MS_DEACTIVATE : c_int = 0x0008;
3688 pub const EPERM : c_int = 1;
3689 pub const ENOENT : c_int = 2;
3690 pub const ESRCH : c_int = 3;
3691 pub const EINTR : c_int = 4;
3692 pub const EIO : c_int = 5;
3693 pub const ENXIO : c_int = 6;
3694 pub const E2BIG : c_int = 7;
3695 pub const ENOEXEC : c_int = 8;
3696 pub const EBADF : c_int = 9;
3697 pub const ECHILD : c_int = 10;
3698 pub const EDEADLK : c_int = 11;
3699 pub const ENOMEM : c_int = 12;
3700 pub const EACCES : c_int = 13;
3701 pub const EFAULT : c_int = 14;
3702 pub const ENOTBLK : c_int = 15;
3703 pub const EBUSY : c_int = 16;
3704 pub const EEXIST : c_int = 17;
3705 pub const EXDEV : c_int = 18;
3706 pub const ENODEV : c_int = 19;
3707 pub const ENOTDIR : c_int = 20;
3708 pub const EISDIR : c_int = 21;
3709 pub const EINVAL : c_int = 22;
3710 pub const ENFILE : c_int = 23;
3711 pub const EMFILE : c_int = 24;
3712 pub const ENOTTY : c_int = 25;
3713 pub const ETXTBSY : c_int = 26;
3714 pub const EFBIG : c_int = 27;
3715 pub const ENOSPC : c_int = 28;
3716 pub const ESPIPE : c_int = 29;
3717 pub const EROFS : c_int = 30;
3718 pub const EMLINK : c_int = 31;
3719 pub const EPIPE : c_int = 32;
3720 pub const EDOM : c_int = 33;
3721 pub const ERANGE : c_int = 34;
3722 pub const EAGAIN : c_int = 35;
3723 pub const EWOULDBLOCK : c_int = EAGAIN;
3724 pub const EINPROGRESS : c_int = 36;
3725 pub const EALREADY : c_int = 37;
3726 pub const ENOTSOCK : c_int = 38;
3727 pub const EDESTADDRREQ : c_int = 39;
3728 pub const EMSGSIZE : c_int = 40;
3729 pub const EPROTOTYPE : c_int = 41;
3730 pub const ENOPROTOOPT : c_int = 42;
3731 pub const EPROTONOSUPPORT : c_int = 43;
3732 pub const ESOCKTNOSUPPORT : c_int = 44;
3733 pub const ENOTSUP : c_int = 45;
3734 pub const EPFNOSUPPORT : c_int = 46;
3735 pub const EAFNOSUPPORT : c_int = 47;
3736 pub const EADDRINUSE : c_int = 48;
3737 pub const EADDRNOTAVAIL : c_int = 49;
3738 pub const ENETDOWN : c_int = 50;
3739 pub const ENETUNREACH : c_int = 51;
3740 pub const ENETRESET : c_int = 52;
3741 pub const ECONNABORTED : c_int = 53;
3742 pub const ECONNRESET : c_int = 54;
3743 pub const ENOBUFS : c_int = 55;
3744 pub const EISCONN : c_int = 56;
3745 pub const ENOTCONN : c_int = 57;
3746 pub const ESHUTDOWN : c_int = 58;
3747 pub const ETOOMANYREFS : c_int = 59;
3748 pub const ETIMEDOUT : c_int = 60;
3749 pub const ECONNREFUSED : c_int = 61;
3750 pub const ELOOP : c_int = 62;
3751 pub const ENAMETOOLONG : c_int = 63;
3752 pub const EHOSTDOWN : c_int = 64;
3753 pub const EHOSTUNREACH : c_int = 65;
3754 pub const ENOTEMPTY : c_int = 66;
3755 pub const EPROCLIM : c_int = 67;
3756 pub const EUSERS : c_int = 68;
3757 pub const EDQUOT : c_int = 69;
3758 pub const ESTALE : c_int = 70;
3759 pub const EREMOTE : c_int = 71;
3760 pub const EBADRPC : c_int = 72;
3761 pub const ERPCMISMATCH : c_int = 73;
3762 pub const EPROGUNAVAIL : c_int = 74;
3763 pub const EPROGMISMATCH : c_int = 75;
3764 pub const EPROCUNAVAIL : c_int = 76;
3765 pub const ENOLCK : c_int = 77;
3766 pub const ENOSYS : c_int = 78;
3767 pub const EFTYPE : c_int = 79;
3768 pub const EAUTH : c_int = 80;
3769 pub const ENEEDAUTH : c_int = 81;
3770 pub const EPWROFF : c_int = 82;
3771 pub const EDEVERR : c_int = 83;
3772 pub const EOVERFLOW : c_int = 84;
3773 pub const EBADEXEC : c_int = 85;
3774 pub const EBADARCH : c_int = 86;
3775 pub const ESHLIBVERS : c_int = 87;
3776 pub const EBADMACHO : c_int = 88;
3777 pub const ECANCELED : c_int = 89;
3778 pub const EIDRM : c_int = 90;
3779 pub const ENOMSG : c_int = 91;
3780 pub const EILSEQ : c_int = 92;
3781 pub const ENOATTR : c_int = 93;
3782 pub const EBADMSG : c_int = 94;
3783 pub const EMULTIHOP : c_int = 95;
3784 pub const ENODATA : c_int = 96;
3785 pub const ENOLINK : c_int = 97;
3786 pub const ENOSR : c_int = 98;
3787 pub const ENOSTR : c_int = 99;
3788 pub const EPROTO : c_int = 100;
3789 pub const ETIME : c_int = 101;
3790 pub const EOPNOTSUPP : c_int = 102;
3791 pub const ENOPOLICY : c_int = 103;
3792 pub const ENOTRECOVERABLE : c_int = 104;
3793 pub const EOWNERDEAD : c_int = 105;
3794 pub const EQFULL : c_int = 106;
3795 pub const ELAST : c_int = 106;
3798 use types::os::arch::c95::{c_int, size_t};
3800 pub const F_DUPFD : c_int = 0;
3801 pub const F_GETFD : c_int = 1;
3802 pub const F_SETFD : c_int = 2;
3803 pub const F_GETFL : c_int = 3;
3804 pub const F_SETFL : c_int = 4;
3806 pub const SIGTRAP : c_int = 5;
3807 pub const SIGPIPE: c_int = 13;
3808 pub const SIG_IGN: size_t = 1;
3810 pub const GLOB_APPEND : c_int = 0x0001;
3811 pub const GLOB_DOOFFS : c_int = 0x0002;
3812 pub const GLOB_ERR : c_int = 0x0004;
3813 pub const GLOB_MARK : c_int = 0x0008;
3814 pub const GLOB_NOCHECK : c_int = 0x0010;
3815 pub const GLOB_NOSORT : c_int = 0x0020;
3816 pub const GLOB_NOESCAPE : c_int = 0x2000;
3818 pub const GLOB_NOSPACE : c_int = -1;
3819 pub const GLOB_ABORTED : c_int = -2;
3820 pub const GLOB_NOMATCH : c_int = -3;
3822 pub const POSIX_MADV_NORMAL : c_int = 0;
3823 pub const POSIX_MADV_RANDOM : c_int = 1;
3824 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3825 pub const POSIX_MADV_WILLNEED : c_int = 3;
3826 pub const POSIX_MADV_DONTNEED : c_int = 4;
3828 pub const _SC_IOV_MAX : c_int = 56;
3829 pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
3830 pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
3831 pub const _SC_LOGIN_NAME_MAX : c_int = 73;
3832 pub const _SC_MQ_PRIO_MAX : c_int = 75;
3833 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
3834 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
3835 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
3836 pub const _SC_THREAD_KEYS_MAX : c_int = 86;
3837 pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
3838 pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
3839 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
3840 pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
3841 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
3842 pub const _SC_THREAD_STACK_MIN : c_int = 93;
3843 pub const _SC_THREAD_THREADS_MAX : c_int = 94;
3844 pub const _SC_THREADS : c_int = 96;
3845 pub const _SC_TTY_NAME_MAX : c_int = 101;
3846 pub const _SC_ATEXIT_MAX : c_int = 107;
3847 pub const _SC_XOPEN_CRYPT : c_int = 108;
3848 pub const _SC_XOPEN_ENH_I18N : c_int = 109;
3849 pub const _SC_XOPEN_LEGACY : c_int = 110;
3850 pub const _SC_XOPEN_REALTIME : c_int = 111;
3851 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
3852 pub const _SC_XOPEN_SHM : c_int = 113;
3853 pub const _SC_XOPEN_UNIX : c_int = 115;
3854 pub const _SC_XOPEN_VERSION : c_int = 116;
3855 pub const _SC_XOPEN_XCU_VERSION : c_int = 121;
3857 pub const PTHREAD_CREATE_JOINABLE: c_int = 1;
3858 pub const PTHREAD_CREATE_DETACHED: c_int = 2;
3859 pub const PTHREAD_STACK_MIN: size_t = 8192;
3864 use types::os::arch::c95::c_int;
3866 pub const MADV_NORMAL : c_int = 0;
3867 pub const MADV_RANDOM : c_int = 1;
3868 pub const MADV_SEQUENTIAL : c_int = 2;
3869 pub const MADV_WILLNEED : c_int = 3;
3870 pub const MADV_DONTNEED : c_int = 4;
3871 pub const MADV_FREE : c_int = 5;
3872 pub const MADV_ZERO_WIRED_PAGES : c_int = 6;
3873 pub const MADV_FREE_REUSABLE : c_int = 7;
3874 pub const MADV_FREE_REUSE : c_int = 8;
3875 pub const MADV_CAN_REUSE : c_int = 9;
3877 pub const MINCORE_INCORE : c_int = 0x1;
3878 pub const MINCORE_REFERENCED : c_int = 0x2;
3879 pub const MINCORE_MODIFIED : c_int = 0x4;
3880 pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
3881 pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
3883 pub const AF_UNIX: c_int = 1;
3884 pub const AF_INET: c_int = 2;
3885 pub const AF_INET6: c_int = 30;
3886 pub const SOCK_STREAM: c_int = 1;
3887 pub const SOCK_DGRAM: c_int = 2;
3888 pub const SOCK_RAW: c_int = 3;
3889 pub const IPPROTO_TCP: c_int = 6;
3890 pub const IPPROTO_IP: c_int = 0;
3891 pub const IPPROTO_IPV6: c_int = 41;
3892 pub const IP_MULTICAST_TTL: c_int = 10;
3893 pub const IP_MULTICAST_LOOP: c_int = 11;
3894 pub const IP_TTL: c_int = 4;
3895 pub const IP_HDRINCL: c_int = 2;
3896 pub const IP_ADD_MEMBERSHIP: c_int = 12;
3897 pub const IP_DROP_MEMBERSHIP: c_int = 13;
3898 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
3899 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
3901 pub const TCP_NODELAY: c_int = 0x01;
3902 pub const TCP_KEEPALIVE: c_int = 0x10;
3903 pub const SOL_SOCKET: c_int = 0xffff;
3904 pub const SO_KEEPALIVE: c_int = 0x0008;
3905 pub const SO_BROADCAST: c_int = 0x0020;
3906 pub const SO_REUSEADDR: c_int = 0x0004;
3907 pub const SO_ERROR: c_int = 0x1007;
3909 pub const IFF_LOOPBACK: c_int = 0x8;
3911 pub const SHUT_RD: c_int = 0;
3912 pub const SHUT_WR: c_int = 1;
3913 pub const SHUT_RDWR: c_int = 2;
3916 use types::os::arch::c95::c_int;
3918 pub const O_DSYNC : c_int = 4194304;
3919 pub const O_SYNC : c_int = 128;
3920 pub const O_NONBLOCK : c_int = 4;
3921 pub const F_FULLFSYNC : c_int = 51;
3923 pub const MAP_COPY : c_int = 0x0002;
3924 pub const MAP_RENAME : c_int = 0x0020;
3925 pub const MAP_NORESERVE : c_int = 0x0040;
3926 pub const MAP_NOEXTEND : c_int = 0x0100;
3927 pub const MAP_HASSEMAPHORE : c_int = 0x0200;
3928 pub const MAP_NOCACHE : c_int = 0x0400;
3929 pub const MAP_JIT : c_int = 0x0800;
3930 pub const MAP_STACK : c_int = 0;
3932 pub const IPPROTO_RAW : c_int = 255;
3935 use types::os::arch::c95::c_int;
3937 pub const _SC_ARG_MAX : c_int = 1;
3938 pub const _SC_CHILD_MAX : c_int = 2;
3939 pub const _SC_CLK_TCK : c_int = 3;
3940 pub const _SC_NGROUPS_MAX : c_int = 4;
3941 pub const _SC_OPEN_MAX : c_int = 5;
3942 pub const _SC_JOB_CONTROL : c_int = 6;
3943 pub const _SC_SAVED_IDS : c_int = 7;
3944 pub const _SC_VERSION : c_int = 8;
3945 pub const _SC_BC_BASE_MAX : c_int = 9;
3946 pub const _SC_BC_DIM_MAX : c_int = 10;
3947 pub const _SC_BC_SCALE_MAX : c_int = 11;
3948 pub const _SC_BC_STRING_MAX : c_int = 12;
3949 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
3950 pub const _SC_EXPR_NEST_MAX : c_int = 14;
3951 pub const _SC_LINE_MAX : c_int = 15;
3952 pub const _SC_RE_DUP_MAX : c_int = 16;
3953 pub const _SC_2_VERSION : c_int = 17;
3954 pub const _SC_2_C_BIND : c_int = 18;
3955 pub const _SC_2_C_DEV : c_int = 19;
3956 pub const _SC_2_CHAR_TERM : c_int = 20;
3957 pub const _SC_2_FORT_DEV : c_int = 21;
3958 pub const _SC_2_FORT_RUN : c_int = 22;
3959 pub const _SC_2_LOCALEDEF : c_int = 23;
3960 pub const _SC_2_SW_DEV : c_int = 24;
3961 pub const _SC_2_UPE : c_int = 25;
3962 pub const _SC_STREAM_MAX : c_int = 26;
3963 pub const _SC_TZNAME_MAX : c_int = 27;
3964 pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
3965 pub const _SC_PAGESIZE : c_int = 29;
3966 pub const _SC_MEMLOCK : c_int = 30;
3967 pub const _SC_MEMLOCK_RANGE : c_int = 31;
3968 pub const _SC_MEMORY_PROTECTION : c_int = 32;
3969 pub const _SC_MESSAGE_PASSING : c_int = 33;
3970 pub const _SC_PRIORITIZED_IO : c_int = 34;
3971 pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
3972 pub const _SC_REALTIME_SIGNALS : c_int = 36;
3973 pub const _SC_SEMAPHORES : c_int = 37;
3974 pub const _SC_FSYNC : c_int = 38;
3975 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
3976 pub const _SC_SYNCHRONIZED_IO : c_int = 40;
3977 pub const _SC_TIMERS : c_int = 41;
3978 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
3979 pub const _SC_AIO_MAX : c_int = 43;
3980 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
3981 pub const _SC_DELAYTIMER_MAX : c_int = 45;
3982 pub const _SC_MQ_OPEN_MAX : c_int = 46;
3983 pub const _SC_MAPPED_FILES : c_int = 47;
3984 pub const _SC_RTSIG_MAX : c_int = 48;
3985 pub const _SC_SEM_NSEMS_MAX : c_int = 49;
3986 pub const _SC_SEM_VALUE_MAX : c_int = 50;
3987 pub const _SC_SIGQUEUE_MAX : c_int = 51;
3988 pub const _SC_TIMER_MAX : c_int = 52;
3989 pub const _SC_XBS5_ILP32_OFF32 : c_int = 122;
3990 pub const _SC_XBS5_ILP32_OFFBIG : c_int = 123;
3991 pub const _SC_XBS5_LP64_OFF64 : c_int = 124;
3992 pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 125;
3999 // Thankfully most of c95 is universally available and does not vary by OS
4000 // or anything. The same is not true of POSIX.
4004 use types::os::arch::c95::{c_char, c_int};
4007 pub fn isalnum(c: c_int) -> c_int;
4008 pub fn isalpha(c: c_int) -> c_int;
4009 pub fn iscntrl(c: c_int) -> c_int;
4010 pub fn isdigit(c: c_int) -> c_int;
4011 pub fn isgraph(c: c_int) -> c_int;
4012 pub fn islower(c: c_int) -> c_int;
4013 pub fn isprint(c: c_int) -> c_int;
4014 pub fn ispunct(c: c_int) -> c_int;
4015 pub fn isspace(c: c_int) -> c_int;
4016 pub fn isupper(c: c_int) -> c_int;
4017 pub fn isxdigit(c: c_int) -> c_int;
4018 pub fn tolower(c: c_char) -> c_char;
4019 pub fn toupper(c: c_char) -> c_char;
4024 use types::common::c95::{FILE, c_void, fpos_t};
4025 use types::os::arch::c95::{c_char, c_int, c_long, size_t};
4028 pub fn fopen(filename: *const c_char,
4029 mode: *const c_char) -> *mut FILE;
4030 pub fn freopen(filename: *const c_char, mode: *const c_char,
4033 pub fn fflush(file: *mut FILE) -> c_int;
4034 pub fn fclose(file: *mut FILE) -> c_int;
4035 pub fn remove(filename: *const c_char) -> c_int;
4036 pub fn rename(oldname: *const c_char,
4037 newname: *const c_char) -> c_int;
4038 pub fn tmpfile() -> *mut FILE;
4039 pub fn setvbuf(stream: *mut FILE,
4040 buffer: *mut c_char,
4044 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
4045 // Omitted: printf and scanf variants.
4046 pub fn fgetc(stream: *mut FILE) -> c_int;
4047 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
4049 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
4050 pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int;
4051 // Omitted: getc, getchar (might be macros).
4053 // Omitted: gets, so ridiculously unsafe that it should not
4056 // Omitted: putc, putchar (might be macros).
4057 pub fn puts(s: *const c_char) -> c_int;
4058 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
4059 pub fn fread(ptr: *mut c_void,
4064 pub fn fwrite(ptr: *const c_void,
4069 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int)
4071 pub fn ftell(stream: *mut FILE) -> c_long;
4072 pub fn rewind(stream: *mut FILE);
4073 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
4074 pub fn fsetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
4075 pub fn feof(stream: *mut FILE) -> c_int;
4076 pub fn ferror(stream: *mut FILE) -> c_int;
4077 pub fn perror(s: *const c_char);
4082 use types::common::c95::c_void;
4083 use types::os::arch::c95::{c_char, c_double, c_int};
4084 use types::os::arch::c95::{c_long, c_uint, c_ulong};
4085 use types::os::arch::c95::{size_t};
4088 pub fn abs(i: c_int) -> c_int;
4089 pub fn labs(i: c_long) -> c_long;
4090 // Omitted: div, ldiv (return pub type incomplete).
4091 pub fn atof(s: *const c_char) -> c_double;
4092 pub fn atoi(s: *const c_char) -> c_int;
4093 pub fn strtod(s: *const c_char,
4094 endp: *mut *mut c_char) -> c_double;
4095 pub fn strtol(s: *const c_char,
4096 endp: *mut *mut c_char, base: c_int) -> c_long;
4097 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
4098 base: c_int) -> c_ulong;
4099 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
4100 pub fn malloc(size: size_t) -> *mut c_void;
4101 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
4102 pub fn free(p: *mut c_void);
4103 pub fn exit(status: c_int) -> !;
4104 pub fn _exit(status: c_int) -> !;
4106 pub fn system(s: *const c_char) -> c_int;
4107 pub fn getenv(s: *const c_char) -> *mut c_char;
4108 // Omitted: bsearch, qsort
4109 pub fn rand() -> c_int;
4110 pub fn srand(seed: c_uint);
4115 use types::common::c95::c_void;
4116 use types::os::arch::c95::{c_char, c_int, size_t};
4117 use types::os::arch::c95::{wchar_t};
4120 pub fn strcpy(dst: *mut c_char,
4121 src: *const c_char) -> *mut c_char;
4122 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t)
4124 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
4125 pub fn strncat(s: *mut c_char, ct: *const c_char,
4126 n: size_t) -> *mut c_char;
4127 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
4128 pub fn strncmp(cs: *const c_char, ct: *const c_char,
4129 n: size_t) -> c_int;
4130 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
4131 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
4132 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
4133 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
4134 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
4135 pub fn strpbrk(cs: *const c_char,
4136 ct: *const c_char) -> *mut c_char;
4137 pub fn strstr(cs: *const c_char,
4138 ct: *const c_char) -> *mut c_char;
4139 pub fn strlen(cs: *const c_char) -> size_t;
4140 pub fn strerror(n: c_int) -> *mut c_char;
4141 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
4142 pub fn strxfrm(s: *mut c_char, ct: *const c_char,
4143 n: size_t) -> size_t;
4144 pub fn wcslen(buf: *const wchar_t) -> size_t;
4146 // Omitted: memcpy, memmove, memset (provided by LLVM)
4148 // These are fine to execute on the Rust stack. They must be,
4149 // in fact, because LLVM generates calls to them!
4150 pub fn memcmp(cx: *const c_void, ct: *const c_void,
4151 n: size_t) -> c_int;
4152 pub fn memchr(cx: *const c_void, c: c_int,
4153 n: size_t) -> *mut c_void;
4158 // Microsoft helpfully underscore-qualifies all of its POSIX-like symbols
4159 // to make sure you don't use them accidentally. It also randomly deviates
4160 // from the exact signatures you might otherwise expect, and omits much,
4161 // so be careful when trying to write portable code; it won't always work
4162 // with the same POSIX functions and types as other platforms.
4164 #[cfg(target_os = "windows")]
4167 use types::os::common::posix01::{stat, utimbuf};
4168 use types::os::arch::c95::{c_int, c_char, wchar_t};
4171 #[link_name = "_chmod"]
4172 pub fn chmod(path: *const c_char, mode: c_int) -> c_int;
4173 #[link_name = "_wchmod"]
4174 pub fn wchmod(path: *const wchar_t, mode: c_int) -> c_int;
4175 #[link_name = "_mkdir"]
4176 pub fn mkdir(path: *const c_char) -> c_int;
4177 #[link_name = "_wrmdir"]
4178 pub fn wrmdir(path: *const wchar_t) -> c_int;
4179 #[link_name = "_fstat64"]
4180 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
4181 #[link_name = "_stat64"]
4182 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
4183 #[link_name = "_wstat64"]
4184 pub fn wstat(path: *const wchar_t, buf: *mut stat) -> c_int;
4185 #[link_name = "_wutime64"]
4186 pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> c_int;
4191 use types::common::c95::FILE;
4192 use types::os::arch::c95::{c_int, c_char};
4195 #[link_name = "_popen"]
4196 pub fn popen(command: *const c_char,
4197 mode: *const c_char) -> *mut FILE;
4198 #[link_name = "_pclose"]
4199 pub fn pclose(stream: *mut FILE) -> c_int;
4200 #[link_name = "_fdopen"]
4201 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
4202 #[link_name = "_fileno"]
4203 pub fn fileno(stream: *mut FILE) -> c_int;
4208 use types::os::arch::c95::{c_int, c_char, wchar_t};
4210 #[link_name = "_open"]
4211 pub fn open(path: *const c_char, oflag: c_int, mode: c_int)
4213 #[link_name = "_wopen"]
4214 pub fn wopen(path: *const wchar_t, oflag: c_int, mode: c_int)
4216 #[link_name = "_creat"]
4217 pub fn creat(path: *const c_char, mode: c_int) -> c_int;
4222 // Not supplied at all.
4226 use types::common::c95::c_void;
4227 use types::os::arch::c95::{c_int, c_uint, c_char,
4229 use types::os::arch::c99::intptr_t;
4232 #[link_name = "_access"]
4233 pub fn access(path: *const c_char, amode: c_int) -> c_int;
4234 #[link_name = "_chdir"]
4235 pub fn chdir(dir: *const c_char) -> c_int;
4236 #[link_name = "_close"]
4237 pub fn close(fd: c_int) -> c_int;
4238 #[link_name = "_dup"]
4239 pub fn dup(fd: c_int) -> c_int;
4240 #[link_name = "_dup2"]
4241 pub fn dup2(src: c_int, dst: c_int) -> c_int;
4242 #[link_name = "_execv"]
4243 pub fn execv(prog: *const c_char,
4244 argv: *mut *const c_char) -> intptr_t;
4245 #[link_name = "_execve"]
4246 pub fn execve(prog: *const c_char, argv: *mut *const c_char,
4247 envp: *mut *const c_char)
4249 #[link_name = "_execvp"]
4250 pub fn execvp(c: *const c_char,
4251 argv: *mut *const c_char) -> c_int;
4252 #[link_name = "_execvpe"]
4253 pub fn execvpe(c: *const c_char, argv: *mut *const c_char,
4254 envp: *mut *const c_char) -> c_int;
4255 #[link_name = "_getcwd"]
4256 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
4257 #[link_name = "_getpid"]
4258 pub fn getpid() -> c_int;
4259 #[link_name = "_isatty"]
4260 pub fn isatty(fd: c_int) -> c_int;
4261 #[link_name = "_lseek"]
4262 pub fn lseek(fd: c_int, offset: c_long, origin: c_int)
4264 #[link_name = "_pipe"]
4265 pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
4267 #[link_name = "_read"]
4268 pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
4270 #[link_name = "_rmdir"]
4271 pub fn rmdir(path: *const c_char) -> c_int;
4272 #[link_name = "_unlink"]
4273 pub fn unlink(c: *const c_char) -> c_int;
4274 #[link_name = "_write"]
4275 pub fn write(fd: c_int, buf: *const c_void,
4276 count: c_uint) -> c_int;
4284 #[cfg(any(target_os = "linux",
4285 target_os = "android",
4286 target_os = "macos",
4288 target_os = "freebsd",
4289 target_os = "dragonfly"))]
4292 use types::os::arch::c95::{c_char, c_int};
4293 use types::os::arch::posix01::stat;
4294 use types::os::arch::posix88::mode_t;
4297 pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
4298 pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
4300 #[cfg(any(target_os = "linux",
4301 target_os = "freebsd",
4302 target_os = "dragonfly",
4303 target_os = "android",
4304 target_os = "ios"))]
4305 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
4307 #[cfg(target_os = "macos")]
4308 #[link_name = "fstat64"]
4309 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
4311 pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
4312 pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
4314 #[cfg(any(target_os = "linux",
4315 target_os = "freebsd",
4316 target_os = "dragonfly",
4317 target_os = "android",
4318 target_os = "ios"))]
4319 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
4321 #[cfg(target_os = "macos")]
4322 #[link_name = "stat64"]
4323 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
4328 use types::common::c95::FILE;
4329 use types::os::arch::c95::{c_char, c_int};
4332 pub fn popen(command: *const c_char,
4333 mode: *const c_char) -> *mut FILE;
4334 pub fn pclose(stream: *mut FILE) -> c_int;
4335 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
4336 pub fn fileno(stream: *mut FILE) -> c_int;
4341 use types::os::arch::c95::{c_char, c_int};
4342 use types::os::arch::posix88::mode_t;
4345 pub fn open(path: *const c_char, oflag: c_int, mode: mode_t)
4347 pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
4348 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
4353 use types::common::posix88::{DIR, dirent_t};
4354 use types::os::arch::c95::{c_char, c_int, c_long};
4356 // NB: On OS X opendir and readdir have two versions,
4357 // one for 32-bit kernelspace and one for 64.
4358 // We should be linking to the 64-bit ones, called
4359 // opendir$INODE64, etc. but for some reason rustc
4360 // doesn't link it correctly on i686, so we're going
4361 // through a C function that mysteriously does work.
4364 #[link_name="rust_opendir"]
4365 pub fn opendir(dirname: *const c_char) -> *mut DIR;
4366 #[link_name="rust_readdir_r"]
4367 pub fn readdir_r(dirp: *mut DIR, entry: *mut dirent_t,
4368 result: *mut *mut dirent_t) -> c_int;
4372 pub fn closedir(dirp: *mut DIR) -> c_int;
4373 pub fn rewinddir(dirp: *mut DIR);
4374 pub fn seekdir(dirp: *mut DIR, loc: c_long);
4375 pub fn telldir(dirp: *mut DIR) -> c_long;
4380 use types::common::c95::c_void;
4381 use types::os::arch::c95::{c_char, c_int, c_long, c_uint};
4382 use types::os::arch::c95::{size_t};
4383 use types::os::common::posix01::timespec;
4384 use types::os::arch::posix01::utimbuf;
4385 use types::os::arch::posix88::{gid_t, off_t, pid_t};
4386 use types::os::arch::posix88::{ssize_t, uid_t};
4388 pub const _PC_NAME_MAX: c_int = 4;
4391 pub fn access(path: *const c_char, amode: c_int) -> c_int;
4392 pub fn alarm(seconds: c_uint) -> c_uint;
4393 pub fn chdir(dir: *const c_char) -> c_int;
4394 pub fn chown(path: *const c_char, uid: uid_t,
4395 gid: gid_t) -> c_int;
4396 pub fn close(fd: c_int) -> c_int;
4397 pub fn dup(fd: c_int) -> c_int;
4398 pub fn dup2(src: c_int, dst: c_int) -> c_int;
4399 pub fn execv(prog: *const c_char,
4400 argv: *mut *const c_char) -> c_int;
4401 pub fn execve(prog: *const c_char, argv: *mut *const c_char,
4402 envp: *mut *const c_char)
4404 pub fn execvp(c: *const c_char,
4405 argv: *mut *const c_char) -> c_int;
4406 pub fn fork() -> pid_t;
4407 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
4408 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
4409 pub fn getegid() -> gid_t;
4410 pub fn geteuid() -> uid_t;
4411 pub fn getgid() -> gid_t ;
4412 pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
4414 pub fn getlogin() -> *mut c_char;
4415 pub fn getopt(argc: c_int, argv: *mut *const c_char,
4416 optstr: *const c_char) -> c_int;
4417 pub fn getpgrp() -> pid_t;
4418 pub fn getpid() -> pid_t;
4419 pub fn getppid() -> pid_t;
4420 pub fn getuid() -> uid_t;
4421 pub fn getsid(pid: pid_t) -> pid_t;
4422 pub fn isatty(fd: c_int) -> c_int;
4423 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
4424 pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
4426 pub fn pathconf(path: *mut c_char, name: c_int) -> c_long;
4427 pub fn pause() -> c_int;
4428 pub fn pipe(fds: *mut c_int) -> c_int;
4429 pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
4431 pub fn rmdir(path: *const c_char) -> c_int;
4432 pub fn setgid(gid: gid_t) -> c_int;
4433 pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
4434 pub fn setsid() -> pid_t;
4435 pub fn setuid(uid: uid_t) -> c_int;
4436 pub fn sleep(secs: c_uint) -> c_uint;
4437 pub fn usleep(secs: c_uint) -> c_int;
4438 pub fn nanosleep(rqtp: *const timespec,
4439 rmtp: *mut timespec) -> c_int;
4440 pub fn sysconf(name: c_int) -> c_long;
4441 pub fn tcgetpgrp(fd: c_int) -> pid_t;
4442 pub fn ttyname(fd: c_int) -> *mut c_char;
4443 pub fn unlink(c: *const c_char) -> c_int;
4444 pub fn write(fd: c_int, buf: *const c_void, count: size_t)
4446 pub fn pread(fd: c_int, buf: *mut c_void, count: size_t,
4447 offset: off_t) -> ssize_t;
4448 pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t,
4449 offset: off_t) -> ssize_t;
4450 pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
4455 use types::os::arch::c95::{c_int};
4456 use types::os::arch::posix88::{pid_t};
4459 pub fn kill(pid: pid_t, sig: c_int) -> c_int;
4464 use types::common::c95::{c_void};
4465 use types::os::arch::c95::{size_t, c_int, c_char};
4466 use types::os::arch::posix88::{mode_t, off_t};
4469 pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
4470 pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
4471 pub fn mlockall(flags: c_int) -> c_int;
4472 pub fn munlockall() -> c_int;
4474 pub fn mmap(addr: *mut c_void,
4481 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
4483 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int)
4486 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int)
4488 pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t)
4490 pub fn shm_unlink(name: *const c_char) -> c_int;
4495 use types::os::arch::c95::{c_char, c_uint};
4498 pub fn if_nametoindex(ifname: *const c_char) -> c_uint;
4504 #[cfg(any(target_os = "linux",
4505 target_os = "android",
4506 target_os = "macos",
4508 target_os = "freebsd",
4509 target_os = "dragonfly"))]
4512 use types::os::arch::c95::{c_char, c_int};
4513 use types::os::arch::posix01::stat;
4516 #[cfg(any(target_os = "linux",
4517 target_os = "freebsd",
4518 target_os = "dragonfly",
4519 target_os = "android",
4520 target_os = "ios"))]
4521 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
4523 #[cfg(target_os = "macos")]
4524 #[link_name = "lstat64"]
4525 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
4530 use types::os::arch::c95::{c_char, c_int, size_t};
4531 use types::os::arch::posix88::{ssize_t, off_t};
4534 pub fn readlink(path: *const c_char,
4539 pub fn fsync(fd: c_int) -> c_int;
4541 #[cfg(any(target_os = "linux", target_os = "android"))]
4542 pub fn fdatasync(fd: c_int) -> c_int;
4544 pub fn setenv(name: *const c_char, val: *const c_char,
4545 overwrite: c_int) -> c_int;
4546 pub fn unsetenv(name: *const c_char) -> c_int;
4547 pub fn putenv(string: *mut c_char) -> c_int;
4549 pub fn symlink(path1: *const c_char,
4550 path2: *const c_char) -> c_int;
4552 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
4557 use types::os::arch::c95::c_int;
4558 use types::os::common::posix01::sighandler_t;
4560 #[cfg(not(target_os = "android"))]
4562 pub fn signal(signum: c_int,
4563 handler: sighandler_t) -> sighandler_t;
4566 #[cfg(target_os = "android")]
4568 #[link_name = "bsd_signal"]
4569 pub fn signal(signum: c_int,
4570 handler: sighandler_t) -> sighandler_t;
4575 use types::os::arch::c95::{c_char, c_int};
4576 use types::os::common::posix01::{glob_t};
4579 pub fn glob(pattern: *const c_char,
4581 errfunc: ::Nullable<extern "C" fn(epath: *const c_char,
4582 errno: c_int) -> c_int>,
4583 pglob: *mut glob_t);
4584 pub fn globfree(pglob: *mut glob_t);
4589 use types::common::c95::{c_void};
4590 use types::os::arch::c95::{c_int, size_t};
4593 pub fn posix_madvise(addr: *mut c_void,
4601 #[cfg(target_os = "windows")]
4620 #[cfg(any(target_os = "windows",
4621 target_os = "linux",
4622 target_os = "android",
4623 target_os = "macos",
4625 target_os = "freebsd",
4626 target_os = "dragonfly"))]
4632 #[cfg(not(windows))]
4634 use types::common::c95::{c_void};
4635 use types::os::common::bsd44::{socklen_t, sockaddr, ifaddrs};
4636 use types::os::arch::c95::{c_int, size_t};
4637 use types::os::arch::posix88::ssize_t;
4640 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int;
4641 pub fn connect(socket: c_int, address: *const sockaddr,
4642 len: socklen_t) -> c_int;
4643 pub fn bind(socket: c_int, address: *const sockaddr,
4644 address_len: socklen_t) -> c_int;
4645 pub fn listen(socket: c_int, backlog: c_int) -> c_int;
4646 pub fn accept(socket: c_int, address: *mut sockaddr,
4647 address_len: *mut socklen_t) -> c_int;
4648 pub fn getpeername(socket: c_int, address: *mut sockaddr,
4649 address_len: *mut socklen_t) -> c_int;
4650 pub fn getsockname(socket: c_int, address: *mut sockaddr,
4651 address_len: *mut socklen_t) -> c_int;
4652 pub fn setsockopt(socket: c_int, level: c_int, name: c_int,
4653 value: *const c_void,
4654 option_len: socklen_t) -> c_int;
4655 pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
4656 flags: c_int) -> ssize_t;
4657 pub fn send(socket: c_int, buf: *const c_void, len: size_t,
4658 flags: c_int) -> ssize_t;
4659 pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
4660 flags: c_int, addr: *mut sockaddr,
4661 addrlen: *mut socklen_t) -> ssize_t;
4662 pub fn sendto(socket: c_int, buf: *const c_void, len: size_t,
4663 flags: c_int, addr: *const sockaddr,
4664 addrlen: socklen_t) -> ssize_t;
4665 pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> c_int;
4666 pub fn freeifaddrs(ifa: *mut ifaddrs);
4667 pub fn shutdown(socket: c_int, how: c_int) -> c_int;
4673 use types::common::c95::{c_void};
4674 use types::os::common::bsd44::{socklen_t, sockaddr, SOCKET};
4675 use types::os::arch::c95::c_int;
4676 use types::os::arch::posix88::ssize_t;
4679 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> SOCKET;
4680 pub fn connect(socket: SOCKET, address: *const sockaddr,
4681 len: socklen_t) -> c_int;
4682 pub fn bind(socket: SOCKET, address: *const sockaddr,
4683 address_len: socklen_t) -> c_int;
4684 pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
4685 pub fn accept(socket: SOCKET, address: *mut sockaddr,
4686 address_len: *mut socklen_t) -> SOCKET;
4687 pub fn getpeername(socket: SOCKET, address: *mut sockaddr,
4688 address_len: *mut socklen_t) -> c_int;
4689 pub fn getsockname(socket: SOCKET, address: *mut sockaddr,
4690 address_len: *mut socklen_t) -> c_int;
4691 pub fn setsockopt(socket: SOCKET, level: c_int, name: c_int,
4692 value: *const c_void,
4693 option_len: socklen_t) -> c_int;
4694 pub fn closesocket(socket: SOCKET) -> c_int;
4695 pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
4696 flags: c_int) -> c_int;
4697 pub fn send(socket: SOCKET, buf: *const c_void, len: c_int,
4698 flags: c_int) -> c_int;
4699 pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
4700 flags: c_int, addr: *mut sockaddr,
4701 addrlen: *mut c_int) -> ssize_t;
4702 pub fn sendto(socket: SOCKET, buf: *const c_void, len: c_int,
4703 flags: c_int, addr: *const sockaddr,
4704 addrlen: c_int) -> c_int;
4705 pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
4709 #[cfg(any(target_os = "macos",
4711 target_os = "freebsd",
4712 target_os = "dragonfly"))]
4714 use types::common::c95::{c_void};
4715 use types::os::arch::c95::{c_char, c_uchar, c_int, c_uint, c_ulong, size_t};
4718 pub fn ioctl(d: c_int, request: c_ulong, ...) -> c_int;
4719 pub fn sysctl(name: *mut c_int,
4722 oldlenp: *mut size_t,
4726 pub fn sysctlbyname(name: *const c_char,
4728 oldlenp: *mut size_t,
4732 pub fn sysctlnametomib(name: *const c_char,
4736 pub fn getdtablesize() -> c_int;
4737 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
4739 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
4745 #[cfg(any(target_os = "linux", target_os = "android"))]
4747 use types::common::c95::{c_void};
4748 use types::os::arch::c95::{c_uchar, c_int, size_t};
4751 pub fn getdtablesize() -> c_int;
4752 pub fn ioctl(d: c_int, request: c_int, ...) -> c_int;
4753 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
4755 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
4761 #[cfg(target_os = "windows")]
4765 #[cfg(any(target_os = "macos", target_os = "ios"))]
4767 use types::os::arch::c95::{c_char, c_int};
4770 pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32)
4775 #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
4779 #[cfg(any(target_os = "linux", target_os = "android"))]
4784 #[cfg(target_os = "windows")]
4788 use types::os::arch::c95::{c_uint};
4789 use types::os::arch::extra::{BOOL, DWORD, SIZE_T, HMODULE,
4791 LPWCH, LPDWORD, LPVOID,
4792 LPCVOID, LPOVERLAPPED,
4793 LPSECURITY_ATTRIBUTES,
4795 LPPROCESS_INFORMATION,
4796 LPMEMORY_BASIC_INFORMATION,
4797 LPSYSTEM_INFO, HANDLE, LPHANDLE,
4798 LARGE_INTEGER, PLARGE_INTEGER,
4799 LPFILETIME, LPWIN32_FIND_DATAW};
4802 pub fn GetEnvironmentVariableW(n: LPCWSTR,
4806 pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
4808 pub fn GetEnvironmentStringsW() -> LPWCH;
4809 pub fn FreeEnvironmentStringsW(env_ptr: LPWCH) -> BOOL;
4810 pub fn GetModuleFileNameW(hModule: HMODULE,
4814 pub fn CreateDirectoryW(lpPathName: LPCWSTR,
4815 lpSecurityAttributes:
4816 LPSECURITY_ATTRIBUTES)
4818 pub fn CopyFileW(lpExistingFileName: LPCWSTR,
4819 lpNewFileName: LPCWSTR,
4820 bFailIfExists: BOOL)
4822 pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
4823 pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
4824 pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
4827 pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
4828 pub fn GetLastError() -> DWORD;
4829 pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW)
4831 pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW)
4833 pub fn FindClose(findFile: HANDLE) -> BOOL;
4834 pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
4835 hSourceHandle: HANDLE,
4836 hTargetProcessHandle: HANDLE,
4837 lpTargetHandle: LPHANDLE,
4838 dwDesiredAccess: DWORD,
4839 bInheritHandle: BOOL,
4842 pub fn CloseHandle(hObject: HANDLE) -> BOOL;
4843 pub fn OpenProcess(dwDesiredAccess: DWORD,
4844 bInheritHandle: BOOL,
4847 pub fn GetCurrentProcess() -> HANDLE;
4848 pub fn CreateProcessW(lpApplicationName: LPCWSTR,
4849 lpCommandLine: LPWSTR,
4850 lpProcessAttributes:
4851 LPSECURITY_ATTRIBUTES,
4853 LPSECURITY_ATTRIBUTES,
4854 bInheritHandles: BOOL,
4855 dwCreationFlags: DWORD,
4856 lpEnvironment: LPVOID,
4857 lpCurrentDirectory: LPCWSTR,
4858 lpStartupInfo: LPSTARTUPINFO,
4859 lpProcessInformation:
4860 LPPROCESS_INFORMATION)
4862 pub fn WaitForSingleObject(hHandle: HANDLE,
4863 dwMilliseconds: DWORD)
4865 pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
4867 pub fn GetExitCodeProcess(hProcess: HANDLE,
4868 lpExitCode: LPDWORD)
4870 pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
4871 pub fn VirtualAlloc(lpAddress: LPVOID,
4873 flAllocationType: DWORD,
4876 pub fn VirtualFree(lpAddress: LPVOID,
4880 pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
4881 pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
4883 pub fn VirtualProtect(lpAddress: LPVOID,
4885 flNewProtect: DWORD,
4886 lpflOldProtect: LPDWORD)
4888 pub fn VirtualQuery(lpAddress: LPCVOID,
4889 lpBuffer: LPMEMORY_BASIC_INFORMATION,
4892 pub fn CreateFileMappingW(hFile: HANDLE,
4893 lpAttributes: LPSECURITY_ATTRIBUTES,
4895 dwMaximumSizeHigh: DWORD,
4896 dwMaximumSizeLow: DWORD,
4899 pub fn MapViewOfFile(hFileMappingObject: HANDLE,
4900 dwDesiredAccess: DWORD,
4901 dwFileOffsetHigh: DWORD,
4902 dwFileOffsetLow: DWORD,
4903 dwNumberOfBytesToMap: SIZE_T)
4905 pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
4906 pub fn MoveFileExW(lpExistingFileName: LPCWSTR,
4907 lpNewFileName: LPCWSTR,
4908 dwFlags: DWORD) -> BOOL;
4909 pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
4910 lpTargetFileName: LPCWSTR,
4911 lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
4913 pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL;
4914 pub fn CreateFileW(lpFileName: LPCWSTR,
4915 dwDesiredAccess: DWORD,
4917 lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
4918 dwCreationDisposition: DWORD,
4919 dwFlagsAndAttributes: DWORD,
4920 hTemplateFile: HANDLE) -> HANDLE;
4921 pub fn ReadFile(hFile: HANDLE,
4923 nNumberOfBytesToRead: DWORD,
4924 lpNumberOfBytesRead: LPDWORD,
4925 lpOverlapped: LPOVERLAPPED) -> BOOL;
4926 pub fn WriteFile(hFile: HANDLE,
4928 nNumberOfBytesToRead: DWORD,
4929 lpNumberOfBytesRead: LPDWORD,
4930 lpOverlapped: LPOVERLAPPED) -> BOOL;
4931 pub fn SetFilePointerEx(hFile: HANDLE,
4932 liDistanceToMove: LARGE_INTEGER,
4933 lpNewFilePointer: PLARGE_INTEGER,
4934 dwMoveMethod: DWORD) -> BOOL;
4935 pub fn SetEndOfFile(hFile: HANDLE) -> BOOL;
4937 pub fn GetSystemTimeAsFileTime(
4938 lpSystemTimeAsFileTime: LPFILETIME);
4940 pub fn QueryPerformanceFrequency(
4941 lpFrequency: *mut LARGE_INTEGER) -> BOOL;
4942 pub fn QueryPerformanceCounter(
4943 lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL;
4945 pub fn GetCurrentProcessId() -> DWORD;
4946 pub fn CreateNamedPipeW(
4950 nMaxInstances: DWORD,
4951 nOutBufferSize: DWORD,
4952 nInBufferSize: DWORD,
4953 nDefaultTimeOut: DWORD,
4954 lpSecurityAttributes: LPSECURITY_ATTRIBUTES
4956 pub fn ConnectNamedPipe(hNamedPipe: HANDLE,
4957 lpOverlapped: LPOVERLAPPED) -> BOOL;
4958 pub fn WaitNamedPipeW(lpNamedPipeName: LPCWSTR,
4959 nTimeOut: DWORD) -> BOOL;
4960 pub fn SetNamedPipeHandleState(hNamedPipe: HANDLE,
4962 lpMaxCollectionCount: LPDWORD,
4963 lpCollectDataTimeout: LPDWORD)
4965 pub fn CreateEventW(lpEventAttributes: LPSECURITY_ATTRIBUTES,
4967 bInitialState: BOOL,
4968 lpName: LPCWSTR) -> HANDLE;
4969 pub fn GetOverlappedResult(hFile: HANDLE,
4970 lpOverlapped: LPOVERLAPPED,
4971 lpNumberOfBytesTransferred: LPDWORD,
4972 bWait: BOOL) -> BOOL;
4973 pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL;
4978 use types::os::arch::c95::{c_int, c_long};
4979 use types::os::arch::c99::intptr_t;
4982 #[link_name = "_commit"]
4983 pub fn commit(fd: c_int) -> c_int;
4985 #[link_name = "_get_osfhandle"]
4986 pub fn get_osfhandle(fd: c_int) -> c_long;
4988 #[link_name = "_open_osfhandle"]
4989 pub fn open_osfhandle(osfhandle: intptr_t,
4990 flags: c_int) -> c_int;
4995 use types::os::arch::c95::{c_int, c_long, c_ulong};
4996 use types::os::common::bsd44::SOCKET;
4999 pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int;
5006 pub fn issue_14344_workaround() {} // FIXME #14344 force linkage to happen correctly
5008 #[test] fn work_on_windows() { } // FIXME #10872 needed for a happy windows
5013 pub use core::kinds;