1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![crate_name = "libc"]
12 #![crate_type = "rlib"]
13 #![cfg_attr(not(feature = "cargo-build"), unstable(feature = "libc"))]
14 #![cfg_attr(not(feature = "cargo-build"), feature(staged_api, core, no_std))]
15 #![cfg_attr(not(feature = "cargo-build"), staged_api)]
16 #![cfg_attr(not(feature = "cargo-build"), no_std)]
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/")]
21 #![cfg_attr(test, feature(test))]
23 //! Bindings for the C standard library and other platform libraries
25 //! **NOTE:** These are *architecture and libc* specific. On Linux, these
26 //! bindings are only correct for glibc.
28 //! This module contains bindings to the C standard library, organized into
29 //! modules by their defining standard. Additionally, it contains some assorted
30 //! platform-specific definitions. For convenience, most functions and types
31 //! are reexported, so `use libc::*` will import the available C bindings as
32 //! appropriate for the target platform. The exact set of functions available
33 //! are platform specific.
35 //! *Note:* Because these definitions are platform-specific, some may not appear
36 //! in the generated documentation.
38 //! We consider the following specs reasonably normative with respect to
39 //! interoperating with the C standard library (libc/msvcrt):
41 //! * ISO 9899:1990 ('C95', 'ANSI C', 'Standard C'), NA1, 1995.
42 //! * ISO 9899:1999 ('C99' or 'C9x').
43 //! * ISO 9945:1988 / IEEE 1003.1-1988 ('POSIX.1').
44 //! * ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
45 //! * ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
47 //! Note that any reference to the 1996 revision of POSIX, or any revs between
48 //! 1990 (when '88 was approved at ISO) and 2001 (when the next actual
49 //! revision-revision happened), are merely additions of other chapters (1b and
50 //! 1c) outside the core interfaces.
52 //! Despite having several names each, these are *reasonably* coherent
53 //! point-in-time, list-of-definition sorts of specs. You can get each under a
54 //! variety of names but will wind up with the same definition in each case.
56 //! See standards(7) in linux-manpages for more details.
58 //! Our interface to these libraries is complicated by the non-universality of
59 //! conformance to any of them. About the only thing universally supported is
60 //! the first (C95), beyond that definitions quickly become absent on various
63 //! We therefore wind up dividing our module-space up (mostly for the sake of
64 //! sanity while editing, filling-in-details and eliminating duplication) into
65 //! definitions common-to-all (held in modules named c95, c99, posix88, posix01
66 //! and posix08) and definitions that appear only on *some* platforms (named
67 //! 'extra'). This would be things like significant OSX foundation kit, or Windows
68 //! library kernel32.dll, or various fancy glibc, Linux or BSD extensions.
70 //! In addition to the per-platform 'extra' modules, we define a module of
71 //! 'common BSD' libc routines that never quite made it into POSIX but show up
72 //! in multiple derived systems. This is the 4.4BSD r2 / 1995 release, the final
73 //! one from Berkeley after the lawsuits died down and the CSRG dissolved.
75 #![allow(bad_style, raw_pointer_derive)]
76 #![cfg_attr(target_os = "nacl", allow(unused_imports))]
77 #[cfg(feature = "cargo-build")] extern crate "std" as core;
78 #[cfg(not(feature = "cargo-build"))] extern crate core;
80 #[cfg(test)] extern crate std;
81 #[cfg(test)] extern crate test;
83 // Explicit export lists for the intersection (provided here) mean that
84 // you can write more-platform-agnostic code if you stick to just these
87 pub use types::common::c95::*;
88 pub use types::common::c99::*;
89 pub use types::common::posix88::*;
90 pub use types::os::common::posix01::*;
91 pub use types::os::common::bsd44::*;
92 pub use types::os::arch::c95::*;
93 pub use types::os::arch::c99::*;
94 pub use types::os::arch::posix88::*;
95 pub use types::os::arch::posix01::*;
96 pub use types::os::arch::extra::*;
98 pub use consts::os::c95::*;
99 pub use consts::os::posix88::*;
100 pub use consts::os::posix01::*;
101 pub use consts::os::bsd44::*;
102 pub use consts::os::extra::*;
104 pub use funcs::c95::ctype::*;
105 pub use funcs::c95::stdio::*;
106 pub use funcs::c95::stdlib::*;
107 pub use funcs::c95::string::*;
108 pub use funcs::posix88::fcntl::*;
109 pub use funcs::posix88::stat_::*;
110 pub use funcs::posix88::stdio::*;
111 pub use funcs::posix88::unistd::*;
113 pub use funcs::bsd43::*;
115 // But we also reexport most everything
116 // if you're interested in writing platform-specific code.
118 // FIXME: This is a mess, but the design of this entire module needs to be
119 // reconsidered, so I'm not inclined to do better right now. As part of
120 // #11870 I removed all the pub globs here, leaving explicit reexports
121 // of everything that is actually used in-tree.
123 // So the following exports don't follow any particular plan.
125 #[cfg(unix)] pub use consts::os::sysconf::*;
127 #[cfg(unix)] pub use funcs::posix88::mman::*;
128 #[cfg(unix)] pub use funcs::posix88::dirent::*;
129 #[cfg(unix)] pub use funcs::posix88::net::*;
130 #[cfg(unix)] pub use funcs::posix01::stat_::*;
131 #[cfg(unix)] pub use funcs::posix01::unistd::*;
134 #[cfg(windows)] pub use funcs::extra::kernel32::*;
135 #[cfg(windows)] pub use funcs::extra::winsock::*;
136 #[cfg(windows)] pub use funcs::extra::msvcrt::*;
138 // On NaCl, these libraries are static. Thus it would be a Bad Idea to link them
139 // in when creating a test crate.
140 #[cfg(not(any(windows, all(target_os = "nacl", test))))]
145 // libnacl provides functions that require a trip through the IRT to work.
146 // ie: _exit, mmap, nanosleep, etc. Anything that would otherwise require a trip
148 #[cfg(all(target_os = "nacl", not(feature = "cargo-build"), not(test)))]
149 #[link(name = "nacl", kind = "static")]
152 // pnaclmm provides a number of functions that the toolchain's Clang emits calls
153 // to when codegening atomic ops. All the functions within wrap various atomic
155 // Yes, it could be linked by rustc explicitly, however by linking it here
156 // instead we save a bit of time where bins are involved (by not running the
157 // optimizations on the whole pnaclmm foreach binary built).
158 #[cfg(all(target_os = "nacl", not(feature = "cargo-build"), not(test)))]
159 #[link(name = "pnaclmm", kind = "static")]
164 // Types tend to vary *per architecture* so we pull their definitions out
167 // Standard types that are opaque or common, so are not per-target.
170 /// Type used to construct void pointers for use with C.
172 /// This type is only useful as a pointer target. Do not use it as a
173 /// return type for FFI functions which have the `void` return type in
174 /// C. Use the unit type `()` or omit the return type instead.
176 /// For LLVM to recognize the void pointer type and by extension
177 /// functions like malloc(), we need to have it represented as i8* in
178 /// LLVM bitcode. The enum used here ensures this and prevents misuse
179 /// of the "raw" type by only having private variants.. We need two
180 /// variants, because the compiler complains about the repr attribute
192 pub type int8_t = i8;
193 pub type int16_t = i16;
194 pub type int32_t = i32;
195 pub type int64_t = i64;
196 pub type uint8_t = u8;
197 pub type uint16_t = u16;
198 pub type uint32_t = u32;
199 pub type uint64_t = u64;
210 // Standard types that are scalar but vary by OS and arch.
212 #[cfg(any(target_os = "linux", target_os = "android", target_os = "nacl"))]
216 use types::common::c95::{c_void};
217 use types::os::arch::c95::{c_char, c_ulong, size_t,
218 time_t, suseconds_t, c_long};
220 #[cfg(not(target_os = "nacl"))]
221 pub type pthread_t = c_ulong;
222 #[cfg(target_os = "nacl")]
223 pub type pthread_t = *mut c_void;
226 #[derive(Copy)] pub struct glob_t {
227 pub gl_pathc: size_t,
228 pub gl_pathv: *mut *mut c_char,
231 pub __unused1: *mut c_void,
232 pub __unused2: *mut c_void,
233 pub __unused3: *mut c_void,
234 pub __unused4: *mut c_void,
235 pub __unused5: *mut c_void,
239 #[derive(Copy)] pub struct timeval {
241 pub tv_usec: suseconds_t,
245 #[derive(Copy)] pub struct timespec {
250 #[derive(Copy)] pub enum timezone {}
252 pub type sighandler_t = size_t;
255 use types::common::c95::{c_void};
256 use types::os::arch::c95::{c_char, c_int, c_uint};
258 pub type socklen_t = u32;
259 pub type sa_family_t = u16;
260 pub type in_port_t = u16;
261 pub type in_addr_t = u32;
263 #[derive(Copy)] pub struct sockaddr {
264 pub sa_family: sa_family_t,
265 pub sa_data: [u8; 14],
268 #[derive(Copy)] pub struct sockaddr_storage {
269 pub ss_family: sa_family_t,
271 pub __ss_pad2: [u8; 112],
274 #[derive(Copy)] pub struct sockaddr_in {
275 pub sin_family: sa_family_t,
276 pub sin_port: in_port_t,
277 pub sin_addr: in_addr,
278 pub sin_zero: [u8; 8],
281 #[derive(Copy)] pub struct in_addr {
282 pub s_addr: in_addr_t,
285 #[derive(Copy)] pub struct sockaddr_in6 {
286 pub sin6_family: sa_family_t,
287 pub sin6_port: in_port_t,
288 pub sin6_flowinfo: u32,
289 pub sin6_addr: in6_addr,
290 pub sin6_scope_id: u32,
293 #[derive(Copy)] pub struct in6_addr {
294 pub s6_addr: [u16; 8]
297 #[derive(Copy)] pub struct ip_mreq {
298 pub imr_multiaddr: in_addr,
299 pub imr_interface: in_addr,
302 #[derive(Copy)] pub struct ip6_mreq {
303 pub ipv6mr_multiaddr: in6_addr,
304 pub ipv6mr_interface: c_uint,
307 #[derive(Copy)] pub struct addrinfo {
309 pub ai_family: c_int,
310 pub ai_socktype: c_int,
311 pub ai_protocol: c_int,
312 pub ai_addrlen: socklen_t,
314 #[cfg(target_os = "linux")]
315 pub ai_addr: *mut sockaddr,
317 #[cfg(target_os = "linux")]
318 pub ai_canonname: *mut c_char,
320 #[cfg(any(target_os = "android", target_os = "nacl"))]
321 pub ai_canonname: *mut c_char,
323 #[cfg(any(target_os = "android", target_os = "nacl"))]
324 pub ai_addr: *mut sockaddr,
326 pub ai_next: *mut addrinfo,
329 #[derive(Copy)] pub struct sockaddr_un {
330 pub sun_family: sa_family_t,
331 pub sun_path: [c_char; 108]
335 #[derive(Copy)] pub struct ifaddrs {
336 pub ifa_next: *mut ifaddrs,
337 pub ifa_name: *mut c_char,
338 pub ifa_flags: c_uint,
339 pub ifa_addr: *mut sockaddr,
340 pub ifa_netmask: *mut sockaddr,
341 pub ifa_ifu: *mut sockaddr, // FIXME This should be a union
342 pub ifa_data: *mut c_void
348 #[cfg(any(target_arch = "x86",
350 target_arch = "mips",
351 target_arch = "mipsel",
352 target_arch = "powerpc",
353 target_arch = "le32"))]
356 pub type c_char = i8;
357 pub type c_schar = i8;
358 pub type c_uchar = u8;
359 pub type c_short = i16;
360 pub type c_ushort = u16;
361 pub type c_int = i32;
362 pub type c_uint = u32;
363 pub type c_long = i32;
364 pub type c_ulong = u32;
365 pub type c_float = f32;
366 pub type c_double = f64;
367 pub type size_t = u32;
368 pub type ptrdiff_t = i32;
369 pub type clock_t = i32;
370 pub type time_t = i32;
371 pub type suseconds_t = i32;
372 pub type wchar_t = i32;
375 pub type c_longlong = i64;
376 pub type c_ulonglong = u64;
377 pub type intptr_t = i32;
378 pub type uintptr_t = u32;
379 pub type intmax_t = i64;
380 pub type uintmax_t = u64;
382 #[cfg(any(target_arch = "x86",
383 target_arch = "mips",
384 target_arch = "mipsel",
385 target_arch = "powerpc",
386 target_arch = "le32",
387 all(target_arch = "arm", not(target_os = "android"))))]
389 pub type off_t = i32;
390 pub type dev_t = u64;
391 pub type ino_t = u32;
392 pub type pid_t = i32;
393 pub type uid_t = u32;
394 pub type gid_t = u32;
395 pub type useconds_t = u32;
396 pub type mode_t = u32;
397 pub type ssize_t = i32;
399 #[cfg(all(target_arch = "arm", target_os = "android"))]
401 pub type off_t = i32;
402 pub type dev_t = u32;
403 pub type ino_t = u32;
404 pub type pid_t = i32;
405 pub type uid_t = u32;
406 pub type gid_t = u32;
407 pub type useconds_t = u32;
408 pub type mode_t = u16;
409 pub type ssize_t = i32;
411 #[cfg(any(target_arch = "x86",
412 target_arch = "le32",
413 target_arch = "powerpc",
414 all(target_arch = "arm", not(target_os = "android"))))]
416 use types::os::arch::c95::{c_short, c_long, time_t};
417 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
418 use types::os::arch::posix88::{mode_t, off_t};
419 use types::os::arch::posix88::{uid_t};
421 pub type nlink_t = u32;
422 pub type blksize_t = i32;
423 pub type blkcnt_t = i32;
426 #[derive(Copy)] pub struct stat {
431 pub st_nlink: nlink_t,
437 pub st_blksize: blksize_t,
438 pub st_blocks: blkcnt_t,
439 pub st_atime: time_t,
440 pub st_atime_nsec: c_long,
441 pub st_mtime: time_t,
442 pub st_mtime_nsec: c_long,
443 pub st_ctime: time_t,
444 pub st_ctime_nsec: c_long,
445 pub __unused4: c_long,
446 pub __unused5: c_long,
450 #[derive(Copy)] pub struct utimbuf {
456 #[derive(Copy)] pub struct pthread_attr_t {
460 #[cfg(all(target_arch = "arm", target_os = "android"))]
462 use types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
463 use types::os::arch::c99::{c_longlong, c_ulonglong};
464 use types::os::arch::posix88::{uid_t, gid_t, ino_t};
466 pub type nlink_t = u16;
467 pub type blksize_t = u32;
468 pub type blkcnt_t = u32;
471 #[derive(Copy)] pub struct stat {
472 pub st_dev: c_ulonglong,
473 pub __pad0: [c_uchar; 4],
476 pub st_nlink: c_uint,
479 pub st_rdev: c_ulonglong,
480 pub __pad3: [c_uchar; 4],
481 pub st_size: c_longlong,
482 pub st_blksize: blksize_t,
483 pub st_blocks: c_ulonglong,
484 pub st_atime: time_t,
485 pub st_atime_nsec: c_ulong,
486 pub st_mtime: time_t,
487 pub st_mtime_nsec: c_ulong,
488 pub st_ctime: time_t,
489 pub st_ctime_nsec: c_ulong,
490 pub st_ino: c_ulonglong,
494 #[derive(Copy)] pub struct utimbuf {
500 #[derive(Copy)] pub struct pthread_attr_t {
504 #[cfg(any(target_arch = "mips",
505 target_arch = "mipsel"))]
507 use types::os::arch::c95::{c_long, c_ulong, time_t};
508 use types::os::arch::posix88::{gid_t, ino_t};
509 use types::os::arch::posix88::{mode_t, off_t};
510 use types::os::arch::posix88::{uid_t};
512 pub type nlink_t = u32;
513 pub type blksize_t = i32;
514 pub type blkcnt_t = i32;
517 #[derive(Copy)] pub struct stat {
519 pub st_pad1: [c_long; 3],
522 pub st_nlink: nlink_t,
525 pub st_rdev: c_ulong,
526 pub st_pad2: [c_long; 2],
529 pub st_atime: time_t,
530 pub st_atime_nsec: c_long,
531 pub st_mtime: time_t,
532 pub st_mtime_nsec: c_long,
533 pub st_ctime: time_t,
534 pub st_ctime_nsec: c_long,
535 pub st_blksize: blksize_t,
536 pub st_blocks: blkcnt_t,
537 pub st_pad5: [c_long; 14],
541 #[derive(Copy)] pub struct utimbuf {
547 #[derive(Copy)] pub struct pthread_attr_t {
554 use types::os::arch::c95::{c_ushort, c_int, c_uchar};
556 #[derive(Copy)] pub struct sockaddr_ll {
557 pub sll_family: c_ushort,
558 pub sll_protocol: c_ushort,
559 pub sll_ifindex: c_int,
560 pub sll_hatype: c_ushort,
561 pub sll_pkttype: c_uchar,
562 pub sll_halen: c_uchar,
563 pub sll_addr: [c_uchar; 8]
569 #[cfg(any(target_arch = "x86_64",
570 target_arch = "aarch64"))]
573 #[cfg(not(target_arch = "aarch64"))]
574 pub type c_char = i8;
575 #[cfg(target_arch = "aarch64")]
576 pub type c_char = u8;
577 pub type c_schar = i8;
578 pub type c_uchar = u8;
579 pub type c_short = i16;
580 pub type c_ushort = u16;
581 pub type c_int = i32;
582 pub type c_uint = u32;
583 pub type c_long = i64;
584 pub type c_ulong = u64;
585 pub type c_float = f32;
586 pub type c_double = f64;
587 pub type size_t = u64;
588 pub type ptrdiff_t = i64;
589 pub type clock_t = i64;
590 pub type time_t = i64;
591 pub type suseconds_t = i64;
592 #[cfg(not(target_arch = "aarch64"))]
593 pub type wchar_t = i32;
594 #[cfg(target_arch = "aarch64")]
595 pub type wchar_t = u32;
598 pub type c_longlong = i64;
599 pub type c_ulonglong = u64;
600 pub type intptr_t = i64;
601 pub type uintptr_t = u64;
602 pub type intmax_t = i64;
603 pub type uintmax_t = u64;
606 pub type off_t = i64;
607 pub type dev_t = u64;
608 pub type ino_t = u64;
609 pub type pid_t = i32;
610 pub type uid_t = u32;
611 pub type gid_t = u32;
612 pub type useconds_t = u32;
613 pub type mode_t = u32;
614 pub type ssize_t = i64;
616 #[cfg(not(target_arch = "aarch64"))]
618 use types::os::arch::c95::{c_int, c_long, time_t};
619 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
620 use types::os::arch::posix88::{mode_t, off_t};
621 use types::os::arch::posix88::{uid_t};
623 pub type nlink_t = u64;
624 pub type blksize_t = i64;
625 pub type blkcnt_t = i64;
628 #[derive(Copy)] pub struct stat {
631 pub st_nlink: nlink_t,
638 pub st_blksize: blksize_t,
639 pub st_blocks: blkcnt_t,
640 pub st_atime: time_t,
641 pub st_atime_nsec: c_long,
642 pub st_mtime: time_t,
643 pub st_mtime_nsec: c_long,
644 pub st_ctime: time_t,
645 pub st_ctime_nsec: c_long,
646 pub __unused: [c_long; 3],
650 #[derive(Copy)] pub struct utimbuf {
656 #[derive(Copy)] pub struct pthread_attr_t {
660 #[cfg(target_arch = "aarch64")]
662 use types::os::arch::c95::{c_int, c_long, time_t};
663 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
664 use types::os::arch::posix88::{mode_t, off_t};
665 use types::os::arch::posix88::{uid_t};
667 pub type nlink_t = u32;
668 pub type blksize_t = i32;
669 pub type blkcnt_t = i64;
672 #[derive(Copy)] pub struct stat {
676 pub st_nlink: nlink_t,
682 pub st_blksize: blksize_t,
684 pub st_blocks: blkcnt_t,
685 pub st_atime: time_t,
686 pub st_atime_nsec: c_long,
687 pub st_mtime: time_t,
688 pub st_mtime_nsec: c_long,
689 pub st_ctime: time_t,
690 pub st_ctime_nsec: c_long,
691 pub __unused: [c_int; 2],
695 #[derive(Copy)] pub struct utimbuf {
701 #[derive(Copy)] pub struct pthread_attr_t {
710 use types::os::arch::c95::{c_ushort, c_int, c_uchar};
711 #[derive(Copy)] pub struct sockaddr_ll {
712 pub sll_family: c_ushort,
713 pub sll_protocol: c_ushort,
714 pub sll_ifindex: c_int,
715 pub sll_hatype: c_ushort,
716 pub sll_pkttype: c_uchar,
717 pub sll_halen: c_uchar,
718 pub sll_addr: [c_uchar; 8]
725 #[cfg(target_os = "freebsd")]
729 use types::common::c95::{c_void};
730 use types::os::arch::c95::{c_char, c_int, size_t,
731 time_t, suseconds_t, c_long};
732 use types::os::arch::c99::{uintptr_t};
734 pub type pthread_t = uintptr_t;
737 #[derive(Copy)] pub struct glob_t {
738 pub gl_pathc: size_t,
739 pub __unused1: size_t,
741 pub __unused2: c_int,
742 pub gl_pathv: *mut *mut c_char,
744 pub __unused3: *mut c_void,
746 pub __unused4: *mut c_void,
747 pub __unused5: *mut c_void,
748 pub __unused6: *mut c_void,
749 pub __unused7: *mut c_void,
750 pub __unused8: *mut c_void,
754 #[derive(Copy)] pub struct timeval {
756 pub tv_usec: suseconds_t,
760 #[derive(Copy)] pub struct timespec {
765 #[derive(Copy)] pub enum timezone {}
767 pub type sighandler_t = size_t;
770 use types::common::c95::{c_void};
771 use types::os::arch::c95::{c_char, c_int, c_uint};
773 pub type socklen_t = u32;
774 pub type sa_family_t = u8;
775 pub type in_port_t = u16;
776 pub type in_addr_t = u32;
778 #[derive(Copy)] pub struct sockaddr {
780 pub sa_family: sa_family_t,
781 pub sa_data: [u8; 14],
784 #[derive(Copy)] pub struct sockaddr_storage {
786 pub ss_family: sa_family_t,
787 pub __ss_pad1: [u8; 6],
789 pub __ss_pad2: [u8; 112],
792 #[derive(Copy)] pub struct sockaddr_in {
794 pub sin_family: sa_family_t,
795 pub sin_port: in_port_t,
796 pub sin_addr: in_addr,
797 pub sin_zero: [u8; 8],
800 #[derive(Copy)] pub struct in_addr {
801 pub s_addr: in_addr_t,
804 #[derive(Copy)] pub struct sockaddr_in6 {
806 pub sin6_family: sa_family_t,
807 pub sin6_port: in_port_t,
808 pub sin6_flowinfo: u32,
809 pub sin6_addr: in6_addr,
810 pub sin6_scope_id: u32,
813 #[derive(Copy)] pub struct in6_addr {
814 pub s6_addr: [u16; 8]
817 #[derive(Copy)] pub struct ip_mreq {
818 pub imr_multiaddr: in_addr,
819 pub imr_interface: in_addr,
822 #[derive(Copy)] pub struct ip6_mreq {
823 pub ipv6mr_multiaddr: in6_addr,
824 pub ipv6mr_interface: c_uint,
827 #[derive(Copy)] pub struct addrinfo {
829 pub ai_family: c_int,
830 pub ai_socktype: c_int,
831 pub ai_protocol: c_int,
832 pub ai_addrlen: socklen_t,
833 pub ai_canonname: *mut c_char,
834 pub ai_addr: *mut sockaddr,
835 pub ai_next: *mut addrinfo,
838 #[derive(Copy)] pub struct sockaddr_un {
840 pub sun_family: sa_family_t,
841 pub sun_path: [c_char; 104]
844 #[derive(Copy)] pub struct ifaddrs {
845 pub ifa_next: *mut ifaddrs,
846 pub ifa_name: *mut c_char,
847 pub ifa_flags: c_uint,
848 pub ifa_addr: *mut sockaddr,
849 pub ifa_netmask: *mut sockaddr,
850 pub ifa_dstaddr: *mut sockaddr,
851 pub ifa_data: *mut c_void
858 #[cfg(target_arch = "x86_64")]
861 pub type c_char = i8;
862 pub type c_schar = i8;
863 pub type c_uchar = u8;
864 pub type c_short = i16;
865 pub type c_ushort = u16;
866 pub type c_int = i32;
867 pub type c_uint = u32;
868 pub type c_long = i64;
869 pub type c_ulong = u64;
870 pub type c_float = f32;
871 pub type c_double = f64;
872 pub type size_t = u64;
873 pub type ptrdiff_t = i64;
874 pub type clock_t = i32;
875 pub type time_t = i64;
876 pub type suseconds_t = i64;
877 pub type wchar_t = i32;
880 pub type c_longlong = i64;
881 pub type c_ulonglong = u64;
882 pub type intptr_t = i64;
883 pub type uintptr_t = u64;
884 pub type intmax_t = i64;
885 pub type uintmax_t = u64;
888 pub type off_t = i64;
889 pub type dev_t = u32;
890 pub type ino_t = u32;
891 pub type pid_t = i32;
892 pub type uid_t = u32;
893 pub type gid_t = u32;
894 pub type useconds_t = u32;
895 pub type mode_t = u16;
896 pub type ssize_t = i64;
899 use types::common::c95::{c_void};
900 use types::common::c99::{uint8_t, uint32_t, int32_t};
901 use types::os::arch::c95::{c_long, time_t};
902 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
903 use types::os::arch::posix88::{mode_t, off_t};
904 use types::os::arch::posix88::{uid_t};
906 pub type nlink_t = u16;
907 pub type blksize_t = i64;
908 pub type blkcnt_t = i64;
909 pub type fflags_t = u32;
911 #[derive(Copy)] pub struct stat {
915 pub st_nlink: nlink_t,
919 pub st_atime: time_t,
920 pub st_atime_nsec: c_long,
921 pub st_mtime: time_t,
922 pub st_mtime_nsec: c_long,
923 pub st_ctime: time_t,
924 pub st_ctime_nsec: c_long,
926 pub st_blocks: blkcnt_t,
927 pub st_blksize: blksize_t,
928 pub st_flags: fflags_t,
929 pub st_gen: uint32_t,
930 pub st_lspare: int32_t,
931 pub st_birthtime: time_t,
932 pub st_birthtime_nsec: c_long,
933 pub __unused: [uint8_t; 2],
937 #[derive(Copy)] pub struct utimbuf {
942 pub type pthread_attr_t = *mut c_void;
953 #[cfg(target_os = "dragonfly")]
957 use types::common::c95::{c_void};
958 use types::os::arch::c95::{c_char, c_int, size_t,
959 time_t, suseconds_t, c_long};
960 use types::os::arch::c99::{uintptr_t};
962 pub type pthread_t = uintptr_t;
965 #[derive(Copy)] pub struct glob_t {
966 pub gl_pathc: size_t,
967 pub __unused1: size_t,
969 pub __unused2: c_int,
970 pub gl_pathv: *mut *mut c_char,
972 pub __unused3: *mut c_void,
974 pub __unused4: *mut c_void,
975 pub __unused5: *mut c_void,
976 pub __unused6: *mut c_void,
977 pub __unused7: *mut c_void,
978 pub __unused8: *mut c_void,
982 #[derive(Copy)] pub struct timeval {
984 pub tv_usec: suseconds_t,
988 #[derive(Copy)] pub struct timespec {
993 #[derive(Copy)] pub enum timezone {}
995 pub type sighandler_t = size_t;
998 use types::common::c95::{c_void};
999 use types::os::arch::c95::{c_char, c_int, c_uint};
1001 pub type socklen_t = u32;
1002 pub type sa_family_t = u8;
1003 pub type in_port_t = u16;
1004 pub type in_addr_t = u32;
1006 #[derive(Copy)] pub struct sockaddr {
1008 pub sa_family: sa_family_t,
1009 pub sa_data: [u8; 14],
1012 #[derive(Copy)] pub struct sockaddr_storage {
1014 pub ss_family: sa_family_t,
1015 pub __ss_pad1: [u8; 6],
1016 pub __ss_align: i64,
1017 pub __ss_pad2: [u8; 112],
1020 #[derive(Copy)] pub struct sockaddr_in {
1022 pub sin_family: sa_family_t,
1023 pub sin_port: in_port_t,
1024 pub sin_addr: in_addr,
1025 pub sin_zero: [u8; 8],
1028 #[derive(Copy)] pub struct in_addr {
1029 pub s_addr: in_addr_t,
1032 #[derive(Copy)] pub struct sockaddr_in6 {
1034 pub sin6_family: sa_family_t,
1035 pub sin6_port: in_port_t,
1036 pub sin6_flowinfo: u32,
1037 pub sin6_addr: in6_addr,
1038 pub sin6_scope_id: u32,
1041 #[derive(Copy)] pub struct in6_addr {
1042 pub s6_addr: [u16; 8]
1045 #[derive(Copy)] pub struct ip_mreq {
1046 pub imr_multiaddr: in_addr,
1047 pub imr_interface: in_addr,
1050 #[derive(Copy)] pub struct ip6_mreq {
1051 pub ipv6mr_multiaddr: in6_addr,
1052 pub ipv6mr_interface: c_uint,
1055 #[derive(Copy)] pub struct addrinfo {
1056 pub ai_flags: c_int,
1057 pub ai_family: c_int,
1058 pub ai_socktype: c_int,
1059 pub ai_protocol: c_int,
1060 pub ai_addrlen: socklen_t,
1061 pub ai_canonname: *mut c_char,
1062 pub ai_addr: *mut sockaddr,
1063 pub ai_next: *mut addrinfo,
1066 #[derive(Copy)] pub struct sockaddr_un {
1068 pub sun_family: sa_family_t,
1069 pub sun_path: [c_char; 104]
1072 #[derive(Copy)] pub struct ifaddrs {
1073 pub ifa_next: *mut ifaddrs,
1074 pub ifa_name: *mut c_char,
1075 pub ifa_flags: c_uint,
1076 pub ifa_addr: *mut sockaddr,
1077 pub ifa_netmask: *mut sockaddr,
1078 pub ifa_dstaddr: *mut sockaddr,
1079 pub ifa_data: *mut c_void
1085 #[cfg(target_arch = "x86_64")]
1088 pub type c_char = i8;
1089 pub type c_schar = i8;
1090 pub type c_uchar = u8;
1091 pub type c_short = i16;
1092 pub type c_ushort = u16;
1093 pub type c_int = i32;
1094 pub type c_uint = u32;
1095 pub type c_long = i64;
1096 pub type c_ulong = u64;
1097 pub type c_float = f32;
1098 pub type c_double = f64;
1099 pub type size_t = u64;
1100 pub type ptrdiff_t = i64;
1101 pub type clock_t = i32;
1102 pub type time_t = i64;
1103 pub type suseconds_t = i64;
1104 pub type wchar_t = i32;
1107 pub type c_longlong = i64;
1108 pub type c_ulonglong = u64;
1109 pub type intptr_t = i64;
1110 pub type uintptr_t = u64;
1111 pub type intmax_t = i64;
1112 pub type uintmax_t = u64;
1115 pub type off_t = i64;
1116 pub type dev_t = u32;
1117 pub type pid_t = i32;
1118 pub type uid_t = u32;
1119 pub type gid_t = u32;
1120 pub type useconds_t = u32;
1121 pub type mode_t = u16;
1122 pub type ssize_t = i64;
1125 use types::common::c95::{c_void};
1126 use types::common::c99::{uint16_t, uint32_t, int32_t, uint64_t, int64_t};
1127 use types::os::arch::c95::{c_long, time_t};
1128 use types::os::arch::posix88::{dev_t, gid_t};
1129 use types::os::arch::posix88::{mode_t, off_t};
1130 use types::os::arch::posix88::{uid_t};
1132 pub type nlink_t = u16;
1133 pub type blksize_t = uint32_t;
1134 pub type ino_t = uint64_t;
1135 pub type blkcnt_t = i64;
1136 pub type fflags_t = u32;
1139 #[derive(Copy)] pub struct stat {
1141 pub st_nlink: nlink_t,
1143 pub st_mode: mode_t,
1144 pub st_padding1: uint16_t,
1148 pub st_atime: time_t,
1149 pub st_atime_nsec: c_long,
1150 pub st_mtime: time_t,
1151 pub st_mtime_nsec: c_long,
1152 pub st_ctime: time_t,
1153 pub st_ctime_nsec: c_long,
1155 pub st_blocks: blkcnt_t,
1156 pub st_blksize: blksize_t,
1157 pub st_flags: fflags_t,
1158 pub st_gen: uint32_t,
1159 pub st_lspare: int32_t,
1160 pub st_qspare1: int64_t,
1161 pub st_qspare2: int64_t,
1164 #[derive(Copy)] pub struct utimbuf {
1166 pub modtime: time_t,
1169 pub type pthread_attr_t = *mut c_void;
1180 #[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
1184 use types::common::c95::{c_void};
1185 use types::os::arch::c95::{c_char, c_int, size_t,
1186 time_t, suseconds_t, c_long};
1187 use types::os::arch::c99::{uintptr_t};
1189 pub type pthread_t = uintptr_t;
1191 #[cfg(target_os = "bitrig")]
1193 #[derive(Copy)] pub struct glob_t {
1194 pub gl_pathc: c_int,
1195 pub gl_matchc: c_int,
1197 pub gl_flags: c_int,
1198 pub gl_pathv: *mut *mut c_char,
1199 pub __unused1: *mut c_void,
1200 pub __unused2: *mut c_void,
1201 pub __unused3: *mut c_void,
1202 pub __unused4: *mut c_void,
1203 pub __unused5: *mut c_void,
1204 pub __unused6: *mut c_void,
1205 pub __unused7: *mut c_void,
1208 #[cfg(target_os = "openbsd")]
1210 #[derive(Copy)] pub struct glob_t {
1211 pub gl_pathc: c_int,
1212 pub __unused1: c_int,
1214 pub __unused2: c_int,
1215 pub gl_pathv: *mut *mut c_char,
1217 pub __unused3: *mut c_void,
1219 pub __unused4: *mut c_void,
1220 pub __unused5: *mut c_void,
1221 pub __unused6: *mut c_void,
1222 pub __unused7: *mut c_void,
1223 pub __unused8: *mut c_void,
1224 pub __unused9: *mut c_void,
1228 #[derive(Copy)] pub struct timeval {
1230 pub tv_usec: suseconds_t,
1234 #[derive(Copy)] pub struct timespec {
1236 pub tv_nsec: c_long,
1239 #[derive(Copy)] pub enum timezone {}
1241 pub type sighandler_t = size_t;
1244 use types::common::c95::{c_void};
1245 use types::os::arch::c95::{c_char, c_int, c_uint};
1247 pub type socklen_t = u32;
1248 pub type sa_family_t = u8;
1249 pub type in_port_t = u16;
1250 pub type in_addr_t = u32;
1252 #[derive(Copy)] pub struct sockaddr {
1254 pub sa_family: sa_family_t,
1255 pub sa_data: [u8; 14],
1258 #[derive(Copy)] pub struct sockaddr_storage {
1260 pub ss_family: sa_family_t,
1261 pub __ss_pad1: [u8; 6],
1263 pub __ss_pad3: [u8; 240],
1266 #[derive(Copy)] pub struct sockaddr_in {
1268 pub sin_family: sa_family_t,
1269 pub sin_port: in_port_t,
1270 pub sin_addr: in_addr,
1271 pub sin_zero: [u8; 8],
1274 #[derive(Copy)] pub struct in_addr {
1275 pub s_addr: in_addr_t,
1278 #[derive(Copy)] pub struct sockaddr_in6 {
1280 pub sin6_family: sa_family_t,
1281 pub sin6_port: in_port_t,
1282 pub sin6_flowinfo: u32,
1283 pub sin6_addr: in6_addr,
1284 pub sin6_scope_id: u32,
1287 #[derive(Copy)] pub struct in6_addr {
1288 pub s6_addr: [u16; 8]
1291 #[derive(Copy)] pub struct ip_mreq {
1292 pub imr_multiaddr: in_addr,
1293 pub imr_interface: in_addr,
1296 #[derive(Copy)] pub struct ip6_mreq {
1297 pub ipv6mr_multiaddr: in6_addr,
1298 pub ipv6mr_interface: c_uint,
1301 #[derive(Copy)] pub struct addrinfo {
1302 pub ai_flags: c_int,
1303 pub ai_family: c_int,
1304 pub ai_socktype: c_int,
1305 pub ai_protocol: c_int,
1306 pub ai_addrlen: socklen_t,
1307 pub ai_addr: *mut sockaddr,
1308 pub ai_canonname: *mut c_char,
1309 pub ai_next: *mut addrinfo,
1312 #[derive(Copy)] pub struct sockaddr_un {
1314 pub sun_family: sa_family_t,
1315 pub sun_path: [c_char; 104]
1318 #[derive(Copy)] pub struct ifaddrs {
1319 pub ifa_next: *mut ifaddrs,
1320 pub ifa_name: *mut c_char,
1321 pub ifa_flags: c_uint,
1322 pub ifa_addr: *mut sockaddr,
1323 pub ifa_netmask: *mut sockaddr,
1324 pub ifa_dstaddr: *mut sockaddr,
1325 pub ifa_data: *mut c_void
1330 #[cfg(target_arch = "x86_64")]
1333 pub type c_char = i8;
1334 pub type c_schar = i8;
1335 pub type c_uchar = u8;
1336 pub type c_short = i16;
1337 pub type c_ushort = u16;
1338 pub type c_int = i32;
1339 pub type c_uint = u32;
1340 pub type c_long = i64;
1341 pub type c_ulong = u64;
1342 pub type c_float = f32;
1343 pub type c_double = f64;
1344 pub type size_t = u64;
1345 pub type ptrdiff_t = i64;
1346 pub type clock_t = i64;
1347 pub type time_t = i64;
1348 pub type suseconds_t = i64;
1349 pub type wchar_t = i32;
1352 pub type c_longlong = i64;
1353 pub type c_ulonglong = u64;
1354 pub type intptr_t = i64;
1355 pub type uintptr_t = u64;
1356 pub type intmax_t = i64;
1357 pub type uintmax_t = u64;
1360 use types::os::arch::c95::{c_long};
1361 pub type off_t = i64;
1362 pub type dev_t = i32;
1363 pub type pid_t = i32;
1364 pub type uid_t = u32;
1365 pub type gid_t = u32;
1366 pub type useconds_t = u32;
1367 pub type mode_t = u32;
1368 pub type ssize_t = c_long;
1371 use types::common::c95::{c_void};
1372 use types::common::c99::{uint32_t, uint64_t};
1373 use types::os::arch::c95::{c_long, time_t};
1374 use types::os::arch::posix88::{dev_t, gid_t};
1375 use types::os::arch::posix88::{mode_t, off_t};
1376 use types::os::arch::posix88::{uid_t};
1378 pub type nlink_t = uint32_t;
1379 pub type blksize_t = uint32_t;
1380 pub type ino_t = uint64_t;
1381 pub type blkcnt_t = i64;
1382 pub type fflags_t = u32; // type not declared, but struct stat have u_int32_t
1385 #[derive(Copy)] pub struct stat {
1386 pub st_mode: mode_t,
1389 pub st_nlink: nlink_t,
1393 pub st_atime: time_t,
1394 pub st_atime_nsec: c_long,
1395 pub st_mtime: time_t,
1396 pub st_mtime_nsec: c_long,
1397 pub st_ctime: time_t,
1398 pub st_ctime_nsec: c_long,
1400 pub st_blocks: blkcnt_t,
1401 pub st_blksize: blksize_t,
1402 pub st_flags: fflags_t,
1403 pub st_gen: uint32_t,
1404 pub st_birthtime: time_t,
1405 pub st_birthtime_nsec: c_long,
1408 #[derive(Copy)] pub struct utimbuf {
1410 pub modtime: time_t,
1413 pub type pthread_attr_t = *mut c_void;
1424 #[cfg(target_os = "windows")]
1428 use types::os::arch::c95::{c_short, time_t, c_long};
1429 use types::os::arch::extra::{int64, time64_t};
1430 use types::os::arch::posix88::{dev_t, ino_t};
1432 // pub Note: this is the struct called stat64 in Windows. Not stat,
1435 #[derive(Copy)] pub struct stat {
1439 pub st_nlink: c_short,
1440 pub st_uid: c_short,
1441 pub st_gid: c_short,
1444 pub st_atime: time64_t,
1445 pub st_mtime: time64_t,
1446 pub st_ctime: time64_t,
1449 // note that this is called utimbuf64 in Windows
1451 #[derive(Copy)] pub struct utimbuf {
1452 pub actime: time64_t,
1453 pub modtime: time64_t,
1457 #[derive(Copy)] pub struct timeval {
1459 pub tv_usec: c_long,
1463 #[derive(Copy)] pub struct timespec {
1465 pub tv_nsec: c_long,
1468 #[derive(Copy)] pub enum timezone {}
1472 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1473 use types::os::arch::c99::uintptr_t;
1475 pub type SOCKET = uintptr_t;
1476 pub type socklen_t = c_int;
1477 pub type sa_family_t = u16;
1478 pub type in_port_t = u16;
1479 pub type in_addr_t = u32;
1481 #[derive(Copy)] pub struct sockaddr {
1482 pub sa_family: sa_family_t,
1483 pub sa_data: [u8; 14],
1486 #[derive(Copy)] pub struct sockaddr_storage {
1487 pub ss_family: sa_family_t,
1488 pub __ss_pad1: [u8; 6],
1489 pub __ss_align: i64,
1490 pub __ss_pad2: [u8; 112],
1493 #[derive(Copy)] pub struct sockaddr_in {
1494 pub sin_family: sa_family_t,
1495 pub sin_port: in_port_t,
1496 pub sin_addr: in_addr,
1497 pub sin_zero: [u8; 8],
1500 #[derive(Copy)] pub struct in_addr {
1501 pub s_addr: in_addr_t,
1504 #[derive(Copy)] pub struct sockaddr_in6 {
1505 pub sin6_family: sa_family_t,
1506 pub sin6_port: in_port_t,
1507 pub sin6_flowinfo: u32,
1508 pub sin6_addr: in6_addr,
1509 pub sin6_scope_id: u32,
1512 #[derive(Copy)] pub struct in6_addr {
1513 pub s6_addr: [u16; 8]
1516 #[derive(Copy)] pub struct ip_mreq {
1517 pub imr_multiaddr: in_addr,
1518 pub imr_interface: in_addr,
1521 #[derive(Copy)] pub struct ip6_mreq {
1522 pub ipv6mr_multiaddr: in6_addr,
1523 pub ipv6mr_interface: c_uint,
1526 #[derive(Copy)] pub struct addrinfo {
1527 pub ai_flags: c_int,
1528 pub ai_family: c_int,
1529 pub ai_socktype: c_int,
1530 pub ai_protocol: c_int,
1531 pub ai_addrlen: size_t,
1532 pub ai_canonname: *mut c_char,
1533 pub ai_addr: *mut sockaddr,
1534 pub ai_next: *mut addrinfo,
1537 #[derive(Copy)] pub struct sockaddr_un {
1538 pub sun_family: sa_family_t,
1539 pub sun_path: [c_char; 108]
1546 pub type c_char = i8;
1547 pub type c_schar = i8;
1548 pub type c_uchar = u8;
1549 pub type c_short = i16;
1550 pub type c_ushort = u16;
1551 pub type c_int = i32;
1552 pub type c_uint = u32;
1553 pub type c_long = i32;
1554 pub type c_ulong = u32;
1555 pub type c_float = f32;
1556 pub type c_double = f64;
1558 #[cfg(target_arch = "x86")]
1559 pub type size_t = u32;
1560 #[cfg(target_arch = "x86_64")]
1561 pub type size_t = u64;
1563 #[cfg(target_arch = "x86")]
1564 pub type ptrdiff_t = i32;
1565 #[cfg(target_arch = "x86_64")]
1566 pub type ptrdiff_t = i64;
1568 pub type clock_t = i32;
1570 #[cfg(target_arch = "x86")]
1571 pub type time_t = i32;
1572 #[cfg(target_arch = "x86_64")]
1573 pub type time_t = i64;
1575 #[cfg(target_arch = "x86")]
1576 pub type suseconds_t = i32;
1577 #[cfg(target_arch = "x86_64")]
1578 pub type suseconds_t = i64;
1580 pub type wchar_t = u16;
1584 pub type c_longlong = i64;
1585 pub type c_ulonglong = u64;
1587 #[cfg(target_arch = "x86")]
1588 pub type intptr_t = i32;
1589 #[cfg(target_arch = "x86_64")]
1590 pub type intptr_t = i64;
1592 #[cfg(target_arch = "x86")]
1593 pub type uintptr_t = u32;
1594 #[cfg(target_arch = "x86_64")]
1595 pub type uintptr_t = u64;
1597 pub type intmax_t = i64;
1598 pub type uintmax_t = u64;
1602 pub type off_t = i32;
1603 pub type dev_t = u32;
1604 pub type ino_t = u16;
1606 pub type pid_t = u32;
1608 pub type useconds_t = u32;
1609 pub type mode_t = u16;
1611 #[cfg(target_arch = "x86")]
1612 pub type ssize_t = i32;
1613 #[cfg(target_arch = "x86_64")]
1614 pub type ssize_t = i64;
1624 use consts::os::extra::{MAX_PROTOCOL_CHAIN,
1626 use types::common::c95::c_void;
1627 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1628 use types::os::arch::c95::{c_long, c_ulong};
1629 use types::os::arch::c95::{wchar_t};
1630 use types::os::arch::c99::{c_ulonglong, c_longlong, uintptr_t};
1632 pub type BOOL = c_int;
1634 pub type BOOLEAN = BYTE;
1635 pub type CCHAR = c_char;
1636 pub type CHAR = c_char;
1638 pub type DWORD = c_ulong;
1639 pub type DWORDLONG = c_ulonglong;
1641 pub type HANDLE = LPVOID;
1642 pub type HINSTANCE = HANDLE;
1643 pub type HMODULE = HINSTANCE;
1645 pub type LONG = c_long;
1646 pub type PLONG = *mut c_long;
1648 #[cfg(target_arch = "x86")]
1649 pub type LONG_PTR = c_long;
1650 #[cfg(target_arch = "x86_64")]
1651 pub type LONG_PTR = i64;
1653 pub type LARGE_INTEGER = c_longlong;
1654 pub type PLARGE_INTEGER = *mut c_longlong;
1656 pub type LPCWSTR = *const WCHAR;
1657 pub type LPCSTR = *const CHAR;
1659 pub type LPWSTR = *mut WCHAR;
1660 pub type LPSTR = *mut CHAR;
1662 pub type LPWCH = *mut WCHAR;
1663 pub type LPCH = *mut CHAR;
1666 #[derive(Copy)] pub struct SECURITY_ATTRIBUTES {
1668 pub lpSecurityDescriptor: LPVOID,
1669 pub bInheritHandle: BOOL,
1671 pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
1673 pub type LPVOID = *mut c_void;
1674 pub type LPCVOID = *const c_void;
1675 pub type LPBYTE = *mut BYTE;
1676 pub type LPWORD = *mut WORD;
1677 pub type LPDWORD = *mut DWORD;
1678 pub type LPHANDLE = *mut HANDLE;
1680 pub type LRESULT = LONG_PTR;
1681 pub type PBOOL = *mut BOOL;
1682 pub type WCHAR = wchar_t;
1683 pub type WORD = u16;
1684 pub type SIZE_T = size_t;
1686 pub type time64_t = i64;
1687 pub type int64 = i64;
1690 #[derive(Copy)] pub struct STARTUPINFO {
1692 pub lpReserved: LPWSTR,
1693 pub lpDesktop: LPWSTR,
1694 pub lpTitle: LPWSTR,
1699 pub dwXCountChars: DWORD,
1700 pub dwYCountCharts: DWORD,
1701 pub dwFillAttribute: DWORD,
1703 pub wShowWindow: WORD,
1704 pub cbReserved2: WORD,
1705 pub lpReserved2: LPBYTE,
1706 pub hStdInput: HANDLE,
1707 pub hStdOutput: HANDLE,
1708 pub hStdError: HANDLE,
1710 pub type LPSTARTUPINFO = *mut STARTUPINFO;
1713 #[derive(Copy)] pub struct PROCESS_INFORMATION {
1714 pub hProcess: HANDLE,
1715 pub hThread: HANDLE,
1716 pub dwProcessId: DWORD,
1717 pub dwThreadId: DWORD,
1719 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
1722 #[derive(Copy)] pub struct SYSTEM_INFO {
1723 pub wProcessorArchitecture: WORD,
1724 pub wReserved: WORD,
1725 pub dwPageSize: DWORD,
1726 pub lpMinimumApplicationAddress: LPVOID,
1727 pub lpMaximumApplicationAddress: LPVOID,
1728 pub dwActiveProcessorMask: uintptr_t,
1729 pub dwNumberOfProcessors: DWORD,
1730 pub dwProcessorType: DWORD,
1731 pub dwAllocationGranularity: DWORD,
1732 pub wProcessorLevel: WORD,
1733 pub wProcessorRevision: WORD,
1735 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
1738 #[derive(Copy)] pub struct MEMORY_BASIC_INFORMATION {
1739 pub BaseAddress: LPVOID,
1740 pub AllocationBase: LPVOID,
1741 pub AllocationProtect: DWORD,
1742 pub RegionSize: SIZE_T,
1747 pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
1750 #[derive(Copy)] pub struct OVERLAPPED {
1751 pub Internal: *mut c_ulong,
1752 pub InternalHigh: *mut c_ulong,
1754 pub OffsetHigh: DWORD,
1758 pub type LPOVERLAPPED = *mut OVERLAPPED;
1761 #[derive(Copy)] pub struct FILETIME {
1762 pub dwLowDateTime: DWORD,
1763 pub dwHighDateTime: DWORD,
1766 pub type LPFILETIME = *mut FILETIME;
1769 #[derive(Copy)] pub struct GUID {
1773 pub Data4: [BYTE; 8],
1777 #[derive(Copy)] pub struct WSAPROTOCOLCHAIN {
1778 pub ChainLen: c_int,
1779 pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as usize],
1782 pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
1785 #[derive(Copy)] pub struct WSAPROTOCOL_INFO {
1786 pub dwServiceFlags1: DWORD,
1787 pub dwServiceFlags2: DWORD,
1788 pub dwServiceFlags3: DWORD,
1789 pub dwServiceFlags4: DWORD,
1790 pub dwProviderFlags: DWORD,
1791 pub ProviderId: GUID,
1792 pub dwCatalogEntryId: DWORD,
1793 pub ProtocolChain: WSAPROTOCOLCHAIN,
1794 pub iVersion: c_int,
1795 pub iAddressFamily: c_int,
1796 pub iMaxSockAddr: c_int,
1797 pub iMinSockAddr: c_int,
1798 pub iSocketType: c_int,
1799 pub iProtocol: c_int,
1800 pub iProtocolMaxOffset: c_int,
1801 pub iNetworkByteOrder: c_int,
1802 pub iSecurityScheme: c_int,
1803 pub dwMessageSize: DWORD,
1804 pub dwProviderReserved: DWORD,
1805 pub szProtocol: [u8; WSAPROTOCOL_LEN as usize + 1],
1808 pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
1810 pub type GROUP = c_uint;
1813 #[derive(Copy)] pub struct WIN32_FIND_DATAW {
1814 pub dwFileAttributes: DWORD,
1815 pub ftCreationTime: FILETIME,
1816 pub ftLastAccessTime: FILETIME,
1817 pub ftLastWriteTime: FILETIME,
1818 pub nFileSizeHigh: DWORD,
1819 pub nFileSizeLow: DWORD,
1820 pub dwReserved0: DWORD,
1821 pub dwReserved1: DWORD,
1822 pub cFileName: [wchar_t; 260], // #define MAX_PATH 260
1823 pub cAlternateFileName: [wchar_t; 14],
1826 pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
1831 #[cfg(any(target_os = "macos", target_os = "ios"))]
1835 use types::common::c95::c_void;
1836 use types::os::arch::c95::{c_char, c_int, size_t, time_t};
1837 use types::os::arch::c95::{suseconds_t, c_long};
1838 use types::os::arch::c99::{uintptr_t};
1840 pub type pthread_t = uintptr_t;
1843 #[derive(Copy)] pub struct glob_t {
1844 pub gl_pathc: size_t,
1845 pub __unused1: c_int,
1846 pub gl_offs: size_t,
1847 pub __unused2: c_int,
1848 pub gl_pathv: *mut *mut c_char,
1850 pub __unused3: *mut c_void,
1852 pub __unused4: *mut c_void,
1853 pub __unused5: *mut c_void,
1854 pub __unused6: *mut c_void,
1855 pub __unused7: *mut c_void,
1856 pub __unused8: *mut c_void,
1860 #[derive(Copy)] pub struct timeval {
1862 pub tv_usec: suseconds_t,
1866 #[derive(Copy)] pub struct timespec {
1868 pub tv_nsec: c_long,
1871 #[derive(Copy)] pub enum timezone {}
1873 pub type sighandler_t = size_t;
1877 use types::common::c95::{c_void};
1878 use types::os::arch::c95::{c_char, c_int, c_uint};
1880 pub type socklen_t = u32;
1881 pub type sa_family_t = u8;
1882 pub type in_port_t = u16;
1883 pub type in_addr_t = u32;
1885 #[derive(Copy)] pub struct sockaddr {
1887 pub sa_family: sa_family_t,
1888 pub sa_data: [u8; 14],
1892 #[derive(Copy)] pub struct sockaddr_storage {
1894 pub ss_family: sa_family_t,
1895 pub __ss_pad1: [u8; 6],
1896 pub __ss_align: i64,
1897 pub __ss_pad2: [u8; 112],
1901 #[derive(Copy)] pub struct sockaddr_in {
1903 pub sin_family: sa_family_t,
1904 pub sin_port: in_port_t,
1905 pub sin_addr: in_addr,
1906 pub sin_zero: [u8; 8],
1910 #[derive(Copy)] pub struct in_addr {
1911 pub s_addr: in_addr_t,
1915 #[derive(Copy)] pub struct sockaddr_in6 {
1917 pub sin6_family: sa_family_t,
1918 pub sin6_port: in_port_t,
1919 pub sin6_flowinfo: u32,
1920 pub sin6_addr: in6_addr,
1921 pub sin6_scope_id: u32,
1925 #[derive(Copy)] pub struct in6_addr {
1926 pub s6_addr: [u16; 8]
1930 #[derive(Copy)] pub struct ip_mreq {
1931 pub imr_multiaddr: in_addr,
1932 pub imr_interface: in_addr,
1936 #[derive(Copy)] pub struct ip6_mreq {
1937 pub ipv6mr_multiaddr: in6_addr,
1938 pub ipv6mr_interface: c_uint,
1942 #[derive(Copy)] pub struct addrinfo {
1943 pub ai_flags: c_int,
1944 pub ai_family: c_int,
1945 pub ai_socktype: c_int,
1946 pub ai_protocol: c_int,
1947 pub ai_addrlen: socklen_t,
1948 pub ai_canonname: *mut c_char,
1949 pub ai_addr: *mut sockaddr,
1950 pub ai_next: *mut addrinfo,
1954 #[derive(Copy)] pub struct sockaddr_un {
1956 pub sun_family: sa_family_t,
1957 pub sun_path: [c_char; 104]
1961 #[derive(Copy)] pub struct ifaddrs {
1962 pub ifa_next: *mut ifaddrs,
1963 pub ifa_name: *mut c_char,
1964 pub ifa_flags: c_uint,
1965 pub ifa_addr: *mut sockaddr,
1966 pub ifa_netmask: *mut sockaddr,
1967 pub ifa_dstaddr: *mut sockaddr,
1968 pub ifa_data: *mut c_void
1973 #[cfg(any(target_arch = "arm", target_arch = "x86"))]
1976 pub type c_char = i8;
1977 pub type c_schar = i8;
1978 pub type c_uchar = u8;
1979 pub type c_short = i16;
1980 pub type c_ushort = u16;
1981 pub type c_int = i32;
1982 pub type c_uint = u32;
1983 pub type c_long = i32;
1984 pub type c_ulong = u32;
1985 pub type c_float = f32;
1986 pub type c_double = f64;
1987 pub type size_t = u32;
1988 pub type ptrdiff_t = i32;
1989 pub type clock_t = c_ulong;
1990 pub type time_t = c_long;
1991 pub type suseconds_t = i32;
1992 pub type wchar_t = i32;
1995 pub type c_longlong = i64;
1996 pub type c_ulonglong = u64;
1997 pub type intptr_t = i32;
1998 pub type uintptr_t = u32;
1999 pub type intmax_t = i64;
2000 pub type uintmax_t = u64;
2003 use types::os::arch::c95::c_long;
2005 pub type off_t = i64;
2006 pub type dev_t = i32;
2007 pub type ino_t = u64;
2008 pub type pid_t = i32;
2009 pub type uid_t = u32;
2010 pub type gid_t = u32;
2011 pub type useconds_t = u32;
2012 pub type mode_t = u16;
2013 pub type ssize_t = c_long;
2016 use types::common::c99::{int32_t, int64_t, uint32_t};
2017 use types::os::arch::c95::{c_char, c_long, time_t};
2018 use types::os::arch::posix88::{dev_t, gid_t, ino_t,
2019 mode_t, off_t, uid_t};
2021 pub type nlink_t = u16;
2022 pub type blksize_t = i32;
2023 pub type blkcnt_t = i64;
2026 #[derive(Copy)] pub struct stat {
2028 pub st_mode: mode_t,
2029 pub st_nlink: nlink_t,
2034 pub st_atime: time_t,
2035 pub st_atime_nsec: c_long,
2036 pub st_mtime: time_t,
2037 pub st_mtime_nsec: c_long,
2038 pub st_ctime: time_t,
2039 pub st_ctime_nsec: c_long,
2040 pub st_birthtime: time_t,
2041 pub st_birthtime_nsec: c_long,
2043 pub st_blocks: blkcnt_t,
2044 pub st_blksize: blksize_t,
2045 pub st_flags: uint32_t,
2046 pub st_gen: uint32_t,
2047 pub st_lspare: int32_t,
2048 pub st_qspare: [int64_t; 2],
2052 #[derive(Copy)] pub struct utimbuf {
2054 pub modtime: time_t,
2058 #[derive(Copy)] pub struct pthread_attr_t {
2060 pub __opaque: [c_char; 36]
2069 #[derive(Copy)] pub struct mach_timebase_info {
2074 pub type mach_timebase_info_data_t = mach_timebase_info;
2078 #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
2081 pub type c_char = i8;
2082 pub type c_schar = i8;
2083 pub type c_uchar = u8;
2084 pub type c_short = i16;
2085 pub type c_ushort = u16;
2086 pub type c_int = i32;
2087 pub type c_uint = u32;
2088 pub type c_long = i64;
2089 pub type c_ulong = u64;
2090 pub type c_float = f32;
2091 pub type c_double = f64;
2092 pub type size_t = u64;
2093 pub type ptrdiff_t = i64;
2094 pub type clock_t = c_ulong;
2095 pub type time_t = c_long;
2096 pub type suseconds_t = i32;
2097 pub type wchar_t = i32;
2100 pub type c_longlong = i64;
2101 pub type c_ulonglong = u64;
2102 pub type intptr_t = i64;
2103 pub type uintptr_t = u64;
2104 pub type intmax_t = i64;
2105 pub type uintmax_t = u64;
2108 use types::os::arch::c95::c_long;
2110 pub type off_t = i64;
2111 pub type dev_t = i32;
2112 pub type ino_t = u64;
2113 pub type pid_t = i32;
2114 pub type uid_t = u32;
2115 pub type gid_t = u32;
2116 pub type useconds_t = u32;
2117 pub type mode_t = u16;
2118 pub type ssize_t = c_long;
2121 use types::common::c99::{int32_t, int64_t};
2122 use types::common::c99::{uint32_t};
2123 use types::os::arch::c95::{c_char, c_long, time_t};
2124 use types::os::arch::posix88::{dev_t, gid_t, ino_t};
2125 use types::os::arch::posix88::{mode_t, off_t, uid_t};
2127 pub type nlink_t = u16;
2128 pub type blksize_t = i32;
2129 pub type blkcnt_t = i64;
2132 #[derive(Copy)] pub struct stat {
2134 pub st_mode: mode_t,
2135 pub st_nlink: nlink_t,
2140 pub st_atime: time_t,
2141 pub st_atime_nsec: c_long,
2142 pub st_mtime: time_t,
2143 pub st_mtime_nsec: c_long,
2144 pub st_ctime: time_t,
2145 pub st_ctime_nsec: c_long,
2146 pub st_birthtime: time_t,
2147 pub st_birthtime_nsec: c_long,
2149 pub st_blocks: blkcnt_t,
2150 pub st_blksize: blksize_t,
2151 pub st_flags: uint32_t,
2152 pub st_gen: uint32_t,
2153 pub st_lspare: int32_t,
2154 pub st_qspare: [int64_t; 2],
2158 #[derive(Copy)] pub struct utimbuf {
2160 pub modtime: time_t,
2164 #[derive(Copy)] pub struct pthread_attr_t {
2166 pub __opaque: [c_char; 56]
2175 #[derive(Copy)] pub struct mach_timebase_info {
2180 pub type mach_timebase_info_data_t = mach_timebase_info;
2187 // Consts tend to vary per OS so we pull their definitions out
2188 // into this module.
2190 #[cfg(target_os = "windows")]
2193 use types::os::arch::c95::{c_int, c_uint};
2195 pub const EXIT_FAILURE : c_int = 1;
2196 pub const EXIT_SUCCESS : c_int = 0;
2197 pub const RAND_MAX : c_int = 32767;
2198 pub const EOF : c_int = -1;
2199 pub const SEEK_SET : c_int = 0;
2200 pub const SEEK_CUR : c_int = 1;
2201 pub const SEEK_END : c_int = 2;
2202 pub const _IOFBF : c_int = 0;
2203 pub const _IONBF : c_int = 4;
2204 pub const _IOLBF : c_int = 64;
2205 pub const BUFSIZ : c_uint = 512;
2206 pub const FOPEN_MAX : c_uint = 20;
2207 pub const FILENAME_MAX : c_uint = 260;
2208 pub const L_tmpnam : c_uint = 16;
2209 pub const TMP_MAX : c_uint = 32767;
2211 pub const WSAEINTR: c_int = 10004;
2212 pub const WSAEBADF: c_int = 10009;
2213 pub const WSAEACCES: c_int = 10013;
2214 pub const WSAEFAULT: c_int = 10014;
2215 pub const WSAEINVAL: c_int = 10022;
2216 pub const WSAEMFILE: c_int = 10024;
2217 pub const WSAEWOULDBLOCK: c_int = 10035;
2218 pub const WSAEINPROGRESS: c_int = 10036;
2219 pub const WSAEALREADY: c_int = 10037;
2220 pub const WSAENOTSOCK: c_int = 10038;
2221 pub const WSAEDESTADDRREQ: c_int = 10039;
2222 pub const WSAEMSGSIZE: c_int = 10040;
2223 pub const WSAEPROTOTYPE: c_int = 10041;
2224 pub const WSAENOPROTOOPT: c_int = 10042;
2225 pub const WSAEPROTONOSUPPORT: c_int = 10043;
2226 pub const WSAESOCKTNOSUPPORT: c_int = 10044;
2227 pub const WSAEOPNOTSUPP: c_int = 10045;
2228 pub const WSAEPFNOSUPPORT: c_int = 10046;
2229 pub const WSAEAFNOSUPPORT: c_int = 10047;
2230 pub const WSAEADDRINUSE: c_int = 10048;
2231 pub const WSAEADDRNOTAVAIL: c_int = 10049;
2232 pub const WSAENETDOWN: c_int = 10050;
2233 pub const WSAENETUNREACH: c_int = 10051;
2234 pub const WSAENETRESET: c_int = 10052;
2235 pub const WSAECONNABORTED: c_int = 10053;
2236 pub const WSAECONNRESET: c_int = 10054;
2237 pub const WSAENOBUFS: c_int = 10055;
2238 pub const WSAEISCONN: c_int = 10056;
2239 pub const WSAENOTCONN: c_int = 10057;
2240 pub const WSAESHUTDOWN: c_int = 10058;
2241 pub const WSAETOOMANYREFS: c_int = 10059;
2242 pub const WSAETIMEDOUT: c_int = 10060;
2243 pub const WSAECONNREFUSED: c_int = 10061;
2244 pub const WSAELOOP: c_int = 10062;
2245 pub const WSAENAMETOOLONG: c_int = 10063;
2246 pub const WSAEHOSTDOWN: c_int = 10064;
2247 pub const WSAEHOSTUNREACH: c_int = 10065;
2248 pub const WSAENOTEMPTY: c_int = 10066;
2249 pub const WSAEPROCLIM: c_int = 10067;
2250 pub const WSAEUSERS: c_int = 10068;
2251 pub const WSAEDQUOT: c_int = 10069;
2252 pub const WSAESTALE: c_int = 10070;
2253 pub const WSAEREMOTE: c_int = 10071;
2254 pub const WSASYSNOTREADY: c_int = 10091;
2255 pub const WSAVERNOTSUPPORTED: c_int = 10092;
2256 pub const WSANOTINITIALISED: c_int = 10093;
2257 pub const WSAEDISCON: c_int = 10101;
2258 pub const WSAENOMORE: c_int = 10102;
2259 pub const WSAECANCELLED: c_int = 10103;
2260 pub const WSAEINVALIDPROCTABLE: c_int = 10104;
2261 pub const WSAEINVALIDPROVIDER: c_int = 10105;
2262 pub const WSAEPROVIDERFAILEDINIT: c_int = 10106;
2267 use types::os::arch::c95::c_int;
2269 pub const O_RDONLY : c_int = 0;
2270 pub const O_WRONLY : c_int = 1;
2271 pub const O_RDWR : c_int = 2;
2272 pub const O_APPEND : c_int = 8;
2273 pub const O_CREAT : c_int = 256;
2274 pub const O_EXCL : c_int = 1024;
2275 pub const O_TRUNC : c_int = 512;
2276 pub const S_IFIFO : c_int = 4096;
2277 pub const S_IFCHR : c_int = 8192;
2278 pub const S_IFBLK : c_int = 12288;
2279 pub const S_IFDIR : c_int = 16384;
2280 pub const S_IFREG : c_int = 32768;
2281 pub const S_IFLNK : c_int = 40960;
2282 pub const S_IFMT : c_int = 61440;
2283 pub const S_IEXEC : c_int = 64;
2284 pub const S_IWRITE : c_int = 128;
2285 pub const S_IREAD : c_int = 256;
2286 pub const S_IRWXU : c_int = 448;
2287 pub const S_IXUSR : c_int = 64;
2288 pub const S_IWUSR : c_int = 128;
2289 pub const S_IRUSR : c_int = 256;
2290 pub const F_OK : c_int = 0;
2291 pub const R_OK : c_int = 4;
2292 pub const W_OK : c_int = 2;
2293 pub const X_OK : c_int = 1;
2294 pub const STDIN_FILENO : c_int = 0;
2295 pub const STDOUT_FILENO : c_int = 1;
2296 pub const STDERR_FILENO : c_int = 2;
2303 use types::os::arch::c95::c_int;
2305 pub const AF_INET: c_int = 2;
2306 pub const AF_INET6: c_int = 23;
2307 pub const SOCK_STREAM: c_int = 1;
2308 pub const SOCK_DGRAM: c_int = 2;
2309 pub const SOCK_RAW: c_int = 3;
2310 pub const IPPROTO_TCP: c_int = 6;
2311 pub const IPPROTO_IP: c_int = 0;
2312 pub const IPPROTO_IPV6: c_int = 41;
2313 pub const IP_MULTICAST_TTL: c_int = 10;
2314 pub const IP_MULTICAST_LOOP: c_int = 11;
2315 pub const IP_ADD_MEMBERSHIP: c_int = 12;
2316 pub const IP_DROP_MEMBERSHIP: c_int = 13;
2317 pub const IPV6_ADD_MEMBERSHIP: c_int = 5;
2318 pub const IPV6_DROP_MEMBERSHIP: c_int = 6;
2319 pub const IP_TTL: c_int = 4;
2320 pub const IP_HDRINCL: c_int = 2;
2322 pub const TCP_NODELAY: c_int = 0x0001;
2323 pub const SOL_SOCKET: c_int = 0xffff;
2324 pub const SO_KEEPALIVE: c_int = 8;
2325 pub const SO_BROADCAST: c_int = 32;
2326 pub const SO_REUSEADDR: c_int = 4;
2327 pub const SO_ERROR: c_int = 0x1007;
2329 pub const IFF_LOOPBACK: c_int = 4;
2331 pub const SHUT_RD: c_int = 0;
2332 pub const SHUT_WR: c_int = 1;
2333 pub const SHUT_RDWR: c_int = 2;
2336 use types::os::common::bsd44::SOCKET;
2337 use types::os::arch::c95::{c_int, c_long};
2338 use types::os::arch::extra::{WORD, DWORD, BOOL, HANDLE};
2340 pub const TRUE : BOOL = 1;
2341 pub const FALSE : BOOL = 0;
2343 pub const O_TEXT : c_int = 16384;
2344 pub const O_BINARY : c_int = 32768;
2345 pub const O_NOINHERIT: c_int = 128;
2347 pub const ERROR_SUCCESS : c_int = 0;
2348 pub const ERROR_INVALID_FUNCTION: c_int = 1;
2349 pub const ERROR_FILE_NOT_FOUND: c_int = 2;
2350 pub const ERROR_ACCESS_DENIED: c_int = 5;
2351 pub const ERROR_INVALID_HANDLE : c_int = 6;
2352 pub const ERROR_BROKEN_PIPE: c_int = 109;
2353 pub const ERROR_DISK_FULL : c_int = 112;
2354 pub const ERROR_CALL_NOT_IMPLEMENTED : c_int = 120;
2355 pub const ERROR_INSUFFICIENT_BUFFER : c_int = 122;
2356 pub const ERROR_INVALID_NAME : c_int = 123;
2357 pub const ERROR_ALREADY_EXISTS : c_int = 183;
2358 pub const ERROR_PIPE_BUSY: c_int = 231;
2359 pub const ERROR_NO_DATA: c_int = 232;
2360 pub const ERROR_INVALID_ADDRESS : c_int = 487;
2361 pub const ERROR_PIPE_CONNECTED: c_int = 535;
2362 pub const ERROR_NOTHING_TO_TERMINATE: c_int = 758;
2363 pub const ERROR_OPERATION_ABORTED: c_int = 995;
2364 pub const ERROR_IO_PENDING: c_int = 997;
2365 pub const ERROR_FILE_INVALID : c_int = 1006;
2366 pub const ERROR_NOT_FOUND: c_int = 1168;
2367 pub const INVALID_HANDLE_VALUE: HANDLE = -1 as HANDLE;
2369 pub const DELETE : DWORD = 0x00010000;
2370 pub const READ_CONTROL : DWORD = 0x00020000;
2371 pub const SYNCHRONIZE : DWORD = 0x00100000;
2372 pub const WRITE_DAC : DWORD = 0x00040000;
2373 pub const WRITE_OWNER : DWORD = 0x00080000;
2375 pub const PROCESS_CREATE_PROCESS : DWORD = 0x0080;
2376 pub const PROCESS_CREATE_THREAD : DWORD = 0x0002;
2377 pub const PROCESS_DUP_HANDLE : DWORD = 0x0040;
2378 pub const PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
2379 pub const PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
2380 pub const PROCESS_SET_INFORMATION : DWORD = 0x0200;
2381 pub const PROCESS_SET_QUOTA : DWORD = 0x0100;
2382 pub const PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
2383 pub const PROCESS_TERMINATE : DWORD = 0x0001;
2384 pub const PROCESS_VM_OPERATION : DWORD = 0x0008;
2385 pub const PROCESS_VM_READ : DWORD = 0x0010;
2386 pub const PROCESS_VM_WRITE : DWORD = 0x0020;
2388 pub const STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
2389 pub const STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
2390 pub const STARTF_PREVENTPINNING : DWORD = 0x00002000;
2391 pub const STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
2392 pub const STARTF_TITLEISAPPID : DWORD = 0x00001000;
2393 pub const STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
2394 pub const STARTF_USECOUNTCHARS : DWORD = 0x00000008;
2395 pub const STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
2396 pub const STARTF_USEHOTKEY : DWORD = 0x00000200;
2397 pub const STARTF_USEPOSITION : DWORD = 0x00000004;
2398 pub const STARTF_USESHOWWINDOW : DWORD = 0x00000001;
2399 pub const STARTF_USESIZE : DWORD = 0x00000002;
2400 pub const STARTF_USESTDHANDLES : DWORD = 0x00000100;
2402 pub const WAIT_ABANDONED : DWORD = 0x00000080;
2403 pub const WAIT_OBJECT_0 : DWORD = 0x00000000;
2404 pub const WAIT_TIMEOUT : DWORD = 0x00000102;
2405 pub const WAIT_FAILED : DWORD = -1;
2407 pub const DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
2408 pub const DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;
2410 pub const INFINITE : DWORD = -1;
2411 pub const STILL_ACTIVE : DWORD = 259;
2413 pub const MEM_COMMIT : DWORD = 0x00001000;
2414 pub const MEM_RESERVE : DWORD = 0x00002000;
2415 pub const MEM_DECOMMIT : DWORD = 0x00004000;
2416 pub const MEM_RELEASE : DWORD = 0x00008000;
2417 pub const MEM_RESET : DWORD = 0x00080000;
2418 pub const MEM_RESET_UNDO : DWORD = 0x1000000;
2419 pub const MEM_LARGE_PAGES : DWORD = 0x20000000;
2420 pub const MEM_PHYSICAL : DWORD = 0x00400000;
2421 pub const MEM_TOP_DOWN : DWORD = 0x00100000;
2422 pub const MEM_WRITE_WATCH : DWORD = 0x00200000;
2424 pub const PAGE_EXECUTE : DWORD = 0x10;
2425 pub const PAGE_EXECUTE_READ : DWORD = 0x20;
2426 pub const PAGE_EXECUTE_READWRITE : DWORD = 0x40;
2427 pub const PAGE_EXECUTE_WRITECOPY : DWORD = 0x80;
2428 pub const PAGE_NOACCESS : DWORD = 0x01;
2429 pub const PAGE_READONLY : DWORD = 0x02;
2430 pub const PAGE_READWRITE : DWORD = 0x04;
2431 pub const PAGE_WRITECOPY : DWORD = 0x08;
2432 pub const PAGE_GUARD : DWORD = 0x100;
2433 pub const PAGE_NOCACHE : DWORD = 0x200;
2434 pub const PAGE_WRITECOMBINE : DWORD = 0x400;
2436 pub const SEC_COMMIT : DWORD = 0x8000000;
2437 pub const SEC_IMAGE : DWORD = 0x1000000;
2438 pub const SEC_IMAGE_NO_EXECUTE : DWORD = 0x11000000;
2439 pub const SEC_LARGE_PAGES : DWORD = 0x80000000;
2440 pub const SEC_NOCACHE : DWORD = 0x10000000;
2441 pub const SEC_RESERVE : DWORD = 0x4000000;
2442 pub const SEC_WRITECOMBINE : DWORD = 0x40000000;
2444 pub const FILE_MAP_ALL_ACCESS : DWORD = 0xf001f;
2445 pub const FILE_MAP_READ : DWORD = 0x4;
2446 pub const FILE_MAP_WRITE : DWORD = 0x2;
2447 pub const FILE_MAP_COPY : DWORD = 0x1;
2448 pub const FILE_MAP_EXECUTE : DWORD = 0x20;
2450 pub const PROCESSOR_ARCHITECTURE_INTEL : WORD = 0;
2451 pub const PROCESSOR_ARCHITECTURE_ARM : WORD = 5;
2452 pub const PROCESSOR_ARCHITECTURE_IA64 : WORD = 6;
2453 pub const PROCESSOR_ARCHITECTURE_AMD64 : WORD = 9;
2454 pub const PROCESSOR_ARCHITECTURE_UNKNOWN : WORD = 0xffff;
2456 pub const MOVEFILE_COPY_ALLOWED: DWORD = 2;
2457 pub const MOVEFILE_CREATE_HARDLINK: DWORD = 16;
2458 pub const MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 4;
2459 pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 32;
2460 pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1;
2461 pub const MOVEFILE_WRITE_THROUGH: DWORD = 8;
2463 pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 1;
2465 pub const FILE_SHARE_DELETE: DWORD = 0x4;
2466 pub const FILE_SHARE_READ: DWORD = 0x1;
2467 pub const FILE_SHARE_WRITE: DWORD = 0x2;
2469 pub const CREATE_ALWAYS: DWORD = 2;
2470 pub const CREATE_NEW: DWORD = 1;
2471 pub const OPEN_ALWAYS: DWORD = 4;
2472 pub const OPEN_EXISTING: DWORD = 3;
2473 pub const TRUNCATE_EXISTING: DWORD = 5;
2475 pub const FILE_APPEND_DATA: DWORD = 0x00000004;
2476 pub const FILE_READ_DATA: DWORD = 0x00000001;
2477 pub const FILE_WRITE_DATA: DWORD = 0x00000002;
2479 pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x20;
2480 pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x800;
2481 pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x40;
2482 pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
2483 pub const FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x4000;
2484 pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x2;
2485 pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x8000;
2486 pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x80;
2487 pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x2000;
2488 pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x20000;
2489 pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x1000;
2490 pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
2491 pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
2492 pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x200;
2493 pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x4;
2494 pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x100;
2495 pub const FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x10000;
2497 pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
2498 pub const FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000;
2499 pub const FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000;
2500 pub const FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000;
2501 pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
2502 pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
2503 pub const FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x0100000;
2504 pub const FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000;
2505 pub const FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000;
2506 pub const FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000;
2507 pub const FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000;
2508 pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
2510 pub const FILE_NAME_NORMALIZED: DWORD = 0x0;
2511 pub const FILE_NAME_OPENED: DWORD = 0x8;
2513 pub const VOLUME_NAME_DOS: DWORD = 0x0;
2514 pub const VOLUME_NAME_GUID: DWORD = 0x1;
2515 pub const VOLUME_NAME_NONE: DWORD = 0x4;
2516 pub const VOLUME_NAME_NT: DWORD = 0x2;
2518 pub const GENERIC_READ: DWORD = 0x80000000;
2519 pub const GENERIC_WRITE: DWORD = 0x40000000;
2520 pub const GENERIC_EXECUTE: DWORD = 0x20000000;
2521 pub const GENERIC_ALL: DWORD = 0x10000000;
2522 pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
2523 pub const FILE_READ_ATTRIBUTES: DWORD = 0x00000080;
2525 pub const STANDARD_RIGHTS_READ: DWORD = 0x20000;
2526 pub const STANDARD_RIGHTS_WRITE: DWORD = 0x20000;
2527 pub const FILE_WRITE_EA: DWORD = 0x00000010;
2528 pub const FILE_READ_EA: DWORD = 0x00000008;
2529 pub const FILE_GENERIC_READ: DWORD =
2530 STANDARD_RIGHTS_READ | FILE_READ_DATA |
2531 FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE;
2532 pub const FILE_GENERIC_WRITE: DWORD =
2533 STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA |
2534 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA |
2537 pub const FILE_BEGIN: DWORD = 0;
2538 pub const FILE_CURRENT: DWORD = 1;
2539 pub const FILE_END: DWORD = 2;
2541 pub const MAX_PROTOCOL_CHAIN: DWORD = 7;
2542 pub const WSAPROTOCOL_LEN: DWORD = 255;
2543 pub const INVALID_SOCKET: SOCKET = !0;
2545 pub const DETACHED_PROCESS: DWORD = 0x00000008;
2546 pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
2547 pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
2549 pub const PIPE_ACCESS_DUPLEX: DWORD = 0x00000003;
2550 pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
2551 pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
2552 pub const PIPE_TYPE_BYTE: DWORD = 0x00000000;
2553 pub const PIPE_TYPE_MESSAGE: DWORD = 0x00000004;
2554 pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
2555 pub const PIPE_READMODE_MESSAGE: DWORD = 0x00000002;
2556 pub const PIPE_WAIT: DWORD = 0x00000000;
2557 pub const PIPE_NOWAIT: DWORD = 0x00000001;
2558 pub const PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000;
2559 pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
2560 pub const PIPE_UNLIMITED_INSTANCES: DWORD = 255;
2562 pub const IPPROTO_RAW: c_int = 255;
2564 pub const FIONBIO: c_long = -0x7FFB9982;
2571 #[cfg(any(target_os = "linux", target_os = "android", target_os = "nacl"))]
2574 use types::os::arch::c95::{c_int, c_uint};
2576 pub const EXIT_FAILURE : c_int = 1;
2577 pub const EXIT_SUCCESS : c_int = 0;
2578 pub const RAND_MAX : c_int = 2147483647;
2579 pub const EOF : c_int = -1;
2580 pub const SEEK_SET : c_int = 0;
2581 pub const SEEK_CUR : c_int = 1;
2582 pub const SEEK_END : c_int = 2;
2583 pub const _IOFBF : c_int = 0;
2584 pub const _IONBF : c_int = 2;
2585 pub const _IOLBF : c_int = 1;
2586 pub const BUFSIZ : c_uint = 8192;
2587 pub const FOPEN_MAX : c_uint = 16;
2588 pub const FILENAME_MAX : c_uint = 4096;
2589 pub const L_tmpnam : c_uint = 20;
2590 pub const TMP_MAX : c_uint = 238328;
2594 #[cfg(any(target_arch = "x86",
2595 target_arch = "x86_64",
2596 target_arch = "arm",
2597 target_arch = "aarch64",
2598 target_arch = "le32",
2599 target_arch = "powerpc"))]
2601 use types::os::arch::c95::c_int;
2602 use types::common::c95::c_void;
2603 use types::os::arch::posix88::mode_t;
2605 pub const O_RDONLY : c_int = 0;
2606 pub const O_WRONLY : c_int = 1;
2607 pub const O_RDWR : c_int = 2;
2608 pub const O_APPEND : c_int = 1024;
2609 pub const O_CREAT : c_int = 64;
2610 pub const O_EXCL : c_int = 128;
2611 pub const O_TRUNC : c_int = 512;
2612 pub const S_IFIFO : mode_t = 4096;
2613 pub const S_IFCHR : mode_t = 8192;
2614 pub const S_IFBLK : mode_t = 24576;
2615 pub const S_IFDIR : mode_t = 16384;
2616 pub const S_IFREG : mode_t = 32768;
2617 pub const S_IFLNK : mode_t = 40960;
2618 pub const S_IFMT : mode_t = 61440;
2619 pub const S_IEXEC : mode_t = 64;
2620 pub const S_IWRITE : mode_t = 128;
2621 pub const S_IREAD : mode_t = 256;
2622 pub const S_IRWXU : mode_t = 448;
2623 pub const S_IXUSR : mode_t = 64;
2624 pub const S_IWUSR : mode_t = 128;
2625 pub const S_IRUSR : mode_t = 256;
2626 pub const F_OK : c_int = 0;
2627 pub const R_OK : c_int = 4;
2628 pub const W_OK : c_int = 2;
2629 pub const X_OK : c_int = 1;
2630 pub const STDIN_FILENO : c_int = 0;
2631 pub const STDOUT_FILENO : c_int = 1;
2632 pub const STDERR_FILENO : c_int = 2;
2633 pub const F_LOCK : c_int = 1;
2634 pub const F_TEST : c_int = 3;
2635 pub const F_TLOCK : c_int = 2;
2636 pub const F_ULOCK : c_int = 0;
2637 pub const SIGHUP : c_int = 1;
2638 pub const SIGINT : c_int = 2;
2639 pub const SIGQUIT : c_int = 3;
2640 pub const SIGILL : c_int = 4;
2641 pub const SIGABRT : c_int = 6;
2642 pub const SIGFPE : c_int = 8;
2643 pub const SIGKILL : c_int = 9;
2644 pub const SIGSEGV : c_int = 11;
2645 pub const SIGPIPE : c_int = 13;
2646 pub const SIGALRM : c_int = 14;
2647 pub const SIGTERM : c_int = 15;
2649 pub const PROT_NONE : c_int = 0;
2650 pub const PROT_READ : c_int = 1;
2651 pub const PROT_WRITE : c_int = 2;
2652 pub const PROT_EXEC : c_int = 4;
2654 pub const MAP_FILE : c_int = 0x0000;
2655 pub const MAP_SHARED : c_int = 0x0001;
2656 pub const MAP_PRIVATE : c_int = 0x0002;
2657 pub const MAP_FIXED : c_int = 0x0010;
2658 pub const MAP_ANON : c_int = 0x0020;
2660 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
2662 pub const MCL_CURRENT : c_int = 0x0001;
2663 pub const MCL_FUTURE : c_int = 0x0002;
2665 pub const MS_ASYNC : c_int = 0x0001;
2666 pub const MS_INVALIDATE : c_int = 0x0002;
2667 pub const MS_SYNC : c_int = 0x0004;
2669 pub const EPERM : c_int = 1;
2670 pub const ENOENT : c_int = 2;
2671 pub const ESRCH : c_int = 3;
2672 pub const EINTR : c_int = 4;
2673 pub const EIO : c_int = 5;
2674 pub const ENXIO : c_int = 6;
2675 pub const E2BIG : c_int = 7;
2676 pub const ENOEXEC : c_int = 8;
2677 pub const EBADF : c_int = 9;
2678 pub const ECHILD : c_int = 10;
2679 pub const EAGAIN : c_int = 11;
2680 pub const ENOMEM : c_int = 12;
2681 pub const EACCES : c_int = 13;
2682 pub const EFAULT : c_int = 14;
2683 pub const ENOTBLK : c_int = 15;
2684 pub const EBUSY : c_int = 16;
2685 pub const EEXIST : c_int = 17;
2686 pub const EXDEV : c_int = 18;
2687 pub const ENODEV : c_int = 19;
2688 pub const ENOTDIR : c_int = 20;
2689 pub const EISDIR : c_int = 21;
2690 pub const EINVAL : c_int = 22;
2691 pub const ENFILE : c_int = 23;
2692 pub const EMFILE : c_int = 24;
2693 pub const ENOTTY : c_int = 25;
2694 pub const ETXTBSY : c_int = 26;
2695 pub const EFBIG : c_int = 27;
2696 pub const ENOSPC : c_int = 28;
2697 pub const ESPIPE : c_int = 29;
2698 pub const EROFS : c_int = 30;
2699 pub const EMLINK : c_int = 31;
2700 pub const EPIPE : c_int = 32;
2701 pub const EDOM : c_int = 33;
2702 pub const ERANGE : c_int = 34;
2704 pub const EDEADLK: c_int = 35;
2705 pub const ENAMETOOLONG: c_int = 36;
2706 pub const ENOLCK: c_int = 37;
2707 pub const ENOSYS: c_int = 38;
2708 pub const ENOTEMPTY: c_int = 39;
2709 pub const ELOOP: c_int = 40;
2710 pub const EWOULDBLOCK: c_int = EAGAIN;
2711 pub const ENOMSG: c_int = 42;
2712 pub const EIDRM: c_int = 43;
2713 pub const ECHRNG: c_int = 44;
2714 pub const EL2NSYNC: c_int = 45;
2715 pub const EL3HLT: c_int = 46;
2716 pub const EL3RST: c_int = 47;
2717 pub const ELNRNG: c_int = 48;
2718 pub const EUNATCH: c_int = 49;
2719 pub const ENOCSI: c_int = 50;
2720 pub const EL2HLT: c_int = 51;
2721 pub const EBADE: c_int = 52;
2722 pub const EBADR: c_int = 53;
2723 pub const EXFULL: c_int = 54;
2724 pub const ENOANO: c_int = 55;
2725 pub const EBADRQC: c_int = 56;
2726 pub const EBADSLT: c_int = 57;
2728 pub const EDEADLOCK: c_int = EDEADLK;
2730 pub const EBFONT: c_int = 59;
2731 pub const ENOSTR: c_int = 60;
2732 pub const ENODATA: c_int = 61;
2733 pub const ETIME: c_int = 62;
2734 pub const ENOSR: c_int = 63;
2735 pub const ENONET: c_int = 64;
2736 pub const ENOPKG: c_int = 65;
2737 pub const EREMOTE: c_int = 66;
2738 pub const ENOLINK: c_int = 67;
2739 pub const EADV: c_int = 68;
2740 pub const ESRMNT: c_int = 69;
2741 pub const ECOMM: c_int = 70;
2742 pub const EPROTO: c_int = 71;
2743 pub const EMULTIHOP: c_int = 72;
2744 pub const EDOTDOT: c_int = 73;
2745 pub const EBADMSG: c_int = 74;
2746 pub const EOVERFLOW: c_int = 75;
2747 pub const ENOTUNIQ: c_int = 76;
2748 pub const EBADFD: c_int = 77;
2749 pub const EREMCHG: c_int = 78;
2750 pub const ELIBACC: c_int = 79;
2751 pub const ELIBBAD: c_int = 80;
2752 pub const ELIBSCN: c_int = 81;
2753 pub const ELIBMAX: c_int = 82;
2754 pub const ELIBEXEC: c_int = 83;
2755 pub const EILSEQ: c_int = 84;
2756 pub const ERESTART: c_int = 85;
2757 pub const ESTRPIPE: c_int = 86;
2758 pub const EUSERS: c_int = 87;
2759 pub const ENOTSOCK: c_int = 88;
2760 pub const EDESTADDRREQ: c_int = 89;
2761 pub const EMSGSIZE: c_int = 90;
2762 pub const EPROTOTYPE: c_int = 91;
2763 pub const ENOPROTOOPT: c_int = 92;
2764 pub const EPROTONOSUPPORT: c_int = 93;
2765 pub const ESOCKTNOSUPPORT: c_int = 94;
2766 pub const EOPNOTSUPP: c_int = 95;
2767 pub const EPFNOSUPPORT: c_int = 96;
2768 pub const EAFNOSUPPORT: c_int = 97;
2769 pub const EADDRINUSE: c_int = 98;
2770 pub const EADDRNOTAVAIL: c_int = 99;
2771 pub const ENETDOWN: c_int = 100;
2772 pub const ENETUNREACH: c_int = 101;
2773 pub const ENETRESET: c_int = 102;
2774 pub const ECONNABORTED: c_int = 103;
2775 pub const ECONNRESET: c_int = 104;
2776 pub const ENOBUFS: c_int = 105;
2777 pub const EISCONN: c_int = 106;
2778 pub const ENOTCONN: c_int = 107;
2779 pub const ESHUTDOWN: c_int = 108;
2780 pub const ETOOMANYREFS: c_int = 109;
2781 pub const ETIMEDOUT: c_int = 110;
2782 pub const ECONNREFUSED: c_int = 111;
2783 pub const EHOSTDOWN: c_int = 112;
2784 pub const EHOSTUNREACH: c_int = 113;
2785 pub const EALREADY: c_int = 114;
2786 pub const EINPROGRESS: c_int = 115;
2787 pub const ESTALE: c_int = 116;
2788 pub const EUCLEAN: c_int = 117;
2789 pub const ENOTNAM: c_int = 118;
2790 pub const ENAVAIL: c_int = 119;
2791 pub const EISNAM: c_int = 120;
2792 pub const EREMOTEIO: c_int = 121;
2793 pub const EDQUOT: c_int = 122;
2795 pub const ENOMEDIUM: c_int = 123;
2796 pub const EMEDIUMTYPE: c_int = 124;
2797 pub const ECANCELED: c_int = 125;
2798 pub const ENOKEY: c_int = 126;
2799 pub const EKEYEXPIRED: c_int = 127;
2800 pub const EKEYREVOKED: c_int = 128;
2801 pub const EKEYREJECTED: c_int = 129;
2803 pub const EOWNERDEAD: c_int = 130;
2804 pub const ENOTRECOVERABLE: c_int = 131;
2806 pub const ERFKILL: c_int = 132;
2808 pub const EHWPOISON: c_int = 133;
2811 #[cfg(any(target_arch = "mips",
2812 target_arch = "mipsel"))]
2814 use types::os::arch::c95::c_int;
2815 use types::common::c95::c_void;
2816 use types::os::arch::posix88::mode_t;
2818 pub const O_RDONLY : c_int = 0;
2819 pub const O_WRONLY : c_int = 1;
2820 pub const O_RDWR : c_int = 2;
2821 pub const O_APPEND : c_int = 8;
2822 pub const O_CREAT : c_int = 256;
2823 pub const O_EXCL : c_int = 1024;
2824 pub const O_TRUNC : c_int = 512;
2825 pub const S_IFIFO : mode_t = 4096;
2826 pub const S_IFCHR : mode_t = 8192;
2827 pub const S_IFBLK : mode_t = 24576;
2828 pub const S_IFDIR : mode_t = 16384;
2829 pub const S_IFREG : mode_t = 32768;
2830 pub const S_IFLNK : mode_t = 40960;
2831 pub const S_IFMT : mode_t = 61440;
2832 pub const S_IEXEC : mode_t = 64;
2833 pub const S_IWRITE : mode_t = 128;
2834 pub const S_IREAD : mode_t = 256;
2835 pub const S_IRWXU : mode_t = 448;
2836 pub const S_IXUSR : mode_t = 64;
2837 pub const S_IWUSR : mode_t = 128;
2838 pub const S_IRUSR : mode_t = 256;
2839 pub const F_OK : c_int = 0;
2840 pub const R_OK : c_int = 4;
2841 pub const W_OK : c_int = 2;
2842 pub const X_OK : c_int = 1;
2843 pub const STDIN_FILENO : c_int = 0;
2844 pub const STDOUT_FILENO : c_int = 1;
2845 pub const STDERR_FILENO : c_int = 2;
2846 pub const F_LOCK : c_int = 1;
2847 pub const F_TEST : c_int = 3;
2848 pub const F_TLOCK : c_int = 2;
2849 pub const F_ULOCK : c_int = 0;
2850 pub const SIGHUP : c_int = 1;
2851 pub const SIGINT : c_int = 2;
2852 pub const SIGQUIT : c_int = 3;
2853 pub const SIGILL : c_int = 4;
2854 pub const SIGABRT : c_int = 6;
2855 pub const SIGFPE : c_int = 8;
2856 pub const SIGKILL : c_int = 9;
2857 pub const SIGSEGV : c_int = 11;
2858 pub const SIGPIPE : c_int = 13;
2859 pub const SIGALRM : c_int = 14;
2860 pub const SIGTERM : c_int = 15;
2862 pub const PROT_NONE : c_int = 0;
2863 pub const PROT_READ : c_int = 1;
2864 pub const PROT_WRITE : c_int = 2;
2865 pub const PROT_EXEC : c_int = 4;
2867 pub const MAP_FILE : c_int = 0x0000;
2868 pub const MAP_SHARED : c_int = 0x0001;
2869 pub const MAP_PRIVATE : c_int = 0x0002;
2870 pub const MAP_FIXED : c_int = 0x0010;
2871 pub const MAP_ANON : c_int = 0x0800;
2873 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
2875 pub const MCL_CURRENT : c_int = 0x0001;
2876 pub const MCL_FUTURE : c_int = 0x0002;
2878 pub const MS_ASYNC : c_int = 0x0001;
2879 pub const MS_INVALIDATE : c_int = 0x0002;
2880 pub const MS_SYNC : c_int = 0x0004;
2882 pub const EPERM : c_int = 1;
2883 pub const ENOENT : c_int = 2;
2884 pub const ESRCH : c_int = 3;
2885 pub const EINTR : c_int = 4;
2886 pub const EIO : c_int = 5;
2887 pub const ENXIO : c_int = 6;
2888 pub const E2BIG : c_int = 7;
2889 pub const ENOEXEC : c_int = 8;
2890 pub const EBADF : c_int = 9;
2891 pub const ECHILD : c_int = 10;
2892 pub const EAGAIN : c_int = 11;
2893 pub const ENOMEM : c_int = 12;
2894 pub const EACCES : c_int = 13;
2895 pub const EFAULT : c_int = 14;
2896 pub const ENOTBLK : c_int = 15;
2897 pub const EBUSY : c_int = 16;
2898 pub const EEXIST : c_int = 17;
2899 pub const EXDEV : c_int = 18;
2900 pub const ENODEV : c_int = 19;
2901 pub const ENOTDIR : c_int = 20;
2902 pub const EISDIR : c_int = 21;
2903 pub const EINVAL : c_int = 22;
2904 pub const ENFILE : c_int = 23;
2905 pub const EMFILE : c_int = 24;
2906 pub const ENOTTY : c_int = 25;
2907 pub const ETXTBSY : c_int = 26;
2908 pub const EFBIG : c_int = 27;
2909 pub const ENOSPC : c_int = 28;
2910 pub const ESPIPE : c_int = 29;
2911 pub const EROFS : c_int = 30;
2912 pub const EMLINK : c_int = 31;
2913 pub const EPIPE : c_int = 32;
2914 pub const EDOM : c_int = 33;
2915 pub const ERANGE : c_int = 34;
2917 pub const ENOMSG: c_int = 35;
2918 pub const EIDRM: c_int = 36;
2919 pub const ECHRNG: c_int = 37;
2920 pub const EL2NSYNC: c_int = 38;
2921 pub const EL3HLT: c_int = 39;
2922 pub const EL3RST: c_int = 40;
2923 pub const ELNRNG: c_int = 41;
2924 pub const EUNATCH: c_int = 42;
2925 pub const ENOCSI: c_int = 43;
2926 pub const EL2HLT: c_int = 44;
2927 pub const EDEADLK: c_int = 45;
2928 pub const ENOLCK: c_int = 46;
2929 pub const EBADE: c_int = 50;
2930 pub const EBADR: c_int = 51;
2931 pub const EXFULL: c_int = 52;
2932 pub const ENOANO: c_int = 53;
2933 pub const EBADRQC: c_int = 54;
2934 pub const EBADSLT: c_int = 55;
2935 pub const EDEADLOCK: c_int = 56;
2936 pub const EBFONT: c_int = 59;
2937 pub const ENOSTR: c_int = 60;
2938 pub const ENODATA: c_int = 61;
2939 pub const ETIME: c_int = 62;
2940 pub const ENOSR: c_int = 63;
2941 pub const ENONET: c_int = 64;
2942 pub const ENOPKG: c_int = 65;
2943 pub const EREMOTE: c_int = 66;
2944 pub const ENOLINK: c_int = 67;
2945 pub const EADV: c_int = 68;
2946 pub const ESRMNT: c_int = 69;
2947 pub const ECOMM: c_int = 70;
2948 pub const EPROTO: c_int = 71;
2949 pub const EDOTDOT: c_int = 73;
2950 pub const EMULTIHOP: c_int = 74;
2951 pub const EBADMSG: c_int = 77;
2952 pub const ENAMETOOLONG: c_int = 78;
2953 pub const EOVERFLOW: c_int = 79;
2954 pub const ENOTUNIQ: c_int = 80;
2955 pub const EBADFD: c_int = 81;
2956 pub const EREMCHG: c_int = 82;
2957 pub const ELIBACC: c_int = 83;
2958 pub const ELIBBAD: c_int = 84;
2959 pub const ELIBSCN: c_int = 95;
2960 pub const ELIBMAX: c_int = 86;
2961 pub const ELIBEXEC: c_int = 87;
2962 pub const EILSEQ: c_int = 88;
2963 pub const ENOSYS: c_int = 89;
2964 pub const ELOOP: c_int = 90;
2965 pub const ERESTART: c_int = 91;
2966 pub const ESTRPIPE: c_int = 92;
2967 pub const ENOTEMPTY: c_int = 93;
2968 pub const EUSERS: c_int = 94;
2969 pub const ENOTSOCK: c_int = 95;
2970 pub const EDESTADDRREQ: c_int = 96;
2971 pub const EMSGSIZE: c_int = 97;
2972 pub const EPROTOTYPE: c_int = 98;
2973 pub const ENOPROTOOPT: c_int = 99;
2974 pub const EPROTONOSUPPORT: c_int = 120;
2975 pub const ESOCKTNOSUPPORT: c_int = 121;
2976 pub const EOPNOTSUPP: c_int = 122;
2977 pub const EPFNOSUPPORT: c_int = 123;
2978 pub const EAFNOSUPPORT: c_int = 124;
2979 pub const EADDRINUSE: c_int = 125;
2980 pub const EADDRNOTAVAIL: c_int = 126;
2981 pub const ENETDOWN: c_int = 127;
2982 pub const ENETUNREACH: c_int = 128;
2983 pub const ENETRESET: c_int = 129;
2984 pub const ECONNABORTED: c_int = 130;
2985 pub const ECONNRESET: c_int = 131;
2986 pub const ENOBUFS: c_int = 132;
2987 pub const EISCONN: c_int = 133;
2988 pub const ENOTCONN: c_int = 134;
2989 pub const EUCLEAN: c_int = 135;
2990 pub const ENOTNAM: c_int = 137;
2991 pub const ENAVAIL: c_int = 138;
2992 pub const EISNAM: c_int = 139;
2993 pub const EREMOTEIO: c_int = 140;
2994 pub const ESHUTDOWN: c_int = 143;
2995 pub const ETOOMANYREFS: c_int = 144;
2996 pub const ETIMEDOUT: c_int = 145;
2997 pub const ECONNREFUSED: c_int = 146;
2998 pub const EHOSTDOWN: c_int = 147;
2999 pub const EHOSTUNREACH: c_int = 148;
3000 pub const EWOULDBLOCK: c_int = EAGAIN;
3001 pub const EALREADY: c_int = 149;
3002 pub const EINPROGRESS: c_int = 150;
3003 pub const ESTALE: c_int = 151;
3004 pub const ECANCELED: c_int = 158;
3006 pub const ENOMEDIUM: c_int = 159;
3007 pub const EMEDIUMTYPE: c_int = 160;
3008 pub const ENOKEY: c_int = 161;
3009 pub const EKEYEXPIRED: c_int = 162;
3010 pub const EKEYREVOKED: c_int = 163;
3011 pub const EKEYREJECTED: c_int = 164;
3013 pub const EOWNERDEAD: c_int = 165;
3014 pub const ENOTRECOVERABLE: c_int = 166;
3016 pub const ERFKILL: c_int = 167;
3018 pub const EHWPOISON: c_int = 168;
3020 pub const EDQUOT: c_int = 1133;
3022 #[cfg(not(target_os = "nacl"))]
3024 use types::os::arch::c95::{c_int, size_t};
3026 pub const F_DUPFD : c_int = 0;
3027 pub const F_GETFD : c_int = 1;
3028 pub const F_SETFD : c_int = 2;
3029 pub const F_GETFL : c_int = 3;
3030 pub const F_SETFL : c_int = 4;
3032 pub const SIGTRAP : c_int = 5;
3033 pub const SIG_IGN: size_t = 1;
3035 pub const GLOB_ERR : c_int = 1 << 0;
3036 pub const GLOB_MARK : c_int = 1 << 1;
3037 pub const GLOB_NOSORT : c_int = 1 << 2;
3038 pub const GLOB_DOOFFS : c_int = 1 << 3;
3039 pub const GLOB_NOCHECK : c_int = 1 << 4;
3040 pub const GLOB_APPEND : c_int = 1 << 5;
3041 pub const GLOB_NOESCAPE : c_int = 1 << 6;
3043 pub const GLOB_NOSPACE : c_int = 1;
3044 pub const GLOB_ABORTED : c_int = 2;
3045 pub const GLOB_NOMATCH : c_int = 3;
3047 pub const POSIX_MADV_NORMAL : c_int = 0;
3048 pub const POSIX_MADV_RANDOM : c_int = 1;
3049 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3050 pub const POSIX_MADV_WILLNEED : c_int = 3;
3051 pub const POSIX_MADV_DONTNEED : c_int = 4;
3053 pub const _SC_MQ_PRIO_MAX : c_int = 28;
3054 pub const _SC_IOV_MAX : c_int = 60;
3055 pub const _SC_GETGR_R_SIZE_MAX : c_int = 69;
3056 pub const _SC_GETPW_R_SIZE_MAX : c_int = 70;
3057 pub const _SC_LOGIN_NAME_MAX : c_int = 71;
3058 pub const _SC_TTY_NAME_MAX : c_int = 72;
3059 pub const _SC_THREADS : c_int = 67;
3060 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
3061 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
3062 pub const _SC_THREAD_KEYS_MAX : c_int = 74;
3063 pub const _SC_THREAD_STACK_MIN : c_int = 75;
3064 pub const _SC_THREAD_THREADS_MAX : c_int = 76;
3065 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
3066 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
3067 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
3068 pub const _SC_THREAD_PRIO_INHERIT : c_int = 80;
3069 pub const _SC_THREAD_PRIO_PROTECT : c_int = 81;
3070 pub const _SC_THREAD_PROCESS_SHARED : c_int = 82;
3071 pub const _SC_ATEXIT_MAX : c_int = 87;
3072 pub const _SC_XOPEN_VERSION : c_int = 89;
3073 pub const _SC_XOPEN_XCU_VERSION : c_int = 90;
3074 pub const _SC_XOPEN_UNIX : c_int = 91;
3075 pub const _SC_XOPEN_CRYPT : c_int = 92;
3076 pub const _SC_XOPEN_ENH_I18N : c_int = 93;
3077 pub const _SC_XOPEN_SHM : c_int = 94;
3078 pub const _SC_XOPEN_LEGACY : c_int = 129;
3079 pub const _SC_XOPEN_REALTIME : c_int = 130;
3080 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 131;
3082 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
3083 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
3085 #[cfg(target_os = "android")]
3086 pub const PTHREAD_STACK_MIN: size_t = 8192;
3088 #[cfg(all(target_os = "linux",
3089 any(target_arch = "arm",
3090 target_arch = "x86",
3091 target_arch = "x86_64")))]
3092 pub const PTHREAD_STACK_MIN: size_t = 16384;
3094 #[cfg(all(target_os = "linux",
3095 any(target_arch = "mips",
3096 target_arch = "mipsel",
3097 target_arch = "aarch64",
3098 target_arch = "powerpc")))]
3099 pub const PTHREAD_STACK_MIN: size_t = 131072;
3101 pub const CLOCK_REALTIME: c_int = 0;
3102 pub const CLOCK_MONOTONIC: c_int = 1;
3104 #[cfg(target_os = "nacl")]
3106 use types::os::arch::c95::{c_int, size_t};
3108 pub const F_DUPFD : c_int = 0;
3109 pub const F_GETFD : c_int = 1;
3110 pub const F_SETFD : c_int = 2;
3111 pub const F_GETFL : c_int = 3;
3112 pub const F_SETFL : c_int = 4;
3114 pub const SIGTRAP : c_int = 5;
3115 pub const SIG_IGN: size_t = 1;
3117 pub const GLOB_ERR : c_int = 1 << 0;
3118 pub const GLOB_MARK : c_int = 1 << 1;
3119 pub const GLOB_NOSORT : c_int = 1 << 2;
3120 pub const GLOB_DOOFFS : c_int = 1 << 3;
3121 pub const GLOB_NOCHECK : c_int = 1 << 4;
3122 pub const GLOB_APPEND : c_int = 1 << 5;
3123 pub const GLOB_NOESCAPE : c_int = 1 << 6;
3125 pub const GLOB_NOSPACE : c_int = 1;
3126 pub const GLOB_ABORTED : c_int = 2;
3127 pub const GLOB_NOMATCH : c_int = 3;
3129 pub const POSIX_MADV_NORMAL : c_int = 0;
3130 pub const POSIX_MADV_RANDOM : c_int = 1;
3131 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3132 pub const POSIX_MADV_WILLNEED : c_int = 3;
3133 pub const POSIX_MADV_DONTNEED : c_int = 4;
3135 pub const _SC_MQ_PRIO_MAX : c_int = 28;
3136 pub const _SC_IOV_MAX : c_int = 60;
3137 pub const _SC_GETGR_R_SIZE_MAX : c_int = 69;
3138 pub const _SC_GETPW_R_SIZE_MAX : c_int = 70;
3139 pub const _SC_LOGIN_NAME_MAX : c_int = 71;
3140 pub const _SC_TTY_NAME_MAX : c_int = 72;
3141 pub const _SC_THREADS : c_int = 67;
3142 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 68;
3143 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 73;
3144 pub const _SC_THREAD_KEYS_MAX : c_int = 74;
3145 pub const _SC_THREAD_STACK_MIN : c_int = 75;
3146 pub const _SC_THREAD_THREADS_MAX : c_int = 76;
3147 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
3148 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
3149 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 79;
3150 pub const _SC_THREAD_PRIO_INHERIT : c_int = 80;
3151 pub const _SC_THREAD_PRIO_PROTECT : c_int = 81;
3152 pub const _SC_THREAD_PROCESS_SHARED : c_int = 82;
3153 pub const _SC_ATEXIT_MAX : c_int = 87;
3154 pub const _SC_XOPEN_VERSION : c_int = 89;
3155 pub const _SC_XOPEN_XCU_VERSION : c_int = 90;
3156 pub const _SC_XOPEN_UNIX : c_int = 91;
3157 pub const _SC_XOPEN_CRYPT : c_int = 92;
3158 pub const _SC_XOPEN_ENH_I18N : c_int = 93;
3159 pub const _SC_XOPEN_SHM : c_int = 94;
3160 pub const _SC_XOPEN_LEGACY : c_int = 129;
3161 pub const _SC_XOPEN_REALTIME : c_int = 130;
3162 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 131;
3164 pub const PTHREAD_CREATE_JOINABLE: c_int = 1;
3165 pub const PTHREAD_CREATE_DETACHED: c_int = 0;
3167 pub const PTHREAD_STACK_MIN: size_t = 1024;
3169 pub const CLOCK_REALTIME: c_int = 0;
3170 pub const CLOCK_MONOTONIC: c_int = 1;
3174 #[cfg(any(target_arch = "arm",
3175 target_arch = "aarch64",
3176 target_arch = "x86",
3177 target_arch = "x86_64",
3178 target_arch = "le32",
3179 target_arch = "powerpc"))]
3181 use types::os::arch::c95::c_int;
3183 pub const MADV_NORMAL : c_int = 0;
3184 pub const MADV_RANDOM : c_int = 1;
3185 pub const MADV_SEQUENTIAL : c_int = 2;
3186 pub const MADV_WILLNEED : c_int = 3;
3187 pub const MADV_DONTNEED : c_int = 4;
3188 pub const MADV_REMOVE : c_int = 9;
3189 pub const MADV_DONTFORK : c_int = 10;
3190 pub const MADV_DOFORK : c_int = 11;
3191 pub const MADV_MERGEABLE : c_int = 12;
3192 pub const MADV_UNMERGEABLE : c_int = 13;
3193 pub const MADV_HWPOISON : c_int = 100;
3195 pub const IFF_LOOPBACK: c_int = 0x8;
3197 pub const AF_UNIX: c_int = 1;
3198 pub const AF_INET: c_int = 2;
3199 pub const AF_INET6: c_int = 10;
3200 pub const SOCK_STREAM: c_int = 1;
3201 pub const SOCK_DGRAM: c_int = 2;
3202 pub const SOCK_RAW: c_int = 3;
3203 pub const IPPROTO_TCP: c_int = 6;
3204 pub const IPPROTO_IP: c_int = 0;
3205 pub const IPPROTO_IPV6: c_int = 41;
3206 pub const IP_MULTICAST_TTL: c_int = 33;
3207 pub const IP_MULTICAST_LOOP: c_int = 34;
3208 pub const IP_TTL: c_int = 2;
3209 pub const IP_HDRINCL: c_int = 3;
3210 pub const IP_ADD_MEMBERSHIP: c_int = 35;
3211 pub const IP_DROP_MEMBERSHIP: c_int = 36;
3212 pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
3213 pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
3215 pub const TCP_NODELAY: c_int = 1;
3216 pub const SOL_SOCKET: c_int = 1;
3217 pub const SO_KEEPALIVE: c_int = 9;
3218 pub const SO_BROADCAST: c_int = 6;
3219 pub const SO_REUSEADDR: c_int = 2;
3220 pub const SO_ERROR: c_int = 4;
3222 pub const SHUT_RD: c_int = 0;
3223 pub const SHUT_WR: c_int = 1;
3224 pub const SHUT_RDWR: c_int = 2;
3226 #[cfg(any(target_arch = "mips",
3227 target_arch = "mipsel"))]
3229 use types::os::arch::c95::c_int;
3231 pub const MADV_NORMAL : c_int = 0;
3232 pub const MADV_RANDOM : c_int = 1;
3233 pub const MADV_SEQUENTIAL : c_int = 2;
3234 pub const MADV_WILLNEED : c_int = 3;
3235 pub const MADV_DONTNEED : c_int = 4;
3236 pub const MADV_REMOVE : c_int = 9;
3237 pub const MADV_DONTFORK : c_int = 10;
3238 pub const MADV_DOFORK : c_int = 11;
3239 pub const MADV_MERGEABLE : c_int = 12;
3240 pub const MADV_UNMERGEABLE : c_int = 13;
3241 pub const MADV_HWPOISON : c_int = 100;
3243 pub const AF_UNIX: c_int = 1;
3244 pub const AF_INET: c_int = 2;
3245 pub const AF_INET6: c_int = 10;
3246 pub const SOCK_STREAM: c_int = 2;
3247 pub const SOCK_DGRAM: c_int = 1;
3248 pub const SOCK_RAW: c_int = 3;
3249 pub const IPPROTO_TCP: c_int = 6;
3250 pub const IPPROTO_IP: c_int = 0;
3251 pub const IPPROTO_IPV6: c_int = 41;
3252 pub const IP_MULTICAST_TTL: c_int = 33;
3253 pub const IP_MULTICAST_LOOP: c_int = 34;
3254 pub const IP_TTL: c_int = 2;
3255 pub const IP_HDRINCL: c_int = 3;
3256 pub const IP_ADD_MEMBERSHIP: c_int = 35;
3257 pub const IP_DROP_MEMBERSHIP: c_int = 36;
3258 pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
3259 pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
3261 pub const TCP_NODELAY: c_int = 1;
3262 pub const SOL_SOCKET: c_int = 65535;
3263 pub const SO_KEEPALIVE: c_int = 8;
3264 pub const SO_BROADCAST: c_int = 32;
3265 pub const SO_REUSEADDR: c_int = 4;
3266 pub const SO_ERROR: c_int = 4103;
3268 pub const SHUT_RD: c_int = 0;
3269 pub const SHUT_WR: c_int = 1;
3270 pub const SHUT_RDWR: c_int = 2;
3272 #[cfg(any(target_arch = "x86",
3273 target_arch = "x86_64",
3274 target_arch = "arm",
3275 target_arch = "aarch64",
3276 target_arch = "le32",
3277 target_arch = "powerpc"))]
3279 use types::os::arch::c95::c_int;
3281 pub const AF_PACKET : c_int = 17;
3282 pub const IPPROTO_RAW : c_int = 255;
3284 pub const O_RSYNC : c_int = 1052672;
3285 pub const O_DSYNC : c_int = 4096;
3286 pub const O_NONBLOCK : c_int = 2048;
3287 pub const O_SYNC : c_int = 1052672;
3289 pub const PROT_GROWSDOWN : c_int = 0x010000000;
3290 pub const PROT_GROWSUP : c_int = 0x020000000;
3292 pub const MAP_TYPE : c_int = 0x000f;
3293 pub const MAP_ANONYMOUS : c_int = 0x0020;
3294 pub const MAP_32BIT : c_int = 0x0040;
3295 pub const MAP_GROWSDOWN : c_int = 0x0100;
3296 pub const MAP_DENYWRITE : c_int = 0x0800;
3297 pub const MAP_EXECUTABLE : c_int = 0x01000;
3298 pub const MAP_LOCKED : c_int = 0x02000;
3299 pub const MAP_NONRESERVE : c_int = 0x04000;
3300 pub const MAP_POPULATE : c_int = 0x08000;
3301 pub const MAP_NONBLOCK : c_int = 0x010000;
3302 pub const MAP_STACK : c_int = 0x020000;
3304 #[cfg(any(target_arch = "mips",
3305 target_arch = "mipsel"))]
3307 use types::os::arch::c95::c_int;
3309 pub const AF_PACKET : c_int = 17;
3310 pub const IPPROTO_RAW : c_int = 255;
3312 pub const O_RSYNC : c_int = 16400;
3313 pub const O_DSYNC : c_int = 16;
3314 pub const O_NONBLOCK : c_int = 128;
3315 pub const O_SYNC : c_int = 16400;
3317 pub const PROT_GROWSDOWN : c_int = 0x01000000;
3318 pub const PROT_GROWSUP : c_int = 0x02000000;
3320 pub const MAP_TYPE : c_int = 0x000f;
3321 pub const MAP_ANONYMOUS : c_int = 0x0800;
3322 pub const MAP_GROWSDOWN : c_int = 0x01000;
3323 pub const MAP_DENYWRITE : c_int = 0x02000;
3324 pub const MAP_EXECUTABLE : c_int = 0x04000;
3325 pub const MAP_LOCKED : c_int = 0x08000;
3326 pub const MAP_NONRESERVE : c_int = 0x0400;
3327 pub const MAP_POPULATE : c_int = 0x010000;
3328 pub const MAP_NONBLOCK : c_int = 0x020000;
3329 pub const MAP_STACK : c_int = 0x040000;
3331 #[cfg(target_os = "linux")]
3333 use types::os::arch::c95::c_int;
3335 pub const _SC_ARG_MAX : c_int = 0;
3336 pub const _SC_CHILD_MAX : c_int = 1;
3337 pub const _SC_CLK_TCK : c_int = 2;
3338 pub const _SC_NGROUPS_MAX : c_int = 3;
3339 pub const _SC_OPEN_MAX : c_int = 4;
3340 pub const _SC_STREAM_MAX : c_int = 5;
3341 pub const _SC_TZNAME_MAX : c_int = 6;
3342 pub const _SC_JOB_CONTROL : c_int = 7;
3343 pub const _SC_SAVED_IDS : c_int = 8;
3344 pub const _SC_REALTIME_SIGNALS : c_int = 9;
3345 pub const _SC_PRIORITY_SCHEDULING : c_int = 10;
3346 pub const _SC_TIMERS : c_int = 11;
3347 pub const _SC_ASYNCHRONOUS_IO : c_int = 12;
3348 pub const _SC_PRIORITIZED_IO : c_int = 13;
3349 pub const _SC_SYNCHRONIZED_IO : c_int = 14;
3350 pub const _SC_FSYNC : c_int = 15;
3351 pub const _SC_MAPPED_FILES : c_int = 16;
3352 pub const _SC_MEMLOCK : c_int = 17;
3353 pub const _SC_MEMLOCK_RANGE : c_int = 18;
3354 pub const _SC_MEMORY_PROTECTION : c_int = 19;
3355 pub const _SC_MESSAGE_PASSING : c_int = 20;
3356 pub const _SC_SEMAPHORES : c_int = 21;
3357 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 22;
3358 pub const _SC_AIO_LISTIO_MAX : c_int = 23;
3359 pub const _SC_AIO_MAX : c_int = 24;
3360 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 25;
3361 pub const _SC_DELAYTIMER_MAX : c_int = 26;
3362 pub const _SC_MQ_OPEN_MAX : c_int = 27;
3363 pub const _SC_VERSION : c_int = 29;
3364 pub const _SC_PAGESIZE : c_int = 30;
3365 pub const _SC_RTSIG_MAX : c_int = 31;
3366 pub const _SC_SEM_NSEMS_MAX : c_int = 32;
3367 pub const _SC_SEM_VALUE_MAX : c_int = 33;
3368 pub const _SC_SIGQUEUE_MAX : c_int = 34;
3369 pub const _SC_TIMER_MAX : c_int = 35;
3370 pub const _SC_BC_BASE_MAX : c_int = 36;
3371 pub const _SC_BC_DIM_MAX : c_int = 37;
3372 pub const _SC_BC_SCALE_MAX : c_int = 38;
3373 pub const _SC_BC_STRING_MAX : c_int = 39;
3374 pub const _SC_COLL_WEIGHTS_MAX : c_int = 40;
3375 pub const _SC_EXPR_NEST_MAX : c_int = 42;
3376 pub const _SC_LINE_MAX : c_int = 43;
3377 pub const _SC_RE_DUP_MAX : c_int = 44;
3378 pub const _SC_2_VERSION : c_int = 46;
3379 pub const _SC_2_C_BIND : c_int = 47;
3380 pub const _SC_2_C_DEV : c_int = 48;
3381 pub const _SC_2_FORT_DEV : c_int = 49;
3382 pub const _SC_2_FORT_RUN : c_int = 50;
3383 pub const _SC_2_SW_DEV : c_int = 51;
3384 pub const _SC_2_LOCALEDEF : c_int = 52;
3385 pub const _SC_2_CHAR_TERM : c_int = 95;
3386 pub const _SC_2_C_VERSION : c_int = 96;
3387 pub const _SC_2_UPE : c_int = 97;
3388 pub const _SC_XBS5_ILP32_OFF32 : c_int = 125;
3389 pub const _SC_XBS5_ILP32_OFFBIG : c_int = 126;
3390 pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 128;
3392 #[cfg(target_os = "nacl")]
3394 use types::os::arch::c95::c_int;
3396 pub static _SC_SENDMSG_MAX_SIZE : c_int = 0;
3397 pub static _SC_NPROCESSORS_ONLN : c_int = 1;
3398 pub static _SC_PAGESIZE : c_int = 2;
3400 #[cfg(target_os = "android")]
3402 use types::os::arch::c95::c_int;
3404 pub const _SC_ARG_MAX : c_int = 0;
3405 pub const _SC_BC_BASE_MAX : c_int = 1;
3406 pub const _SC_BC_DIM_MAX : c_int = 2;
3407 pub const _SC_BC_SCALE_MAX : c_int = 3;
3408 pub const _SC_BC_STRING_MAX : c_int = 4;
3409 pub const _SC_CHILD_MAX : c_int = 5;
3410 pub const _SC_CLK_TCK : c_int = 6;
3411 pub const _SC_COLL_WEIGHTS_MAX : c_int = 7;
3412 pub const _SC_EXPR_NEST_MAX : c_int = 8;
3413 pub const _SC_LINE_MAX : c_int = 9;
3414 pub const _SC_NGROUPS_MAX : c_int = 10;
3415 pub const _SC_OPEN_MAX : c_int = 11;
3416 pub const _SC_2_C_BIND : c_int = 13;
3417 pub const _SC_2_C_DEV : c_int = 14;
3418 pub const _SC_2_C_VERSION : c_int = 15;
3419 pub const _SC_2_CHAR_TERM : c_int = 16;
3420 pub const _SC_2_FORT_DEV : c_int = 17;
3421 pub const _SC_2_FORT_RUN : c_int = 18;
3422 pub const _SC_2_LOCALEDEF : c_int = 19;
3423 pub const _SC_2_SW_DEV : c_int = 20;
3424 pub const _SC_2_UPE : c_int = 21;
3425 pub const _SC_2_VERSION : c_int = 22;
3426 pub const _SC_JOB_CONTROL : c_int = 23;
3427 pub const _SC_SAVED_IDS : c_int = 24;
3428 pub const _SC_VERSION : c_int = 25;
3429 pub const _SC_RE_DUP_MAX : c_int = 26;
3430 pub const _SC_STREAM_MAX : c_int = 27;
3431 pub const _SC_TZNAME_MAX : c_int = 28;
3432 pub const _SC_PAGESIZE : c_int = 39;
3436 #[cfg(any(target_os = "freebsd",
3437 target_os = "dragonfly"))]
3440 use types::os::arch::c95::{c_int, c_uint};
3442 pub const EXIT_FAILURE : c_int = 1;
3443 pub const EXIT_SUCCESS : c_int = 0;
3444 pub const RAND_MAX : c_int = 2147483647;
3445 pub const EOF : c_int = -1;
3446 pub const SEEK_SET : c_int = 0;
3447 pub const SEEK_CUR : c_int = 1;
3448 pub const SEEK_END : c_int = 2;
3449 pub const _IOFBF : c_int = 0;
3450 pub const _IONBF : c_int = 2;
3451 pub const _IOLBF : c_int = 1;
3452 pub const BUFSIZ : c_uint = 1024;
3453 pub const FOPEN_MAX : c_uint = 20;
3454 pub const FILENAME_MAX : c_uint = 1024;
3455 pub const L_tmpnam : c_uint = 1024;
3456 pub const TMP_MAX : c_uint = 308915776;
3461 use types::common::c95::c_void;
3462 use types::os::arch::c95::c_int;
3463 use types::os::arch::posix88::mode_t;
3465 pub const O_RDONLY : c_int = 0;
3466 pub const O_WRONLY : c_int = 1;
3467 pub const O_RDWR : c_int = 2;
3468 pub const O_APPEND : c_int = 8;
3469 pub const O_CREAT : c_int = 512;
3470 pub const O_EXCL : c_int = 2048;
3471 pub const O_TRUNC : c_int = 1024;
3472 pub const S_IFIFO : mode_t = 4096;
3473 pub const S_IFCHR : mode_t = 8192;
3474 pub const S_IFBLK : mode_t = 24576;
3475 pub const S_IFDIR : mode_t = 16384;
3476 pub const S_IFREG : mode_t = 32768;
3477 pub const S_IFLNK : mode_t = 40960;
3478 pub const S_IFMT : mode_t = 61440;
3479 pub const S_IEXEC : mode_t = 64;
3480 pub const S_IWRITE : mode_t = 128;
3481 pub const S_IREAD : mode_t = 256;
3482 pub const S_IRWXU : mode_t = 448;
3483 pub const S_IXUSR : mode_t = 64;
3484 pub const S_IWUSR : mode_t = 128;
3485 pub const S_IRUSR : mode_t = 256;
3486 pub const F_OK : c_int = 0;
3487 pub const R_OK : c_int = 4;
3488 pub const W_OK : c_int = 2;
3489 pub const X_OK : c_int = 1;
3490 pub const STDIN_FILENO : c_int = 0;
3491 pub const STDOUT_FILENO : c_int = 1;
3492 pub const STDERR_FILENO : c_int = 2;
3493 pub const F_LOCK : c_int = 1;
3494 pub const F_TEST : c_int = 3;
3495 pub const F_TLOCK : c_int = 2;
3496 pub const F_ULOCK : c_int = 0;
3497 pub const SIGHUP : c_int = 1;
3498 pub const SIGINT : c_int = 2;
3499 pub const SIGQUIT : c_int = 3;
3500 pub const SIGILL : c_int = 4;
3501 pub const SIGABRT : c_int = 6;
3502 pub const SIGFPE : c_int = 8;
3503 pub const SIGKILL : c_int = 9;
3504 pub const SIGSEGV : c_int = 11;
3505 pub const SIGPIPE : c_int = 13;
3506 pub const SIGALRM : c_int = 14;
3507 pub const SIGTERM : c_int = 15;
3509 pub const PROT_NONE : c_int = 0;
3510 pub const PROT_READ : c_int = 1;
3511 pub const PROT_WRITE : c_int = 2;
3512 pub const PROT_EXEC : c_int = 4;
3514 pub const MAP_FILE : c_int = 0x0000;
3515 pub const MAP_SHARED : c_int = 0x0001;
3516 pub const MAP_PRIVATE : c_int = 0x0002;
3517 pub const MAP_FIXED : c_int = 0x0010;
3518 pub const MAP_ANON : c_int = 0x1000;
3520 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
3522 pub const MCL_CURRENT : c_int = 0x0001;
3523 pub const MCL_FUTURE : c_int = 0x0002;
3525 pub const MS_SYNC : c_int = 0x0000;
3526 pub const MS_ASYNC : c_int = 0x0001;
3527 pub const MS_INVALIDATE : c_int = 0x0002;
3529 pub const EPERM : c_int = 1;
3530 pub const ENOENT : c_int = 2;
3531 pub const ESRCH : c_int = 3;
3532 pub const EINTR : c_int = 4;
3533 pub const EIO : c_int = 5;
3534 pub const ENXIO : c_int = 6;
3535 pub const E2BIG : c_int = 7;
3536 pub const ENOEXEC : c_int = 8;
3537 pub const EBADF : c_int = 9;
3538 pub const ECHILD : c_int = 10;
3539 pub const EDEADLK : c_int = 11;
3540 pub const ENOMEM : c_int = 12;
3541 pub const EACCES : c_int = 13;
3542 pub const EFAULT : c_int = 14;
3543 pub const ENOTBLK : c_int = 15;
3544 pub const EBUSY : c_int = 16;
3545 pub const EEXIST : c_int = 17;
3546 pub const EXDEV : c_int = 18;
3547 pub const ENODEV : c_int = 19;
3548 pub const ENOTDIR : c_int = 20;
3549 pub const EISDIR : c_int = 21;
3550 pub const EINVAL : c_int = 22;
3551 pub const ENFILE : c_int = 23;
3552 pub const EMFILE : c_int = 24;
3553 pub const ENOTTY : c_int = 25;
3554 pub const ETXTBSY : c_int = 26;
3555 pub const EFBIG : c_int = 27;
3556 pub const ENOSPC : c_int = 28;
3557 pub const ESPIPE : c_int = 29;
3558 pub const EROFS : c_int = 30;
3559 pub const EMLINK : c_int = 31;
3560 pub const EPIPE : c_int = 32;
3561 pub const EDOM : c_int = 33;
3562 pub const ERANGE : c_int = 34;
3563 pub const EAGAIN : c_int = 35;
3564 pub const EWOULDBLOCK : c_int = 35;
3565 pub const EINPROGRESS : c_int = 36;
3566 pub const EALREADY : c_int = 37;
3567 pub const ENOTSOCK : c_int = 38;
3568 pub const EDESTADDRREQ : c_int = 39;
3569 pub const EMSGSIZE : c_int = 40;
3570 pub const EPROTOTYPE : c_int = 41;
3571 pub const ENOPROTOOPT : c_int = 42;
3572 pub const EPROTONOSUPPORT : c_int = 43;
3573 pub const ESOCKTNOSUPPORT : c_int = 44;
3574 pub const EOPNOTSUPP : c_int = 45;
3575 pub const EPFNOSUPPORT : c_int = 46;
3576 pub const EAFNOSUPPORT : c_int = 47;
3577 pub const EADDRINUSE : c_int = 48;
3578 pub const EADDRNOTAVAIL : c_int = 49;
3579 pub const ENETDOWN : c_int = 50;
3580 pub const ENETUNREACH : c_int = 51;
3581 pub const ENETRESET : c_int = 52;
3582 pub const ECONNABORTED : c_int = 53;
3583 pub const ECONNRESET : c_int = 54;
3584 pub const ENOBUFS : c_int = 55;
3585 pub const EISCONN : c_int = 56;
3586 pub const ENOTCONN : c_int = 57;
3587 pub const ESHUTDOWN : c_int = 58;
3588 pub const ETOOMANYREFS : c_int = 59;
3589 pub const ETIMEDOUT : c_int = 60;
3590 pub const ECONNREFUSED : c_int = 61;
3591 pub const ELOOP : c_int = 62;
3592 pub const ENAMETOOLONG : c_int = 63;
3593 pub const EHOSTDOWN : c_int = 64;
3594 pub const EHOSTUNREACH : c_int = 65;
3595 pub const ENOTEMPTY : c_int = 66;
3596 pub const EPROCLIM : c_int = 67;
3597 pub const EUSERS : c_int = 68;
3598 pub const EDQUOT : c_int = 69;
3599 pub const ESTALE : c_int = 70;
3600 pub const EREMOTE : c_int = 71;
3601 pub const EBADRPC : c_int = 72;
3602 pub const ERPCMISMATCH : c_int = 73;
3603 pub const EPROGUNAVAIL : c_int = 74;
3604 pub const EPROGMISMATCH : c_int = 75;
3605 pub const EPROCUNAVAIL : c_int = 76;
3606 pub const ENOLCK : c_int = 77;
3607 pub const ENOSYS : c_int = 78;
3608 pub const EFTYPE : c_int = 79;
3609 pub const EAUTH : c_int = 80;
3610 pub const ENEEDAUTH : c_int = 81;
3611 pub const EIDRM : c_int = 82;
3612 pub const ENOMSG : c_int = 83;
3613 pub const EOVERFLOW : c_int = 84;
3614 pub const ECANCELED : c_int = 85;
3615 pub const EILSEQ : c_int = 86;
3616 pub const ENOATTR : c_int = 87;
3617 pub const EDOOFUS : c_int = 88;
3618 pub const EBADMSG : c_int = 89;
3619 pub const EMULTIHOP : c_int = 90;
3620 pub const ENOLINK : c_int = 91;
3621 pub const EPROTO : c_int = 92;
3622 pub const ENOMEDIUM : c_int = 93;
3623 pub const EUNUSED94 : c_int = 94;
3624 pub const EUNUSED95 : c_int = 95;
3625 pub const EUNUSED96 : c_int = 96;
3626 pub const EUNUSED97 : c_int = 97;
3627 pub const EUNUSED98 : c_int = 98;
3628 pub const EASYNC : c_int = 99;
3629 pub const ELAST : c_int = 99;
3632 use types::os::arch::c95::{c_int, size_t};
3634 pub const F_DUPFD : c_int = 0;
3635 pub const F_GETFD : c_int = 1;
3636 pub const F_SETFD : c_int = 2;
3637 pub const F_GETFL : c_int = 3;
3638 pub const F_SETFL : c_int = 4;
3640 pub const SIGTRAP : c_int = 5;
3641 pub const SIG_IGN: size_t = 1;
3643 pub const GLOB_APPEND : c_int = 0x0001;
3644 pub const GLOB_DOOFFS : c_int = 0x0002;
3645 pub const GLOB_ERR : c_int = 0x0004;
3646 pub const GLOB_MARK : c_int = 0x0008;
3647 pub const GLOB_NOCHECK : c_int = 0x0010;
3648 pub const GLOB_NOSORT : c_int = 0x0020;
3649 pub const GLOB_NOESCAPE : c_int = 0x2000;
3651 pub const GLOB_NOSPACE : c_int = -1;
3652 pub const GLOB_ABORTED : c_int = -2;
3653 pub const GLOB_NOMATCH : c_int = -3;
3655 pub const POSIX_MADV_NORMAL : c_int = 0;
3656 pub const POSIX_MADV_RANDOM : c_int = 1;
3657 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
3658 pub const POSIX_MADV_WILLNEED : c_int = 3;
3659 pub const POSIX_MADV_DONTNEED : c_int = 4;
3661 pub const _SC_IOV_MAX : c_int = 56;
3662 pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
3663 pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
3664 pub const _SC_LOGIN_NAME_MAX : c_int = 73;
3665 pub const _SC_MQ_PRIO_MAX : c_int = 75;
3666 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
3667 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
3668 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
3669 pub const _SC_THREAD_KEYS_MAX : c_int = 86;
3670 pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
3671 pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
3672 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
3673 pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
3674 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
3675 pub const _SC_THREAD_STACK_MIN : c_int = 93;
3676 pub const _SC_THREAD_THREADS_MAX : c_int = 94;
3677 pub const _SC_THREADS : c_int = 96;
3678 pub const _SC_TTY_NAME_MAX : c_int = 101;
3679 pub const _SC_ATEXIT_MAX : c_int = 107;
3680 pub const _SC_XOPEN_CRYPT : c_int = 108;
3681 pub const _SC_XOPEN_ENH_I18N : c_int = 109;
3682 pub const _SC_XOPEN_LEGACY : c_int = 110;
3683 pub const _SC_XOPEN_REALTIME : c_int = 111;
3684 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
3685 pub const _SC_XOPEN_SHM : c_int = 113;
3686 pub const _SC_XOPEN_UNIX : c_int = 115;
3687 pub const _SC_XOPEN_VERSION : c_int = 116;
3688 pub const _SC_XOPEN_XCU_VERSION : c_int = 117;
3690 pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
3691 pub const PTHREAD_CREATE_DETACHED: c_int = 1;
3693 #[cfg(target_arch = "arm")]
3694 pub const PTHREAD_STACK_MIN: size_t = 4096;
3696 #[cfg(all(target_os = "freebsd",
3697 any(target_arch = "mips",
3698 target_arch = "mipsel",
3699 target_arch = "x86",
3700 target_arch = "x86_64")))]
3701 pub const PTHREAD_STACK_MIN: size_t = 2048;
3703 #[cfg(target_os = "dragonfly")]
3704 pub const PTHREAD_STACK_MIN: size_t = 1024;
3706 pub const CLOCK_REALTIME: c_int = 0;
3707 pub const CLOCK_MONOTONIC: c_int = 4;
3712 use types::os::arch::c95::c_int;
3714 pub const MADV_NORMAL : c_int = 0;
3715 pub const MADV_RANDOM : c_int = 1;
3716 pub const MADV_SEQUENTIAL : c_int = 2;
3717 pub const MADV_WILLNEED : c_int = 3;
3718 pub const MADV_DONTNEED : c_int = 4;
3719 pub const MADV_FREE : c_int = 5;
3720 pub const MADV_NOSYNC : c_int = 6;
3721 pub const MADV_AUTOSYNC : c_int = 7;
3722 pub const MADV_NOCORE : c_int = 8;
3723 pub const MADV_CORE : c_int = 9;
3724 pub const MADV_PROTECT : c_int = 10;
3726 pub const MINCORE_INCORE : c_int = 0x1;
3727 pub const MINCORE_REFERENCED : c_int = 0x2;
3728 pub const MINCORE_MODIFIED : c_int = 0x4;
3729 pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
3730 pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
3731 pub const MINCORE_SUPER : c_int = 0x20;
3733 pub const AF_INET: c_int = 2;
3734 pub const AF_INET6: c_int = 28;
3735 pub const AF_UNIX: c_int = 1;
3736 pub const SOCK_STREAM: c_int = 1;
3737 pub const SOCK_DGRAM: c_int = 2;
3738 pub const SOCK_RAW: c_int = 3;
3739 pub const IPPROTO_TCP: c_int = 6;
3740 pub const IPPROTO_IP: c_int = 0;
3741 pub const IPPROTO_IPV6: c_int = 41;
3742 pub const IP_MULTICAST_TTL: c_int = 10;
3743 pub const IP_MULTICAST_LOOP: c_int = 11;
3744 pub const IP_TTL: c_int = 4;
3745 pub const IP_HDRINCL: c_int = 2;
3746 pub const IP_ADD_MEMBERSHIP: c_int = 12;
3747 pub const IP_DROP_MEMBERSHIP: c_int = 13;
3748 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
3749 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
3751 pub const TCP_NODELAY: c_int = 1;
3752 pub const TCP_KEEPIDLE: c_int = 256;
3753 pub const SOL_SOCKET: c_int = 0xffff;
3754 pub const SO_KEEPALIVE: c_int = 0x0008;
3755 pub const SO_BROADCAST: c_int = 0x0020;
3756 pub const SO_REUSEADDR: c_int = 0x0004;
3757 pub const SO_ERROR: c_int = 0x1007;
3759 pub const IFF_LOOPBACK: c_int = 0x8;
3761 pub const SHUT_RD: c_int = 0;
3762 pub const SHUT_WR: c_int = 1;
3763 pub const SHUT_RDWR: c_int = 2;
3766 use types::os::arch::c95::c_int;
3768 pub const O_SYNC : c_int = 128;
3769 pub const O_NONBLOCK : c_int = 4;
3770 pub const CTL_KERN: c_int = 1;
3771 pub const KERN_PROC: c_int = 14;
3772 #[cfg(target_os = "freebsd")]
3773 pub const KERN_PROC_PATHNAME: c_int = 12;
3774 #[cfg(target_os = "dragonfly")]
3775 pub const KERN_PROC_PATHNAME: c_int = 9;
3777 pub const MAP_COPY : c_int = 0x0002;
3778 pub const MAP_RENAME : c_int = 0x0020;
3779 pub const MAP_NORESERVE : c_int = 0x0040;
3780 pub const MAP_HASSEMAPHORE : c_int = 0x0200;
3781 pub const MAP_STACK : c_int = 0x0400;
3782 pub const MAP_NOSYNC : c_int = 0x0800;
3783 pub const MAP_NOCORE : c_int = 0x020000;
3785 pub const IPPROTO_RAW : c_int = 255;
3788 use types::os::arch::c95::c_int;
3790 pub const _SC_ARG_MAX : c_int = 1;
3791 pub const _SC_CHILD_MAX : c_int = 2;
3792 pub const _SC_CLK_TCK : c_int = 3;
3793 pub const _SC_NGROUPS_MAX : c_int = 4;
3794 pub const _SC_OPEN_MAX : c_int = 5;
3795 pub const _SC_JOB_CONTROL : c_int = 6;
3796 pub const _SC_SAVED_IDS : c_int = 7;
3797 pub const _SC_VERSION : c_int = 8;
3798 pub const _SC_BC_BASE_MAX : c_int = 9;
3799 pub const _SC_BC_DIM_MAX : c_int = 10;
3800 pub const _SC_BC_SCALE_MAX : c_int = 11;
3801 pub const _SC_BC_STRING_MAX : c_int = 12;
3802 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
3803 pub const _SC_EXPR_NEST_MAX : c_int = 14;
3804 pub const _SC_LINE_MAX : c_int = 15;
3805 pub const _SC_RE_DUP_MAX : c_int = 16;
3806 pub const _SC_2_VERSION : c_int = 17;
3807 pub const _SC_2_C_BIND : c_int = 18;
3808 pub const _SC_2_C_DEV : c_int = 19;
3809 pub const _SC_2_CHAR_TERM : c_int = 20;
3810 pub const _SC_2_FORT_DEV : c_int = 21;
3811 pub const _SC_2_FORT_RUN : c_int = 22;
3812 pub const _SC_2_LOCALEDEF : c_int = 23;
3813 pub const _SC_2_SW_DEV : c_int = 24;
3814 pub const _SC_2_UPE : c_int = 25;
3815 pub const _SC_STREAM_MAX : c_int = 26;
3816 pub const _SC_TZNAME_MAX : c_int = 27;
3817 pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
3818 pub const _SC_MAPPED_FILES : c_int = 29;
3819 pub const _SC_MEMLOCK : c_int = 30;
3820 pub const _SC_MEMLOCK_RANGE : c_int = 31;
3821 pub const _SC_MEMORY_PROTECTION : c_int = 32;
3822 pub const _SC_MESSAGE_PASSING : c_int = 33;
3823 pub const _SC_PRIORITIZED_IO : c_int = 34;
3824 pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
3825 pub const _SC_REALTIME_SIGNALS : c_int = 36;
3826 pub const _SC_SEMAPHORES : c_int = 37;
3827 pub const _SC_FSYNC : c_int = 38;
3828 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
3829 pub const _SC_SYNCHRONIZED_IO : c_int = 40;
3830 pub const _SC_TIMERS : c_int = 41;
3831 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
3832 pub const _SC_AIO_MAX : c_int = 43;
3833 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
3834 pub const _SC_DELAYTIMER_MAX : c_int = 45;
3835 pub const _SC_MQ_OPEN_MAX : c_int = 46;
3836 pub const _SC_PAGESIZE : c_int = 47;
3837 pub const _SC_RTSIG_MAX : c_int = 48;
3838 pub const _SC_SEM_NSEMS_MAX : c_int = 49;
3839 pub const _SC_SEM_VALUE_MAX : c_int = 50;
3840 pub const _SC_SIGQUEUE_MAX : c_int = 51;
3841 pub const _SC_TIMER_MAX : c_int = 52;
3845 #[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
3848 use types::os::arch::c95::{c_int, c_uint};
3850 pub const EXIT_FAILURE : c_int = 1;
3851 pub const EXIT_SUCCESS : c_int = 0;
3852 pub const RAND_MAX : c_int = 2147483647;
3853 pub const EOF : c_int = -1;
3854 pub const SEEK_SET : c_int = 0;
3855 pub const SEEK_CUR : c_int = 1;
3856 pub const SEEK_END : c_int = 2;
3857 pub const _IOFBF : c_int = 0;
3858 pub const _IONBF : c_int = 2;
3859 pub const _IOLBF : c_int = 1;
3860 pub const BUFSIZ : c_uint = 1024;
3861 pub const FOPEN_MAX : c_uint = 20;
3862 pub const FILENAME_MAX : c_uint = 1024;
3863 pub const L_tmpnam : c_uint = 1024;
3864 pub const TMP_MAX : c_uint = 308915776;
3869 use types::common::c95::c_void;
3870 use types::os::arch::c95::c_int;
3871 use types::os::arch::posix88::mode_t;
3873 pub const O_RDONLY : c_int = 0;
3874 pub const O_WRONLY : c_int = 1;
3875 pub const O_RDWR : c_int = 2;
3876 pub const O_APPEND : c_int = 8;
3877 pub const O_CREAT : c_int = 512;
3878 pub const O_EXCL : c_int = 2048;
3879 pub const O_TRUNC : c_int = 1024;
3880 pub const S_IFIFO : mode_t = 4096;
3881 pub const S_IFCHR : mode_t = 8192;
3882 pub const S_IFBLK : mode_t = 24576;
3883 pub const S_IFDIR : mode_t = 16384;
3884 pub const S_IFREG : mode_t = 32768;
3885 pub const S_IFLNK : mode_t = 40960;
3886 pub const S_IFMT : mode_t = 61440;
3887 pub const S_IEXEC : mode_t = 64;
3888 pub const S_IWRITE : mode_t = 128;
3889 pub const S_IREAD : mode_t = 256;
3890 pub const S_IRWXU : mode_t = 448;
3891 pub const S_IXUSR : mode_t = 64;
3892 pub const S_IWUSR : mode_t = 128;
3893 pub const S_IRUSR : mode_t = 256;
3894 pub const F_OK : c_int = 0;
3895 pub const R_OK : c_int = 4;
3896 pub const W_OK : c_int = 2;
3897 pub const X_OK : c_int = 1;
3898 pub const STDIN_FILENO : c_int = 0;
3899 pub const STDOUT_FILENO : c_int = 1;
3900 pub const STDERR_FILENO : c_int = 2;
3901 pub const F_LOCK : c_int = 1;
3902 pub const F_TEST : c_int = 3;
3903 pub const F_TLOCK : c_int = 2;
3904 pub const F_ULOCK : c_int = 0;
3905 pub const SIGHUP : c_int = 1;
3906 pub const SIGINT : c_int = 2;
3907 pub const SIGQUIT : c_int = 3;
3908 pub const SIGILL : c_int = 4;
3909 pub const SIGABRT : c_int = 6;
3910 pub const SIGFPE : c_int = 8;
3911 pub const SIGKILL : c_int = 9;
3912 pub const SIGSEGV : c_int = 11;
3913 pub const SIGPIPE : c_int = 13;
3914 pub const SIGALRM : c_int = 14;
3915 pub const SIGTERM : c_int = 15;
3917 pub const PROT_NONE : c_int = 0;
3918 pub const PROT_READ : c_int = 1;
3919 pub const PROT_WRITE : c_int = 2;
3920 pub const PROT_EXEC : c_int = 4;
3922 pub const MAP_FILE : c_int = 0x0000;
3923 pub const MAP_SHARED : c_int = 0x0001;
3924 pub const MAP_PRIVATE : c_int = 0x0002;
3925 pub const MAP_FIXED : c_int = 0x0010;
3926 pub const MAP_ANON : c_int = 0x1000;
3928 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
3930 pub const MCL_CURRENT : c_int = 0x0001;
3931 pub const MCL_FUTURE : c_int = 0x0002;
3933 pub const MS_ASYNC : c_int = 0x0001;
3934 pub const MS_SYNC : c_int = 0x0002;
3935 pub const MS_INVALIDATE : c_int = 0x0004;
3937 pub const EPERM : c_int = 1;
3938 pub const ENOENT : c_int = 2;
3939 pub const ESRCH : c_int = 3;
3940 pub const EINTR : c_int = 4;
3941 pub const EIO : c_int = 5;
3942 pub const ENXIO : c_int = 6;
3943 pub const E2BIG : c_int = 7;
3944 pub const ENOEXEC : c_int = 8;
3945 pub const EBADF : c_int = 9;
3946 pub const ECHILD : c_int = 10;
3947 pub const EDEADLK : c_int = 11;
3948 pub const ENOMEM : c_int = 12;
3949 pub const EACCES : c_int = 13;
3950 pub const EFAULT : c_int = 14;
3951 pub const ENOTBLK : c_int = 15;
3952 pub const EBUSY : c_int = 16;
3953 pub const EEXIST : c_int = 17;
3954 pub const EXDEV : c_int = 18;
3955 pub const ENODEV : c_int = 19;
3956 pub const ENOTDIR : c_int = 20;
3957 pub const EISDIR : c_int = 21;
3958 pub const EINVAL : c_int = 22;
3959 pub const ENFILE : c_int = 23;
3960 pub const EMFILE : c_int = 24;
3961 pub const ENOTTY : c_int = 25;
3962 pub const ETXTBSY : c_int = 26;
3963 pub const EFBIG : c_int = 27;
3964 pub const ENOSPC : c_int = 28;
3965 pub const ESPIPE : c_int = 29;
3966 pub const EROFS : c_int = 30;
3967 pub const EMLINK : c_int = 31;
3968 pub const EPIPE : c_int = 32;
3969 pub const EDOM : c_int = 33;
3970 pub const ERANGE : c_int = 34;
3971 pub const EAGAIN : c_int = 35;
3972 pub const EWOULDBLOCK : c_int = 35;
3973 pub const EINPROGRESS : c_int = 36;
3974 pub const EALREADY : c_int = 37;
3975 pub const ENOTSOCK : c_int = 38;
3976 pub const EDESTADDRREQ : c_int = 39;
3977 pub const EMSGSIZE : c_int = 40;
3978 pub const EPROTOTYPE : c_int = 41;
3979 pub const ENOPROTOOPT : c_int = 42;
3980 pub const EPROTONOSUPPORT : c_int = 43;
3981 pub const ESOCKTNOSUPPORT : c_int = 44;
3982 pub const EOPNOTSUPP : c_int = 45;
3983 pub const EPFNOSUPPORT : c_int = 46;
3984 pub const EAFNOSUPPORT : c_int = 47;
3985 pub const EADDRINUSE : c_int = 48;
3986 pub const EADDRNOTAVAIL : c_int = 49;
3987 pub const ENETDOWN : c_int = 50;
3988 pub const ENETUNREACH : c_int = 51;
3989 pub const ENETRESET : c_int = 52;
3990 pub const ECONNABORTED : c_int = 53;
3991 pub const ECONNRESET : c_int = 54;
3992 pub const ENOBUFS : c_int = 55;
3993 pub const EISCONN : c_int = 56;
3994 pub const ENOTCONN : c_int = 57;
3995 pub const ESHUTDOWN : c_int = 58;
3996 pub const ETOOMANYREFS : c_int = 59;
3997 pub const ETIMEDOUT : c_int = 60;
3998 pub const ECONNREFUSED : c_int = 61;
3999 pub const ELOOP : c_int = 62;
4000 pub const ENAMETOOLONG : c_int = 63;
4001 pub const EHOSTDOWN : c_int = 64;
4002 pub const EHOSTUNREACH : c_int = 65;
4003 pub const ENOTEMPTY : c_int = 66;
4004 pub const EPROCLIM : c_int = 67;
4005 pub const EUSERS : c_int = 68;
4006 pub const EDQUOT : c_int = 69;
4007 pub const ESTALE : c_int = 70;
4008 pub const EREMOTE : c_int = 71;
4009 pub const EBADRPC : c_int = 72;
4010 pub const ERPCMISMATCH : c_int = 73;
4011 pub const EPROGUNAVAIL : c_int = 74;
4012 pub const EPROGMISMATCH : c_int = 75;
4013 pub const EPROCUNAVAIL : c_int = 76;
4014 pub const ENOLCK : c_int = 77;
4015 pub const ENOSYS : c_int = 78;
4016 pub const EFTYPE : c_int = 79;
4017 pub const EAUTH : c_int = 80;
4018 pub const ENEEDAUTH : c_int = 81;
4019 pub const EIPSEC : c_int = 82;
4020 pub const ENOATTR : c_int = 83;
4021 pub const EILSEQ : c_int = 84;
4022 pub const ENOMEDIUM : c_int = 85;
4023 pub const EMEDIUMTYPE : c_int = 86;
4024 pub const EOVERFLOW : c_int = 87;
4025 pub const ECANCELED : c_int = 88;
4026 pub const EIDRM : c_int = 89;
4027 pub const ENOMSG : c_int = 90;
4028 pub const ENOTSUP : c_int = 91;
4029 pub const ELAST : c_int = 91; // must be equal to largest errno
4032 use types::os::arch::c95::{c_int, size_t};
4034 pub const F_DUPFD : c_int = 0;
4035 pub const F_GETFD : c_int = 1;
4036 pub const F_SETFD : c_int = 2;
4037 pub const F_GETFL : c_int = 3;
4038 pub const F_SETFL : c_int = 4;
4039 pub const F_GETOWN : c_int = 5;
4040 pub const F_SETOWN : c_int = 6;
4041 pub const F_GETLK : c_int = 7;
4042 pub const F_SETLK : c_int = 8;
4043 pub const F_SETLKW : c_int = 9;
4044 pub const F_DUPFD_CLOEXEC : c_int = 10;
4046 pub const SIGTRAP : c_int = 5;
4047 pub const SIG_IGN: size_t = 1;
4049 pub const GLOB_APPEND : c_int = 0x0001;
4050 pub const GLOB_DOOFFS : c_int = 0x0002;
4051 pub const GLOB_ERR : c_int = 0x0004;
4052 pub const GLOB_MARK : c_int = 0x0008;
4053 pub const GLOB_NOCHECK : c_int = 0x0010;
4054 pub const GLOB_NOSORT : c_int = 0x0020;
4055 pub const GLOB_NOESCAPE : c_int = 0x1000;
4057 pub const GLOB_NOSPACE : c_int = -1;
4058 pub const GLOB_ABORTED : c_int = -2;
4059 pub const GLOB_NOMATCH : c_int = -3;
4060 pub const GLOB_NOSYS : c_int = -4;
4062 pub const POSIX_MADV_NORMAL : c_int = 0;
4063 pub const POSIX_MADV_RANDOM : c_int = 1;
4064 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
4065 pub const POSIX_MADV_WILLNEED : c_int = 3;
4066 pub const POSIX_MADV_DONTNEED : c_int = 4;
4068 pub const _SC_IOV_MAX : c_int = 51;
4069 pub const _SC_GETGR_R_SIZE_MAX : c_int = 100;
4070 pub const _SC_GETPW_R_SIZE_MAX : c_int = 101;
4071 pub const _SC_LOGIN_NAME_MAX : c_int = 102;
4072 pub const _SC_MQ_PRIO_MAX : c_int = 59;
4073 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
4074 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
4075 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 80;
4076 pub const _SC_THREAD_KEYS_MAX : c_int = 81;
4077 pub const _SC_THREAD_PRIO_INHERIT : c_int = 82;
4078 pub const _SC_THREAD_PRIO_PROTECT : c_int = 83;
4079 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 84;
4080 pub const _SC_THREAD_PROCESS_SHARED : c_int = 85;
4081 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 103;
4082 pub const _SC_THREAD_STACK_MIN : c_int = 89;
4083 pub const _SC_THREAD_THREADS_MAX : c_int = 90;
4084 pub const _SC_THREADS : c_int = 91;
4085 pub const _SC_TTY_NAME_MAX : c_int = 107;
4086 pub const _SC_ATEXIT_MAX : c_int = 46;
4087 pub const _SC_XOPEN_CRYPT : c_int = 117;
4088 pub const _SC_XOPEN_ENH_I18N : c_int = 118;
4089 pub const _SC_XOPEN_LEGACY : c_int = 119;
4090 pub const _SC_XOPEN_REALTIME : c_int = 120;
4091 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 121;
4092 pub const _SC_XOPEN_SHM : c_int = 30;
4093 pub const _SC_XOPEN_UNIX : c_int = 123;
4094 pub const _SC_XOPEN_VERSION : c_int = 125;
4096 pub const PTHREAD_CREATE_JOINABLE : c_int = 0;
4097 pub const PTHREAD_CREATE_DETACHED : c_int = 1;
4098 pub const PTHREAD_STACK_MIN : size_t = 2048;
4100 pub const CLOCK_REALTIME : c_int = 0;
4101 pub const CLOCK_MONOTONIC : c_int = 3;
4106 use types::os::arch::c95::c_int;
4108 pub const MADV_NORMAL : c_int = 0;
4109 pub const MADV_RANDOM : c_int = 1;
4110 pub const MADV_SEQUENTIAL : c_int = 2;
4111 pub const MADV_WILLNEED : c_int = 3;
4112 pub const MADV_DONTNEED : c_int = 4;
4113 pub const MADV_FREE : c_int = 6;
4115 pub const AF_UNIX: c_int = 1;
4116 pub const AF_INET: c_int = 2;
4117 pub const AF_INET6: c_int = 24;
4118 pub const SOCK_STREAM: c_int = 1;
4119 pub const SOCK_DGRAM: c_int = 2;
4120 pub const SOCK_RAW: c_int = 3;
4121 pub const IPPROTO_TCP: c_int = 6;
4122 pub const IPPROTO_IP: c_int = 0;
4123 pub const IPPROTO_IPV6: c_int = 41;
4124 pub const IP_MULTICAST_TTL: c_int = 10;
4125 pub const IP_MULTICAST_LOOP: c_int = 11;
4126 pub const IP_TTL: c_int = 4;
4127 pub const IP_HDRINCL: c_int = 2;
4128 pub const IP_ADD_MEMBERSHIP: c_int = 12;
4129 pub const IP_DROP_MEMBERSHIP: c_int = 13;
4130 pub const IPV6_ADD_MEMBERSHIP: c_int = 12; // don't exist
4131 pub const IPV6_DROP_MEMBERSHIP: c_int = 13; // don't exist
4133 pub const TCP_NODELAY: c_int = 0x01;
4134 pub const SOL_SOCKET: c_int = 0xffff;
4135 pub const SO_KEEPALIVE: c_int = 0x0008;
4136 pub const SO_BROADCAST: c_int = 0x0020;
4137 pub const SO_REUSEADDR: c_int = 0x0004;
4138 pub const SO_ERROR: c_int = 0x1007;
4140 pub const IFF_LOOPBACK: c_int = 0x8;
4142 pub const SHUT_RD: c_int = 0;
4143 pub const SHUT_WR: c_int = 1;
4144 pub const SHUT_RDWR: c_int = 2;
4147 use types::os::arch::c95::c_int;
4149 pub const O_DSYNC : c_int = 128; // same as SYNC
4150 pub const O_SYNC : c_int = 128;
4151 pub const O_NONBLOCK : c_int = 4;
4152 pub const CTL_KERN : c_int = 1;
4153 pub const KERN_PROC : c_int = 66;
4155 pub const MAP_COPY : c_int = 0x0002;
4156 pub const MAP_RENAME : c_int = 0x0000;
4157 pub const MAP_NORESERVE : c_int = 0x0000;
4158 pub const MAP_NOEXTEND : c_int = 0x0000;
4159 pub const MAP_HASSEMAPHORE : c_int = 0x0000;
4161 pub const IPPROTO_RAW : c_int = 255;
4163 pub const PATH_MAX: c_int = 1024;
4166 use types::os::arch::c95::c_int;
4168 pub const _SC_ARG_MAX : c_int = 1;
4169 pub const _SC_CHILD_MAX : c_int = 2;
4170 pub const _SC_CLK_TCK : c_int = 3;
4171 pub const _SC_NGROUPS_MAX : c_int = 4;
4172 pub const _SC_OPEN_MAX : c_int = 5;
4173 pub const _SC_JOB_CONTROL : c_int = 6;
4174 pub const _SC_SAVED_IDS : c_int = 7;
4175 pub const _SC_VERSION : c_int = 8;
4176 pub const _SC_BC_BASE_MAX : c_int = 9;
4177 pub const _SC_BC_DIM_MAX : c_int = 10;
4178 pub const _SC_BC_SCALE_MAX : c_int = 11;
4179 pub const _SC_BC_STRING_MAX : c_int = 12;
4180 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
4181 pub const _SC_EXPR_NEST_MAX : c_int = 14;
4182 pub const _SC_LINE_MAX : c_int = 15;
4183 pub const _SC_RE_DUP_MAX : c_int = 16;
4184 pub const _SC_2_VERSION : c_int = 17;
4185 pub const _SC_2_C_BIND : c_int = 18;
4186 pub const _SC_2_C_DEV : c_int = 19;
4187 pub const _SC_2_CHAR_TERM : c_int = 20;
4188 pub const _SC_2_FORT_DEV : c_int = 21;
4189 pub const _SC_2_FORT_RUN : c_int = 22;
4190 pub const _SC_2_LOCALEDEF : c_int = 23;
4191 pub const _SC_2_SW_DEV : c_int = 24;
4192 pub const _SC_2_UPE : c_int = 25;
4193 pub const _SC_STREAM_MAX : c_int = 26;
4194 pub const _SC_TZNAME_MAX : c_int = 27;
4195 pub const _SC_PAGESIZE : c_int = 28;
4196 pub const _SC_FSYNC : c_int = 29;
4197 pub const _SC_SEM_NSEMS_MAX : c_int = 31;
4198 pub const _SC_SEM_VALUE_MAX : c_int = 32;
4199 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
4200 pub const _SC_AIO_MAX : c_int = 43;
4201 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
4202 pub const _SC_ASYNCHRONOUS_IO : c_int = 45;
4203 pub const _SC_DELAYTIMER_MAX : c_int = 50;
4204 pub const _SC_MAPPED_FILES : c_int = 53;
4205 pub const _SC_MEMLOCK : c_int = 54;
4206 pub const _SC_MEMLOCK_RANGE : c_int = 55;
4207 pub const _SC_MEMORY_PROTECTION : c_int = 56;
4208 pub const _SC_MESSAGE_PASSING : c_int = 57;
4209 pub const _SC_MQ_OPEN_MAX : c_int = 58;
4210 pub const _SC_PRIORITIZED_IO : c_int = 60;
4211 pub const _SC_PRIORITY_SCHEDULING : c_int = 61;
4212 pub const _SC_REALTIME_SIGNALS : c_int = 64;
4213 pub const _SC_RTSIG_MAX : c_int = 66;
4214 pub const _SC_SEMAPHORES : c_int = 67;
4215 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 68;
4216 pub const _SC_SIGQUEUE_MAX : c_int = 70;
4217 pub const _SC_SYNCHRONIZED_IO : c_int = 75;
4218 pub const _SC_TIMER_MAX : c_int = 93;
4219 pub const _SC_TIMERS : c_int = 94;
4223 #[cfg(any(target_os = "macos", target_os = "ios"))]
4226 use types::os::arch::c95::{c_int, c_uint};
4228 pub const EXIT_FAILURE : c_int = 1;
4229 pub const EXIT_SUCCESS : c_int = 0;
4230 pub const RAND_MAX : c_int = 2147483647;
4231 pub const EOF : c_int = -1;
4232 pub const SEEK_SET : c_int = 0;
4233 pub const SEEK_CUR : c_int = 1;
4234 pub const SEEK_END : c_int = 2;
4235 pub const _IOFBF : c_int = 0;
4236 pub const _IONBF : c_int = 2;
4237 pub const _IOLBF : c_int = 1;
4238 pub const BUFSIZ : c_uint = 1024;
4239 pub const FOPEN_MAX : c_uint = 20;
4240 pub const FILENAME_MAX : c_uint = 1024;
4241 pub const L_tmpnam : c_uint = 1024;
4242 pub const TMP_MAX : c_uint = 308915776;
4247 use types::common::c95::c_void;
4248 use types::os::arch::c95::c_int;
4249 use types::os::arch::posix88::mode_t;
4251 pub const O_RDONLY : c_int = 0;
4252 pub const O_WRONLY : c_int = 1;
4253 pub const O_RDWR : c_int = 2;
4254 pub const O_APPEND : c_int = 8;
4255 pub const O_CREAT : c_int = 512;
4256 pub const O_EXCL : c_int = 2048;
4257 pub const O_TRUNC : c_int = 1024;
4258 pub const S_IFIFO : mode_t = 4096;
4259 pub const S_IFCHR : mode_t = 8192;
4260 pub const S_IFBLK : mode_t = 24576;
4261 pub const S_IFDIR : mode_t = 16384;
4262 pub const S_IFREG : mode_t = 32768;
4263 pub const S_IFLNK : mode_t = 40960;
4264 pub const S_IFMT : mode_t = 61440;
4265 pub const S_IEXEC : mode_t = 64;
4266 pub const S_IWRITE : mode_t = 128;
4267 pub const S_IREAD : mode_t = 256;
4268 pub const S_IRWXU : mode_t = 448;
4269 pub const S_IXUSR : mode_t = 64;
4270 pub const S_IWUSR : mode_t = 128;
4271 pub const S_IRUSR : mode_t = 256;
4272 pub const F_OK : c_int = 0;
4273 pub const R_OK : c_int = 4;
4274 pub const W_OK : c_int = 2;
4275 pub const X_OK : c_int = 1;
4276 pub const STDIN_FILENO : c_int = 0;
4277 pub const STDOUT_FILENO : c_int = 1;
4278 pub const STDERR_FILENO : c_int = 2;
4279 pub const F_LOCK : c_int = 1;
4280 pub const F_TEST : c_int = 3;
4281 pub const F_TLOCK : c_int = 2;
4282 pub const F_ULOCK : c_int = 0;
4283 pub const SIGHUP : c_int = 1;
4284 pub const SIGINT : c_int = 2;
4285 pub const SIGQUIT : c_int = 3;
4286 pub const SIGILL : c_int = 4;
4287 pub const SIGABRT : c_int = 6;
4288 pub const SIGFPE : c_int = 8;
4289 pub const SIGKILL : c_int = 9;
4290 pub const SIGSEGV : c_int = 11;
4291 pub const SIGPIPE : c_int = 13;
4292 pub const SIGALRM : c_int = 14;
4293 pub const SIGTERM : c_int = 15;
4295 pub const PROT_NONE : c_int = 0;
4296 pub const PROT_READ : c_int = 1;
4297 pub const PROT_WRITE : c_int = 2;
4298 pub const PROT_EXEC : c_int = 4;
4300 pub const MAP_FILE : c_int = 0x0000;
4301 pub const MAP_SHARED : c_int = 0x0001;
4302 pub const MAP_PRIVATE : c_int = 0x0002;
4303 pub const MAP_FIXED : c_int = 0x0010;
4304 pub const MAP_ANON : c_int = 0x1000;
4306 pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
4308 pub const MCL_CURRENT : c_int = 0x0001;
4309 pub const MCL_FUTURE : c_int = 0x0002;
4311 pub const MS_ASYNC : c_int = 0x0001;
4312 pub const MS_INVALIDATE : c_int = 0x0002;
4313 pub const MS_SYNC : c_int = 0x0010;
4315 pub const MS_KILLPAGES : c_int = 0x0004;
4316 pub const MS_DEACTIVATE : c_int = 0x0008;
4318 pub const EPERM : c_int = 1;
4319 pub const ENOENT : c_int = 2;
4320 pub const ESRCH : c_int = 3;
4321 pub const EINTR : c_int = 4;
4322 pub const EIO : c_int = 5;
4323 pub const ENXIO : c_int = 6;
4324 pub const E2BIG : c_int = 7;
4325 pub const ENOEXEC : c_int = 8;
4326 pub const EBADF : c_int = 9;
4327 pub const ECHILD : c_int = 10;
4328 pub const EDEADLK : c_int = 11;
4329 pub const ENOMEM : c_int = 12;
4330 pub const EACCES : c_int = 13;
4331 pub const EFAULT : c_int = 14;
4332 pub const ENOTBLK : c_int = 15;
4333 pub const EBUSY : c_int = 16;
4334 pub const EEXIST : c_int = 17;
4335 pub const EXDEV : c_int = 18;
4336 pub const ENODEV : c_int = 19;
4337 pub const ENOTDIR : c_int = 20;
4338 pub const EISDIR : c_int = 21;
4339 pub const EINVAL : c_int = 22;
4340 pub const ENFILE : c_int = 23;
4341 pub const EMFILE : c_int = 24;
4342 pub const ENOTTY : c_int = 25;
4343 pub const ETXTBSY : c_int = 26;
4344 pub const EFBIG : c_int = 27;
4345 pub const ENOSPC : c_int = 28;
4346 pub const ESPIPE : c_int = 29;
4347 pub const EROFS : c_int = 30;
4348 pub const EMLINK : c_int = 31;
4349 pub const EPIPE : c_int = 32;
4350 pub const EDOM : c_int = 33;
4351 pub const ERANGE : c_int = 34;
4352 pub const EAGAIN : c_int = 35;
4353 pub const EWOULDBLOCK : c_int = EAGAIN;
4354 pub const EINPROGRESS : c_int = 36;
4355 pub const EALREADY : c_int = 37;
4356 pub const ENOTSOCK : c_int = 38;
4357 pub const EDESTADDRREQ : c_int = 39;
4358 pub const EMSGSIZE : c_int = 40;
4359 pub const EPROTOTYPE : c_int = 41;
4360 pub const ENOPROTOOPT : c_int = 42;
4361 pub const EPROTONOSUPPORT : c_int = 43;
4362 pub const ESOCKTNOSUPPORT : c_int = 44;
4363 pub const ENOTSUP : c_int = 45;
4364 pub const EPFNOSUPPORT : c_int = 46;
4365 pub const EAFNOSUPPORT : c_int = 47;
4366 pub const EADDRINUSE : c_int = 48;
4367 pub const EADDRNOTAVAIL : c_int = 49;
4368 pub const ENETDOWN : c_int = 50;
4369 pub const ENETUNREACH : c_int = 51;
4370 pub const ENETRESET : c_int = 52;
4371 pub const ECONNABORTED : c_int = 53;
4372 pub const ECONNRESET : c_int = 54;
4373 pub const ENOBUFS : c_int = 55;
4374 pub const EISCONN : c_int = 56;
4375 pub const ENOTCONN : c_int = 57;
4376 pub const ESHUTDOWN : c_int = 58;
4377 pub const ETOOMANYREFS : c_int = 59;
4378 pub const ETIMEDOUT : c_int = 60;
4379 pub const ECONNREFUSED : c_int = 61;
4380 pub const ELOOP : c_int = 62;
4381 pub const ENAMETOOLONG : c_int = 63;
4382 pub const EHOSTDOWN : c_int = 64;
4383 pub const EHOSTUNREACH : c_int = 65;
4384 pub const ENOTEMPTY : c_int = 66;
4385 pub const EPROCLIM : c_int = 67;
4386 pub const EUSERS : c_int = 68;
4387 pub const EDQUOT : c_int = 69;
4388 pub const ESTALE : c_int = 70;
4389 pub const EREMOTE : c_int = 71;
4390 pub const EBADRPC : c_int = 72;
4391 pub const ERPCMISMATCH : c_int = 73;
4392 pub const EPROGUNAVAIL : c_int = 74;
4393 pub const EPROGMISMATCH : c_int = 75;
4394 pub const EPROCUNAVAIL : c_int = 76;
4395 pub const ENOLCK : c_int = 77;
4396 pub const ENOSYS : c_int = 78;
4397 pub const EFTYPE : c_int = 79;
4398 pub const EAUTH : c_int = 80;
4399 pub const ENEEDAUTH : c_int = 81;
4400 pub const EPWROFF : c_int = 82;
4401 pub const EDEVERR : c_int = 83;
4402 pub const EOVERFLOW : c_int = 84;
4403 pub const EBADEXEC : c_int = 85;
4404 pub const EBADARCH : c_int = 86;
4405 pub const ESHLIBVERS : c_int = 87;
4406 pub const EBADMACHO : c_int = 88;
4407 pub const ECANCELED : c_int = 89;
4408 pub const EIDRM : c_int = 90;
4409 pub const ENOMSG : c_int = 91;
4410 pub const EILSEQ : c_int = 92;
4411 pub const ENOATTR : c_int = 93;
4412 pub const EBADMSG : c_int = 94;
4413 pub const EMULTIHOP : c_int = 95;
4414 pub const ENODATA : c_int = 96;
4415 pub const ENOLINK : c_int = 97;
4416 pub const ENOSR : c_int = 98;
4417 pub const ENOSTR : c_int = 99;
4418 pub const EPROTO : c_int = 100;
4419 pub const ETIME : c_int = 101;
4420 pub const EOPNOTSUPP : c_int = 102;
4421 pub const ENOPOLICY : c_int = 103;
4422 pub const ENOTRECOVERABLE : c_int = 104;
4423 pub const EOWNERDEAD : c_int = 105;
4424 pub const EQFULL : c_int = 106;
4425 pub const ELAST : c_int = 106;
4428 use types::os::arch::c95::{c_int, size_t};
4430 pub const F_DUPFD : c_int = 0;
4431 pub const F_GETFD : c_int = 1;
4432 pub const F_SETFD : c_int = 2;
4433 pub const F_GETFL : c_int = 3;
4434 pub const F_SETFL : c_int = 4;
4436 pub const SIGTRAP : c_int = 5;
4437 pub const SIG_IGN: size_t = 1;
4439 pub const GLOB_APPEND : c_int = 0x0001;
4440 pub const GLOB_DOOFFS : c_int = 0x0002;
4441 pub const GLOB_ERR : c_int = 0x0004;
4442 pub const GLOB_MARK : c_int = 0x0008;
4443 pub const GLOB_NOCHECK : c_int = 0x0010;
4444 pub const GLOB_NOSORT : c_int = 0x0020;
4445 pub const GLOB_NOESCAPE : c_int = 0x2000;
4447 pub const GLOB_NOSPACE : c_int = -1;
4448 pub const GLOB_ABORTED : c_int = -2;
4449 pub const GLOB_NOMATCH : c_int = -3;
4451 pub const POSIX_MADV_NORMAL : c_int = 0;
4452 pub const POSIX_MADV_RANDOM : c_int = 1;
4453 pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
4454 pub const POSIX_MADV_WILLNEED : c_int = 3;
4455 pub const POSIX_MADV_DONTNEED : c_int = 4;
4457 pub const _SC_IOV_MAX : c_int = 56;
4458 pub const _SC_GETGR_R_SIZE_MAX : c_int = 70;
4459 pub const _SC_GETPW_R_SIZE_MAX : c_int = 71;
4460 pub const _SC_LOGIN_NAME_MAX : c_int = 73;
4461 pub const _SC_MQ_PRIO_MAX : c_int = 75;
4462 pub const _SC_THREAD_ATTR_STACKADDR : c_int = 82;
4463 pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 83;
4464 pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 85;
4465 pub const _SC_THREAD_KEYS_MAX : c_int = 86;
4466 pub const _SC_THREAD_PRIO_INHERIT : c_int = 87;
4467 pub const _SC_THREAD_PRIO_PROTECT : c_int = 88;
4468 pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 89;
4469 pub const _SC_THREAD_PROCESS_SHARED : c_int = 90;
4470 pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 91;
4471 pub const _SC_THREAD_STACK_MIN : c_int = 93;
4472 pub const _SC_THREAD_THREADS_MAX : c_int = 94;
4473 pub const _SC_THREADS : c_int = 96;
4474 pub const _SC_TTY_NAME_MAX : c_int = 101;
4475 pub const _SC_ATEXIT_MAX : c_int = 107;
4476 pub const _SC_XOPEN_CRYPT : c_int = 108;
4477 pub const _SC_XOPEN_ENH_I18N : c_int = 109;
4478 pub const _SC_XOPEN_LEGACY : c_int = 110;
4479 pub const _SC_XOPEN_REALTIME : c_int = 111;
4480 pub const _SC_XOPEN_REALTIME_THREADS : c_int = 112;
4481 pub const _SC_XOPEN_SHM : c_int = 113;
4482 pub const _SC_XOPEN_UNIX : c_int = 115;
4483 pub const _SC_XOPEN_VERSION : c_int = 116;
4484 pub const _SC_XOPEN_XCU_VERSION : c_int = 121;
4486 pub const PTHREAD_CREATE_JOINABLE: c_int = 1;
4487 pub const PTHREAD_CREATE_DETACHED: c_int = 2;
4488 pub const PTHREAD_STACK_MIN: size_t = 8192;
4493 use types::os::arch::c95::c_int;
4495 pub const MADV_NORMAL : c_int = 0;
4496 pub const MADV_RANDOM : c_int = 1;
4497 pub const MADV_SEQUENTIAL : c_int = 2;
4498 pub const MADV_WILLNEED : c_int = 3;
4499 pub const MADV_DONTNEED : c_int = 4;
4500 pub const MADV_FREE : c_int = 5;
4501 pub const MADV_ZERO_WIRED_PAGES : c_int = 6;
4502 pub const MADV_FREE_REUSABLE : c_int = 7;
4503 pub const MADV_FREE_REUSE : c_int = 8;
4504 pub const MADV_CAN_REUSE : c_int = 9;
4506 pub const MINCORE_INCORE : c_int = 0x1;
4507 pub const MINCORE_REFERENCED : c_int = 0x2;
4508 pub const MINCORE_MODIFIED : c_int = 0x4;
4509 pub const MINCORE_REFERENCED_OTHER : c_int = 0x8;
4510 pub const MINCORE_MODIFIED_OTHER : c_int = 0x10;
4512 pub const AF_UNIX: c_int = 1;
4513 pub const AF_INET: c_int = 2;
4514 pub const AF_INET6: c_int = 30;
4515 pub const SOCK_STREAM: c_int = 1;
4516 pub const SOCK_DGRAM: c_int = 2;
4517 pub const SOCK_RAW: c_int = 3;
4518 pub const IPPROTO_TCP: c_int = 6;
4519 pub const IPPROTO_IP: c_int = 0;
4520 pub const IPPROTO_IPV6: c_int = 41;
4521 pub const IP_MULTICAST_TTL: c_int = 10;
4522 pub const IP_MULTICAST_LOOP: c_int = 11;
4523 pub const IP_TTL: c_int = 4;
4524 pub const IP_HDRINCL: c_int = 2;
4525 pub const IP_ADD_MEMBERSHIP: c_int = 12;
4526 pub const IP_DROP_MEMBERSHIP: c_int = 13;
4527 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
4528 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
4530 pub const TCP_NODELAY: c_int = 0x01;
4531 pub const TCP_KEEPALIVE: c_int = 0x10;
4532 pub const SOL_SOCKET: c_int = 0xffff;
4533 pub const SO_KEEPALIVE: c_int = 0x0008;
4534 pub const SO_BROADCAST: c_int = 0x0020;
4535 pub const SO_REUSEADDR: c_int = 0x0004;
4536 pub const SO_ERROR: c_int = 0x1007;
4538 pub const IFF_LOOPBACK: c_int = 0x8;
4540 pub const SHUT_RD: c_int = 0;
4541 pub const SHUT_WR: c_int = 1;
4542 pub const SHUT_RDWR: c_int = 2;
4545 use types::os::arch::c95::c_int;
4547 pub const O_DSYNC : c_int = 4194304;
4548 pub const O_SYNC : c_int = 128;
4549 pub const O_NONBLOCK : c_int = 4;
4550 pub const F_FULLFSYNC : c_int = 51;
4552 pub const MAP_COPY : c_int = 0x0002;
4553 pub const MAP_RENAME : c_int = 0x0020;
4554 pub const MAP_NORESERVE : c_int = 0x0040;
4555 pub const MAP_NOEXTEND : c_int = 0x0100;
4556 pub const MAP_HASSEMAPHORE : c_int = 0x0200;
4557 pub const MAP_NOCACHE : c_int = 0x0400;
4558 pub const MAP_JIT : c_int = 0x0800;
4559 pub const MAP_STACK : c_int = 0;
4561 pub const IPPROTO_RAW : c_int = 255;
4564 use types::os::arch::c95::c_int;
4566 pub const _SC_ARG_MAX : c_int = 1;
4567 pub const _SC_CHILD_MAX : c_int = 2;
4568 pub const _SC_CLK_TCK : c_int = 3;
4569 pub const _SC_NGROUPS_MAX : c_int = 4;
4570 pub const _SC_OPEN_MAX : c_int = 5;
4571 pub const _SC_JOB_CONTROL : c_int = 6;
4572 pub const _SC_SAVED_IDS : c_int = 7;
4573 pub const _SC_VERSION : c_int = 8;
4574 pub const _SC_BC_BASE_MAX : c_int = 9;
4575 pub const _SC_BC_DIM_MAX : c_int = 10;
4576 pub const _SC_BC_SCALE_MAX : c_int = 11;
4577 pub const _SC_BC_STRING_MAX : c_int = 12;
4578 pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
4579 pub const _SC_EXPR_NEST_MAX : c_int = 14;
4580 pub const _SC_LINE_MAX : c_int = 15;
4581 pub const _SC_RE_DUP_MAX : c_int = 16;
4582 pub const _SC_2_VERSION : c_int = 17;
4583 pub const _SC_2_C_BIND : c_int = 18;
4584 pub const _SC_2_C_DEV : c_int = 19;
4585 pub const _SC_2_CHAR_TERM : c_int = 20;
4586 pub const _SC_2_FORT_DEV : c_int = 21;
4587 pub const _SC_2_FORT_RUN : c_int = 22;
4588 pub const _SC_2_LOCALEDEF : c_int = 23;
4589 pub const _SC_2_SW_DEV : c_int = 24;
4590 pub const _SC_2_UPE : c_int = 25;
4591 pub const _SC_STREAM_MAX : c_int = 26;
4592 pub const _SC_TZNAME_MAX : c_int = 27;
4593 pub const _SC_ASYNCHRONOUS_IO : c_int = 28;
4594 pub const _SC_PAGESIZE : c_int = 29;
4595 pub const _SC_MEMLOCK : c_int = 30;
4596 pub const _SC_MEMLOCK_RANGE : c_int = 31;
4597 pub const _SC_MEMORY_PROTECTION : c_int = 32;
4598 pub const _SC_MESSAGE_PASSING : c_int = 33;
4599 pub const _SC_PRIORITIZED_IO : c_int = 34;
4600 pub const _SC_PRIORITY_SCHEDULING : c_int = 35;
4601 pub const _SC_REALTIME_SIGNALS : c_int = 36;
4602 pub const _SC_SEMAPHORES : c_int = 37;
4603 pub const _SC_FSYNC : c_int = 38;
4604 pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 39;
4605 pub const _SC_SYNCHRONIZED_IO : c_int = 40;
4606 pub const _SC_TIMERS : c_int = 41;
4607 pub const _SC_AIO_LISTIO_MAX : c_int = 42;
4608 pub const _SC_AIO_MAX : c_int = 43;
4609 pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
4610 pub const _SC_DELAYTIMER_MAX : c_int = 45;
4611 pub const _SC_MQ_OPEN_MAX : c_int = 46;
4612 pub const _SC_MAPPED_FILES : c_int = 47;
4613 pub const _SC_RTSIG_MAX : c_int = 48;
4614 pub const _SC_SEM_NSEMS_MAX : c_int = 49;
4615 pub const _SC_SEM_VALUE_MAX : c_int = 50;
4616 pub const _SC_SIGQUEUE_MAX : c_int = 51;
4617 pub const _SC_TIMER_MAX : c_int = 52;
4618 pub const _SC_XBS5_ILP32_OFF32 : c_int = 122;
4619 pub const _SC_XBS5_ILP32_OFFBIG : c_int = 123;
4620 pub const _SC_XBS5_LP64_OFF64 : c_int = 124;
4621 pub const _SC_XBS5_LPBIG_OFFBIG : c_int = 125;
4628 // Thankfully most of c95 is universally available and does not vary by OS
4629 // or anything. The same is not true of POSIX.
4633 use types::os::arch::c95::{c_char, c_int};
4636 pub fn isalnum(c: c_int) -> c_int;
4637 pub fn isalpha(c: c_int) -> c_int;
4638 pub fn iscntrl(c: c_int) -> c_int;
4639 pub fn isdigit(c: c_int) -> c_int;
4640 pub fn isgraph(c: c_int) -> c_int;
4641 pub fn islower(c: c_int) -> c_int;
4642 pub fn isprint(c: c_int) -> c_int;
4643 pub fn ispunct(c: c_int) -> c_int;
4644 pub fn isspace(c: c_int) -> c_int;
4645 pub fn isupper(c: c_int) -> c_int;
4646 pub fn isxdigit(c: c_int) -> c_int;
4647 pub fn tolower(c: c_char) -> c_char;
4648 pub fn toupper(c: c_char) -> c_char;
4653 use types::common::c95::{FILE, c_void, fpos_t};
4654 use types::os::arch::c95::{c_char, c_int, c_long, size_t};
4657 pub fn fopen(filename: *const c_char,
4658 mode: *const c_char) -> *mut FILE;
4659 pub fn freopen(filename: *const c_char, mode: *const c_char,
4662 pub fn fflush(file: *mut FILE) -> c_int;
4663 pub fn fclose(file: *mut FILE) -> c_int;
4664 pub fn remove(filename: *const c_char) -> c_int;
4665 pub fn rename(oldname: *const c_char,
4666 newname: *const c_char) -> c_int;
4667 pub fn tmpfile() -> *mut FILE;
4668 pub fn setvbuf(stream: *mut FILE,
4669 buffer: *mut c_char,
4673 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
4674 // Omitted: printf and scanf variants.
4675 pub fn fgetc(stream: *mut FILE) -> c_int;
4676 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
4678 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
4679 pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int;
4680 // Omitted: getc, getchar (might be macros).
4682 // Omitted: gets, so ridiculously unsafe that it should not
4685 // Omitted: putc, putchar (might be macros).
4686 pub fn puts(s: *const c_char) -> c_int;
4687 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
4688 pub fn fread(ptr: *mut c_void,
4693 pub fn fwrite(ptr: *const c_void,
4698 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int)
4700 pub fn ftell(stream: *mut FILE) -> c_long;
4701 pub fn rewind(stream: *mut FILE);
4702 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
4703 pub fn fsetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
4704 pub fn feof(stream: *mut FILE) -> c_int;
4705 pub fn ferror(stream: *mut FILE) -> c_int;
4706 pub fn perror(s: *const c_char);
4711 use types::common::c95::c_void;
4712 use types::os::arch::c95::{c_char, c_double, c_int};
4713 use types::os::arch::c95::{c_long, c_uint, c_ulong};
4714 use types::os::arch::c95::{size_t};
4717 pub fn abs(i: c_int) -> c_int;
4718 pub fn labs(i: c_long) -> c_long;
4719 // Omitted: div, ldiv (return pub type incomplete).
4720 pub fn atof(s: *const c_char) -> c_double;
4721 pub fn atoi(s: *const c_char) -> c_int;
4722 pub fn strtod(s: *const c_char,
4723 endp: *mut *mut c_char) -> c_double;
4724 pub fn strtol(s: *const c_char,
4725 endp: *mut *mut c_char, base: c_int) -> c_long;
4726 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
4727 base: c_int) -> c_ulong;
4728 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
4729 pub fn malloc(size: size_t) -> *mut c_void;
4730 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
4731 pub fn free(p: *mut c_void);
4733 /// Exits the running program in a possibly dangerous manner.
4737 /// While this forces your program to exit, it does so in a way that has
4738 /// consequences. This will skip all unwinding code, which means that anything
4739 /// relying on unwinding for cleanup (such as flushing and closing a buffer to a
4740 /// file) may act in an unexpected way.
4745 /// extern crate libc;
4753 pub fn exit(status: c_int) -> !;
4754 pub fn _exit(status: c_int) -> !;
4755 pub fn atexit(cb: extern fn()) -> c_int;
4756 pub fn system(s: *const c_char) -> c_int;
4757 pub fn getenv(s: *const c_char) -> *mut c_char;
4758 // Omitted: bsearch, qsort
4759 pub fn rand() -> c_int;
4760 pub fn srand(seed: c_uint);
4765 use types::common::c95::c_void;
4766 use types::os::arch::c95::{c_char, c_int, size_t};
4767 use types::os::arch::c95::{wchar_t};
4770 pub fn strcpy(dst: *mut c_char,
4771 src: *const c_char) -> *mut c_char;
4772 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t)
4774 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
4775 pub fn strncat(s: *mut c_char, ct: *const c_char,
4776 n: size_t) -> *mut c_char;
4777 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
4778 pub fn strncmp(cs: *const c_char, ct: *const c_char,
4779 n: size_t) -> c_int;
4780 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
4781 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
4782 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
4783 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
4784 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
4785 pub fn strpbrk(cs: *const c_char,
4786 ct: *const c_char) -> *mut c_char;
4787 pub fn strstr(cs: *const c_char,
4788 ct: *const c_char) -> *mut c_char;
4789 pub fn strlen(cs: *const c_char) -> size_t;
4790 pub fn strerror(n: c_int) -> *mut c_char;
4791 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
4792 pub fn strxfrm(s: *mut c_char, ct: *const c_char,
4793 n: size_t) -> size_t;
4794 pub fn wcslen(buf: *const wchar_t) -> size_t;
4796 // Omitted: memcpy, memmove, memset (provided by LLVM)
4798 // These are fine to execute on the Rust stack. They must be,
4799 // in fact, because LLVM generates calls to them!
4800 pub fn memcmp(cx: *const c_void, ct: *const c_void,
4801 n: size_t) -> c_int;
4802 pub fn memchr(cx: *const c_void, c: c_int,
4803 n: size_t) -> *mut c_void;
4808 // Microsoft helpfully underscore-qualifies all of its POSIX-like symbols
4809 // to make sure you don't use them accidentally. It also randomly deviates
4810 // from the exact signatures you might otherwise expect, and omits much,
4811 // so be careful when trying to write portable code; it won't always work
4812 // with the same POSIX functions and types as other platforms.
4814 #[cfg(target_os = "windows")]
4817 use types::os::common::posix01::{stat, utimbuf};
4818 use types::os::arch::c95::{c_int, c_char, wchar_t};
4821 #[link_name = "_chmod"]
4822 pub fn chmod(path: *const c_char, mode: c_int) -> c_int;
4823 #[link_name = "_wchmod"]
4824 pub fn wchmod(path: *const wchar_t, mode: c_int) -> c_int;
4825 #[link_name = "_mkdir"]
4826 pub fn mkdir(path: *const c_char) -> c_int;
4827 #[link_name = "_wrmdir"]
4828 pub fn wrmdir(path: *const wchar_t) -> c_int;
4829 #[link_name = "_fstat64"]
4830 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
4831 #[link_name = "_stat64"]
4832 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
4833 #[link_name = "_wstat64"]
4834 pub fn wstat(path: *const wchar_t, buf: *mut stat) -> c_int;
4835 #[link_name = "_wutime64"]
4836 pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> c_int;
4841 use types::common::c95::FILE;
4842 use types::os::arch::c95::{c_int, c_char};
4845 #[link_name = "_popen"]
4846 pub fn popen(command: *const c_char,
4847 mode: *const c_char) -> *mut FILE;
4848 #[link_name = "_pclose"]
4849 pub fn pclose(stream: *mut FILE) -> c_int;
4850 #[link_name = "_fdopen"]
4851 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
4852 #[link_name = "_fileno"]
4853 pub fn fileno(stream: *mut FILE) -> c_int;
4858 use types::os::arch::c95::{c_int, c_char, wchar_t};
4860 #[link_name = "_open"]
4861 pub fn open(path: *const c_char, oflag: c_int, mode: c_int)
4863 #[link_name = "_wopen"]
4864 pub fn wopen(path: *const wchar_t, oflag: c_int, mode: c_int)
4866 #[link_name = "_creat"]
4867 pub fn creat(path: *const c_char, mode: c_int) -> c_int;
4872 // Not supplied at all.
4876 use types::common::c95::c_void;
4877 use types::os::arch::c95::{c_int, c_uint, c_char,
4879 use types::os::arch::c99::intptr_t;
4882 #[link_name = "_access"]
4883 pub fn access(path: *const c_char, amode: c_int) -> c_int;
4884 #[link_name = "_chdir"]
4885 pub fn chdir(dir: *const c_char) -> c_int;
4886 #[link_name = "_close"]
4887 pub fn close(fd: c_int) -> c_int;
4888 #[link_name = "_dup"]
4889 pub fn dup(fd: c_int) -> c_int;
4890 #[link_name = "_dup2"]
4891 pub fn dup2(src: c_int, dst: c_int) -> c_int;
4892 #[link_name = "_execv"]
4893 pub fn execv(prog: *const c_char,
4894 argv: *mut *const c_char) -> intptr_t;
4895 #[link_name = "_execve"]
4896 pub fn execve(prog: *const c_char, argv: *mut *const c_char,
4897 envp: *mut *const c_char)
4899 #[link_name = "_execvp"]
4900 pub fn execvp(c: *const c_char,
4901 argv: *mut *const c_char) -> c_int;
4902 #[link_name = "_execvpe"]
4903 pub fn execvpe(c: *const c_char, argv: *mut *const c_char,
4904 envp: *mut *const c_char) -> c_int;
4905 #[link_name = "_getcwd"]
4906 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
4907 #[link_name = "_getpid"]
4908 pub fn getpid() -> c_int;
4909 #[link_name = "_isatty"]
4910 pub fn isatty(fd: c_int) -> c_int;
4911 #[link_name = "_lseek"]
4912 pub fn lseek(fd: c_int, offset: c_long, origin: c_int)
4914 #[link_name = "_pipe"]
4915 pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
4917 #[link_name = "_read"]
4918 pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
4920 #[link_name = "_rmdir"]
4921 pub fn rmdir(path: *const c_char) -> c_int;
4922 #[link_name = "_unlink"]
4923 pub fn unlink(c: *const c_char) -> c_int;
4924 #[link_name = "_write"]
4925 pub fn write(fd: c_int, buf: *const c_void,
4926 count: c_uint) -> c_int;
4934 #[cfg(any(target_os = "linux",
4935 target_os = "android",
4936 target_os = "macos",
4938 target_os = "freebsd",
4939 target_os = "dragonfly",
4940 target_os = "bitrig",
4941 target_os = "openbsd",
4942 target_os = "nacl"))]
4945 use types::os::arch::c95::{c_char, c_int};
4946 use types::os::arch::posix01::stat;
4947 use types::os::arch::posix88::mode_t;
4950 pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
4951 pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
4953 #[cfg(any(target_os = "linux",
4954 target_os = "freebsd",
4955 target_os = "dragonfly",
4956 target_os = "bitrig",
4957 target_os = "openbsd",
4958 target_os = "android",
4960 target_os = "nacl"))]
4961 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
4963 #[cfg(target_os = "macos")]
4964 #[link_name = "fstat64"]
4965 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
4967 pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
4968 #[cfg(not(target_os = "nacl"))]
4969 pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
4971 #[cfg(any(target_os = "linux",
4972 target_os = "freebsd",
4973 target_os = "dragonfly",
4974 target_os = "bitrig",
4975 target_os = "openbsd",
4976 target_os = "android",
4978 target_os = "nacl"))]
4979 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
4981 #[cfg(target_os = "macos")]
4982 #[link_name = "stat64"]
4983 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
4988 use types::common::c95::FILE;
4989 use types::os::arch::c95::{c_char, c_int};
4992 pub fn popen(command: *const c_char,
4993 mode: *const c_char) -> *mut FILE;
4994 pub fn pclose(stream: *mut FILE) -> c_int;
4995 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
4996 pub fn fileno(stream: *mut FILE) -> c_int;
5001 use types::os::arch::c95::{c_char, c_int};
5002 use types::os::arch::posix88::mode_t;
5006 #[cfg(any(target_os = "macos",
5007 target_os = "ios"))]
5008 pub fn open(path: *const ::c_char, oflag: ::c_int, ...)
5011 #[cfg(not(any(target_os = "macos",
5012 target_os = "ios")))]
5013 pub fn open(path: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
5018 #[cfg(any(target_os = "macos",
5019 target_os = "ios"))]
5021 pub unsafe extern fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
5022 use types::os::arch::c95::c_uint;
5023 open_shim::open(path, oflag, mode as c_uint)
5026 #[cfg(not(any(target_os = "macos",
5027 target_os = "ios")))]
5029 pub unsafe extern fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
5030 open_shim::open(path, oflag, mode)
5034 pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
5035 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
5040 use types::common::posix88::{DIR, dirent_t};
5041 use types::os::arch::c95::{c_char, c_int, c_long};
5043 // NB: On OS X opendir and readdir have two versions,
5044 // one for 32-bit kernelspace and one for 64.
5045 // We should be linking to the 64-bit ones, called
5046 // opendir$INODE64, etc. but for some reason rustc
5047 // doesn't link it correctly on i686, so we're going
5048 // through a C function that mysteriously does work.
5051 #[link_name="rust_opendir"]
5052 pub fn opendir(dirname: *const c_char) -> *mut DIR;
5053 #[link_name="rust_readdir_r"]
5054 pub fn readdir_r(dirp: *mut DIR, entry: *mut dirent_t,
5055 result: *mut *mut dirent_t) -> c_int;
5059 pub fn closedir(dirp: *mut DIR) -> c_int;
5060 pub fn rewinddir(dirp: *mut DIR);
5061 pub fn seekdir(dirp: *mut DIR, loc: c_long);
5062 pub fn telldir(dirp: *mut DIR) -> c_long;
5067 use types::common::c95::c_void;
5068 use types::os::arch::c95::{c_char, c_int, c_long, c_uint};
5069 use types::os::arch::c95::{size_t};
5070 use types::os::common::posix01::timespec;
5071 use types::os::arch::posix01::utimbuf;
5072 use types::os::arch::posix88::{gid_t, off_t, pid_t};
5073 use types::os::arch::posix88::{ssize_t, uid_t};
5075 pub const _PC_NAME_MAX: c_int = 4;
5077 #[cfg(not(target_os = "nacl"))]
5079 pub fn access(path: *const c_char, amode: c_int) -> c_int;
5080 pub fn alarm(seconds: c_uint) -> c_uint;
5081 pub fn chdir(dir: *const c_char) -> c_int;
5082 pub fn chown(path: *const c_char, uid: uid_t,
5083 gid: gid_t) -> c_int;
5084 pub fn close(fd: c_int) -> c_int;
5085 pub fn dup(fd: c_int) -> c_int;
5086 pub fn dup2(src: c_int, dst: c_int) -> c_int;
5087 pub fn execv(prog: *const c_char,
5088 argv: *mut *const c_char) -> c_int;
5089 pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5090 envp: *mut *const c_char)
5092 pub fn execvp(c: *const c_char,
5093 argv: *mut *const c_char) -> c_int;
5094 pub fn fork() -> pid_t;
5095 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
5096 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
5097 pub fn getegid() -> gid_t;
5098 pub fn geteuid() -> uid_t;
5099 pub fn getgid() -> gid_t;
5100 pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
5102 pub fn getlogin() -> *mut c_char;
5103 pub fn getopt(argc: c_int, argv: *mut *const c_char,
5104 optstr: *const c_char) -> c_int;
5105 pub fn getpgrp() -> pid_t;
5106 pub fn getpid() -> pid_t;
5107 pub fn getppid() -> pid_t;
5108 pub fn getuid() -> uid_t;
5109 pub fn getsid(pid: pid_t) -> pid_t;
5110 pub fn isatty(fd: c_int) -> c_int;
5111 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
5112 pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
5114 pub fn pathconf(path: *mut c_char, name: c_int) -> c_long;
5115 pub fn pause() -> c_int;
5116 pub fn pipe(fds: *mut c_int) -> c_int;
5117 pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
5119 pub fn rmdir(path: *const c_char) -> c_int;
5120 pub fn setgid(gid: gid_t) -> c_int;
5121 pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
5122 pub fn setsid() -> pid_t;
5123 pub fn setuid(uid: uid_t) -> c_int;
5124 pub fn sleep(secs: c_uint) -> c_uint;
5125 pub fn usleep(secs: c_uint) -> c_int;
5126 pub fn nanosleep(rqtp: *const timespec,
5127 rmtp: *mut timespec) -> c_int;
5128 pub fn sysconf(name: c_int) -> c_long;
5129 pub fn tcgetpgrp(fd: c_int) -> pid_t;
5130 pub fn ttyname(fd: c_int) -> *mut c_char;
5131 pub fn unlink(c: *const c_char) -> c_int;
5132 pub fn write(fd: c_int, buf: *const c_void, count: size_t)
5134 pub fn pread(fd: c_int, buf: *mut c_void, count: size_t,
5135 offset: off_t) -> ssize_t;
5136 pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t,
5137 offset: off_t) -> ssize_t;
5138 pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
5140 #[cfg(target_os = "nacl")]
5142 pub fn access(path: *const c_char, amode: c_int) -> c_int;
5143 pub fn chdir(dir: *const c_char) -> c_int;
5144 pub fn chown(path: *const c_char, uid: uid_t,
5145 gid: gid_t) -> c_int;
5146 pub fn close(fd: c_int) -> c_int;
5147 pub fn dup(fd: c_int) -> c_int;
5148 pub fn dup2(src: c_int, dst: c_int) -> c_int;
5149 pub fn execv(prog: *const c_char,
5150 argv: *mut *const c_char) -> c_int;
5151 pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5152 envp: *mut *const c_char)
5154 pub fn execvp(c: *const c_char,
5155 argv: *mut *const c_char) -> c_int;
5156 pub fn fork() -> pid_t;
5157 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
5158 pub fn getegid() -> gid_t;
5159 pub fn geteuid() -> uid_t;
5160 pub fn getgid() -> gid_t;
5161 pub fn getlogin() -> *mut c_char;
5162 pub fn getopt(argc: c_int, argv: *mut *const c_char,
5163 optstr: *const c_char) -> c_int;
5164 pub fn getuid() -> uid_t;
5165 pub fn getsid(pid: pid_t) -> pid_t;
5166 pub fn isatty(fd: c_int) -> c_int;
5167 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
5168 pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
5170 pub fn pipe(fds: *mut c_int) -> c_int;
5171 pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
5173 pub fn rmdir(path: *const c_char) -> c_int;
5174 pub fn setgid(gid: gid_t) -> c_int;
5175 pub fn setuid(uid: uid_t) -> c_int;
5176 pub fn sleep(secs: c_uint) -> c_uint;
5177 pub fn usleep(secs: c_uint) -> c_int;
5178 pub fn nanosleep(rqtp: *const timespec,
5179 rmtp: *mut timespec) -> c_int;
5180 pub fn sysconf(name: c_int) -> c_long;
5181 pub fn ttyname(fd: c_int) -> *mut c_char;
5182 pub fn unlink(c: *const c_char) -> c_int;
5183 pub fn write(fd: c_int, buf: *const c_void, count: size_t)
5185 pub fn pread(fd: c_int, buf: *mut c_void, count: size_t,
5186 offset: off_t) -> ssize_t;
5187 pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t,
5188 offset: off_t) -> ssize_t;
5189 pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
5194 use types::os::arch::c95::{c_int};
5195 use types::os::arch::posix88::{pid_t};
5198 pub fn kill(pid: pid_t, sig: c_int) -> c_int;
5203 use types::common::c95::{c_void};
5204 use types::os::arch::c95::{size_t, c_int, c_char};
5205 use types::os::arch::posix88::{mode_t, off_t};
5207 #[cfg(not(target_os = "nacl"))]
5209 pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
5210 pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
5211 pub fn mlockall(flags: c_int) -> c_int;
5212 pub fn munlockall() -> c_int;
5214 pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int)
5217 pub fn msync(addr: *mut c_void, len: size_t, flags: c_int)
5219 pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t)
5221 pub fn shm_unlink(name: *const c_char) -> c_int;
5225 pub fn mmap(addr: *mut c_void,
5232 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
5238 use types::os::arch::c95::{c_char, c_uint};
5241 pub fn if_nametoindex(ifname: *const c_char) -> c_uint;
5247 #[cfg(any(target_os = "linux",
5248 target_os = "android",
5249 target_os = "macos",
5251 target_os = "freebsd",
5252 target_os = "dragonfly",
5253 target_os = "bitrig",
5254 target_os = "openbsd",
5255 target_os = "nacl"))]
5258 use types::os::arch::c95::{c_char, c_int};
5259 use types::os::arch::posix01::stat;
5262 #[cfg(any(target_os = "linux",
5263 target_os = "freebsd",
5264 target_os = "dragonfly",
5265 target_os = "bitrig",
5266 target_os = "openbsd",
5267 target_os = "android",
5269 target_os = "nacl"))]
5270 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
5272 #[cfg(target_os = "macos")]
5273 #[link_name = "lstat64"]
5274 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
5279 use types::os::arch::c95::{c_char, c_int, size_t};
5280 use types::os::arch::posix88::{ssize_t, off_t};
5283 pub fn readlink(path: *const c_char,
5288 pub fn fsync(fd: c_int) -> c_int;
5290 #[cfg(any(target_os = "linux", target_os = "android"))]
5291 pub fn fdatasync(fd: c_int) -> c_int;
5293 pub fn setenv(name: *const c_char, val: *const c_char,
5294 overwrite: c_int) -> c_int;
5295 pub fn unsetenv(name: *const c_char) -> c_int;
5296 pub fn putenv(string: *mut c_char) -> c_int;
5298 pub fn symlink(path1: *const c_char,
5299 path2: *const c_char) -> c_int;
5301 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
5306 use types::os::arch::c95::c_int;
5307 use types::os::common::posix01::sighandler_t;
5309 #[cfg(not(all(target_os = "android", target_arch = "arm")))]
5311 pub fn signal(signum: c_int,
5312 handler: sighandler_t) -> sighandler_t;
5315 #[cfg(all(target_os = "android", target_arch = "arm"))]
5317 #[link_name = "bsd_signal"]
5318 pub fn signal(signum: c_int,
5319 handler: sighandler_t) -> sighandler_t;
5324 use types::os::arch::c95::{c_char, c_int};
5325 use types::os::common::posix01::{glob_t};
5328 pub fn glob(pattern: *const c_char,
5330 errfunc: ::core::option::Option<extern "C" fn(epath: *const c_char,
5331 errno: c_int) -> c_int>,
5332 pglob: *mut glob_t);
5333 pub fn globfree(pglob: *mut glob_t);
5338 use types::common::c95::{c_void};
5339 use types::os::arch::c95::{c_int, size_t};
5341 #[cfg(not(target_os = "nacl"))]
5343 pub fn posix_madvise(addr: *mut c_void,
5351 #[cfg(target_os = "windows")]
5370 #[cfg(any(target_os = "windows",
5371 target_os = "linux",
5372 target_os = "android",
5373 target_os = "macos",
5375 target_os = "freebsd",
5376 target_os = "dragonfly",
5377 target_os = "bitrig",
5378 target_os = "openbsd",
5379 target_os = "nacl"))]
5385 #[cfg(not(windows))]
5387 use types::common::c95::{c_void};
5388 use types::os::common::bsd44::{socklen_t, sockaddr, ifaddrs};
5389 use types::os::arch::c95::{c_int, size_t};
5390 use types::os::arch::posix88::ssize_t;
5393 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int;
5394 pub fn connect(socket: c_int, address: *const sockaddr,
5395 len: socklen_t) -> c_int;
5396 pub fn bind(socket: c_int, address: *const sockaddr,
5397 address_len: socklen_t) -> c_int;
5398 pub fn listen(socket: c_int, backlog: c_int) -> c_int;
5399 pub fn accept(socket: c_int, address: *mut sockaddr,
5400 address_len: *mut socklen_t) -> c_int;
5401 pub fn getpeername(socket: c_int, address: *mut sockaddr,
5402 address_len: *mut socklen_t) -> c_int;
5403 pub fn getsockname(socket: c_int, address: *mut sockaddr,
5404 address_len: *mut socklen_t) -> c_int;
5405 pub fn setsockopt(socket: c_int, level: c_int, name: c_int,
5406 value: *const c_void,
5407 option_len: socklen_t) -> c_int;
5408 pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
5409 flags: c_int) -> ssize_t;
5410 pub fn send(socket: c_int, buf: *const c_void, len: size_t,
5411 flags: c_int) -> ssize_t;
5412 pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
5413 flags: c_int, addr: *mut sockaddr,
5414 addrlen: *mut socklen_t) -> ssize_t;
5415 pub fn sendto(socket: c_int, buf: *const c_void, len: size_t,
5416 flags: c_int, addr: *const sockaddr,
5417 addrlen: socklen_t) -> ssize_t;
5418 pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> c_int;
5419 pub fn freeifaddrs(ifa: *mut ifaddrs);
5420 pub fn shutdown(socket: c_int, how: c_int) -> c_int;
5426 use types::common::c95::{c_void};
5427 use types::os::common::bsd44::{socklen_t, sockaddr, SOCKET};
5428 use types::os::arch::c95::c_int;
5429 use types::os::arch::posix88::ssize_t;
5432 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> SOCKET;
5433 pub fn connect(socket: SOCKET, address: *const sockaddr,
5434 len: socklen_t) -> c_int;
5435 pub fn bind(socket: SOCKET, address: *const sockaddr,
5436 address_len: socklen_t) -> c_int;
5437 pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
5438 pub fn accept(socket: SOCKET, address: *mut sockaddr,
5439 address_len: *mut socklen_t) -> SOCKET;
5440 pub fn getpeername(socket: SOCKET, address: *mut sockaddr,
5441 address_len: *mut socklen_t) -> c_int;
5442 pub fn getsockname(socket: SOCKET, address: *mut sockaddr,
5443 address_len: *mut socklen_t) -> c_int;
5444 pub fn setsockopt(socket: SOCKET, level: c_int, name: c_int,
5445 value: *const c_void,
5446 option_len: socklen_t) -> c_int;
5447 pub fn closesocket(socket: SOCKET) -> c_int;
5448 pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
5449 flags: c_int) -> c_int;
5450 pub fn send(socket: SOCKET, buf: *const c_void, len: c_int,
5451 flags: c_int) -> c_int;
5452 pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
5453 flags: c_int, addr: *mut sockaddr,
5454 addrlen: *mut c_int) -> ssize_t;
5455 pub fn sendto(socket: SOCKET, buf: *const c_void, len: c_int,
5456 flags: c_int, addr: *const sockaddr,
5457 addrlen: c_int) -> c_int;
5458 pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
5462 #[cfg(any(target_os = "macos",
5464 target_os = "freebsd",
5465 target_os = "dragonfly",
5466 target_os = "bitrig",
5467 target_os = "openbsd"))]
5469 use types::common::c95::{c_void};
5470 use types::os::arch::c95::{c_char, c_uchar, c_int, c_uint, c_ulong, size_t};
5473 pub fn ioctl(d: c_int, request: c_ulong, ...) -> c_int;
5474 pub fn sysctl(name: *mut c_int,
5477 oldlenp: *mut size_t,
5481 pub fn sysctlbyname(name: *const c_char,
5483 oldlenp: *mut size_t,
5487 pub fn sysctlnametomib(name: *const c_char,
5491 pub fn getdtablesize() -> c_int;
5492 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
5494 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
5496 pub fn realpath(pathname: *const c_char, resolved: *mut c_char)
5501 #[cfg(any(target_os = "linux", target_os = "android"))]
5503 use types::common::c95::{c_void};
5504 use types::os::arch::c95::{c_uchar, c_int, size_t};
5507 #[cfg(not(all(target_os = "android", target_arch = "aarch64")))]
5508 pub fn getdtablesize() -> c_int;
5509 pub fn ioctl(d: c_int, request: c_int, ...) -> c_int;
5510 pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int)
5512 pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
5517 #[cfg(target_os = "nacl")]
5519 use types::os::arch::c95::c_int;
5521 pub fn getdtablesize() -> c_int;
5525 #[cfg(target_os = "windows")]
5529 #[cfg(any(target_os = "macos", target_os = "ios"))]
5531 use types::os::arch::c95::{c_char, c_int};
5534 pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32)
5539 #[cfg(any(target_os = "freebsd",
5540 target_os = "dragonfly",
5541 target_os = "bitrig",
5542 target_os = "openbsd"))]
5546 #[cfg(any(target_os = "linux", target_os = "android", target_os = "nacl"))]
5551 #[cfg(target_os = "windows")]
5555 use types::os::arch::c95::{c_uint};
5556 use types::os::arch::extra::{BOOL, DWORD, SIZE_T, HMODULE,
5558 LPWCH, LPDWORD, LPVOID,
5559 LPCVOID, LPOVERLAPPED,
5560 LPSECURITY_ATTRIBUTES,
5562 LPPROCESS_INFORMATION,
5563 LPMEMORY_BASIC_INFORMATION,
5564 LPSYSTEM_INFO, HANDLE, LPHANDLE,
5565 LARGE_INTEGER, PLARGE_INTEGER,
5566 LPFILETIME, LPWIN32_FIND_DATAW};
5569 pub fn GetEnvironmentVariableW(n: LPCWSTR,
5573 pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
5575 pub fn GetEnvironmentStringsW() -> LPWCH;
5576 pub fn FreeEnvironmentStringsW(env_ptr: LPWCH) -> BOOL;
5577 pub fn GetModuleFileNameW(hModule: HMODULE,
5581 pub fn CreateDirectoryW(lpPathName: LPCWSTR,
5582 lpSecurityAttributes:
5583 LPSECURITY_ATTRIBUTES)
5585 pub fn CopyFileW(lpExistingFileName: LPCWSTR,
5586 lpNewFileName: LPCWSTR,
5587 bFailIfExists: BOOL)
5589 pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
5590 pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
5591 pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
5594 pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
5595 pub fn GetLastError() -> DWORD;
5596 pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW)
5598 pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW)
5600 pub fn FindClose(findFile: HANDLE) -> BOOL;
5601 pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
5602 hSourceHandle: HANDLE,
5603 hTargetProcessHandle: HANDLE,
5604 lpTargetHandle: LPHANDLE,
5605 dwDesiredAccess: DWORD,
5606 bInheritHandle: BOOL,
5609 pub fn CloseHandle(hObject: HANDLE) -> BOOL;
5610 pub fn OpenProcess(dwDesiredAccess: DWORD,
5611 bInheritHandle: BOOL,
5614 pub fn GetCurrentProcess() -> HANDLE;
5615 pub fn CreateProcessW(lpApplicationName: LPCWSTR,
5616 lpCommandLine: LPWSTR,
5617 lpProcessAttributes:
5618 LPSECURITY_ATTRIBUTES,
5620 LPSECURITY_ATTRIBUTES,
5621 bInheritHandles: BOOL,
5622 dwCreationFlags: DWORD,
5623 lpEnvironment: LPVOID,
5624 lpCurrentDirectory: LPCWSTR,
5625 lpStartupInfo: LPSTARTUPINFO,
5626 lpProcessInformation:
5627 LPPROCESS_INFORMATION)
5629 pub fn WaitForSingleObject(hHandle: HANDLE,
5630 dwMilliseconds: DWORD)
5632 pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
5634 pub fn GetExitCodeProcess(hProcess: HANDLE,
5635 lpExitCode: LPDWORD)
5637 pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
5638 pub fn VirtualAlloc(lpAddress: LPVOID,
5640 flAllocationType: DWORD,
5643 pub fn VirtualFree(lpAddress: LPVOID,
5647 pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
5648 pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
5650 pub fn VirtualProtect(lpAddress: LPVOID,
5652 flNewProtect: DWORD,
5653 lpflOldProtect: LPDWORD)
5655 pub fn VirtualQuery(lpAddress: LPCVOID,
5656 lpBuffer: LPMEMORY_BASIC_INFORMATION,
5659 pub fn CreateFileMappingW(hFile: HANDLE,
5660 lpAttributes: LPSECURITY_ATTRIBUTES,
5662 dwMaximumSizeHigh: DWORD,
5663 dwMaximumSizeLow: DWORD,
5666 pub fn MapViewOfFile(hFileMappingObject: HANDLE,
5667 dwDesiredAccess: DWORD,
5668 dwFileOffsetHigh: DWORD,
5669 dwFileOffsetLow: DWORD,
5670 dwNumberOfBytesToMap: SIZE_T)
5672 pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
5673 pub fn MoveFileExW(lpExistingFileName: LPCWSTR,
5674 lpNewFileName: LPCWSTR,
5675 dwFlags: DWORD) -> BOOL;
5676 pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
5677 lpTargetFileName: LPCWSTR,
5678 lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
5680 pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL;
5681 pub fn CreateFileW(lpFileName: LPCWSTR,
5682 dwDesiredAccess: DWORD,
5684 lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
5685 dwCreationDisposition: DWORD,
5686 dwFlagsAndAttributes: DWORD,
5687 hTemplateFile: HANDLE) -> HANDLE;
5688 pub fn ReadFile(hFile: HANDLE,
5690 nNumberOfBytesToRead: DWORD,
5691 lpNumberOfBytesRead: LPDWORD,
5692 lpOverlapped: LPOVERLAPPED) -> BOOL;
5693 pub fn WriteFile(hFile: HANDLE,
5695 nNumberOfBytesToRead: DWORD,
5696 lpNumberOfBytesRead: LPDWORD,
5697 lpOverlapped: LPOVERLAPPED) -> BOOL;
5698 pub fn SetFilePointerEx(hFile: HANDLE,
5699 liDistanceToMove: LARGE_INTEGER,
5700 lpNewFilePointer: PLARGE_INTEGER,
5701 dwMoveMethod: DWORD) -> BOOL;
5702 pub fn SetEndOfFile(hFile: HANDLE) -> BOOL;
5704 pub fn GetSystemTimeAsFileTime(
5705 lpSystemTimeAsFileTime: LPFILETIME);
5707 pub fn QueryPerformanceFrequency(
5708 lpFrequency: *mut LARGE_INTEGER) -> BOOL;
5709 pub fn QueryPerformanceCounter(
5710 lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL;
5712 pub fn GetCurrentProcessId() -> DWORD;
5713 pub fn CreateNamedPipeW(
5717 nMaxInstances: DWORD,
5718 nOutBufferSize: DWORD,
5719 nInBufferSize: DWORD,
5720 nDefaultTimeOut: DWORD,
5721 lpSecurityAttributes: LPSECURITY_ATTRIBUTES
5723 pub fn ConnectNamedPipe(hNamedPipe: HANDLE,
5724 lpOverlapped: LPOVERLAPPED) -> BOOL;
5725 pub fn WaitNamedPipeW(lpNamedPipeName: LPCWSTR,
5726 nTimeOut: DWORD) -> BOOL;
5727 pub fn SetNamedPipeHandleState(hNamedPipe: HANDLE,
5729 lpMaxCollectionCount: LPDWORD,
5730 lpCollectDataTimeout: LPDWORD)
5732 pub fn CreateEventW(lpEventAttributes: LPSECURITY_ATTRIBUTES,
5734 bInitialState: BOOL,
5735 lpName: LPCWSTR) -> HANDLE;
5736 pub fn GetOverlappedResult(hFile: HANDLE,
5737 lpOverlapped: LPOVERLAPPED,
5738 lpNumberOfBytesTransferred: LPDWORD,
5739 bWait: BOOL) -> BOOL;
5740 pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL;
5745 use types::os::arch::c95::{c_int, c_long};
5746 use types::os::arch::c99::intptr_t;
5749 #[link_name = "_commit"]
5750 pub fn commit(fd: c_int) -> c_int;
5752 #[link_name = "_get_osfhandle"]
5753 pub fn get_osfhandle(fd: c_int) -> c_long;
5755 #[link_name = "_open_osfhandle"]
5756 pub fn open_osfhandle(osfhandle: intptr_t,
5757 flags: c_int) -> c_int;
5762 use types::os::arch::c95::{c_int, c_long, c_ulong};
5763 use types::os::common::bsd44::SOCKET;
5766 pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int;
5773 pub fn issue_14344_workaround() {} // FIXME #14344 force linkage to happen correctly
5775 #[test] fn work_on_windows() { } // FIXME #10872 needed for a happy windows