From a1b948e34abeefa646826aeafd4fdd8a1c0b0934 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 11:54:32 -0700 Subject: [PATCH 01/17] Fix FreeBSD --- ci/Vagrantfile | 30 +++++++++++++++ ci/run-travis.sh | 23 ++++++++++++ libc-test/build.rs | 57 +++++++++++++++-------------- src/unix/bsd/apple/mod.rs | 11 +++++- src/unix/bsd/freebsdlike/freebsd.rs | 2 +- src/unix/bsd/freebsdlike/mod.rs | 25 +++++++++---- src/unix/bsd/mod.rs | 8 +--- src/unix/bsd/openbsdlike/mod.rs | 9 +++++ src/unix/mod.rs | 3 -- src/unix/notbsd/mod.rs | 3 ++ 10 files changed, 125 insertions(+), 46 deletions(-) create mode 100644 ci/Vagrantfile diff --git a/ci/Vagrantfile b/ci/Vagrantfile new file mode 100644 index 0000000000000..a55aa3ebea42d --- /dev/null +++ b/ci/Vagrantfile @@ -0,0 +1,30 @@ +# A vagrant configuration file for running tests on BSD-like machines +# +# Note that this was originally intended to later be used to run tests on +# Travis, but it didn't work out. Regardless this has stuck around! You can run +# tests in FreeBSD via: +# +# git clone https://github.com/alexcrichton/libc --branch autotest +# cd libc/ci +# vagrant up freebsd +# vagrant ssh freebsd +# ... +# cd /vagrant/libc-test +# cargo run +# +# And "that's it"! You look up instructions on Vagrant's website for how to +# install vagrant. + +Vagrant.configure(2) do |config| + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + config.vm.define :freebsd do |bsd| + bsd.vm.box = "arkadi/freebsd-10.1-amd64" + bsd.vm.provision :shell, inline: 'yes | sudo pkg install rust cargo' + bsd.vm.provider "virtualbox" do |vb| + vb.memory = "2048" + end + end + config.vm.synced_folder "..", "/vagrant" +end diff --git a/ci/run-travis.sh b/ci/run-travis.sh index b7d0206479a06..ede2e4855fd7d 100644 --- a/ci/run-travis.sh +++ b/ci/run-travis.sh @@ -20,6 +20,23 @@ install() { sudo apt-get install $@ } +# NOTE: this is not actually run on travis right now, this was added to in +# theory run FreeBSD vagrant images on Travis, but it ended up not working, so +# this may not be working when you read this. +install_vagrant() { + echo 'deb http://download.virtualbox.org/virtualbox/debian trusty contrib' | \ + sudo tee -a /etc/apt/sources.list + vbox=virtualbox-5.0_5.0.4-102546~Ubuntu~trusty_amd64.deb + curl https://www.virtualbox.org/download/oracle_vbox.asc | sudo apt-key add - + install virtualbox-5.0 linux-headers-3.16.0-31-generic nfs-kernel-server + + # After we've got virtualbox, install vagrant itself. Note that the version in + # the default ubuntu repos is too old to run the images we have, so install + # the one from the vagrant website's download link + curl -LO https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb + sudo dpkg -i vagrant_1.7.4_x86_64.deb +} + if [ "$TARGET" = "arm-linux-androideabi" ]; then # Pull a pre-built docker image for testing android, then run tests entirely # within that image. @@ -51,6 +68,12 @@ elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then install emdebian-archive-keyring install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes export CC=mips-linux-gnu-gcc +elif [ "$TARGET" = "x86_64-unknown-freebsd" ]; then + install_vagrant + cd ci + vagrant up freebsd + exec vagrant ssh freebsd -c \ + 'cd /vagrant && CARGO_TARGET_DIR=/tmp sh ci/run.sh x86_64-unknown-freebsd' else # Download the rustlib folder from the relevant portion of main distribution's # tarballs. diff --git a/libc-test/build.rs b/libc-test/build.rs index 0f607c24bd034..530d10b50cce6 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -12,6 +12,8 @@ fn main() { let android = target.contains("android"); let darwin = target.contains("apple-darwin"); let musl = target.contains("musl"); + let freebsd = target.contains("freebsd"); + let bsdlike = freebsd || darwin; let mut cfg = ctest::TestGenerator::new(); // Pull in extra goodies on linux/mingw @@ -39,14 +41,6 @@ fn main() { .header("time.h") .header("wchar.h"); - if darwin { - cfg.header("mach-o/dyld.h"); - cfg.header("mach/mach_time.h"); - } else if linux || android { - cfg.header("netpacket/packet.h"); - cfg.header("net/ethernet.h"); - } - if windows { cfg.header("winsock2.h"); // must be before windows.h @@ -84,31 +78,38 @@ fn main() { cfg.header("utime.h"); cfg.header("pwd.h"); cfg.header("grp.h"); + } - if android { - cfg.header("arpa/inet.h"); - } else { - cfg.header("glob.h"); - cfg.header("ifaddrs.h"); - - if !musl { - cfg.header("execinfo.h"); - cfg.header("sys/sysctl.h"); - } - } - - if darwin { - cfg.header("malloc/malloc.h"); - cfg.header("crt_externs.h"); - } else { - cfg.header("malloc.h"); + if android { + cfg.header("arpa/inet.h"); + } else if !windows { + cfg.header("glob.h"); + cfg.header("ifaddrs.h"); + + if !musl { + cfg.header("execinfo.h"); + cfg.header("sys/sysctl.h"); } + } + if darwin { + cfg.header("mach-o/dyld.h"); + cfg.header("mach/mach_time.h"); + cfg.header("malloc/malloc.h"); + cfg.header("crt_externs.h"); } - if target.contains("linux") { + + if linux || android { + cfg.header("netpacket/packet.h"); + cfg.header("net/ethernet.h"); + cfg.header("malloc.h"); cfg.header("sys/prctl.h"); } + if freebsd { + cfg.header("pthread_np.h"); + } + cfg.type_name(move |ty, is_struct| { match ty { // Just pass all these through, no need for a "struct" prefix @@ -120,7 +121,7 @@ fn main() { "ssize_t" if windows => "SSIZE_T".to_string(), // OSX calls this something else - "sighandler_t" if darwin => "sig_t".to_string(), + "sighandler_t" if bsdlike => "sig_t".to_string(), t if t.ends_with("_t") => t.to_string(), @@ -216,7 +217,7 @@ fn main() { "strerror_r" if linux => true, // actually xpg-something-or-other // typed 2nd arg on linux and android - "gettimeofday" if linux || android => true, + "gettimeofday" if linux || android || freebsd => true, "dlerror" if android => true, // const-ness is added diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 588f33ee528e6..56f5ad432ee8e 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -158,6 +158,12 @@ s! { pub sa_mask: sigset_t, pub sa_flags: ::c_int, } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_size: ::size_t, + pub ss_flags: ::c_int, + } } pub const EXIT_FAILURE: c_int = 1; @@ -638,7 +644,6 @@ pub const _SC_TRACE_SYS_MAX: c_int = 129; pub const _SC_TRACE_USER_EVENT_MAX: c_int = 130; pub const _SC_PASS_MAX: c_int = 131; - pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; pub const _PTHREAD_MUTEX_SIG_init: ::c_long = 0x32AAABA7; pub const _PTHREAD_COND_SIG_init: ::c_long = 0x3CB0B1BB; @@ -656,6 +661,8 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { __opaque: [0; __PTHREAD_RWLOCK_SIZE__], }; +pub const SIGSTKSZ: ::size_t = 131072; + extern { pub fn _NSGetExecutablePath(buf: *mut ::c_char, bufsize: *mut ::uint32_t) -> ::c_int; @@ -686,6 +693,8 @@ extern { pub fn pthread_get_stackaddr_np(thread: pthread_t) -> *mut ::c_void; pub fn pthread_get_stacksize_np(thread: pthread_t) -> ::size_t; pub fn __error() -> *mut ::c_int; + pub fn backtrace(buf: *mut *mut ::c_void, + sz: ::c_int) -> ::c_int; } cfg_if! { diff --git a/src/unix/bsd/freebsdlike/freebsd.rs b/src/unix/bsd/freebsdlike/freebsd.rs index 808f6eac95638..cfaba455a80f9 100644 --- a/src/unix/bsd/freebsdlike/freebsd.rs +++ b/src/unix/bsd/freebsdlike/freebsd.rs @@ -2,5 +2,5 @@ pub const PTHREAD_STACK_MIN: ::size_t = 2048; pub const KERN_PROC_PATHNAME: ::c_int = 12; extern { - pub fn __error() -> *const ::c_int; + pub fn __error() -> *mut ::c_int; } diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 4ca588f941f00..7fafaf91d148f 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -64,13 +64,14 @@ s! { } pub struct siginfo_t { - pub _signo: ::c_int, - pub _errno: ::c_int, - pub _code: ::c_int, - pub _pid: ::pid_t, - pub _uid: ::uid_t, - pub _status: ::c_int, - pub si_addr: *mut ::c_void + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + pub si_pid: ::pid_t, + pub si_uid: ::uid_t, + pub si_status: ::c_int, + pub si_addr: *mut ::c_void, + _pad: [c_int; 12], } pub struct sigaction { @@ -78,6 +79,12 @@ s! { pub sa_flags: ::c_int, pub sa_mask: sigset_t, } + + pub struct stack_t { + pub ss_sp: *mut ::c_char, + pub ss_size: ::size_t, + pub ss_flags: ::c_int, + } } pub const EXIT_FAILURE: ::c_int = 1; @@ -491,6 +498,8 @@ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _; pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; +pub const SIGSTKSZ: ::size_t = 34816; + extern { pub fn mprotect(addr: *const ::c_void, len: size_t, prot: c_int) -> c_int; @@ -511,6 +520,8 @@ extern { -> c_int; pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int; pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); + pub fn backtrace(buf: *mut *mut ::c_void, + sz: ::size_t) -> ::size_t; } cfg_if! { diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 94c90e85a7ae8..56ae724674916 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -39,12 +39,9 @@ s! { pub pw_dir: *mut ::c_char, pub pw_shell: *mut ::c_char, pub pw_expire: ::time_t, - } - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_size: ::size_t, - pub ss_flags: ::c_int, + #[cfg(not(target_os = "macos"))] + pub pw_fields: ::c_int, } } @@ -53,7 +50,6 @@ pub const FIOCLEX: c_ulong = 0x20006601; pub const SA_ONSTACK: ::c_int = 0x0001; pub const SA_SIGINFO: ::c_int = 0x0040; -pub const SIGSTKSZ: ::size_t = 131072; pub const SIGBUS: ::c_int = 10; pub const SIG_SETMASK: ::c_int = 3; diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs index ef40db4458f83..5c5d426dc29d6 100644 --- a/src/unix/bsd/openbsdlike/mod.rs +++ b/src/unix/bsd/openbsdlike/mod.rs @@ -17,6 +17,12 @@ pub type pthread_key_t = ::c_int; pub sa_flags: libc::c_int, } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_size: ::size_t, + pub ss_flags: ::c_int, + } #[cfg(any(target_os = "bitrig", target_os = "netbsd", target_os ="openbsd"))] pub mod os { pub mod common { @@ -736,6 +742,7 @@ pub type pthread_key_t = ::c_int; pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = ptr::null_mut(); pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = ptr::null_mut(); pub const PTHREAD_MUTEX_RECURSIVE: libc::c_int = 2; +pub const SIGSTKSZ: ::size_t = 131072; extern { pub fn mprotect(addr: *const ::c_void, len: size_t, prot: c_int) -> c_int; @@ -760,4 +767,6 @@ extern { pub fn pthread_stackseg_np(thread: pthread_t, sinfo: *mut stack_t) -> ::c_uint; pub fn __errno() -> *const ::c_int; + pub fn backtrace(buf: *mut *mut ::c_void, + sz: ::size_t) -> ::size_t; } diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 4e80d2cf7f958..16c9a152858f5 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -493,9 +493,6 @@ extern { buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int; - #[cfg(not(target_env = "musl"))] - pub fn backtrace(buf: *mut *mut ::c_void, - sz: ::c_int) -> ::c_int; pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int; diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index ba6c767a4b54b..23467aca2a860 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -318,6 +318,9 @@ extern { pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int; + #[cfg(not(target_env = "musl"))] + pub fn backtrace(buf: *mut *mut ::c_void, + sz: ::c_int) -> ::c_int; } cfg_if! { From 1e1ff67a9bf19c9ef2e1db418a905470f3cfc361 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 15:00:36 -0700 Subject: [PATCH 02/17] Fix backtrace for android --- src/unix/notbsd/linux/mod.rs | 2 ++ src/unix/notbsd/mod.rs | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index eaf7cb257ddb9..59b591a027e05 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -259,6 +259,8 @@ cfg_if! { newlen: size_t) -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; + pub fn backtrace(buf: *mut *mut ::c_void, + sz: ::c_int) -> ::c_int; } } } diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index 23467aca2a860..ba6c767a4b54b 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -318,9 +318,6 @@ extern { pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int; - #[cfg(not(target_env = "musl"))] - pub fn backtrace(buf: *mut *mut ::c_void, - sz: ::c_int) -> ::c_int; } cfg_if! { From c4a8d60974df815e9424a9be9459e7d1074a2f50 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 15:00:49 -0700 Subject: [PATCH 03/17] Consolidate mode_t upwards on linux --- src/unix/notbsd/linux/mips.rs | 1 - src/unix/notbsd/linux/mod.rs | 1 + src/unix/notbsd/linux/notmips/b32/mod.rs | 2 +- src/unix/notbsd/linux/notmips/b64/aarch64.rs | 2 +- src/unix/notbsd/linux/notmips/b64/mod.rs | 1 - src/unix/notbsd/linux/notmips/b64/x86_64.rs | 2 +- 6 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/unix/notbsd/linux/mips.rs b/src/unix/notbsd/linux/mips.rs index 349e3330910df..53cd2db13255a 100644 --- a/src/unix/notbsd/linux/mips.rs +++ b/src/unix/notbsd/linux/mips.rs @@ -14,7 +14,6 @@ pub type ino_t = u32; pub type ssize_t = i32; pub type blkcnt_t = i32; pub type blksize_t = i32; -pub type mode_t = u32; pub type nlink_t = u32; s! { diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 59b591a027e05..d45cb4eb85ad4 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -4,6 +4,7 @@ pub type useconds_t = u32; pub type dev_t = u64; pub type socklen_t = u32; pub type pthread_t = c_ulong; +pub type mode_t = u32; s! { pub struct glob_t { diff --git a/src/unix/notbsd/linux/notmips/b32/mod.rs b/src/unix/notbsd/linux/notmips/b32/mod.rs index 862969060dece..b437d76d95ef0 100644 --- a/src/unix/notbsd/linux/notmips/b32/mod.rs +++ b/src/unix/notbsd/linux/notmips/b32/mod.rs @@ -13,8 +13,8 @@ pub type ino_t = u32; pub type off_t = i32; pub type ssize_t = i32; pub type blkcnt_t = i32; + pub type blksize_t = i32; -pub type mode_t = u32; pub type nlink_t = u32; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; diff --git a/src/unix/notbsd/linux/notmips/b64/aarch64.rs b/src/unix/notbsd/linux/notmips/b64/aarch64.rs index 7452e7dc89e34..31e8b25f52841 100644 --- a/src/unix/notbsd/linux/notmips/b64/aarch64.rs +++ b/src/unix/notbsd/linux/notmips/b64/aarch64.rs @@ -1,9 +1,9 @@ //! AArch64-specific definitions for 64-bit linux-like values pub type c_char = u8; +pub type wchar_t = u32; pub type nlink_t = u32; pub type blksize_t = i32; -pub type wchar_t = u32; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48; pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8; diff --git a/src/unix/notbsd/linux/notmips/b64/mod.rs b/src/unix/notbsd/linux/notmips/b64/mod.rs index 8f55e09d601d7..1916dc43aac95 100644 --- a/src/unix/notbsd/linux/notmips/b64/mod.rs +++ b/src/unix/notbsd/linux/notmips/b64/mod.rs @@ -11,7 +11,6 @@ pub type intptr_t = i64; pub type uintptr_t = u64; pub type ino_t = u64; pub type off_t = i64; -pub type mode_t = u32; pub type ssize_t = i64; pub type blkcnt_t = i64; diff --git a/src/unix/notbsd/linux/notmips/b64/x86_64.rs b/src/unix/notbsd/linux/notmips/b64/x86_64.rs index 0068fe0654fbb..2d3320a20bc68 100644 --- a/src/unix/notbsd/linux/notmips/b64/x86_64.rs +++ b/src/unix/notbsd/linux/notmips/b64/x86_64.rs @@ -1,9 +1,9 @@ //! x86_64-specific definitions for 64-bit linux-like values pub type c_char = i8; +pub type wchar_t = i32; pub type nlink_t = u64; pub type blksize_t = i64; -pub type wchar_t = i32; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; From 83c81680dc6f623f54b4c74542902cbeb13efe45 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 15:01:06 -0700 Subject: [PATCH 04/17] Consolidate freebsd arch's upwards --- src/unix/bsd/freebsdlike/mod.rs | 29 +++++++++++++++++++++++++++++ src/unix/bsd/freebsdlike/x86.rs | 28 ---------------------------- src/unix/bsd/freebsdlike/x86_64.rs | 28 ---------------------------- 3 files changed, 29 insertions(+), 56 deletions(-) diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 7fafaf91d148f..11bf83022439d 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1,3 +1,32 @@ +pub type c_char = i8; +pub type c_schar = i8; +pub type c_uchar = u8; +pub type c_short = i16; +pub type c_ushort = u16; +pub type c_int = i32; +pub type c_uint = u32; +pub type c_float = f32; +pub type c_double = f64; +pub type clock_t = i32; +pub type wchar_t = i32; +pub type c_longlong = i64; +pub type c_ulonglong = u64; +pub type intmax_t = i64; +pub type uintmax_t = u64; +pub type off_t = i64; +pub type dev_t = u32; +pub type ino_t = u32; +pub type pid_t = i32; +pub type uid_t = u32; +pub type gid_t = u32; +pub type useconds_t = u32; +pub type mode_t = u16; +pub type nlink_t = u16; +pub type blksize_t = u32; +pub type blkcnt_t = i64; +pub type fflags_t = u32; +pub type pthread_attr_t = *mut ::c_void; + pub type pthread_t = uintptr_t; pub type rlim_t = i64; pub type sighandler_t = size_t; diff --git a/src/unix/bsd/freebsdlike/x86.rs b/src/unix/bsd/freebsdlike/x86.rs index 5a80c0d42b038..3be08eee33cc8 100644 --- a/src/unix/bsd/freebsdlike/x86.rs +++ b/src/unix/bsd/freebsdlike/x86.rs @@ -1,40 +1,12 @@ -pub type c_char = i8; -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; pub type c_long = i32; pub type c_ulong = u32; -pub type c_float = f32; -pub type c_double = f64; pub type size_t = u32; pub type ptrdiff_t = i32; -pub type clock_t = i32; pub type time_t = i32; pub type suseconds_t = i32; -pub type wchar_t = i32; -pub type c_longlong = i64; -pub type c_ulonglong = u64; pub type intptr_t = i32; pub type uintptr_t = u32; -pub type intmax_t = i64; -pub type uintmax_t = u64; -pub type off_t = i64; -pub type dev_t = u32; -pub type ino_t = u32; -pub type pid_t = i32; -pub type uid_t = u32; -pub type gid_t = u32; -pub type useconds_t = u32; -pub type mode_t = u16; pub type ssize_t = i32; -pub type nlink_t = u16; -pub type blksize_t = u32; -pub type blkcnt_t = i64; -pub type fflags_t = u32; -pub type pthread_attr_t = *mut c_void; s! { pub struct stat { diff --git a/src/unix/bsd/freebsdlike/x86_64.rs b/src/unix/bsd/freebsdlike/x86_64.rs index bacea737a13a9..c45374423b56a 100644 --- a/src/unix/bsd/freebsdlike/x86_64.rs +++ b/src/unix/bsd/freebsdlike/x86_64.rs @@ -1,40 +1,12 @@ -pub type c_char = i8; -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; pub type c_long = i64; pub type c_ulong = u64; -pub type c_float = f32; -pub type c_double = f64; pub type size_t = u64; pub type ptrdiff_t = i64; -pub type clock_t = i32; pub type time_t = i64; pub type suseconds_t = i64; -pub type wchar_t = i32; -pub type c_longlong = i64; -pub type c_ulonglong = u64; pub type intptr_t = i64; pub type uintptr_t = u64; -pub type intmax_t = i64; -pub type uintmax_t = u64; -pub type off_t = i64; -pub type dev_t = u32; -pub type ino_t = u32; -pub type pid_t = i32; -pub type uid_t = u32; -pub type gid_t = u32; -pub type useconds_t = u32; -pub type mode_t = u16; pub type ssize_t = i64; -pub type nlink_t = u16; -pub type blksize_t = u32; -pub type blkcnt_t = i64; -pub type fflags_t = u32; -pub type pthread_attr_t = *mut ::c_void; s! { pub struct stat { From 78f5acadfa7410cc59a723328067631e7246409f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 15:01:16 -0700 Subject: [PATCH 05/17] Note triples in README --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 46b30bfd7f776..2b57d7ee7e6e5 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,17 @@ various systems, including libc. [![Build status](https://ci.appveyor.com/api/projects/status/v0414slj8y8nga0p?svg=true)](https://ci.appveyor.com/project/alexcrichton/libc) [Documentation](http://alexcrichton.com/libc) + +## Platform Support + +Tested: + * `{i686,x86_64}-pc-windows-{msvc,gnu}` + * `{i686,x86_64,mips,aarch64}-unknown-linux-gnu` + * `x86_64-unknown-linux-musl` + * `arm-unknown-linux-gnueabihf` + * `arm-linux-androideabi` + * `{i686,x86_64}-apple-darwin` + +Untested: + * `{i686,x86_64}-unknown-freebsd` + * `x86_64-unknown-{bitrig,dragonfly,openbsd,netbsd}` From 2eb32ef4552dba475779fc215cd6af93aa1aa007 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 15:09:10 -0700 Subject: [PATCH 06/17] Format openbsd --- src/unix/bsd/openbsdlike/bitrig.rs | 16 + src/unix/bsd/openbsdlike/mod.rs | 1258 +++++++++++---------------- src/unix/bsd/openbsdlike/openbsd.rs | 18 + 3 files changed, 564 insertions(+), 728 deletions(-) create mode 100644 src/unix/bsd/openbsdlike/bitrig.rs create mode 100644 src/unix/bsd/openbsdlike/openbsd.rs diff --git a/src/unix/bsd/openbsdlike/bitrig.rs b/src/unix/bsd/openbsdlike/bitrig.rs new file mode 100644 index 0000000000000..9039ff446cd36 --- /dev/null +++ b/src/unix/bsd/openbsdlike/bitrig.rs @@ -0,0 +1,16 @@ +s! { + pub struct glob_t { + pub gl_pathc: c_int, + pub gl_matchc: c_int, + pub gl_offs: c_int, + pub gl_flags: c_int, + pub gl_pathv: *mut *mut c_char, + __unused1: *mut c_void, + __unused2: *mut c_void, + __unused3: *mut c_void, + __unused4: *mut c_void, + __unused5: *mut c_void, + __unused6: *mut c_void, + __unused7: *mut c_void, + } +} diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs index 5c5d426dc29d6..1234c19b15bda 100644 --- a/src/unix/bsd/openbsdlike/mod.rs +++ b/src/unix/bsd/openbsdlike/mod.rs @@ -1,748 +1,540 @@ - pub type sigset_t = libc::c_uint; +pub type c_char = i8; +pub type c_schar = i8; +pub type c_uchar = u8; +pub type c_short = i16; +pub type c_ushort = u16; +pub type c_int = i32; +pub type c_uint = u32; +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_float = f32; +pub type c_double = f64; +pub type size_t = u64; +pub type ptrdiff_t = i64; +pub type clock_t = i64; +pub type time_t = i64; +pub type suseconds_t = i64; +pub type wchar_t = i32; +pub type c_longlong = i64; +pub type c_ulonglong = u64; +pub type intptr_t = i64; +pub type uintptr_t = u64; +pub type intmax_t = i64; +pub type uintmax_t = u64; +pub type off_t = i64; +pub type dev_t = i32; +pub type pid_t = i32; +pub type uid_t = u32; +pub type gid_t = u32; +pub type useconds_t = u32; +pub type mode_t = u32; +pub type ssize_t = c_long; + +pub type sighandler_t = size_t; +pub type socklen_t = u32; +pub type sa_family_t = u8; +pub type in_port_t = u16; +pub type in_addr_t = u32; + +pub type nlink_t = uint32_t; +pub type blksize_t = uint32_t; +pub type ino_t = uint64_t; +pub type blkcnt_t = i64; +pub type fflags_t = u32; +pub type pthread_attr_t = *mut c_void; +pub type sigset_t = ::c_uint; pub type pthread_key_t = ::c_int; - struct stack_t { - ss_sp: *mut libc::c_void, - ss_size: libc::size_t, - ss_flags: libc::c_int, - } +pub type pthread_mutex_t = *mut ::c_void; +pub type pthread_mutexattr_t = *mut ::c_void; +pub type pthread_cond_t = *mut ::c_void; +pub type pthread_rwlock_t = *mut ::c_void; +pub type pthread_t = uintptr_t; +pub type rlim_t = u64; + + +pub enum timezone {} + +s! { + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_size: ::size_t, + pub ss_flags: ::c_int, + } + pub struct siginfo_t { - pub si_signo: libc::c_int, - pub si_code: libc::c_int, - pub si_errno: libc::c_int, - pub si_addr: *mut libc::c_void + pub si_signo: ::c_int, + pub si_code: ::c_int, + pub si_errno: ::c_int, + pub si_addr: *mut ::c_void } + pub struct sigaction { pub sa_sigaction: sighandler_t, pub sa_mask: sigset_t, - pub sa_flags: libc::c_int, + pub sa_flags: ::c_int, } - pub struct stack_t { pub ss_sp: *mut ::c_void, pub ss_size: ::size_t, pub ss_flags: ::c_int, } - #[cfg(any(target_os = "bitrig", target_os = "netbsd", target_os ="openbsd"))] - pub mod os { - pub mod common { - pub mod posix01 { - use types::common::c95::{c_void}; - use types::os::arch::c95::{c_char, c_int, size_t, - time_t, suseconds_t, c_long}; - use types::os::arch::c99::{uintptr_t}; - - pub type pthread_t = uintptr_t; - pub type rlim_t = u64; - - #[cfg(target_os = "bitrig")] - #[repr(C)] - #[derive(Copy, Clone)] pub struct glob_t { - pub gl_pathc: c_int, - pub gl_matchc: c_int, - pub gl_offs: c_int, - pub gl_flags: c_int, - pub gl_pathv: *mut *mut c_char, - __unused1: *mut c_void, - __unused2: *mut c_void, - __unused3: *mut c_void, - __unused4: *mut c_void, - __unused5: *mut c_void, - __unused6: *mut c_void, - __unused7: *mut c_void, - } - - #[cfg(any(target_os = "netbsd", target_os="openbsd"))] - #[repr(C)] - #[derive(Copy, Clone)] pub struct glob_t { - pub gl_pathc: c_int, - __unused1: c_int, - pub gl_offs: c_int, - __unused2: c_int, - pub gl_pathv: *mut *mut c_char, - - __unused3: *mut c_void, - - __unused4: *mut c_void, - __unused5: *mut c_void, - __unused6: *mut c_void, - __unused7: *mut c_void, - __unused8: *mut c_void, - __unused9: *mut c_void, - } - - #[repr(C)] - #[derive(Copy, Clone)] pub struct timeval { - pub tv_sec: time_t, - pub tv_usec: suseconds_t, - } - - #[repr(C)] - #[derive(Copy, Clone)] pub struct timespec { - pub tv_sec: time_t, - pub tv_nsec: c_long, - } - - pub enum timezone {} - - pub type sighandler_t = size_t; - - #[repr(C)] - #[derive(Copy, Clone)] - pub struct rlimit { - pub rlim_cur: rlim_t, - pub rlim_max: rlim_t, - } - } - - pub mod bsd43 { - use types::os::common::posix01::timeval; - use types::os::arch::c95::c_long; - #[repr(C)] - #[derive(Copy, Clone)] - pub struct rusage { - pub ru_utime: timeval, - pub ru_stime: timeval, - pub ru_maxrss: c_long, - pub ru_ixrss: c_long, - pub ru_idrss: c_long, - pub ru_isrss: c_long, - pub ru_minflt: c_long, - pub ru_majflt: c_long, - pub ru_nswap: c_long, - pub ru_inblock: c_long, - pub ru_oublock: c_long, - pub ru_msgsnd: c_long, - pub ru_msgrcv: c_long, - pub ru_nsignals: c_long, - pub ru_nvcsw: c_long, - pub ru_nivcsw: c_long - } - } - - pub mod bsd44 { - use types::common::c95::{c_void}; - use types::os::arch::c95::{c_char, c_int, c_uint}; - - pub type socklen_t = u32; - pub type sa_family_t = u8; - pub type in_port_t = u16; - pub type in_addr_t = u32; - #[repr(C)] - #[derive(Copy, Clone)] pub struct sockaddr { - pub sa_len: u8, - pub sa_family: sa_family_t, - pub sa_data: [u8; 14], - } - #[repr(C)] - #[derive(Copy)] pub struct sockaddr_storage { - pub ss_len: u8, - pub ss_family: sa_family_t, - __ss_pad1: [u8; 6], - __ss_pad2: i64, - __ss_pad3: [u8; 240], - } - impl Clone for sockaddr_storage { - fn clone(&self) -> sockaddr_storage { *self } - } - #[repr(C)] - #[derive(Copy, Clone)] pub struct sockaddr_in { - pub sin_len: u8, - pub sin_family: sa_family_t, - pub sin_port: in_port_t, - pub sin_addr: in_addr, - pub sin_zero: [u8; 8], - } - #[repr(C)] - #[derive(Copy, Clone)] pub struct in_addr { - pub s_addr: in_addr_t, - } - #[repr(C)] - #[derive(Copy, Clone)] pub struct sockaddr_in6 { - pub sin6_len: u8, - pub sin6_family: sa_family_t, - pub sin6_port: in_port_t, - pub sin6_flowinfo: u32, - pub sin6_addr: in6_addr, - pub sin6_scope_id: u32, - } - #[repr(C)] - #[derive(Copy, Clone)] pub struct in6_addr { - pub s6_addr: [u16; 8], - __align: [u32; 0], - } - #[repr(C)] - #[derive(Copy, Clone)] pub struct ip_mreq { - pub imr_multiaddr: in_addr, - pub imr_interface: in_addr, - } - #[repr(C)] - #[derive(Copy, Clone)] pub struct ipv6_mreq { - pub ipv6mr_multiaddr: in6_addr, - pub ipv6mr_interface: c_uint, - } - #[repr(C)] - #[derive(Copy, Clone)] pub struct addrinfo { - pub ai_flags: c_int, - pub ai_family: c_int, - pub ai_socktype: c_int, - pub ai_protocol: c_int, - pub ai_addrlen: socklen_t, - pub ai_addr: *mut sockaddr, - pub ai_canonname: *mut c_char, - pub ai_next: *mut addrinfo, - } - #[repr(C)] - #[derive(Copy)] pub struct sockaddr_un { - pub sun_len: u8, - pub sun_family: sa_family_t, - pub sun_path: [c_char; 104] - } - impl Clone for sockaddr_un { - fn clone(&self) -> sockaddr_un { *self } - } - #[repr(C)] - #[derive(Copy, Clone)] pub struct ifaddrs { - pub ifa_next: *mut ifaddrs, - pub ifa_name: *mut c_char, - pub ifa_flags: c_uint, - pub ifa_addr: *mut sockaddr, - pub ifa_netmask: *mut sockaddr, - pub ifa_dstaddr: *mut sockaddr, - pub ifa_data: *mut c_void - } - } - } - - #[cfg(target_arch = "x86_64")] - pub mod arch { - pub mod c95 { - pub type c_char = i8; - pub type c_schar = i8; - pub type c_uchar = u8; - pub type c_short = i16; - pub type c_ushort = u16; - pub type c_int = i32; - pub type c_uint = u32; - pub type c_long = i64; - pub type c_ulong = u64; - pub type c_float = f32; - pub type c_double = f64; - pub type size_t = u64; - pub type ptrdiff_t = i64; - pub type clock_t = i64; - pub type time_t = i64; - pub type suseconds_t = i64; - pub type wchar_t = i32; - } - pub mod c99 { - pub type c_longlong = i64; - pub type c_ulonglong = u64; - pub type intptr_t = i64; - pub type uintptr_t = u64; - pub type intmax_t = i64; - pub type uintmax_t = u64; - } - pub mod posix88 { - use types::os::arch::c95::{c_long}; - pub type off_t = i64; - pub type dev_t = i32; - pub type pid_t = i32; - pub type uid_t = u32; - pub type gid_t = u32; - pub type useconds_t = u32; - pub type mode_t = u32; - pub type ssize_t = c_long; - } - pub mod posix01 { - use types::common::c95::{c_void}; - use types::common::c99::{uint32_t, uint64_t}; - use types::os::arch::c95::{c_long, time_t}; - use types::os::arch::posix88::{dev_t, gid_t}; - use types::os::arch::posix88::{mode_t, off_t}; - use types::os::arch::posix88::{uid_t}; - - pub type nlink_t = uint32_t; - pub type blksize_t = uint32_t; - pub type ino_t = uint64_t; - pub type blkcnt_t = i64; - pub type fflags_t = u32; // type not declared, but struct stat have u_int32_t - - #[repr(C)] - #[derive(Copy, Clone)] pub struct stat { - pub st_mode: mode_t, - pub st_dev: dev_t, - pub st_ino: ino_t, - pub st_nlink: nlink_t, - pub st_uid: uid_t, - pub st_gid: gid_t, - pub st_rdev: dev_t, - pub st_atime: time_t, - pub st_atime_nsec: c_long, - pub st_mtime: time_t, - pub st_mtime_nsec: c_long, - pub st_ctime: time_t, - pub st_ctime_nsec: c_long, - pub st_size: off_t, - pub st_blocks: blkcnt_t, - pub st_blksize: blksize_t, - pub st_flags: fflags_t, - pub st_gen: uint32_t, - pub st_birthtime: time_t, - pub st_birthtime_nsec: c_long, - } - #[repr(C)] - #[derive(Copy, Clone)] pub struct utimbuf { - pub actime: time_t, - pub modtime: time_t, - } - - pub type pthread_attr_t = *mut c_void; - } - pub mod posix08 { - } - pub mod bsd44 { - } - pub mod extra { - } - } + + pub struct sockaddr_storage { + pub ss_len: u8, + pub ss_family: sa_family_t, + __ss_pad1: [u8; 6], + __ss_pad2: i64, + __ss_pad3: [u8; 240], + } + + pub struct addrinfo { + pub ai_flags: c_int, + pub ai_family: c_int, + pub ai_socktype: c_int, + pub ai_protocol: c_int, + pub ai_addrlen: socklen_t, + pub ai_addr: *mut sockaddr, + pub ai_canonname: *mut c_char, + pub ai_next: *mut addrinfo, } - #[cfg(any(target_os = "bitrig", target_os = "netbsd", target_os = "openbsd"))] - pub mod os { - pub mod c95 { - use types::os::arch::c95::{c_int, c_uint}; - - pub const EXIT_FAILURE : c_int = 1; - pub const EXIT_SUCCESS : c_int = 0; - pub const RAND_MAX : c_int = 2147483647; - pub const EOF : c_int = -1; - pub const SEEK_SET : c_int = 0; - pub const SEEK_CUR : c_int = 1; - pub const SEEK_END : c_int = 2; - pub const _IOFBF : c_int = 0; - pub const _IONBF : c_int = 2; - pub const _IOLBF : c_int = 1; - pub const BUFSIZ : c_uint = 1024; - pub const FOPEN_MAX : c_uint = 20; - pub const FILENAME_MAX : c_uint = 1024; - pub const L_tmpnam : c_uint = 1024; - pub const TMP_MAX : c_uint = 308915776; - } - pub mod c99 { - } - pub mod posix88 { - use types::common::c95::c_void; - use types::os::arch::c95::c_int; - use types::os::arch::posix88::mode_t; - - pub const O_RDONLY : c_int = 0; - pub const O_WRONLY : c_int = 1; - pub const O_RDWR : c_int = 2; - pub const O_APPEND : c_int = 8; - pub const O_CREAT : c_int = 512; - pub const O_EXCL : c_int = 2048; - pub const O_NOCTTY : c_int = 32768; - pub const O_TRUNC : c_int = 1024; - pub const S_IFIFO : mode_t = 4096; - pub const S_IFCHR : mode_t = 8192; - pub const S_IFBLK : mode_t = 24576; - pub const S_IFDIR : mode_t = 16384; - pub const S_IFREG : mode_t = 32768; - pub const S_IFLNK : mode_t = 40960; - pub const S_IFSOCK : mode_t = 49152; - pub const S_IFMT : mode_t = 61440; - pub const S_IEXEC : mode_t = 64; - pub const S_IWRITE : mode_t = 128; - pub const S_IREAD : mode_t = 256; - pub const S_IRWXU : mode_t = 448; - pub const S_IXUSR : mode_t = 64; - pub const S_IWUSR : mode_t = 128; - pub const S_IRUSR : mode_t = 256; - pub const S_IRWXG : mode_t = 56; - pub const S_IXGRP : mode_t = 8; - pub const S_IWGRP : mode_t = 16; - pub const S_IRGRP : mode_t = 32; - pub const S_IRWXO : mode_t = 7; - pub const S_IXOTH : mode_t = 1; - pub const S_IWOTH : mode_t = 2; - pub const S_IROTH : mode_t = 4; - pub const F_OK : c_int = 0; - pub const R_OK : c_int = 4; - pub const W_OK : c_int = 2; - pub const X_OK : c_int = 1; - pub const STDIN_FILENO : c_int = 0; - pub const STDOUT_FILENO : c_int = 1; - pub const STDERR_FILENO : c_int = 2; - pub const F_LOCK : c_int = 1; - pub const F_TEST : c_int = 3; - pub const F_TLOCK : c_int = 2; - pub const F_ULOCK : c_int = 0; - pub const SIGHUP : c_int = 1; - pub const SIGINT : c_int = 2; - pub const SIGQUIT : c_int = 3; - pub const SIGILL : c_int = 4; - pub const SIGABRT : c_int = 6; - pub const SIGFPE : c_int = 8; - pub const SIGKILL : c_int = 9; - pub const SIGSEGV : c_int = 11; - pub const SIGPIPE : c_int = 13; - pub const SIGALRM : c_int = 14; - pub const SIGTERM : c_int = 15; - - pub const PROT_NONE : c_int = 0; - pub const PROT_READ : c_int = 1; - pub const PROT_WRITE : c_int = 2; - pub const PROT_EXEC : c_int = 4; - - pub const MAP_FILE : c_int = 0x0000; - pub const MAP_SHARED : c_int = 0x0001; - pub const MAP_PRIVATE : c_int = 0x0002; - pub const MAP_FIXED : c_int = 0x0010; - pub const MAP_ANON : c_int = 0x1000; - - pub const MAP_FAILED : *mut c_void = !0 as *mut c_void; - - pub const MCL_CURRENT : c_int = 0x0001; - pub const MCL_FUTURE : c_int = 0x0002; - - pub const MS_ASYNC : c_int = 0x0001; - pub const MS_SYNC : c_int = 0x0002; - pub const MS_INVALIDATE : c_int = 0x0004; - - pub const EPERM : c_int = 1; - pub const ENOENT : c_int = 2; - pub const ESRCH : c_int = 3; - pub const EINTR : c_int = 4; - pub const EIO : c_int = 5; - pub const ENXIO : c_int = 6; - pub const E2BIG : c_int = 7; - pub const ENOEXEC : c_int = 8; - pub const EBADF : c_int = 9; - pub const ECHILD : c_int = 10; - pub const EDEADLK : c_int = 11; - pub const ENOMEM : c_int = 12; - pub const EACCES : c_int = 13; - pub const EFAULT : c_int = 14; - pub const ENOTBLK : c_int = 15; - pub const EBUSY : c_int = 16; - pub const EEXIST : c_int = 17; - pub const EXDEV : c_int = 18; - pub const ENODEV : c_int = 19; - pub const ENOTDIR : c_int = 20; - pub const EISDIR : c_int = 21; - pub const EINVAL : c_int = 22; - pub const ENFILE : c_int = 23; - pub const EMFILE : c_int = 24; - pub const ENOTTY : c_int = 25; - pub const ETXTBSY : c_int = 26; - pub const EFBIG : c_int = 27; - pub const ENOSPC : c_int = 28; - pub const ESPIPE : c_int = 29; - pub const EROFS : c_int = 30; - pub const EMLINK : c_int = 31; - pub const EPIPE : c_int = 32; - pub const EDOM : c_int = 33; - pub const ERANGE : c_int = 34; - pub const EAGAIN : c_int = 35; - pub const EWOULDBLOCK : c_int = 35; - pub const EINPROGRESS : c_int = 36; - pub const EALREADY : c_int = 37; - pub const ENOTSOCK : c_int = 38; - pub const EDESTADDRREQ : c_int = 39; - pub const EMSGSIZE : c_int = 40; - pub const EPROTOTYPE : c_int = 41; - pub const ENOPROTOOPT : c_int = 42; - pub const EPROTONOSUPPORT : c_int = 43; - pub const ESOCKTNOSUPPORT : c_int = 44; - pub const EOPNOTSUPP : c_int = 45; - pub const EPFNOSUPPORT : c_int = 46; - pub const EAFNOSUPPORT : c_int = 47; - pub const EADDRINUSE : c_int = 48; - pub const EADDRNOTAVAIL : c_int = 49; - pub const ENETDOWN : c_int = 50; - pub const ENETUNREACH : c_int = 51; - pub const ENETRESET : c_int = 52; - pub const ECONNABORTED : c_int = 53; - pub const ECONNRESET : c_int = 54; - pub const ENOBUFS : c_int = 55; - pub const EISCONN : c_int = 56; - pub const ENOTCONN : c_int = 57; - pub const ESHUTDOWN : c_int = 58; - pub const ETOOMANYREFS : c_int = 59; - pub const ETIMEDOUT : c_int = 60; - pub const ECONNREFUSED : c_int = 61; - pub const ELOOP : c_int = 62; - pub const ENAMETOOLONG : c_int = 63; - pub const EHOSTDOWN : c_int = 64; - pub const EHOSTUNREACH : c_int = 65; - pub const ENOTEMPTY : c_int = 66; - pub const EPROCLIM : c_int = 67; - pub const EUSERS : c_int = 68; - pub const EDQUOT : c_int = 69; - pub const ESTALE : c_int = 70; - pub const EREMOTE : c_int = 71; - pub const EBADRPC : c_int = 72; - pub const ERPCMISMATCH : c_int = 73; - pub const EPROGUNAVAIL : c_int = 74; - pub const EPROGMISMATCH : c_int = 75; - pub const EPROCUNAVAIL : c_int = 76; - pub const ENOLCK : c_int = 77; - pub const ENOSYS : c_int = 78; - pub const EFTYPE : c_int = 79; - pub const EAUTH : c_int = 80; - pub const ENEEDAUTH : c_int = 81; - pub const EIPSEC : c_int = 82; - pub const ENOATTR : c_int = 83; - pub const EILSEQ : c_int = 84; - pub const ENOMEDIUM : c_int = 85; - pub const EMEDIUMTYPE : c_int = 86; - pub const EOVERFLOW : c_int = 87; - pub const ECANCELED : c_int = 88; - pub const EIDRM : c_int = 89; - pub const ENOMSG : c_int = 90; - pub const ENOTSUP : c_int = 91; - pub const ELAST : c_int = 91; // must be equal to largest errno - } - pub mod posix01 { - use types::os::arch::c95::{c_int, size_t}; - use types::os::common::posix01::rlim_t; - - pub const F_DUPFD : c_int = 0; - pub const F_GETFD : c_int = 1; - pub const F_SETFD : c_int = 2; - pub const F_GETFL : c_int = 3; - pub const F_SETFL : c_int = 4; - pub const F_GETOWN : c_int = 5; - pub const F_SETOWN : c_int = 6; - pub const F_GETLK : c_int = 7; - pub const F_SETLK : c_int = 8; - pub const F_SETLKW : c_int = 9; - pub const F_DUPFD_CLOEXEC : c_int = 10; - - pub const SIGTRAP : c_int = 5; - - pub const GLOB_APPEND : c_int = 0x0001; - pub const GLOB_DOOFFS : c_int = 0x0002; - pub const GLOB_ERR : c_int = 0x0004; - pub const GLOB_MARK : c_int = 0x0008; - pub const GLOB_NOCHECK : c_int = 0x0010; - pub const GLOB_NOSORT : c_int = 0x0020; - pub const GLOB_NOESCAPE : c_int = 0x1000; - - pub const GLOB_NOSPACE : c_int = -1; - pub const GLOB_ABORTED : c_int = -2; - pub const GLOB_NOMATCH : c_int = -3; - pub const GLOB_NOSYS : c_int = -4; - - pub const POSIX_MADV_NORMAL : c_int = 0; - pub const POSIX_MADV_RANDOM : c_int = 1; - pub const POSIX_MADV_SEQUENTIAL : c_int = 2; - pub const POSIX_MADV_WILLNEED : c_int = 3; - pub const POSIX_MADV_DONTNEED : c_int = 4; - - pub const _SC_IOV_MAX : c_int = 51; - pub const _SC_GETGR_R_SIZE_MAX : c_int = 100; - pub const _SC_GETPW_R_SIZE_MAX : c_int = 101; - pub const _SC_LOGIN_NAME_MAX : c_int = 102; - pub const _SC_MQ_PRIO_MAX : c_int = 59; - pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77; - pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78; - pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 80; - pub const _SC_THREAD_KEYS_MAX : c_int = 81; - pub const _SC_THREAD_PRIO_INHERIT : c_int = 82; - pub const _SC_THREAD_PRIO_PROTECT : c_int = 83; - pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 84; - pub const _SC_THREAD_PROCESS_SHARED : c_int = 85; - pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 103; - pub const _SC_THREAD_STACK_MIN : c_int = 89; - pub const _SC_THREAD_THREADS_MAX : c_int = 90; - pub const _SC_THREADS : c_int = 91; - pub const _SC_TTY_NAME_MAX : c_int = 107; - pub const _SC_ATEXIT_MAX : c_int = 46; - pub const _SC_XOPEN_CRYPT : c_int = 117; - pub const _SC_XOPEN_ENH_I18N : c_int = 118; - pub const _SC_XOPEN_LEGACY : c_int = 119; - pub const _SC_XOPEN_REALTIME : c_int = 120; - pub const _SC_XOPEN_REALTIME_THREADS : c_int = 121; - pub const _SC_XOPEN_SHM : c_int = 30; - pub const _SC_XOPEN_UNIX : c_int = 123; - pub const _SC_XOPEN_VERSION : c_int = 125; - - pub const PTHREAD_CREATE_JOINABLE : c_int = 0; - pub const PTHREAD_CREATE_DETACHED : c_int = 1; - pub const PTHREAD_STACK_MIN : size_t = 2048; - - pub const CLOCK_REALTIME : c_int = 0; - pub const CLOCK_MONOTONIC : c_int = 3; - - pub const RLIMIT_CPU: c_int = 0; - pub const RLIMIT_FSIZE: c_int = 1; - pub const RLIMIT_DATA: c_int = 2; - pub const RLIMIT_STACK: c_int = 3; - pub const RLIMIT_CORE: c_int = 4; - pub const RLIMIT_RSS: c_int = 5; - pub const RLIMIT_MEMLOCK: c_int = 6; - pub const RLIMIT_NPROC: c_int = 7; - pub const RLIMIT_NOFILE: c_int = 8; - pub const RLIM_NLIMITS: c_int = 9; - - pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff; - pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY; - pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY; - - pub const RUSAGE_SELF: c_int = 0; - pub const RUSAGE_CHILDREN: c_int = -1; - pub const RUSAGE_THREAD: c_int = 1; - } - pub mod posix08 { - } - pub mod bsd44 { - use types::os::arch::c95::c_int; - - pub const MADV_NORMAL : c_int = 0; - pub const MADV_RANDOM : c_int = 1; - pub const MADV_SEQUENTIAL : c_int = 2; - pub const MADV_WILLNEED : c_int = 3; - pub const MADV_DONTNEED : c_int = 4; - pub const MADV_FREE : c_int = 6; - - pub const AF_UNIX: c_int = 1; - pub const AF_INET: c_int = 2; - pub const AF_INET6: c_int = 24; - pub const SOCK_STREAM: c_int = 1; - pub const SOCK_DGRAM: c_int = 2; - pub const SOCK_RAW: c_int = 3; - pub const IPPROTO_TCP: c_int = 6; - pub const IPPROTO_IP: c_int = 0; - pub const IPPROTO_IPV6: c_int = 41; - pub const IP_MULTICAST_TTL: c_int = 10; - pub const IP_MULTICAST_LOOP: c_int = 11; - pub const IP_TTL: c_int = 4; - pub const IP_HDRINCL: c_int = 2; - pub const IP_ADD_MEMBERSHIP: c_int = 12; - pub const IP_DROP_MEMBERSHIP: c_int = 13; - pub const IPV6_ADD_MEMBERSHIP: c_int = 12; // don't exist - pub const IPV6_DROP_MEMBERSHIP: c_int = 13; // don't exist - - pub const TCP_NODELAY: c_int = 0x01; - pub const SOL_SOCKET: c_int = 0xffff; - pub const SO_DEBUG: c_int = 0x01; - pub const SO_ACCEPTCONN: c_int = 0x0002; - pub const SO_REUSEADDR: c_int = 0x0004; - pub const SO_KEEPALIVE: c_int = 0x0008; - pub const SO_DONTROUTE: c_int = 0x0010; - pub const SO_BROADCAST: c_int = 0x0020; - pub const SO_USELOOPBACK: c_int = 0x0040; - pub const SO_LINGER: c_int = 0x0080; - pub const SO_OOBINLINE: c_int = 0x0100; - pub const SO_REUSEPORT: c_int = 0x0200; - pub const SO_SNDBUF: c_int = 0x1001; - pub const SO_RCVBUF: c_int = 0x1002; - pub const SO_SNDLOWAT: c_int = 0x1003; - pub const SO_RCVLOWAT: c_int = 0x1004; - pub const SO_SNDTIMEO: c_int = 0x1005; - pub const SO_RCVTIMEO: c_int = 0x1006; - pub const SO_ERROR: c_int = 0x1007; - pub const SO_TYPE: c_int = 0x1008; - - pub const IFF_LOOPBACK: c_int = 0x8; - - pub const SHUT_RD: c_int = 0; - pub const SHUT_WR: c_int = 1; - pub const SHUT_RDWR: c_int = 2; - - pub const LOCK_SH: c_int = 1; - pub const LOCK_EX: c_int = 2; - pub const LOCK_NB: c_int = 4; - pub const LOCK_UN: c_int = 8; - } - pub mod extra { - use types::os::arch::c95::c_int; - - pub const O_DSYNC : c_int = 128; // same as SYNC - pub const O_SYNC : c_int = 128; - pub const O_NONBLOCK : c_int = 4; - pub const CTL_KERN : c_int = 1; - pub const KERN_PROC : c_int = 66; - - pub const MAP_COPY : c_int = 0x0002; - pub const MAP_RENAME : c_int = 0x0000; - pub const MAP_NORESERVE : c_int = 0x0000; - pub const MAP_NOEXTEND : c_int = 0x0000; - pub const MAP_HASSEMAPHORE : c_int = 0x0000; - - pub const IPPROTO_RAW : c_int = 255; - - pub const PATH_MAX: c_int = 1024; - } - pub mod sysconf { - use types::os::arch::c95::c_int; - - pub const _SC_ARG_MAX : c_int = 1; - pub const _SC_CHILD_MAX : c_int = 2; - pub const _SC_CLK_TCK : c_int = 3; - pub const _SC_NGROUPS_MAX : c_int = 4; - pub const _SC_OPEN_MAX : c_int = 5; - pub const _SC_JOB_CONTROL : c_int = 6; - pub const _SC_SAVED_IDS : c_int = 7; - pub const _SC_VERSION : c_int = 8; - pub const _SC_BC_BASE_MAX : c_int = 9; - pub const _SC_BC_DIM_MAX : c_int = 10; - pub const _SC_BC_SCALE_MAX : c_int = 11; - pub const _SC_BC_STRING_MAX : c_int = 12; - pub const _SC_COLL_WEIGHTS_MAX : c_int = 13; - pub const _SC_EXPR_NEST_MAX : c_int = 14; - pub const _SC_LINE_MAX : c_int = 15; - pub const _SC_RE_DUP_MAX : c_int = 16; - pub const _SC_2_VERSION : c_int = 17; - pub const _SC_2_C_BIND : c_int = 18; - pub const _SC_2_C_DEV : c_int = 19; - pub const _SC_2_CHAR_TERM : c_int = 20; - pub const _SC_2_FORT_DEV : c_int = 21; - pub const _SC_2_FORT_RUN : c_int = 22; - pub const _SC_2_LOCALEDEF : c_int = 23; - pub const _SC_2_SW_DEV : c_int = 24; - pub const _SC_2_UPE : c_int = 25; - pub const _SC_STREAM_MAX : c_int = 26; - pub const _SC_TZNAME_MAX : c_int = 27; - pub const _SC_PAGESIZE : c_int = 28; - pub const _SC_FSYNC : c_int = 29; - pub const _SC_SEM_NSEMS_MAX : c_int = 31; - pub const _SC_SEM_VALUE_MAX : c_int = 32; - pub const _SC_AIO_LISTIO_MAX : c_int = 42; - pub const _SC_AIO_MAX : c_int = 43; - pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44; - pub const _SC_ASYNCHRONOUS_IO : c_int = 45; - pub const _SC_DELAYTIMER_MAX : c_int = 50; - pub const _SC_MAPPED_FILES : c_int = 53; - pub const _SC_MEMLOCK : c_int = 54; - pub const _SC_MEMLOCK_RANGE : c_int = 55; - pub const _SC_MEMORY_PROTECTION : c_int = 56; - pub const _SC_MESSAGE_PASSING : c_int = 57; - pub const _SC_MQ_OPEN_MAX : c_int = 58; - pub const _SC_PRIORITIZED_IO : c_int = 60; - pub const _SC_PRIORITY_SCHEDULING : c_int = 61; - pub const _SC_REALTIME_SIGNALS : c_int = 64; - pub const _SC_RTSIG_MAX : c_int = 66; - pub const _SC_SEMAPHORES : c_int = 67; - pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 68; - pub const _SC_SIGQUEUE_MAX : c_int = 70; - pub const _SC_SYNCHRONIZED_IO : c_int = 75; - pub const _SC_TIMER_MAX : c_int = 93; - pub const _SC_TIMERS : c_int = 94; - } + pub struct ifaddrs { + pub ifa_next: *mut ifaddrs, + pub ifa_name: *mut c_char, + pub ifa_flags: c_uint, + pub ifa_addr: *mut sockaddr, + pub ifa_netmask: *mut sockaddr, + pub ifa_dstaddr: *mut sockaddr, + pub ifa_data: *mut c_void } - pub type pthread_mutex_t = *mut libc::c_void; - pub type pthread_mutexattr_t = *mut libc::c_void; - pub type pthread_cond_t = *mut libc::c_void; - pub type pthread_rwlock_t = *mut libc::c_void; - - pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = ptr::null_mut(); - pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = ptr::null_mut(); - pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = ptr::null_mut(); - pub const PTHREAD_MUTEX_RECURSIVE: libc::c_int = 2; + + pub struct stat { + pub st_mode: mode_t, + pub st_dev: dev_t, + pub st_ino: ino_t, + pub st_nlink: nlink_t, + pub st_uid: uid_t, + pub st_gid: gid_t, + pub st_rdev: dev_t, + pub st_atime: time_t, + pub st_atime_nsec: c_long, + pub st_mtime: time_t, + pub st_mtime_nsec: c_long, + pub st_ctime: time_t, + pub st_ctime_nsec: c_long, + pub st_size: off_t, + pub st_blocks: blkcnt_t, + pub st_blksize: blksize_t, + pub st_flags: fflags_t, + pub st_gen: uint32_t, + pub st_birthtime: time_t, + pub st_birthtime_nsec: c_long, + } +} + +pub const EXIT_FAILURE : c_int = 1; +pub const EXIT_SUCCESS : c_int = 0; +pub const RAND_MAX : c_int = 2147483647; +pub const EOF : c_int = -1; +pub const SEEK_SET : c_int = 0; +pub const SEEK_CUR : c_int = 1; +pub const SEEK_END : c_int = 2; +pub const _IOFBF : c_int = 0; +pub const _IONBF : c_int = 2; +pub const _IOLBF : c_int = 1; +pub const BUFSIZ : c_uint = 1024; +pub const FOPEN_MAX : c_uint = 20; +pub const FILENAME_MAX : c_uint = 1024; +pub const L_tmpnam : c_uint = 1024; +pub const TMP_MAX : c_uint = 308915776; +pub const O_RDONLY : c_int = 0; +pub const O_WRONLY : c_int = 1; +pub const O_RDWR : c_int = 2; +pub const O_APPEND : c_int = 8; +pub const O_CREAT : c_int = 512; +pub const O_EXCL : c_int = 2048; +pub const O_NOCTTY : c_int = 32768; +pub const O_TRUNC : c_int = 1024; +pub const S_IFIFO : mode_t = 4096; +pub const S_IFCHR : mode_t = 8192; +pub const S_IFBLK : mode_t = 24576; +pub const S_IFDIR : mode_t = 16384; +pub const S_IFREG : mode_t = 32768; +pub const S_IFLNK : mode_t = 40960; +pub const S_IFSOCK : mode_t = 49152; +pub const S_IFMT : mode_t = 61440; +pub const S_IEXEC : mode_t = 64; +pub const S_IWRITE : mode_t = 128; +pub const S_IREAD : mode_t = 256; +pub const S_IRWXU : mode_t = 448; +pub const S_IXUSR : mode_t = 64; +pub const S_IWUSR : mode_t = 128; +pub const S_IRUSR : mode_t = 256; +pub const S_IRWXG : mode_t = 56; +pub const S_IXGRP : mode_t = 8; +pub const S_IWGRP : mode_t = 16; +pub const S_IRGRP : mode_t = 32; +pub const S_IRWXO : mode_t = 7; +pub const S_IXOTH : mode_t = 1; +pub const S_IWOTH : mode_t = 2; +pub const S_IROTH : mode_t = 4; +pub const F_OK : c_int = 0; +pub const R_OK : c_int = 4; +pub const W_OK : c_int = 2; +pub const X_OK : c_int = 1; +pub const STDIN_FILENO : c_int = 0; +pub const STDOUT_FILENO : c_int = 1; +pub const STDERR_FILENO : c_int = 2; +pub const F_LOCK : c_int = 1; +pub const F_TEST : c_int = 3; +pub const F_TLOCK : c_int = 2; +pub const F_ULOCK : c_int = 0; +pub const SIGHUP : c_int = 1; +pub const SIGINT : c_int = 2; +pub const SIGQUIT : c_int = 3; +pub const SIGILL : c_int = 4; +pub const SIGABRT : c_int = 6; +pub const SIGFPE : c_int = 8; +pub const SIGKILL : c_int = 9; +pub const SIGSEGV : c_int = 11; +pub const SIGPIPE : c_int = 13; +pub const SIGALRM : c_int = 14; +pub const SIGTERM : c_int = 15; + +pub const PROT_NONE : c_int = 0; +pub const PROT_READ : c_int = 1; +pub const PROT_WRITE : c_int = 2; +pub const PROT_EXEC : c_int = 4; + +pub const MAP_FILE : c_int = 0x0000; +pub const MAP_SHARED : c_int = 0x0001; +pub const MAP_PRIVATE : c_int = 0x0002; +pub const MAP_FIXED : c_int = 0x0010; +pub const MAP_ANON : c_int = 0x1000; + +pub const MAP_FAILED : *mut c_void = !0 as *mut c_void; + +pub const MCL_CURRENT : c_int = 0x0001; +pub const MCL_FUTURE : c_int = 0x0002; + +pub const MS_ASYNC : c_int = 0x0001; +pub const MS_SYNC : c_int = 0x0002; +pub const MS_INVALIDATE : c_int = 0x0004; + +pub const EPERM : c_int = 1; +pub const ENOENT : c_int = 2; +pub const ESRCH : c_int = 3; +pub const EINTR : c_int = 4; +pub const EIO : c_int = 5; +pub const ENXIO : c_int = 6; +pub const E2BIG : c_int = 7; +pub const ENOEXEC : c_int = 8; +pub const EBADF : c_int = 9; +pub const ECHILD : c_int = 10; +pub const EDEADLK : c_int = 11; +pub const ENOMEM : c_int = 12; +pub const EACCES : c_int = 13; +pub const EFAULT : c_int = 14; +pub const ENOTBLK : c_int = 15; +pub const EBUSY : c_int = 16; +pub const EEXIST : c_int = 17; +pub const EXDEV : c_int = 18; +pub const ENODEV : c_int = 19; +pub const ENOTDIR : c_int = 20; +pub const EISDIR : c_int = 21; +pub const EINVAL : c_int = 22; +pub const ENFILE : c_int = 23; +pub const EMFILE : c_int = 24; +pub const ENOTTY : c_int = 25; +pub const ETXTBSY : c_int = 26; +pub const EFBIG : c_int = 27; +pub const ENOSPC : c_int = 28; +pub const ESPIPE : c_int = 29; +pub const EROFS : c_int = 30; +pub const EMLINK : c_int = 31; +pub const EPIPE : c_int = 32; +pub const EDOM : c_int = 33; +pub const ERANGE : c_int = 34; +pub const EAGAIN : c_int = 35; +pub const EWOULDBLOCK : c_int = 35; +pub const EINPROGRESS : c_int = 36; +pub const EALREADY : c_int = 37; +pub const ENOTSOCK : c_int = 38; +pub const EDESTADDRREQ : c_int = 39; +pub const EMSGSIZE : c_int = 40; +pub const EPROTOTYPE : c_int = 41; +pub const ENOPROTOOPT : c_int = 42; +pub const EPROTONOSUPPORT : c_int = 43; +pub const ESOCKTNOSUPPORT : c_int = 44; +pub const EOPNOTSUPP : c_int = 45; +pub const EPFNOSUPPORT : c_int = 46; +pub const EAFNOSUPPORT : c_int = 47; +pub const EADDRINUSE : c_int = 48; +pub const EADDRNOTAVAIL : c_int = 49; +pub const ENETDOWN : c_int = 50; +pub const ENETUNREACH : c_int = 51; +pub const ENETRESET : c_int = 52; +pub const ECONNABORTED : c_int = 53; +pub const ECONNRESET : c_int = 54; +pub const ENOBUFS : c_int = 55; +pub const EISCONN : c_int = 56; +pub const ENOTCONN : c_int = 57; +pub const ESHUTDOWN : c_int = 58; +pub const ETOOMANYREFS : c_int = 59; +pub const ETIMEDOUT : c_int = 60; +pub const ECONNREFUSED : c_int = 61; +pub const ELOOP : c_int = 62; +pub const ENAMETOOLONG : c_int = 63; +pub const EHOSTDOWN : c_int = 64; +pub const EHOSTUNREACH : c_int = 65; +pub const ENOTEMPTY : c_int = 66; +pub const EPROCLIM : c_int = 67; +pub const EUSERS : c_int = 68; +pub const EDQUOT : c_int = 69; +pub const ESTALE : c_int = 70; +pub const EREMOTE : c_int = 71; +pub const EBADRPC : c_int = 72; +pub const ERPCMISMATCH : c_int = 73; +pub const EPROGUNAVAIL : c_int = 74; +pub const EPROGMISMATCH : c_int = 75; +pub const EPROCUNAVAIL : c_int = 76; +pub const ENOLCK : c_int = 77; +pub const ENOSYS : c_int = 78; +pub const EFTYPE : c_int = 79; +pub const EAUTH : c_int = 80; +pub const ENEEDAUTH : c_int = 81; +pub const EIPSEC : c_int = 82; +pub const ENOATTR : c_int = 83; +pub const EILSEQ : c_int = 84; +pub const ENOMEDIUM : c_int = 85; +pub const EMEDIUMTYPE : c_int = 86; +pub const EOVERFLOW : c_int = 87; +pub const ECANCELED : c_int = 88; +pub const EIDRM : c_int = 89; +pub const ENOMSG : c_int = 90; +pub const ENOTSUP : c_int = 91; +pub const ELAST : c_int = 91; // must be equal to largest errno + +pub const F_DUPFD : c_int = 0; +pub const F_GETFD : c_int = 1; +pub const F_SETFD : c_int = 2; +pub const F_GETFL : c_int = 3; +pub const F_SETFL : c_int = 4; +pub const F_GETOWN : c_int = 5; +pub const F_SETOWN : c_int = 6; +pub const F_GETLK : c_int = 7; +pub const F_SETLK : c_int = 8; +pub const F_SETLKW : c_int = 9; +pub const F_DUPFD_CLOEXEC : c_int = 10; + +pub const SIGTRAP : c_int = 5; + +pub const GLOB_APPEND : c_int = 0x0001; +pub const GLOB_DOOFFS : c_int = 0x0002; +pub const GLOB_ERR : c_int = 0x0004; +pub const GLOB_MARK : c_int = 0x0008; +pub const GLOB_NOCHECK : c_int = 0x0010; +pub const GLOB_NOSORT : c_int = 0x0020; +pub const GLOB_NOESCAPE : c_int = 0x1000; + +pub const GLOB_NOSPACE : c_int = -1; +pub const GLOB_ABORTED : c_int = -2; +pub const GLOB_NOMATCH : c_int = -3; +pub const GLOB_NOSYS : c_int = -4; + +pub const POSIX_MADV_NORMAL : c_int = 0; +pub const POSIX_MADV_RANDOM : c_int = 1; +pub const POSIX_MADV_SEQUENTIAL : c_int = 2; +pub const POSIX_MADV_WILLNEED : c_int = 3; +pub const POSIX_MADV_DONTNEED : c_int = 4; + +pub const _SC_IOV_MAX : c_int = 51; +pub const _SC_GETGR_R_SIZE_MAX : c_int = 100; +pub const _SC_GETPW_R_SIZE_MAX : c_int = 101; +pub const _SC_LOGIN_NAME_MAX : c_int = 102; +pub const _SC_MQ_PRIO_MAX : c_int = 59; +pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77; +pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 80; +pub const _SC_THREAD_KEYS_MAX : c_int = 81; +pub const _SC_THREAD_PRIO_INHERIT : c_int = 82; +pub const _SC_THREAD_PRIO_PROTECT : c_int = 83; +pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 84; +pub const _SC_THREAD_PROCESS_SHARED : c_int = 85; +pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 103; +pub const _SC_THREAD_STACK_MIN : c_int = 89; +pub const _SC_THREAD_THREADS_MAX : c_int = 90; +pub const _SC_THREADS : c_int = 91; +pub const _SC_TTY_NAME_MAX : c_int = 107; +pub const _SC_ATEXIT_MAX : c_int = 46; +pub const _SC_XOPEN_CRYPT : c_int = 117; +pub const _SC_XOPEN_ENH_I18N : c_int = 118; +pub const _SC_XOPEN_LEGACY : c_int = 119; +pub const _SC_XOPEN_REALTIME : c_int = 120; +pub const _SC_XOPEN_REALTIME_THREADS : c_int = 121; +pub const _SC_XOPEN_SHM : c_int = 30; +pub const _SC_XOPEN_UNIX : c_int = 123; +pub const _SC_XOPEN_VERSION : c_int = 125; + +pub const PTHREAD_CREATE_JOINABLE : c_int = 0; +pub const PTHREAD_CREATE_DETACHED : c_int = 1; +pub const PTHREAD_STACK_MIN : size_t = 2048; + +pub const CLOCK_REALTIME : c_int = 0; +pub const CLOCK_MONOTONIC : c_int = 3; + +pub const RLIMIT_CPU: c_int = 0; +pub const RLIMIT_FSIZE: c_int = 1; +pub const RLIMIT_DATA: c_int = 2; +pub const RLIMIT_STACK: c_int = 3; +pub const RLIMIT_CORE: c_int = 4; +pub const RLIMIT_RSS: c_int = 5; +pub const RLIMIT_MEMLOCK: c_int = 6; +pub const RLIMIT_NPROC: c_int = 7; +pub const RLIMIT_NOFILE: c_int = 8; +pub const RLIM_NLIMITS: c_int = 9; + +pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff; +pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY; +pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY; + +pub const RUSAGE_SELF: c_int = 0; +pub const RUSAGE_CHILDREN: c_int = -1; +pub const RUSAGE_THREAD: c_int = 1; + +pub const MADV_NORMAL : c_int = 0; +pub const MADV_RANDOM : c_int = 1; +pub const MADV_SEQUENTIAL : c_int = 2; +pub const MADV_WILLNEED : c_int = 3; +pub const MADV_DONTNEED : c_int = 4; +pub const MADV_FREE : c_int = 6; + +pub const AF_UNIX: c_int = 1; +pub const AF_INET: c_int = 2; +pub const AF_INET6: c_int = 24; +pub const SOCK_STREAM: c_int = 1; +pub const SOCK_DGRAM: c_int = 2; +pub const SOCK_RAW: c_int = 3; +pub const IPPROTO_TCP: c_int = 6; +pub const IPPROTO_IP: c_int = 0; +pub const IPPROTO_IPV6: c_int = 41; +pub const IP_MULTICAST_TTL: c_int = 10; +pub const IP_MULTICAST_LOOP: c_int = 11; +pub const IP_TTL: c_int = 4; +pub const IP_HDRINCL: c_int = 2; +pub const IP_ADD_MEMBERSHIP: c_int = 12; +pub const IP_DROP_MEMBERSHIP: c_int = 13; +pub const IPV6_ADD_MEMBERSHIP: c_int = 12; // don't exist +pub const IPV6_DROP_MEMBERSHIP: c_int = 13; // don't exist + +pub const TCP_NODELAY: c_int = 0x01; +pub const SOL_SOCKET: c_int = 0xffff; +pub const SO_DEBUG: c_int = 0x01; +pub const SO_ACCEPTCONN: c_int = 0x0002; +pub const SO_REUSEADDR: c_int = 0x0004; +pub const SO_KEEPALIVE: c_int = 0x0008; +pub const SO_DONTROUTE: c_int = 0x0010; +pub const SO_BROADCAST: c_int = 0x0020; +pub const SO_USELOOPBACK: c_int = 0x0040; +pub const SO_LINGER: c_int = 0x0080; +pub const SO_OOBINLINE: c_int = 0x0100; +pub const SO_REUSEPORT: c_int = 0x0200; +pub const SO_SNDBUF: c_int = 0x1001; +pub const SO_RCVBUF: c_int = 0x1002; +pub const SO_SNDLOWAT: c_int = 0x1003; +pub const SO_RCVLOWAT: c_int = 0x1004; +pub const SO_SNDTIMEO: c_int = 0x1005; +pub const SO_RCVTIMEO: c_int = 0x1006; +pub const SO_ERROR: c_int = 0x1007; +pub const SO_TYPE: c_int = 0x1008; + +pub const IFF_LOOPBACK: c_int = 0x8; + +pub const SHUT_RD: c_int = 0; +pub const SHUT_WR: c_int = 1; +pub const SHUT_RDWR: c_int = 2; + +pub const LOCK_SH: c_int = 1; +pub const LOCK_EX: c_int = 2; +pub const LOCK_NB: c_int = 4; +pub const LOCK_UN: c_int = 8; + +pub const O_DSYNC : c_int = 128; // same as SYNC +pub const O_SYNC : c_int = 128; +pub const O_NONBLOCK : c_int = 4; +pub const CTL_KERN : c_int = 1; +pub const KERN_PROC : c_int = 66; + +pub const MAP_COPY : c_int = 0x0002; +pub const MAP_RENAME : c_int = 0x0000; +pub const MAP_NORESERVE : c_int = 0x0000; +pub const MAP_NOEXTEND : c_int = 0x0000; +pub const MAP_HASSEMAPHORE : c_int = 0x0000; + +pub const IPPROTO_RAW : c_int = 255; + +pub const PATH_MAX: c_int = 1024; + +pub const _SC_ARG_MAX : c_int = 1; +pub const _SC_CHILD_MAX : c_int = 2; +pub const _SC_CLK_TCK : c_int = 3; +pub const _SC_NGROUPS_MAX : c_int = 4; +pub const _SC_OPEN_MAX : c_int = 5; +pub const _SC_JOB_CONTROL : c_int = 6; +pub const _SC_SAVED_IDS : c_int = 7; +pub const _SC_VERSION : c_int = 8; +pub const _SC_BC_BASE_MAX : c_int = 9; +pub const _SC_BC_DIM_MAX : c_int = 10; +pub const _SC_BC_SCALE_MAX : c_int = 11; +pub const _SC_BC_STRING_MAX : c_int = 12; +pub const _SC_COLL_WEIGHTS_MAX : c_int = 13; +pub const _SC_EXPR_NEST_MAX : c_int = 14; +pub const _SC_LINE_MAX : c_int = 15; +pub const _SC_RE_DUP_MAX : c_int = 16; +pub const _SC_2_VERSION : c_int = 17; +pub const _SC_2_C_BIND : c_int = 18; +pub const _SC_2_C_DEV : c_int = 19; +pub const _SC_2_CHAR_TERM : c_int = 20; +pub const _SC_2_FORT_DEV : c_int = 21; +pub const _SC_2_FORT_RUN : c_int = 22; +pub const _SC_2_LOCALEDEF : c_int = 23; +pub const _SC_2_SW_DEV : c_int = 24; +pub const _SC_2_UPE : c_int = 25; +pub const _SC_STREAM_MAX : c_int = 26; +pub const _SC_TZNAME_MAX : c_int = 27; +pub const _SC_PAGESIZE : c_int = 28; +pub const _SC_FSYNC : c_int = 29; +pub const _SC_SEM_NSEMS_MAX : c_int = 31; +pub const _SC_SEM_VALUE_MAX : c_int = 32; +pub const _SC_AIO_LISTIO_MAX : c_int = 42; +pub const _SC_AIO_MAX : c_int = 43; +pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44; +pub const _SC_ASYNCHRONOUS_IO : c_int = 45; +pub const _SC_DELAYTIMER_MAX : c_int = 50; +pub const _SC_MAPPED_FILES : c_int = 53; +pub const _SC_MEMLOCK : c_int = 54; +pub const _SC_MEMLOCK_RANGE : c_int = 55; +pub const _SC_MEMORY_PROTECTION : c_int = 56; +pub const _SC_MESSAGE_PASSING : c_int = 57; +pub const _SC_MQ_OPEN_MAX : c_int = 58; +pub const _SC_PRIORITIZED_IO : c_int = 60; +pub const _SC_PRIORITY_SCHEDULING : c_int = 61; +pub const _SC_REALTIME_SIGNALS : c_int = 64; +pub const _SC_RTSIG_MAX : c_int = 66; +pub const _SC_SEMAPHORES : c_int = 67; +pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 68; +pub const _SC_SIGQUEUE_MAX : c_int = 70; +pub const _SC_SYNCHRONIZED_IO : c_int = 75; +pub const _SC_TIMER_MAX : c_int = 93; +pub const _SC_TIMERS : c_int = 94; + +pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _; +pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _; +pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _; +pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; pub const SIGSTKSZ: ::size_t = 131072; + extern { pub fn mprotect(addr: *const ::c_void, len: size_t, prot: c_int) -> c_int; @@ -770,3 +562,13 @@ extern { pub fn backtrace(buf: *mut *mut ::c_void, sz: ::size_t) -> ::size_t; } + +cfg_if! { + if #[cfg(target_os = "bitrig")] { + mod bitrig; + use self::bitrig::*; + } else { + mod openbsd; + use self::openbsd::*; + } +} diff --git a/src/unix/bsd/openbsdlike/openbsd.rs b/src/unix/bsd/openbsdlike/openbsd.rs new file mode 100644 index 0000000000000..417c8a559fbf3 --- /dev/null +++ b/src/unix/bsd/openbsdlike/openbsd.rs @@ -0,0 +1,18 @@ +s! { + pub struct glob_t { + pub gl_pathc: c_int, + __unused1: c_int, + pub gl_offs: c_int, + __unused2: c_int, + pub gl_pathv: *mut *mut c_char, + + __unused3: *mut c_void, + + __unused4: *mut c_void, + __unused5: *mut c_void, + __unused6: *mut c_void, + __unused7: *mut c_void, + __unused8: *mut c_void, + __unused9: *mut c_void, + } +} From a4e27ed77adbb6e65ea39c5640678cb873dc6e60 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 16:20:02 -0700 Subject: [PATCH 07/17] Upward movement for BSD --- src/unix/bsd/apple/mod.rs | 28 ------------- src/unix/bsd/freebsdlike/mod.rs | 69 +++++++++------------------------ src/unix/bsd/mod.rs | 27 +++++++++++++ src/unix/bsd/openbsdlike/mod.rs | 40 +++---------------- 4 files changed, 52 insertions(+), 112 deletions(-) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 56f5ad432ee8e..489afe0656e57 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -2,44 +2,16 @@ //! //! This covers *-apple-* triples currently -pub type c_char = i8; -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; -pub type c_float = f32; -pub type c_double = f64; pub type clock_t = c_ulong; pub type time_t = c_long; pub type suseconds_t = i32; -pub type wchar_t = i32; -pub type c_longlong = i64; -pub type c_ulonglong = u64; -pub type intmax_t = i64; -pub type uintmax_t = u64; - -pub type off_t = i64; pub type dev_t = i32; pub type ino_t = u64; -pub type pid_t = i32; -pub type uid_t = u32; -pub type gid_t = u32; -pub type useconds_t = u32; pub type mode_t = u16; pub type ssize_t = c_long; - pub type nlink_t = u16; pub type blksize_t = i32; -pub type blkcnt_t = i64; -pub type socklen_t = u32; -pub type sa_family_t = u8; -pub type in_port_t = u16; -pub type in_addr_t = u32; -pub type pthread_t = uintptr_t; pub type rlim_t = u64; -pub type sighandler_t = size_t; pub type mach_timebase_info_data_t = mach_timebase_info; pub type pthread_key_t = c_ulong; pub type sigset_t = u32; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 11bf83022439d..42b15090079e1 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1,39 +1,12 @@ -pub type c_char = i8; -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; -pub type c_float = f32; -pub type c_double = f64; pub type clock_t = i32; -pub type wchar_t = i32; -pub type c_longlong = i64; -pub type c_ulonglong = u64; -pub type intmax_t = i64; -pub type uintmax_t = u64; -pub type off_t = i64; pub type dev_t = u32; pub type ino_t = u32; -pub type pid_t = i32; -pub type uid_t = u32; -pub type gid_t = u32; -pub type useconds_t = u32; pub type mode_t = u16; pub type nlink_t = u16; pub type blksize_t = u32; -pub type blkcnt_t = i64; pub type fflags_t = u32; pub type pthread_attr_t = *mut ::c_void; - -pub type pthread_t = uintptr_t; pub type rlim_t = i64; -pub type sighandler_t = size_t; -pub type socklen_t = u32; -pub type sa_family_t = u8; -pub type in_port_t = u16; -pub type in_addr_t = u32; pub type pthread_mutex_t = *mut ::c_void; pub type pthread_mutexattr_t = *mut ::c_void; pub type pthread_cond_t = *mut ::c_void; @@ -61,7 +34,7 @@ s! { pub struct sockaddr_storage { pub ss_len: u8, - pub ss_family: sa_family_t, + pub ss_family: ::sa_family_t, __ss_pad1: [u8; 6], __ss_align: i64, __ss_pad2: [u8; 112], @@ -72,16 +45,16 @@ s! { pub ai_family: ::c_int, pub ai_socktype: ::c_int, pub ai_protocol: ::c_int, - pub ai_addrlen: socklen_t, - pub ai_canonname: *mut c_char, + pub ai_addrlen: ::socklen_t, + pub ai_canonname: *mut ::c_char, pub ai_addr: *mut ::sockaddr, pub ai_next: *mut addrinfo, } pub struct ifaddrs { pub ifa_next: *mut ifaddrs, - pub ifa_name: *mut c_char, - pub ifa_flags: c_uint, + pub ifa_name: *mut ::c_char, + pub ifa_flags: ::c_uint, pub ifa_addr: *mut ::sockaddr, pub ifa_netmask: *mut ::sockaddr, pub ifa_dstaddr: *mut ::sockaddr, @@ -100,11 +73,11 @@ s! { pub si_uid: ::uid_t, pub si_status: ::c_int, pub si_addr: *mut ::c_void, - _pad: [c_int; 12], + _pad: [::c_int; 12], } pub struct sigaction { - pub sa_sigaction: sighandler_t, + pub sa_sigaction: ::sighandler_t, pub sa_flags: ::c_int, pub sa_mask: sigset_t, } @@ -126,11 +99,11 @@ pub const SEEK_END: ::c_int = 2; pub const _IOFBF: ::c_int = 0; pub const _IONBF: ::c_int = 2; pub const _IOLBF: ::c_int = 1; -pub const BUFSIZ: c_uint = 1024; -pub const FOPEN_MAX: c_uint = 20; -pub const FILENAME_MAX: c_uint = 1024; -pub const L_tmpnam: c_uint = 1024; -pub const TMP_MAX: c_uint = 308915776; +pub const BUFSIZ: ::c_uint = 1024; +pub const FOPEN_MAX: ::c_uint = 20; +pub const FILENAME_MAX: ::c_uint = 1024; +pub const L_tmpnam: ::c_uint = 1024; +pub const TMP_MAX: ::c_uint = 308915776; pub const O_RDONLY: ::c_int = 0; pub const O_WRONLY: ::c_int = 1; @@ -527,30 +500,26 @@ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _; pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; -pub const SIGSTKSZ: ::size_t = 34816; - extern { - pub fn mprotect(addr: *const ::c_void, len: size_t, prot: c_int) - -> c_int; + pub fn mprotect(addr: *const ::c_void, len: size_t, prot: ::c_int) + -> ::c_int; pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int; - pub fn sysctl(name: *const c_int, - namelen: c_uint, + pub fn sysctl(name: *const ::c_int, + namelen: ::c_uint, oldp: *mut ::c_void, oldlenp: *mut size_t, newp: *const ::c_void, newlen: size_t) - -> c_int; - pub fn sysctlbyname(name: *const c_char, + -> ::c_int; + pub fn sysctlbyname(name: *const ::c_char, oldp: *mut ::c_void, oldlenp: *mut size_t, newp: *const ::c_void, newlen: size_t) - -> c_int; + -> ::c_int; pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int; pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); - pub fn backtrace(buf: *mut *mut ::c_void, - sz: ::size_t) -> ::size_t; } cfg_if! { diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 56ae724674916..a7c30eabe7bc6 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -1,3 +1,30 @@ +pub type c_char = i8; +pub type c_schar = i8; +pub type c_uchar = u8; +pub type c_short = i16; +pub type c_ushort = u16; +pub type c_int = i32; +pub type c_uint = u32; +pub type c_float = f32; +pub type c_double = f64; +pub type c_longlong = i64; +pub type c_ulonglong = u64; +pub type wchar_t = i32; +pub type intmax_t = i64; +pub type uintmax_t = u64; +pub type off_t = i64; +pub type pid_t = i32; +pub type uid_t = u32; +pub type gid_t = u32; +pub type useconds_t = u32; +pub type blkcnt_t = i64; +pub type socklen_t = u32; +pub type sa_family_t = u8; +pub type in_port_t = u16; +pub type in_addr_t = u32; +pub type pthread_t = uintptr_t; +pub type sighandler_t = size_t; + s! { pub struct sockaddr { pub sa_len: u8, diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs index 1234c19b15bda..340857d8aa96d 100644 --- a/src/unix/bsd/openbsdlike/mod.rs +++ b/src/unix/bsd/openbsdlike/mod.rs @@ -1,45 +1,18 @@ -pub type c_char = i8; -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; pub type c_long = i64; pub type c_ulong = u64; -pub type c_float = f32; -pub type c_double = f64; pub type size_t = u64; pub type ptrdiff_t = i64; pub type clock_t = i64; pub type time_t = i64; pub type suseconds_t = i64; -pub type wchar_t = i32; -pub type c_longlong = i64; -pub type c_ulonglong = u64; pub type intptr_t = i64; pub type uintptr_t = u64; -pub type intmax_t = i64; -pub type uintmax_t = u64; -pub type off_t = i64; pub type dev_t = i32; -pub type pid_t = i32; -pub type uid_t = u32; -pub type gid_t = u32; -pub type useconds_t = u32; pub type mode_t = u32; pub type ssize_t = c_long; - -pub type sighandler_t = size_t; -pub type socklen_t = u32; -pub type sa_family_t = u8; -pub type in_port_t = u16; -pub type in_addr_t = u32; - pub type nlink_t = uint32_t; pub type blksize_t = uint32_t; pub type ino_t = uint64_t; -pub type blkcnt_t = i64; pub type fflags_t = u32; pub type pthread_attr_t = *mut c_void; pub type sigset_t = ::c_uint; @@ -48,19 +21,12 @@ pub type pthread_mutex_t = *mut ::c_void; pub type pthread_mutexattr_t = *mut ::c_void; pub type pthread_cond_t = *mut ::c_void; pub type pthread_rwlock_t = *mut ::c_void; -pub type pthread_t = uintptr_t; pub type rlim_t = u64; pub enum timezone {} s! { - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_size: ::size_t, - pub ss_flags: ::c_int, - } - pub struct siginfo_t { pub si_signo: ::c_int, pub si_code: ::c_int, @@ -131,6 +97,12 @@ s! { pub st_birthtime: time_t, pub st_birthtime_nsec: c_long, } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_size: ::size_t, + pub ss_flags: ::c_int, + } } pub const EXIT_FAILURE : c_int = 1; From c674e37af501726f8449cd6390a3cb49e383880a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 16:22:00 -0700 Subject: [PATCH 08/17] Upward movement for Unix --- src/unix/bsd/mod.rs | 24 +++--------------------- src/unix/mod.rs | 19 +++++++++++++++++++ src/unix/notbsd/mod.rs | 18 ------------------ 3 files changed, 22 insertions(+), 39 deletions(-) diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index a7c30eabe7bc6..18ba01093ae71 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -1,29 +1,11 @@ pub type c_char = i8; -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; -pub type c_float = f32; -pub type c_double = f64; -pub type c_longlong = i64; -pub type c_ulonglong = u64; pub type wchar_t = i32; -pub type intmax_t = i64; -pub type uintmax_t = u64; pub type off_t = i64; -pub type pid_t = i32; -pub type uid_t = u32; -pub type gid_t = u32; pub type useconds_t = u32; pub type blkcnt_t = i64; pub type socklen_t = u32; pub type sa_family_t = u8; -pub type in_port_t = u16; -pub type in_addr_t = u32; pub type pthread_t = uintptr_t; -pub type sighandler_t = size_t; s! { pub struct sockaddr { @@ -82,11 +64,11 @@ pub const SIG_SETMASK: ::c_int = 3; extern { pub fn mincore(addr: *const ::c_void, len: size_t, - vec: *mut c_char) -> c_int; + vec: *mut c_char) -> ::c_int; pub fn sysctlnametomib(name: *const c_char, - mibp: *mut c_int, + mibp: *mut ::c_int, sizep: *mut size_t) - -> c_int; + -> ::c_int; pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 16c9a152858f5..e8a16691a7a6a 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -3,6 +3,25 @@ //! More functions and definitions can be found in the more specific modules //! according to the platform in question. +pub type c_schar = i8; +pub type c_uchar = u8; +pub type c_short = i16; +pub type c_ushort = u16; +pub type c_int = i32; +pub type c_uint = u32; +pub type c_float = f32; +pub type c_double = f64; +pub type c_longlong = i64; +pub type c_ulonglong = u64; +pub type intmax_t = i64; +pub type uintmax_t = u64; +pub type pid_t = i32; +pub type uid_t = u32; +pub type gid_t = u32; +pub type in_addr_t = u32; +pub type in_port_t = u16; +pub type sighandler_t = size_t; + s! { pub struct utimbuf { pub actime: time_t, diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index ba6c767a4b54b..e982ce6a0b602 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1,23 +1,5 @@ -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; -pub type c_float = f32; -pub type c_double = f64; -pub type c_longlong = i64; -pub type c_ulonglong = u64; -pub type intmax_t = i64; -pub type uintmax_t = u64; -pub type pid_t = i32; -pub type uid_t = u32; -pub type gid_t = u32; -pub type in_addr_t = u32; -pub type in_port_t = u16; pub type rlim_t = c_ulong; pub type sa_family_t = u16; -pub type sighandler_t = size_t; pub type pthread_key_t = c_uint; pub enum timezone {} From 6603ca0d7ea72abcd1aff1d34acae7c5dc1e79ae Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 16:23:25 -0700 Subject: [PATCH 09/17] AppVeyor only autotest branch --- appveyor.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index cdd5bf1abb74e..1412f909cd30b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -26,3 +26,7 @@ build: false test_script: - cargo test - cargo run --manifest-path libc-test/Cargo.toml + +branches: + only: + - autotest From 3715e831f86c326938cc63dfcb26d79361eb5fe4 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 16:27:10 -0700 Subject: [PATCH 10/17] Move ifaddrs up a level on BSD --- src/unix/bsd/apple/mod.rs | 10 ---------- src/unix/bsd/freebsdlike/mod.rs | 10 ---------- src/unix/bsd/mod.rs | 10 ++++++++++ src/unix/bsd/openbsdlike/mod.rs | 10 ---------- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 489afe0656e57..23184e1e4e94b 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -54,16 +54,6 @@ s! { pub ai_next: *mut addrinfo, } - pub struct ifaddrs { - pub ifa_next: *mut ifaddrs, - pub ifa_name: *mut c_char, - pub ifa_flags: c_uint, - pub ifa_addr: *mut ::sockaddr, - pub ifa_netmask: *mut ::sockaddr, - pub ifa_dstaddr: *mut ::sockaddr, - pub ifa_data: *mut ::c_void - } - pub struct mach_timebase_info { pub numer: u32, pub denom: u32, diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 42b15090079e1..043eb64afa7b0 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -51,16 +51,6 @@ s! { pub ai_next: *mut addrinfo, } - pub struct ifaddrs { - pub ifa_next: *mut ifaddrs, - pub ifa_name: *mut ::c_char, - pub ifa_flags: ::c_uint, - pub ifa_addr: *mut ::sockaddr, - pub ifa_netmask: *mut ::sockaddr, - pub ifa_dstaddr: *mut ::sockaddr, - pub ifa_data: *mut ::c_void - } - pub struct sigset_t { bits: [u32; 4], } diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 18ba01093ae71..216c68852caa8 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -52,6 +52,16 @@ s! { #[cfg(not(target_os = "macos"))] pub pw_fields: ::c_int, } + + pub struct ifaddrs { + pub ifa_next: *mut ifaddrs, + pub ifa_name: *mut ::c_char, + pub ifa_flags: ::c_uint, + pub ifa_addr: *mut ::sockaddr, + pub ifa_netmask: *mut ::sockaddr, + pub ifa_dstaddr: *mut ::sockaddr, + pub ifa_data: *mut ::c_void + } } pub const FIOCLEX: c_ulong = 0x20006601; diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs index 340857d8aa96d..239eff2c7edc1 100644 --- a/src/unix/bsd/openbsdlike/mod.rs +++ b/src/unix/bsd/openbsdlike/mod.rs @@ -65,16 +65,6 @@ s! { pub ai_next: *mut addrinfo, } - pub struct ifaddrs { - pub ifa_next: *mut ifaddrs, - pub ifa_name: *mut c_char, - pub ifa_flags: c_uint, - pub ifa_addr: *mut sockaddr, - pub ifa_netmask: *mut sockaddr, - pub ifa_dstaddr: *mut sockaddr, - pub ifa_data: *mut c_void - } - pub struct stat { pub st_mode: mode_t, pub st_dev: dev_t, From 239f9cda7fb3a7f664febbf1850eed07f692fccc Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 16:31:34 -0700 Subject: [PATCH 11/17] Fix resolution in notbsd/mod.rs --- src/unix/notbsd/mod.rs | 98 +++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index e982ce6a0b602..b0f74215526ba 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1,6 +1,6 @@ pub type rlim_t = c_ulong; pub type sa_family_t = u16; -pub type pthread_key_t = c_uint; +pub type pthread_key_t = ::c_uint; pub enum timezone {} @@ -40,10 +40,10 @@ s! { } pub struct addrinfo { - pub ai_flags: c_int, - pub ai_family: c_int, - pub ai_socktype: c_int, - pub ai_protocol: c_int, + pub ai_flags: ::c_int, + pub ai_family: ::c_int, + pub ai_socktype: ::c_int, + pub ai_protocol: ::c_int, pub ai_addrlen: socklen_t, #[cfg(target_os = "linux")] @@ -58,53 +58,53 @@ s! { } pub struct sockaddr_ll { - pub sll_family: c_ushort, - pub sll_protocol: c_ushort, - pub sll_ifindex: c_int, - pub sll_hatype: c_ushort, - pub sll_pkttype: c_uchar, - pub sll_halen: c_uchar, - pub sll_addr: [c_uchar; 8] + pub sll_family: ::c_ushort, + pub sll_protocol: ::c_ushort, + pub sll_ifindex: ::c_int, + pub sll_hatype: ::c_ushort, + pub sll_pkttype: ::c_uchar, + pub sll_halen: ::c_uchar, + pub sll_addr: [::c_uchar; 8] } } -pub const EXIT_FAILURE: c_int = 1; -pub const EXIT_SUCCESS: c_int = 0; -pub const RAND_MAX: c_int = 2147483647; -pub const EOF: c_int = -1; -pub const SEEK_SET: c_int = 0; -pub const SEEK_CUR: c_int = 1; -pub const SEEK_END: c_int = 2; -pub const _IOFBF: c_int = 0; -pub const _IONBF: c_int = 2; -pub const _IOLBF: c_int = 1; - -pub const F_DUPFD: c_int = 0; -pub const F_GETFD: c_int = 1; -pub const F_SETFD: c_int = 2; -pub const F_GETFL: c_int = 3; -pub const F_SETFL: c_int = 4; - -pub const SIGTRAP: c_int = 5; - -pub const PTHREAD_CREATE_JOINABLE: c_int = 0; -pub const PTHREAD_CREATE_DETACHED: c_int = 1; - -pub const CLOCK_REALTIME: c_int = 0; -pub const CLOCK_MONOTONIC: c_int = 1; - -pub const RLIMIT_CPU: c_int = 0; -pub const RLIMIT_FSIZE: c_int = 1; -pub const RLIMIT_DATA: c_int = 2; -pub const RLIMIT_STACK: c_int = 3; -pub const RLIMIT_CORE: c_int = 4; -pub const RLIMIT_LOCKS: c_int = 10; -pub const RLIMIT_SIGPENDING: c_int = 11; -pub const RLIMIT_MSGQUEUE: c_int = 12; -pub const RLIMIT_NICE: c_int = 13; -pub const RLIMIT_RTPRIO: c_int = 14; - -pub const RUSAGE_SELF: c_int = 0; +pub const EXIT_FAILURE: ::c_int = 1; +pub const EXIT_SUCCESS: ::c_int = 0; +pub const RAND_MAX: ::c_int = 2147483647; +pub const EOF: ::c_int = -1; +pub const SEEK_SET: ::c_int = 0; +pub const SEEK_CUR: ::c_int = 1; +pub const SEEK_END: ::c_int = 2; +pub const _IOFBF: ::c_int = 0; +pub const _IONBF: ::c_int = 2; +pub const _IOLBF: ::c_int = 1; + +pub const F_DUPFD: ::c_int = 0; +pub const F_GETFD: ::c_int = 1; +pub const F_SETFD: ::c_int = 2; +pub const F_GETFL: ::c_int = 3; +pub const F_SETFL: ::c_int = 4; + +pub const SIGTRAP: ::c_int = 5; + +pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; +pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; + +pub const CLOCK_REALTIME: ::c_int = 0; +pub const CLOCK_MONOTONIC: ::c_int = 1; + +pub const RLIMIT_CPU: ::c_int = 0; +pub const RLIMIT_FSIZE: ::c_int = 1; +pub const RLIMIT_DATA: ::c_int = 2; +pub const RLIMIT_STACK: ::c_int = 3; +pub const RLIMIT_CORE: ::c_int = 4; +pub const RLIMIT_LOCKS: ::c_int = 10; +pub const RLIMIT_SIGPENDING: ::c_int = 11; +pub const RLIMIT_MSGQUEUE: ::c_int = 12; +pub const RLIMIT_NICE: ::c_int = 13; +pub const RLIMIT_RTPRIO: ::c_int = 14; + +pub const RUSAGE_SELF: ::c_int = 0; pub const O_RDONLY: ::c_int = 0; pub const O_WRONLY: ::c_int = 1; From 70b1f23f27db39268545d9036fcdfd47041d5ffe Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 16:32:03 -0700 Subject: [PATCH 12/17] Try running MIPS again --- ci/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/run.sh b/ci/run.sh index f9e0b51e02e64..22146f28752b3 100644 --- a/ci/run.sh +++ b/ci/run.sh @@ -17,7 +17,7 @@ elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then qemu-arm -L /usr/arm-linux-gnueabihf libc-test/target/$TARGET/debug/libc-test elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then # FIXME: this segfaults on travis, passes locally? - #qemu-mips -L /usr/mips-linux-gnu libc-test/target/$TARGET/debug/all-* + qemu-mips -L /usr/mips-linux-gnu libc-test/target/$TARGET/debug/libc-test echo skip elif [ "$TARGET" = "aarch64-unknown-linux-gnu" ]; then qemu-aarch64 -L /usr/aarch64-linux-gnu/ libc-test/target/$TARGET/debug/libc-test From caeb3fa56c0dafcd4127466095e46d8af93d12bb Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 16:51:54 -0700 Subject: [PATCH 13/17] Fix resolution on OSX --- src/unix/bsd/apple/mod.rs | 932 +++++++++++++++++++------------------- 1 file changed, 466 insertions(+), 466 deletions(-) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 23184e1e4e94b..7b5b04317a3a8 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -21,10 +21,10 @@ pub enum timezone {} s! { pub struct glob_t { pub gl_pathc: size_t, - __unused1: c_int, + __unused1: ::c_int, pub gl_offs: size_t, - __unused2: c_int, - pub gl_pathv: *mut *mut c_char, + __unused2: ::c_int, + pub gl_pathv: *mut *mut ::c_char, __unused3: *mut ::c_void, @@ -37,19 +37,19 @@ s! { pub struct sockaddr_storage { pub ss_len: u8, - pub ss_family: sa_family_t, + pub ss_family: ::sa_family_t, __ss_pad1: [u8; 6], __ss_align: i64, __ss_pad2: [u8; 112], } pub struct addrinfo { - pub ai_flags: c_int, - pub ai_family: c_int, - pub ai_socktype: c_int, - pub ai_protocol: c_int, - pub ai_addrlen: socklen_t, - pub ai_canonname: *mut c_char, + pub ai_flags: ::c_int, + pub ai_family: ::c_int, + pub ai_socktype: ::c_int, + pub ai_protocol: ::c_int, + pub ai_addrlen: ::socklen_t, + pub ai_canonname: *mut ::c_char, pub ai_addr: *mut ::sockaddr, pub ai_next: *mut addrinfo, } @@ -64,8 +64,8 @@ s! { pub st_mode: mode_t, pub st_nlink: nlink_t, pub st_ino: ino_t, - pub st_uid: uid_t, - pub st_gid: gid_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, pub st_rdev: dev_t, pub st_atime: time_t, pub st_atime_nsec: c_long, @@ -75,8 +75,8 @@ s! { pub st_ctime_nsec: c_long, pub st_birthtime: time_t, pub st_birthtime_nsec: c_long, - pub st_size: off_t, - pub st_blocks: blkcnt_t, + pub st_size: ::off_t, + pub st_blocks: ::blkcnt_t, pub st_blksize: blksize_t, pub st_flags: ::uint32_t, pub st_gen: ::uint32_t, @@ -116,7 +116,7 @@ s! { } pub struct sigaction { - pub sa_sigaction: sighandler_t, + pub sa_sigaction: ::sighandler_t, pub sa_mask: sigset_t, pub sa_flags: ::c_int, } @@ -128,31 +128,31 @@ s! { } } -pub const EXIT_FAILURE: c_int = 1; -pub const EXIT_SUCCESS: c_int = 0; -pub const RAND_MAX: c_int = 2147483647; -pub const EOF: c_int = -1; -pub const SEEK_SET: c_int = 0; -pub const SEEK_CUR: c_int = 1; -pub const SEEK_END: c_int = 2; -pub const _IOFBF: c_int = 0; -pub const _IONBF: c_int = 2; -pub const _IOLBF: c_int = 1; -pub const BUFSIZ: c_uint = 1024; -pub const FOPEN_MAX: c_uint = 20; -pub const FILENAME_MAX: c_uint = 1024; -pub const L_tmpnam: c_uint = 1024; -pub const TMP_MAX: c_uint = 308915776; -pub const _PC_NAME_MAX: c_int = 4; - -pub const O_RDONLY: c_int = 0; -pub const O_WRONLY: c_int = 1; -pub const O_RDWR: c_int = 2; -pub const O_APPEND: c_int = 8; -pub const O_CREAT: c_int = 512; -pub const O_EXCL: c_int = 2048; -pub const O_NOCTTY: c_int = 131072; -pub const O_TRUNC: c_int = 1024; +pub const EXIT_FAILURE: ::c_int = 1; +pub const EXIT_SUCCESS: ::c_int = 0; +pub const RAND_MAX: ::c_int = 2147483647; +pub const EOF: ::c_int = -1; +pub const SEEK_SET: ::c_int = 0; +pub const SEEK_CUR: ::c_int = 1; +pub const SEEK_END: ::c_int = 2; +pub const _IOFBF: ::c_int = 0; +pub const _IONBF: ::c_int = 2; +pub const _IOLBF: ::c_int = 1; +pub const BUFSIZ: ::c_uint = 1024; +pub const FOPEN_MAX: ::c_uint = 20; +pub const FILENAME_MAX: ::c_uint = 1024; +pub const L_tmpnam: ::c_uint = 1024; +pub const TMP_MAX: ::c_uint = 308915776; +pub const _PC_NAME_MAX: ::c_int = 4; + +pub const O_RDONLY: ::c_int = 0; +pub const O_WRONLY: ::c_int = 1; +pub const O_RDWR: ::c_int = 2; +pub const O_APPEND: ::c_int = 8; +pub const O_CREAT: ::c_int = 512; +pub const O_EXCL: ::c_int = 2048; +pub const O_NOCTTY: ::c_int = 131072; +pub const O_TRUNC: ::c_int = 1024; pub const S_IFIFO: mode_t = 4096; pub const S_IFCHR: mode_t = 8192; pub const S_IFBLK: mode_t = 24576; @@ -176,435 +176,435 @@ pub const S_IRWXO: mode_t = 7; pub const S_IXOTH: mode_t = 1; pub const S_IWOTH: mode_t = 2; pub const S_IROTH: mode_t = 4; -pub const F_OK: c_int = 0; -pub const R_OK: c_int = 4; -pub const W_OK: c_int = 2; -pub const X_OK: c_int = 1; -pub const STDIN_FILENO: c_int = 0; -pub const STDOUT_FILENO: c_int = 1; -pub const STDERR_FILENO: c_int = 2; -pub const F_LOCK: c_int = 1; -pub const F_TEST: c_int = 3; -pub const F_TLOCK: c_int = 2; -pub const F_ULOCK: c_int = 0; -pub const SIGHUP: c_int = 1; -pub const SIGINT: c_int = 2; -pub const SIGQUIT: c_int = 3; -pub const SIGILL: c_int = 4; -pub const SIGABRT: c_int = 6; -pub const SIGFPE: c_int = 8; -pub const SIGKILL: c_int = 9; -pub const SIGSEGV: c_int = 11; -pub const SIGPIPE: c_int = 13; -pub const SIGALRM: c_int = 14; -pub const SIGTERM: c_int = 15; - -pub const PROT_NONE: c_int = 0; -pub const PROT_READ: c_int = 1; -pub const PROT_WRITE: c_int = 2; -pub const PROT_EXEC: c_int = 4; - -pub const MAP_FILE: c_int = 0x0000; -pub const MAP_SHARED: c_int = 0x0001; -pub const MAP_PRIVATE: c_int = 0x0002; -pub const MAP_FIXED: c_int = 0x0010; -pub const MAP_ANON: c_int = 0x1000; +pub const F_OK: ::c_int = 0; +pub const R_OK: ::c_int = 4; +pub const W_OK: ::c_int = 2; +pub const X_OK: ::c_int = 1; +pub const STDIN_FILENO: ::c_int = 0; +pub const STDOUT_FILENO: ::c_int = 1; +pub const STDERR_FILENO: ::c_int = 2; +pub const F_LOCK: ::c_int = 1; +pub const F_TEST: ::c_int = 3; +pub const F_TLOCK: ::c_int = 2; +pub const F_ULOCK: ::c_int = 0; +pub const SIGHUP: ::c_int = 1; +pub const SIGINT: ::c_int = 2; +pub const SIGQUIT: ::c_int = 3; +pub const SIGILL: ::c_int = 4; +pub const SIGABRT: ::c_int = 6; +pub const SIGFPE: ::c_int = 8; +pub const SIGKILL: ::c_int = 9; +pub const SIGSEGV: ::c_int = 11; +pub const SIGPIPE: ::c_int = 13; +pub const SIGALRM: ::c_int = 14; +pub const SIGTERM: ::c_int = 15; + +pub const PROT_NONE: ::c_int = 0; +pub const PROT_READ: ::c_int = 1; +pub const PROT_WRITE: ::c_int = 2; +pub const PROT_EXEC: ::c_int = 4; + +pub const MAP_FILE: ::c_int = 0x0000; +pub const MAP_SHARED: ::c_int = 0x0001; +pub const MAP_PRIVATE: ::c_int = 0x0002; +pub const MAP_FIXED: ::c_int = 0x0010; +pub const MAP_ANON: ::c_int = 0x1000; pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; -pub const MCL_CURRENT: c_int = 0x0001; -pub const MCL_FUTURE: c_int = 0x0002; - -pub const MS_ASYNC: c_int = 0x0001; -pub const MS_INVALIDATE: c_int = 0x0002; -pub const MS_SYNC: c_int = 0x0010; - -pub const MS_KILLPAGES: c_int = 0x0004; -pub const MS_DEACTIVATE: c_int = 0x0008; - -pub const EPERM: c_int = 1; -pub const ENOENT: c_int = 2; -pub const ESRCH: c_int = 3; -pub const EINTR: c_int = 4; -pub const EIO: c_int = 5; -pub const ENXIO: c_int = 6; -pub const E2BIG: c_int = 7; -pub const ENOEXEC: c_int = 8; -pub const EBADF: c_int = 9; -pub const ECHILD: c_int = 10; -pub const EDEADLK: c_int = 11; -pub const ENOMEM: c_int = 12; -pub const EACCES: c_int = 13; -pub const EFAULT: c_int = 14; -pub const ENOTBLK: c_int = 15; -pub const EBUSY: c_int = 16; -pub const EEXIST: c_int = 17; -pub const EXDEV: c_int = 18; -pub const ENODEV: c_int = 19; -pub const ENOTDIR: c_int = 20; -pub const EISDIR: c_int = 21; -pub const EINVAL: c_int = 22; -pub const ENFILE: c_int = 23; -pub const EMFILE: c_int = 24; -pub const ENOTTY: c_int = 25; -pub const ETXTBSY: c_int = 26; -pub const EFBIG: c_int = 27; -pub const ENOSPC: c_int = 28; -pub const ESPIPE: c_int = 29; -pub const EROFS: c_int = 30; -pub const EMLINK: c_int = 31; -pub const EPIPE: c_int = 32; -pub const EDOM: c_int = 33; -pub const ERANGE: c_int = 34; -pub const EAGAIN: c_int = 35; -pub const EWOULDBLOCK: c_int = EAGAIN; -pub const EINPROGRESS: c_int = 36; -pub const EALREADY: c_int = 37; -pub const ENOTSOCK: c_int = 38; -pub const EDESTADDRREQ: c_int = 39; -pub const EMSGSIZE: c_int = 40; -pub const EPROTOTYPE: c_int = 41; -pub const ENOPROTOOPT: c_int = 42; -pub const EPROTONOSUPPORT: c_int = 43; -pub const ESOCKTNOSUPPORT: c_int = 44; -pub const ENOTSUP: c_int = 45; -pub const EPFNOSUPPORT: c_int = 46; -pub const EAFNOSUPPORT: c_int = 47; -pub const EADDRINUSE: c_int = 48; -pub const EADDRNOTAVAIL: c_int = 49; -pub const ENETDOWN: c_int = 50; -pub const ENETUNREACH: c_int = 51; -pub const ENETRESET: c_int = 52; -pub const ECONNABORTED: c_int = 53; -pub const ECONNRESET: c_int = 54; -pub const ENOBUFS: c_int = 55; -pub const EISCONN: c_int = 56; -pub const ENOTCONN: c_int = 57; -pub const ESHUTDOWN: c_int = 58; -pub const ETOOMANYREFS: c_int = 59; -pub const ETIMEDOUT: c_int = 60; -pub const ECONNREFUSED: c_int = 61; -pub const ELOOP: c_int = 62; -pub const ENAMETOOLONG: c_int = 63; -pub const EHOSTDOWN: c_int = 64; -pub const EHOSTUNREACH: c_int = 65; -pub const ENOTEMPTY: c_int = 66; -pub const EPROCLIM: c_int = 67; -pub const EUSERS: c_int = 68; -pub const EDQUOT: c_int = 69; -pub const ESTALE: c_int = 70; -pub const EREMOTE: c_int = 71; -pub const EBADRPC: c_int = 72; -pub const ERPCMISMATCH: c_int = 73; -pub const EPROGUNAVAIL: c_int = 74; -pub const EPROGMISMATCH: c_int = 75; -pub const EPROCUNAVAIL: c_int = 76; -pub const ENOLCK: c_int = 77; -pub const ENOSYS: c_int = 78; -pub const EFTYPE: c_int = 79; -pub const EAUTH: c_int = 80; -pub const ENEEDAUTH: c_int = 81; -pub const EPWROFF: c_int = 82; -pub const EDEVERR: c_int = 83; -pub const EOVERFLOW: c_int = 84; -pub const EBADEXEC: c_int = 85; -pub const EBADARCH: c_int = 86; -pub const ESHLIBVERS: c_int = 87; -pub const EBADMACHO: c_int = 88; -pub const ECANCELED: c_int = 89; -pub const EIDRM: c_int = 90; -pub const ENOMSG: c_int = 91; -pub const EILSEQ: c_int = 92; -pub const ENOATTR: c_int = 93; -pub const EBADMSG: c_int = 94; -pub const EMULTIHOP: c_int = 95; -pub const ENODATA: c_int = 96; -pub const ENOLINK: c_int = 97; -pub const ENOSR: c_int = 98; -pub const ENOSTR: c_int = 99; -pub const EPROTO: c_int = 100; -pub const ETIME: c_int = 101; -pub const EOPNOTSUPP: c_int = 102; -pub const ENOPOLICY: c_int = 103; -pub const ENOTRECOVERABLE: c_int = 104; -pub const EOWNERDEAD: c_int = 105; -pub const EQFULL: c_int = 106; -pub const ELAST: c_int = 106; - -pub const F_DUPFD: c_int = 0; -pub const F_GETFD: c_int = 1; -pub const F_SETFD: c_int = 2; -pub const F_GETFL: c_int = 3; -pub const F_SETFL: c_int = 4; - -pub const O_ACCMODE: c_int = 3; - -pub const SIGTRAP: c_int = 5; - -pub const GLOB_APPEND : c_int = 0x0001; -pub const GLOB_DOOFFS : c_int = 0x0002; -pub const GLOB_ERR : c_int = 0x0004; -pub const GLOB_MARK : c_int = 0x0008; -pub const GLOB_NOCHECK : c_int = 0x0010; -pub const GLOB_NOSORT : c_int = 0x0020; -pub const GLOB_NOESCAPE: c_int = 0x2000; - -pub const GLOB_NOSPACE : c_int = -1; -pub const GLOB_ABORTED : c_int = -2; -pub const GLOB_NOMATCH : c_int = -3; - -pub const POSIX_MADV_NORMAL: c_int = 0; -pub const POSIX_MADV_RANDOM: c_int = 1; -pub const POSIX_MADV_SEQUENTIAL: c_int = 2; -pub const POSIX_MADV_WILLNEED: c_int = 3; -pub const POSIX_MADV_DONTNEED: c_int = 4; - -pub const _SC_IOV_MAX: c_int = 56; -pub const _SC_GETGR_R_SIZE_MAX: c_int = 70; -pub const _SC_GETPW_R_SIZE_MAX: c_int = 71; -pub const _SC_LOGIN_NAME_MAX: c_int = 73; -pub const _SC_MQ_PRIO_MAX: c_int = 75; -pub const _SC_THREAD_ATTR_STACKADDR: c_int = 82; -pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 83; -pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: c_int = 85; -pub const _SC_THREAD_KEYS_MAX: c_int = 86; -pub const _SC_THREAD_PRIO_INHERIT: c_int = 87; -pub const _SC_THREAD_PRIO_PROTECT: c_int = 88; -pub const _SC_THREAD_PRIORITY_SCHEDULING: c_int = 89; -pub const _SC_THREAD_PROCESS_SHARED: c_int = 90; -pub const _SC_THREAD_SAFE_FUNCTIONS: c_int = 91; -pub const _SC_THREAD_STACK_MIN: c_int = 93; -pub const _SC_THREAD_THREADS_MAX: c_int = 94; -pub const _SC_THREADS: c_int = 96; -pub const _SC_TTY_NAME_MAX: c_int = 101; -pub const _SC_ATEXIT_MAX: c_int = 107; -pub const _SC_XOPEN_CRYPT: c_int = 108; -pub const _SC_XOPEN_ENH_I18N: c_int = 109; -pub const _SC_XOPEN_LEGACY: c_int = 110; -pub const _SC_XOPEN_REALTIME: c_int = 111; -pub const _SC_XOPEN_REALTIME_THREADS: c_int = 112; -pub const _SC_XOPEN_SHM: c_int = 113; -pub const _SC_XOPEN_UNIX: c_int = 115; -pub const _SC_XOPEN_VERSION: c_int = 116; -pub const _SC_XOPEN_XCU_VERSION: c_int = 121; - -pub const PTHREAD_CREATE_JOINABLE: c_int = 1; -pub const PTHREAD_CREATE_DETACHED: c_int = 2; +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const MS_ASYNC: ::c_int = 0x0001; +pub const MS_INVALIDATE: ::c_int = 0x0002; +pub const MS_SYNC: ::c_int = 0x0010; + +pub const MS_KILLPAGES: ::c_int = 0x0004; +pub const MS_DEACTIVATE: ::c_int = 0x0008; + +pub const EPERM: ::c_int = 1; +pub const ENOENT: ::c_int = 2; +pub const ESRCH: ::c_int = 3; +pub const EINTR: ::c_int = 4; +pub const EIO: ::c_int = 5; +pub const ENXIO: ::c_int = 6; +pub const E2BIG: ::c_int = 7; +pub const ENOEXEC: ::c_int = 8; +pub const EBADF: ::c_int = 9; +pub const ECHILD: ::c_int = 10; +pub const EDEADLK: ::c_int = 11; +pub const ENOMEM: ::c_int = 12; +pub const EACCES: ::c_int = 13; +pub const EFAULT: ::c_int = 14; +pub const ENOTBLK: ::c_int = 15; +pub const EBUSY: ::c_int = 16; +pub const EEXIST: ::c_int = 17; +pub const EXDEV: ::c_int = 18; +pub const ENODEV: ::c_int = 19; +pub const ENOTDIR: ::c_int = 20; +pub const EISDIR: ::c_int = 21; +pub const EINVAL: ::c_int = 22; +pub const ENFILE: ::c_int = 23; +pub const EMFILE: ::c_int = 24; +pub const ENOTTY: ::c_int = 25; +pub const ETXTBSY: ::c_int = 26; +pub const EFBIG: ::c_int = 27; +pub const ENOSPC: ::c_int = 28; +pub const ESPIPE: ::c_int = 29; +pub const EROFS: ::c_int = 30; +pub const EMLINK: ::c_int = 31; +pub const EPIPE: ::c_int = 32; +pub const EDOM: ::c_int = 33; +pub const ERANGE: ::c_int = 34; +pub const EAGAIN: ::c_int = 35; +pub const EWOULDBLOCK: ::c_int = EAGAIN; +pub const EINPROGRESS: ::c_int = 36; +pub const EALREADY: ::c_int = 37; +pub const ENOTSOCK: ::c_int = 38; +pub const EDESTADDRREQ: ::c_int = 39; +pub const EMSGSIZE: ::c_int = 40; +pub const EPROTOTYPE: ::c_int = 41; +pub const ENOPROTOOPT: ::c_int = 42; +pub const EPROTONOSUPPORT: ::c_int = 43; +pub const ESOCKTNOSUPPORT: ::c_int = 44; +pub const ENOTSUP: ::c_int = 45; +pub const EPFNOSUPPORT: ::c_int = 46; +pub const EAFNOSUPPORT: ::c_int = 47; +pub const EADDRINUSE: ::c_int = 48; +pub const EADDRNOTAVAIL: ::c_int = 49; +pub const ENETDOWN: ::c_int = 50; +pub const ENETUNREACH: ::c_int = 51; +pub const ENETRESET: ::c_int = 52; +pub const ECONNABORTED: ::c_int = 53; +pub const ECONNRESET: ::c_int = 54; +pub const ENOBUFS: ::c_int = 55; +pub const EISCONN: ::c_int = 56; +pub const ENOTCONN: ::c_int = 57; +pub const ESHUTDOWN: ::c_int = 58; +pub const ETOOMANYREFS: ::c_int = 59; +pub const ETIMEDOUT: ::c_int = 60; +pub const ECONNREFUSED: ::c_int = 61; +pub const ELOOP: ::c_int = 62; +pub const ENAMETOOLONG: ::c_int = 63; +pub const EHOSTDOWN: ::c_int = 64; +pub const EHOSTUNREACH: ::c_int = 65; +pub const ENOTEMPTY: ::c_int = 66; +pub const EPROCLIM: ::c_int = 67; +pub const EUSERS: ::c_int = 68; +pub const EDQUOT: ::c_int = 69; +pub const ESTALE: ::c_int = 70; +pub const EREMOTE: ::c_int = 71; +pub const EBADRPC: ::c_int = 72; +pub const ERPCMISMATCH: ::c_int = 73; +pub const EPROGUNAVAIL: ::c_int = 74; +pub const EPROGMISMATCH: ::c_int = 75; +pub const EPROCUNAVAIL: ::c_int = 76; +pub const ENOLCK: ::c_int = 77; +pub const ENOSYS: ::c_int = 78; +pub const EFTYPE: ::c_int = 79; +pub const EAUTH: ::c_int = 80; +pub const ENEEDAUTH: ::c_int = 81; +pub const EPWROFF: ::c_int = 82; +pub const EDEVERR: ::c_int = 83; +pub const EOVERFLOW: ::c_int = 84; +pub const EBADEXEC: ::c_int = 85; +pub const EBADARCH: ::c_int = 86; +pub const ESHLIBVERS: ::c_int = 87; +pub const EBADMACHO: ::c_int = 88; +pub const ECANCELED: ::c_int = 89; +pub const EIDRM: ::c_int = 90; +pub const ENOMSG: ::c_int = 91; +pub const EILSEQ: ::c_int = 92; +pub const ENOATTR: ::c_int = 93; +pub const EBADMSG: ::c_int = 94; +pub const EMULTIHOP: ::c_int = 95; +pub const ENODATA: ::c_int = 96; +pub const ENOLINK: ::c_int = 97; +pub const ENOSR: ::c_int = 98; +pub const ENOSTR: ::c_int = 99; +pub const EPROTO: ::c_int = 100; +pub const ETIME: ::c_int = 101; +pub const EOPNOTSUPP: ::c_int = 102; +pub const ENOPOLICY: ::c_int = 103; +pub const ENOTRECOVERABLE: ::c_int = 104; +pub const EOWNERDEAD: ::c_int = 105; +pub const EQFULL: ::c_int = 106; +pub const ELAST: ::c_int = 106; + +pub const F_DUPFD: ::c_int = 0; +pub const F_GETFD: ::c_int = 1; +pub const F_SETFD: ::c_int = 2; +pub const F_GETFL: ::c_int = 3; +pub const F_SETFL: ::c_int = 4; + +pub const O_ACCMODE: ::c_int = 3; + +pub const SIGTRAP: ::c_int = 5; + +pub const GLOB_APPEND : ::c_int = 0x0001; +pub const GLOB_DOOFFS : ::c_int = 0x0002; +pub const GLOB_ERR : ::c_int = 0x0004; +pub const GLOB_MARK : ::c_int = 0x0008; +pub const GLOB_NOCHECK : ::c_int = 0x0010; +pub const GLOB_NOSORT : ::c_int = 0x0020; +pub const GLOB_NOESCAPE: ::c_int = 0x2000; + +pub const GLOB_NOSPACE : ::c_int = -1; +pub const GLOB_ABORTED : ::c_int = -2; +pub const GLOB_NOMATCH : ::c_int = -3; + +pub const POSIX_MADV_NORMAL: ::c_int = 0; +pub const POSIX_MADV_RANDOM: ::c_int = 1; +pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; +pub const POSIX_MADV_WILLNEED: ::c_int = 3; +pub const POSIX_MADV_DONTNEED: ::c_int = 4; + +pub const _SC_IOV_MAX: ::c_int = 56; +pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70; +pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71; +pub const _SC_LOGIN_NAME_MAX: ::c_int = 73; +pub const _SC_MQ_PRIO_MAX: ::c_int = 75; +pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82; +pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85; +pub const _SC_THREAD_KEYS_MAX: ::c_int = 86; +pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87; +pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88; +pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89; +pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90; +pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91; +pub const _SC_THREAD_STACK_MIN: ::c_int = 93; +pub const _SC_THREAD_THREADS_MAX: ::c_int = 94; +pub const _SC_THREADS: ::c_int = 96; +pub const _SC_TTY_NAME_MAX: ::c_int = 101; +pub const _SC_ATEXIT_MAX: ::c_int = 107; +pub const _SC_XOPEN_CRYPT: ::c_int = 108; +pub const _SC_XOPEN_ENH_I18N: ::c_int = 109; +pub const _SC_XOPEN_LEGACY: ::c_int = 110; +pub const _SC_XOPEN_REALTIME: ::c_int = 111; +pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112; +pub const _SC_XOPEN_SHM: ::c_int = 113; +pub const _SC_XOPEN_UNIX: ::c_int = 115; +pub const _SC_XOPEN_VERSION: ::c_int = 116; +pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121; + +pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1; +pub const PTHREAD_CREATE_DETACHED: ::c_int = 2; pub const PTHREAD_STACK_MIN: size_t = 8192; -pub const RLIMIT_CPU: c_int = 0; -pub const RLIMIT_FSIZE: c_int = 1; -pub const RLIMIT_DATA: c_int = 2; -pub const RLIMIT_STACK: c_int = 3; -pub const RLIMIT_CORE: c_int = 4; -pub const RLIMIT_AS: c_int = 5; -pub const RLIMIT_MEMLOCK: c_int = 6; -pub const RLIMIT_NPROC: c_int = 7; -pub const RLIMIT_NOFILE: c_int = 8; -pub const RLIM_NLIMITS: c_int = 9; -pub const _RLIMIT_POSIX_FLAG: c_int = 0x1000; +pub const RLIMIT_CPU: ::c_int = 0; +pub const RLIMIT_FSIZE: ::c_int = 1; +pub const RLIMIT_DATA: ::c_int = 2; +pub const RLIMIT_STACK: ::c_int = 3; +pub const RLIMIT_CORE: ::c_int = 4; +pub const RLIMIT_AS: ::c_int = 5; +pub const RLIMIT_MEMLOCK: ::c_int = 6; +pub const RLIMIT_NPROC: ::c_int = 7; +pub const RLIMIT_NOFILE: ::c_int = 8; +pub const RLIM_NLIMITS: ::c_int = 9; +pub const _RLIMIT_POSIX_FLAG: ::c_int = 0x1000; pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff; -pub const RUSAGE_SELF: c_int = 0; -pub const RUSAGE_CHILDREN: c_int = -1; - -pub const MADV_NORMAL: c_int = 0; -pub const MADV_RANDOM: c_int = 1; -pub const MADV_SEQUENTIAL: c_int = 2; -pub const MADV_WILLNEED: c_int = 3; -pub const MADV_DONTNEED: c_int = 4; -pub const MADV_FREE: c_int = 5; -pub const MADV_ZERO_WIRED_PAGES: c_int = 6; -pub const MADV_FREE_REUSABLE: c_int = 7; -pub const MADV_FREE_REUSE: c_int = 8; -pub const MADV_CAN_REUSE: c_int = 9; - -pub const MINCORE_INCORE: c_int = 0x1; -pub const MINCORE_REFERENCED: c_int = 0x2; -pub const MINCORE_MODIFIED: c_int = 0x4; -pub const MINCORE_REFERENCED_OTHER: c_int = 0x8; -pub const MINCORE_MODIFIED_OTHER: c_int = 0x10; - -pub const AF_UNIX: c_int = 1; -pub const AF_INET: c_int = 2; -pub const AF_INET6: c_int = 30; -pub const SOCK_STREAM: c_int = 1; -pub const SOCK_DGRAM: c_int = 2; -pub const SOCK_RAW: c_int = 3; -pub const IPPROTO_TCP: c_int = 6; -pub const IPPROTO_IP: c_int = 0; -pub const IPPROTO_IPV6: c_int = 41; -pub const IP_MULTICAST_TTL: c_int = 10; -pub const IP_MULTICAST_LOOP: c_int = 11; -pub const IP_TTL: c_int = 4; -pub const IP_HDRINCL: c_int = 2; -pub const IP_ADD_MEMBERSHIP: c_int = 12; -pub const IP_DROP_MEMBERSHIP: c_int = 13; -pub const IPV6_JOIN_GROUP: c_int = 12; -pub const IPV6_LEAVE_GROUP: c_int = 13; - -pub const TCP_NODELAY: c_int = 0x01; -pub const TCP_KEEPALIVE: c_int = 0x10; -pub const SOL_SOCKET: c_int = 0xffff; - -pub const SO_DEBUG: c_int = 0x01; -pub const SO_ACCEPTCONN: c_int = 0x0002; -pub const SO_REUSEADDR: c_int = 0x0004; -pub const SO_KEEPALIVE: c_int = 0x0008; -pub const SO_DONTROUTE: c_int = 0x0010; -pub const SO_BROADCAST: c_int = 0x0020; -pub const SO_USELOOPBACK: c_int = 0x0040; -pub const SO_LINGER: c_int = 0x0080; -pub const SO_OOBINLINE: c_int = 0x0100; -pub const SO_REUSEPORT: c_int = 0x0200; -pub const SO_SNDBUF: c_int = 0x1001; -pub const SO_RCVBUF: c_int = 0x1002; -pub const SO_SNDLOWAT: c_int = 0x1003; -pub const SO_RCVLOWAT: c_int = 0x1004; -pub const SO_SNDTIMEO: c_int = 0x1005; -pub const SO_RCVTIMEO: c_int = 0x1006; -pub const SO_ERROR: c_int = 0x1007; -pub const SO_TYPE: c_int = 0x1008; - -pub const IFF_LOOPBACK: c_int = 0x8; - -pub const SHUT_RD: c_int = 0; -pub const SHUT_WR: c_int = 1; -pub const SHUT_RDWR: c_int = 2; - -pub const LOCK_SH: c_int = 1; -pub const LOCK_EX: c_int = 2; -pub const LOCK_NB: c_int = 4; -pub const LOCK_UN: c_int = 8; - -pub const O_DSYNC: c_int = 4194304; -pub const O_SYNC: c_int = 128; -pub const O_NONBLOCK: c_int = 4; -pub const F_GETPATH: c_int = 50; -pub const F_FULLFSYNC: c_int = 51; - -pub const MAP_COPY: c_int = 0x0002; -pub const MAP_RENAME: c_int = 0x0020; -pub const MAP_NORESERVE: c_int = 0x0040; -pub const MAP_NOEXTEND: c_int = 0x0100; -pub const MAP_HASSEMAPHORE: c_int = 0x0200; -pub const MAP_NOCACHE: c_int = 0x0400; -pub const MAP_JIT: c_int = 0x0800; - -pub const IPPROTO_RAW: c_int = 255; - -pub const SO_NREAD: c_int = 0x1020; -pub const SO_NKE: c_int = 0x1021; -pub const SO_NOSIGPIPE: c_int = 0x1022; -pub const SO_NOADDRERR: c_int = 0x1023; -pub const SO_NWRITE: c_int = 0x1024; -pub const SO_DONTTRUNC: c_int = 0x2000; -pub const SO_WANTMORE: c_int = 0x4000; -pub const SO_WANTOOBFLAG: c_int = 0x8000; - -pub const PATH_MAX: c_int = 1024; - -pub const _SC_ARG_MAX: c_int = 1; -pub const _SC_CHILD_MAX: c_int = 2; -pub const _SC_CLK_TCK: c_int = 3; -pub const _SC_NGROUPS_MAX: c_int = 4; -pub const _SC_OPEN_MAX: c_int = 5; -pub const _SC_JOB_CONTROL: c_int = 6; -pub const _SC_SAVED_IDS: c_int = 7; -pub const _SC_VERSION: c_int = 8; -pub const _SC_BC_BASE_MAX: c_int = 9; -pub const _SC_BC_DIM_MAX: c_int = 10; -pub const _SC_BC_SCALE_MAX: c_int = 11; -pub const _SC_BC_STRING_MAX: c_int = 12; -pub const _SC_COLL_WEIGHTS_MAX: c_int = 13; -pub const _SC_EXPR_NEST_MAX: c_int = 14; -pub const _SC_LINE_MAX: c_int = 15; -pub const _SC_RE_DUP_MAX: c_int = 16; -pub const _SC_2_VERSION: c_int = 17; -pub const _SC_2_C_BIND: c_int = 18; -pub const _SC_2_C_DEV: c_int = 19; -pub const _SC_2_CHAR_TERM: c_int = 20; -pub const _SC_2_FORT_DEV: c_int = 21; -pub const _SC_2_FORT_RUN: c_int = 22; -pub const _SC_2_LOCALEDEF: c_int = 23; -pub const _SC_2_SW_DEV: c_int = 24; -pub const _SC_2_UPE: c_int = 25; -pub const _SC_STREAM_MAX: c_int = 26; -pub const _SC_TZNAME_MAX: c_int = 27; -pub const _SC_ASYNCHRONOUS_IO: c_int = 28; -pub const _SC_PAGESIZE: c_int = 29; -pub const _SC_MEMLOCK: c_int = 30; -pub const _SC_MEMLOCK_RANGE: c_int = 31; -pub const _SC_MEMORY_PROTECTION: c_int = 32; -pub const _SC_MESSAGE_PASSING: c_int = 33; -pub const _SC_PRIORITIZED_IO: c_int = 34; -pub const _SC_PRIORITY_SCHEDULING: c_int = 35; -pub const _SC_REALTIME_SIGNALS: c_int = 36; -pub const _SC_SEMAPHORES: c_int = 37; -pub const _SC_FSYNC: c_int = 38; -pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 39; -pub const _SC_SYNCHRONIZED_IO: c_int = 40; -pub const _SC_TIMERS: c_int = 41; -pub const _SC_AIO_LISTIO_MAX: c_int = 42; -pub const _SC_AIO_MAX: c_int = 43; -pub const _SC_AIO_PRIO_DELTA_MAX: c_int = 44; -pub const _SC_DELAYTIMER_MAX: c_int = 45; -pub const _SC_MQ_OPEN_MAX: c_int = 46; -pub const _SC_MAPPED_FILES: c_int = 47; -pub const _SC_RTSIG_MAX: c_int = 48; -pub const _SC_SEM_NSEMS_MAX: c_int = 49; -pub const _SC_SEM_VALUE_MAX: c_int = 50; -pub const _SC_SIGQUEUE_MAX: c_int = 51; -pub const _SC_TIMER_MAX: c_int = 52; -pub const _SC_NPROCESSORS_CONF: c_int = 57; -pub const _SC_NPROCESSORS_ONLN: c_int = 58; -pub const _SC_2_PBS: c_int = 59; -pub const _SC_2_PBS_ACCOUNTING: c_int = 60; -pub const _SC_2_PBS_CHECKPOINT: c_int = 61; -pub const _SC_2_PBS_LOCATE: c_int = 62; -pub const _SC_2_PBS_MESSAGE: c_int = 63; -pub const _SC_2_PBS_TRACK: c_int = 64; -pub const _SC_ADVISORY_INFO: c_int = 65; -pub const _SC_BARRIERS: c_int = 66; -pub const _SC_CLOCK_SELECTION: c_int = 67; -pub const _SC_CPUTIME: c_int = 68; -pub const _SC_FILE_LOCKING: c_int = 69; -pub const _SC_HOST_NAME_MAX: c_int = 72; -pub const _SC_MONOTONIC_CLOCK: c_int = 74; -pub const _SC_READER_WRITER_LOCKS: c_int = 76; -pub const _SC_REGEXP: c_int = 77; -pub const _SC_SHELL: c_int = 78; -pub const _SC_SPAWN: c_int = 79; -pub const _SC_SPIN_LOCKS: c_int = 80; -pub const _SC_SPORADIC_SERVER: c_int = 81; -pub const _SC_THREAD_CPUTIME: c_int = 84; -pub const _SC_THREAD_SPORADIC_SERVER: c_int = 92; -pub const _SC_TIMEOUTS: c_int = 95; -pub const _SC_TRACE: c_int = 97; -pub const _SC_TRACE_EVENT_FILTER: c_int = 98; -pub const _SC_TRACE_INHERIT: c_int = 99; -pub const _SC_TRACE_LOG: c_int = 100; -pub const _SC_TYPED_MEMORY_OBJECTS: c_int = 102; -pub const _SC_V6_ILP32_OFF32: c_int = 103; -pub const _SC_V6_ILP32_OFFBIG: c_int = 104; -pub const _SC_V6_LP64_OFF64: c_int = 105; -pub const _SC_V6_LPBIG_OFFBIG: c_int = 106; -pub const _SC_IPV6: c_int = 118; -pub const _SC_RAW_SOCKETS: c_int = 119; -pub const _SC_SYMLOOP_MAX: c_int = 120; -pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE; -pub const _SC_XOPEN_STREAMS: c_int = 114; -pub const _SC_XBS5_ILP32_OFF32: c_int = 122; -pub const _SC_XBS5_ILP32_OFFBIG: c_int = 123; -pub const _SC_XBS5_LP64_OFF64: c_int = 124; -pub const _SC_XBS5_LPBIG_OFFBIG: c_int = 125; -pub const _SC_SS_REPL_MAX: c_int = 126; -pub const _SC_TRACE_EVENT_NAME_MAX: c_int = 127; -pub const _SC_TRACE_NAME_MAX: c_int = 128; -pub const _SC_TRACE_SYS_MAX: c_int = 129; -pub const _SC_TRACE_USER_EVENT_MAX: c_int = 130; -pub const _SC_PASS_MAX: c_int = 131; +pub const RUSAGE_SELF: ::c_int = 0; +pub const RUSAGE_CHILDREN: ::c_int = -1; + +pub const MADV_NORMAL: ::c_int = 0; +pub const MADV_RANDOM: ::c_int = 1; +pub const MADV_SEQUENTIAL: ::c_int = 2; +pub const MADV_WILLNEED: ::c_int = 3; +pub const MADV_DONTNEED: ::c_int = 4; +pub const MADV_FREE: ::c_int = 5; +pub const MADV_ZERO_WIRED_PAGES: ::c_int = 6; +pub const MADV_FREE_REUSABLE: ::c_int = 7; +pub const MADV_FREE_REUSE: ::c_int = 8; +pub const MADV_CAN_REUSE: ::c_int = 9; + +pub const MINCORE_INCORE: ::c_int = 0x1; +pub const MINCORE_REFERENCED: ::c_int = 0x2; +pub const MINCORE_MODIFIED: ::c_int = 0x4; +pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8; +pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10; + +pub const AF_UNIX: ::c_int = 1; +pub const AF_INET: ::c_int = 2; +pub const AF_INET6: ::c_int = 30; +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_RAW: ::c_int = 3; +pub const IPPROTO_TCP: ::c_int = 6; +pub const IPPROTO_IP: ::c_int = 0; +pub const IPPROTO_IPV6: ::c_int = 41; +pub const IP_MULTICAST_TTL: ::c_int = 10; +pub const IP_MULTICAST_LOOP: ::c_int = 11; +pub const IP_TTL: ::c_int = 4; +pub const IP_HDRINCL: ::c_int = 2; +pub const IP_ADD_MEMBERSHIP: ::c_int = 12; +pub const IP_DROP_MEMBERSHIP: ::c_int = 13; +pub const IPV6_JOIN_GROUP: ::c_int = 12; +pub const IPV6_LEAVE_GROUP: ::c_int = 13; + +pub const TCP_NODELAY: ::c_int = 0x01; +pub const TCP_KEEPALIVE: ::c_int = 0x10; +pub const SOL_SOCKET: ::c_int = 0xffff; + +pub const SO_DEBUG: ::c_int = 0x01; +pub const SO_ACCEPTCONN: ::c_int = 0x0002; +pub const SO_REUSEADDR: ::c_int = 0x0004; +pub const SO_KEEPALIVE: ::c_int = 0x0008; +pub const SO_DONTROUTE: ::c_int = 0x0010; +pub const SO_BROADCAST: ::c_int = 0x0020; +pub const SO_USELOOPBACK: ::c_int = 0x0040; +pub const SO_LINGER: ::c_int = 0x0080; +pub const SO_OOBINLINE: ::c_int = 0x0100; +pub const SO_REUSEPORT: ::c_int = 0x0200; +pub const SO_SNDBUF: ::c_int = 0x1001; +pub const SO_RCVBUF: ::c_int = 0x1002; +pub const SO_SNDLOWAT: ::c_int = 0x1003; +pub const SO_RCVLOWAT: ::c_int = 0x1004; +pub const SO_SNDTIMEO: ::c_int = 0x1005; +pub const SO_RCVTIMEO: ::c_int = 0x1006; +pub const SO_ERROR: ::c_int = 0x1007; +pub const SO_TYPE: ::c_int = 0x1008; + +pub const IFF_LOOPBACK: ::c_int = 0x8; + +pub const SHUT_RD: ::c_int = 0; +pub const SHUT_WR: ::c_int = 1; +pub const SHUT_RDWR: ::c_int = 2; + +pub const LOCK_SH: ::c_int = 1; +pub const LOCK_EX: ::c_int = 2; +pub const LOCK_NB: ::c_int = 4; +pub const LOCK_UN: ::c_int = 8; + +pub const O_DSYNC: ::c_int = 4194304; +pub const O_SYNC: ::c_int = 128; +pub const O_NONBLOCK: ::c_int = 4; +pub const F_GETPATH: ::c_int = 50; +pub const F_FULLFSYNC: ::c_int = 51; + +pub const MAP_COPY: ::c_int = 0x0002; +pub const MAP_RENAME: ::c_int = 0x0020; +pub const MAP_NORESERVE: ::c_int = 0x0040; +pub const MAP_NOEXTEND: ::c_int = 0x0100; +pub const MAP_HASSEMAPHORE: ::c_int = 0x0200; +pub const MAP_NOCACHE: ::c_int = 0x0400; +pub const MAP_JIT: ::c_int = 0x0800; + +pub const IPPROTO_RAW: ::c_int = 255; + +pub const SO_NREAD: ::c_int = 0x1020; +pub const SO_NKE: ::c_int = 0x1021; +pub const SO_NOSIGPIPE: ::c_int = 0x1022; +pub const SO_NOADDRERR: ::c_int = 0x1023; +pub const SO_NWRITE: ::c_int = 0x1024; +pub const SO_DONTTRUNC: ::c_int = 0x2000; +pub const SO_WANTMORE: ::c_int = 0x4000; +pub const SO_WANTOOBFLAG: ::c_int = 0x8000; + +pub const PATH_MAX: ::c_int = 1024; + +pub const _SC_ARG_MAX: ::c_int = 1; +pub const _SC_CHILD_MAX: ::c_int = 2; +pub const _SC_CLK_TCK: ::c_int = 3; +pub const _SC_NGROUPS_MAX: ::c_int = 4; +pub const _SC_OPEN_MAX: ::c_int = 5; +pub const _SC_JOB_CONTROL: ::c_int = 6; +pub const _SC_SAVED_IDS: ::c_int = 7; +pub const _SC_VERSION: ::c_int = 8; +pub const _SC_BC_BASE_MAX: ::c_int = 9; +pub const _SC_BC_DIM_MAX: ::c_int = 10; +pub const _SC_BC_SCALE_MAX: ::c_int = 11; +pub const _SC_BC_STRING_MAX: ::c_int = 12; +pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 13; +pub const _SC_EXPR_NEST_MAX: ::c_int = 14; +pub const _SC_LINE_MAX: ::c_int = 15; +pub const _SC_RE_DUP_MAX: ::c_int = 16; +pub const _SC_2_VERSION: ::c_int = 17; +pub const _SC_2_C_BIND: ::c_int = 18; +pub const _SC_2_C_DEV: ::c_int = 19; +pub const _SC_2_CHAR_TERM: ::c_int = 20; +pub const _SC_2_FORT_DEV: ::c_int = 21; +pub const _SC_2_FORT_RUN: ::c_int = 22; +pub const _SC_2_LOCALEDEF: ::c_int = 23; +pub const _SC_2_SW_DEV: ::c_int = 24; +pub const _SC_2_UPE: ::c_int = 25; +pub const _SC_STREAM_MAX: ::c_int = 26; +pub const _SC_TZNAME_MAX: ::c_int = 27; +pub const _SC_ASYNCHRONOUS_IO: ::c_int = 28; +pub const _SC_PAGESIZE: ::c_int = 29; +pub const _SC_MEMLOCK: ::c_int = 30; +pub const _SC_MEMLOCK_RANGE: ::c_int = 31; +pub const _SC_MEMORY_PROTECTION: ::c_int = 32; +pub const _SC_MESSAGE_PASSING: ::c_int = 33; +pub const _SC_PRIORITIZED_IO: ::c_int = 34; +pub const _SC_PRIORITY_SCHEDULING: ::c_int = 35; +pub const _SC_REALTIME_SIGNALS: ::c_int = 36; +pub const _SC_SEMAPHORES: ::c_int = 37; +pub const _SC_FSYNC: ::c_int = 38; +pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 39; +pub const _SC_SYNCHRONIZED_IO: ::c_int = 40; +pub const _SC_TIMERS: ::c_int = 41; +pub const _SC_AIO_LISTIO_MAX: ::c_int = 42; +pub const _SC_AIO_MAX: ::c_int = 43; +pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 44; +pub const _SC_DELAYTIMER_MAX: ::c_int = 45; +pub const _SC_MQ_OPEN_MAX: ::c_int = 46; +pub const _SC_MAPPED_FILES: ::c_int = 47; +pub const _SC_RTSIG_MAX: ::c_int = 48; +pub const _SC_SEM_NSEMS_MAX: ::c_int = 49; +pub const _SC_SEM_VALUE_MAX: ::c_int = 50; +pub const _SC_SIGQUEUE_MAX: ::c_int = 51; +pub const _SC_TIMER_MAX: ::c_int = 52; +pub const _SC_NPROCESSORS_CONF: ::c_int = 57; +pub const _SC_NPROCESSORS_ONLN: ::c_int = 58; +pub const _SC_2_PBS: ::c_int = 59; +pub const _SC_2_PBS_ACCOUNTING: ::c_int = 60; +pub const _SC_2_PBS_CHECKPOINT: ::c_int = 61; +pub const _SC_2_PBS_LOCATE: ::c_int = 62; +pub const _SC_2_PBS_MESSAGE: ::c_int = 63; +pub const _SC_2_PBS_TRACK: ::c_int = 64; +pub const _SC_ADVISORY_INFO: ::c_int = 65; +pub const _SC_BARRIERS: ::c_int = 66; +pub const _SC_CLOCK_SELECTION: ::c_int = 67; +pub const _SC_CPUTIME: ::c_int = 68; +pub const _SC_FILE_LOCKING: ::c_int = 69; +pub const _SC_HOST_NAME_MAX: ::c_int = 72; +pub const _SC_MONOTONIC_CLOCK: ::c_int = 74; +pub const _SC_READER_WRITER_LOCKS: ::c_int = 76; +pub const _SC_REGEXP: ::c_int = 77; +pub const _SC_SHELL: ::c_int = 78; +pub const _SC_SPAWN: ::c_int = 79; +pub const _SC_SPIN_LOCKS: ::c_int = 80; +pub const _SC_SPORADIC_SERVER: ::c_int = 81; +pub const _SC_THREAD_CPUTIME: ::c_int = 84; +pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 92; +pub const _SC_TIMEOUTS: ::c_int = 95; +pub const _SC_TRACE: ::c_int = 97; +pub const _SC_TRACE_EVENT_FILTER: ::c_int = 98; +pub const _SC_TRACE_INHERIT: ::c_int = 99; +pub const _SC_TRACE_LOG: ::c_int = 100; +pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 102; +pub const _SC_V6_ILP32_OFF32: ::c_int = 103; +pub const _SC_V6_ILP32_OFFBIG: ::c_int = 104; +pub const _SC_V6_LP64_OFF64: ::c_int = 105; +pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 106; +pub const _SC_IPV6: ::c_int = 118; +pub const _SC_RAW_SOCKETS: ::c_int = 119; +pub const _SC_SYMLOOP_MAX: ::c_int = 120; +pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; +pub const _SC_XOPEN_STREAMS: ::c_int = 114; +pub const _SC_XBS5_ILP32_OFF32: ::c_int = 122; +pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 123; +pub const _SC_XBS5_LP64_OFF64: ::c_int = 124; +pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 125; +pub const _SC_SS_REPL_MAX: ::c_int = 126; +pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 127; +pub const _SC_TRACE_NAME_MAX: ::c_int = 128; +pub const _SC_TRACE_SYS_MAX: ::c_int = 129; +pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 130; +pub const _SC_PASS_MAX: ::c_int = 131; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; pub const _PTHREAD_MUTEX_SIG_init: ::c_long = 0x32AAABA7; @@ -628,9 +628,9 @@ pub const SIGSTKSZ: ::size_t = 131072; extern { pub fn _NSGetExecutablePath(buf: *mut ::c_char, bufsize: *mut ::uint32_t) -> ::c_int; - pub fn _NSGetArgc() -> *mut c_int; - pub fn _NSGetArgv() -> *mut *mut *mut c_char; - pub fn _NSGetEnviron() -> *mut *mut *mut c_char; + pub fn _NSGetArgc() -> *mut ::c_int; + pub fn _NSGetArgv() -> *mut *mut *mut ::c_char; + pub fn _NSGetEnviron() -> *mut *mut *mut ::c_char; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "mprotect$UNIX2003")] pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) @@ -652,8 +652,8 @@ extern { pub fn mach_absolute_time() -> u64; pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int; pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int; - pub fn pthread_get_stackaddr_np(thread: pthread_t) -> *mut ::c_void; - pub fn pthread_get_stacksize_np(thread: pthread_t) -> ::size_t; + pub fn pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void; + pub fn pthread_get_stacksize_np(thread: ::pthread_t) -> ::size_t; pub fn __error() -> *mut ::c_int; pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int; From a7600612270d7d1c9b8555ccf56f4ed580106845 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 17:10:40 -0700 Subject: [PATCH 14/17] Add sample OpenBSD VM --- ci/Vagrantfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ci/Vagrantfile b/ci/Vagrantfile index a55aa3ebea42d..caa11a85d2eaf 100644 --- a/ci/Vagrantfile +++ b/ci/Vagrantfile @@ -19,6 +19,8 @@ Vagrant.configure(2) do |config| # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. + config.vm.synced_folder "..", "/vagrant" + config.vm.define :freebsd do |bsd| bsd.vm.box = "arkadi/freebsd-10.1-amd64" bsd.vm.provision :shell, inline: 'yes | sudo pkg install rust cargo' @@ -26,5 +28,11 @@ Vagrant.configure(2) do |config| vb.memory = "2048" end end - config.vm.synced_folder "..", "/vagrant" + + config.vm.define :openbsd do |bsd| + bsd.vm.box = "bodgit/openbsd-5.7-amd64" + bsd.vm.provider "virtualbox" do |vb| + vb.memory = "2048" + end + end end From babf390fcfa42e1cd8c1767d01337daf2b3eb7d3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 17:16:51 -0700 Subject: [PATCH 15/17] Add some IPv6 options --- src/unix/bsd/mod.rs | 3 +++ src/unix/notbsd/mod.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 216c68852caa8..3b8c4fb8f587a 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -72,6 +72,9 @@ pub const SA_SIGINFO: ::c_int = 0x0040; pub const SIGBUS: ::c_int = 10; pub const SIG_SETMASK: ::c_int = 3; +pub const IPV6_MULTICAST_LOOP: ::c_int = 11; +pub const IPV6_V6ONLY: ::c_int = 27; + extern { pub fn mincore(addr: *const ::c_void, len: size_t, vec: *mut c_char) -> ::c_int; diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index b0f74215526ba..cd7547ccef92c 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -271,6 +271,9 @@ pub const TCP_INFO: ::c_int = 11; pub const TCP_QUICKACK: ::c_int = 12; pub const TCP_CONGESTION: ::c_int = 13; +pub const IPV6_MULTICAST_LOOP: ::c_int = 19; +pub const IPV6_V6ONLY: ::c_int = 26; + pub const SO_DEBUG: ::c_int = 1; pub const SHUT_RD: ::c_int = 0; From 2536b35aa8801082e51c96f950c75963f0f6bfd8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 17:20:26 -0700 Subject: [PATCH 16/17] OK, apparently MIPS can run now? --- ci/run.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/run.sh b/ci/run.sh index 22146f28752b3..04e49cacc3188 100644 --- a/ci/run.sh +++ b/ci/run.sh @@ -16,9 +16,7 @@ if [ "$TARGET" = "arm-linux-androideabi" ]; then elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then qemu-arm -L /usr/arm-linux-gnueabihf libc-test/target/$TARGET/debug/libc-test elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then - # FIXME: this segfaults on travis, passes locally? qemu-mips -L /usr/mips-linux-gnu libc-test/target/$TARGET/debug/libc-test - echo skip elif [ "$TARGET" = "aarch64-unknown-linux-gnu" ]; then qemu-aarch64 -L /usr/aarch64-linux-gnu/ libc-test/target/$TARGET/debug/libc-test else From 22f3c5e1a74103777bde9fc244063451da3c3a78 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Sep 2015 17:30:58 -0700 Subject: [PATCH 17/17] Use a switch instead of if/else --- ci/run-travis.sh | 126 ++++++++++++++++++++++------------------------- ci/run.sh | 25 +++++++--- 2 files changed, 76 insertions(+), 75 deletions(-) diff --git a/ci/run-travis.sh b/ci/run-travis.sh index ede2e4855fd7d..0bebd4245140a 100644 --- a/ci/run-travis.sh +++ b/ci/run-travis.sh @@ -20,75 +20,65 @@ install() { sudo apt-get install $@ } -# NOTE: this is not actually run on travis right now, this was added to in -# theory run FreeBSD vagrant images on Travis, but it ended up not working, so -# this may not be working when you read this. -install_vagrant() { - echo 'deb http://download.virtualbox.org/virtualbox/debian trusty contrib' | \ - sudo tee -a /etc/apt/sources.list - vbox=virtualbox-5.0_5.0.4-102546~Ubuntu~trusty_amd64.deb - curl https://www.virtualbox.org/download/oracle_vbox.asc | sudo apt-key add - - install virtualbox-5.0 linux-headers-3.16.0-31-generic nfs-kernel-server - - # After we've got virtualbox, install vagrant itself. Note that the version in - # the default ubuntu repos is too old to run the images we have, so install - # the one from the vagrant website's download link - curl -LO https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.deb - sudo dpkg -i vagrant_1.7.4_x86_64.deb -} - -if [ "$TARGET" = "arm-linux-androideabi" ]; then +case "$TARGET" in # Pull a pre-built docker image for testing android, then run tests entirely - # within that image. - docker pull alexcrichton/rust-libc-test - exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \ - sh ci/run.sh $TARGET -elif [ "$TARGET" = "x86_64-unknown-linux-musl" ]; then - curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib - install musl-tools - export CC=musl-gcc -elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then - curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib - install gcc-4.7-arm-linux-gnueabihf qemu-user - export CC=arm-linux-gnueabihf-gcc-4.7 -elif [ "$TARGET" = "aarch64-unknown-linux-gnu" ]; then - curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib - install gcc-aarch64-linux-gnu qemu-user - export CC=aarch64-linux-gnu-gcc -elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then - # Download pre-built and custom MIPS libs and then also instsall the MIPS - # compiler according to this post: - # http://sathisharada.blogspot.com/2014_10_01_archive.html - curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib - - echo 'deb http://ftp.de.debian.org/debian squeeze main' | \ - sudo tee -a /etc/apt/sources.list - echo 'deb http://www.emdebian.org/debian/ squeeze main' | \ - sudo tee -a /etc/apt/sources.list - install emdebian-archive-keyring - install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes - export CC=mips-linux-gnu-gcc -elif [ "$TARGET" = "x86_64-unknown-freebsd" ]; then - install_vagrant - cd ci - vagrant up freebsd - exec vagrant ssh freebsd -c \ - 'cd /vagrant && CARGO_TARGET_DIR=/tmp sh ci/run.sh x86_64-unknown-freebsd' -else - # Download the rustlib folder from the relevant portion of main distribution's - # tarballs. - curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \ - tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \ - rust-$TRAVIS_RUST_VERSION-$HOST/rustc/lib/rustlib/$HOST - TARGET=$HOST - - # clang has better error messages and implements alignof more broadly - export CC=clang - - if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then - install gcc-multilib - fi -fi + #d within that image. + arm-linux-androideabi) + docker pull alexcrichton/rust-libc-test + exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \ + sh ci/run.sh $TARGET + ;; + + x86_64-unknown-linux-musl) + curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib + install musl-tools + export CC=musl-gcc + ;; + + arm-unknown-linux-gnueabihf) + curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib + install gcc-4.7-arm-linux-gnueabihf qemu-user + export CC=arm-linux-gnueabihf-gcc-4.7 + ;; + + aarch64-unknown-linux-gnu) + curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib + install gcc-aarch64-linux-gnu qemu-user + export CC=aarch64-linux-gnu-gcc + ;; + + mips-unknown-linux-gnu) + # Download pre-built and custom MIPS libs and then also instsall the MIPS + # compiler according to this post: + # http://sathisharada.blogspot.com/2014_10_01_archive.html + curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib + + echo 'deb http://ftp.de.debian.org/debian squeeze main' | \ + sudo tee -a /etc/apt/sources.list + echo 'deb http://www.emdebian.org/debian/ squeeze main' | \ + sudo tee -a /etc/apt/sources.list + install emdebian-archive-keyring + install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes + export CC=mips-linux-gnu-gcc + ;; + + *) + # Download the rustlib folder from the relevant portion of main distribution's + # tarballs. + curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \ + tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \ + rust-$TRAVIS_RUST_VERSION-$HOST/rustc/lib/rustlib/$HOST + TARGET=$HOST + + # clang has better error messages and implements alignof more broadly + export CC=clang + + if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then + install gcc-multilib + fi + ;; + +esac mkdir .cargo cp ci/cargo-config .cargo/config diff --git a/ci/run.sh b/ci/run.sh index 04e49cacc3188..b0d4726f70391 100644 --- a/ci/run.sh +++ b/ci/run.sh @@ -8,17 +8,28 @@ set -ex TARGET=$1 cargo build --manifest-path libc-test/Cargo.toml --target $TARGET -if [ "$TARGET" = "arm-linux-androideabi" ]; then +case "$TARGET" in + arm-linux-androideabi) emulator @test -no-window & adb wait-for-device adb push /root/target/$TARGET/debug/libc-test /data/libc-test adb shell /data/libc-test -elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then + ;; + + arm-unknown-linux-gnueabihf) qemu-arm -L /usr/arm-linux-gnueabihf libc-test/target/$TARGET/debug/libc-test -elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then + ;; + + mips-unknown-linux-gnu) qemu-mips -L /usr/mips-linux-gnu libc-test/target/$TARGET/debug/libc-test -elif [ "$TARGET" = "aarch64-unknown-linux-gnu" ]; then - qemu-aarch64 -L /usr/aarch64-linux-gnu/ libc-test/target/$TARGET/debug/libc-test -else + ;; + + aarch64-unknown-linux-gnu) + qemu-aarch64 -L /usr/aarch64-linux-gnu/ \ + libc-test/target/$TARGET/debug/libc-test + ;; + + *) cargo run --manifest-path libc-test/Cargo.toml --target $TARGET -fi + ;; +esac