Merge pull request #86 from alexcrichton/rumprun

Add rumprun CI and get tests passing
This commit is contained in:
Alex Crichton 2015-12-01 17:49:35 -08:00
commit 6a13db97fb
16 changed files with 876 additions and 258 deletions

View File

@ -25,7 +25,7 @@ env:
matrix:
include:
- os: linux
env: TARGET=arm-linux-androideabi
env: TARGET=arm-linux-androideabi DOCKER=alexcrichton/rust-slave-android:2015-10-21
rust: nightly
- os: linux
env: TARGET=x86_64-unknown-linux-musl
@ -45,6 +45,9 @@ matrix:
- os: osx
env: TARGET=x86_64-apple-ios
rust: nightly-2015-09-08
- os: linux
env: TARGET=x86_64-rumprun-netbsd DOCKER=alexcrichton/rust-libc-rumprun:2015-11-27
rust: nightly-2015-09-27
notifications:
email:
on_success: never

12
ci/rumprun/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM ubuntu:15.04
RUN apt-get update
RUN apt-get install -y binutils git g++ make qemu
WORKDIR /build
RUN git clone --recursive http://repo.rumpkernel.org/rumprun
WORKDIR /build/rumprun
RUN CC=cc ./build-rr.sh hw
ENV PATH=$PATH:/build/rumprun/rumprun/bin
WORKDIR /root

View File

@ -16,16 +16,21 @@ if [ "$TARGET" = "" ]; then
fi
MAIN_TARGETS=https://static.rust-lang.org/dist
EXTRA_TARGETS=https://people.mozilla.org/~acrichton/libc-test/2015-09-08
DATE=$(echo $TRAVIS_RUST_VERSION | sed s/nightly-//)
EXTRA_TARGETS=https://people.mozilla.org/~acrichton/libc-test/$DATE
install() {
sudo apt-get update
sudo apt-get install -y $@
}
mkdir -p .cargo
cp ci/cargo-config .cargo/config
case "$TARGET" in
*-apple-ios)
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
*-apple-ios | *-rumprun-*)
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | \
tar xzf - -C `rustc --print sysroot`/lib/rustlib
;;
*)
@ -44,27 +49,23 @@ case "$TARGET" in
esac
case "$TARGET" in
# Pull a pre-built docker image for testing android, then run tests entirely
# within that image. Note that this is using the same rustc installation that
# travis has (sharing it via `-v`) and otherwise the tests run entirely within
# the container.
arm-linux-androideabi)
script="
cp -r /checkout/* .
mkdir .cargo
cp ci/cargo-config .cargo/config
exec sh ci/run.sh $TARGET
"
exec docker run \
--entrypoint bash \
-v $HOME/rust:/usr/local:ro \
-v `pwd`:/checkout:ro \
-e LD_LIBRARY_PATH=/usr/local/lib \
-it alexcrichton/rust-slave-android:2015-10-21 \
-c "$script"
;;
# Pull a pre-built docker image for testing android, then run tests entirely
# within that image. Note that this is using the same rustc installation that
# travis has (sharing it via `-v`) and otherwise the tests run entirely within
# the container.
if [ "$DOCKER" != "" ]; then
exec docker run \
--entrypoint bash \
-v `rustc --print sysroot`:/usr/local:ro \
-v `pwd`:/checkout \
-e LD_LIBRARY_PATH=/usr/local/lib \
-e CARGO_TARGET_DIR=/tmp \
-w /checkout \
-it $DOCKER \
ci/run.sh $TARGET
fi
case "$TARGET" in
x86_64-unknown-linux-musl)
install musl-tools
export CC=musl-gcc
@ -107,8 +108,6 @@ exec sh ci/run.sh $TARGET
esac
mkdir .cargo
cp ci/cargo-config .cargo/config
sh ci/run.sh $TARGET
if [ "$TARGET" = "x86_64-unknown-linux-gnu" ] && \

View File

@ -21,9 +21,9 @@ case "$TARGET" in
arm-linux-androideabi)
emulator @arm-18 -no-window &
adb wait-for-device
adb push libc-test/target/$TARGET/debug/libc-test /data/libc-test
adb shell /data/libc-test 2>&1 | tee out
grep "^PASSED .* tests" out
adb push /tmp/$TARGET/debug/libc-test /data/libc-test
adb shell /data/libc-test 2>&1 | tee /tmp/out
grep "^PASSED .* tests" /tmp/out
;;
arm-unknown-linux-gnueabihf)
@ -39,6 +39,14 @@ case "$TARGET" in
libc-test/target/$TARGET/debug/libc-test
;;
*-rumprun-netbsd)
rumprun-bake hw_virtio /tmp/libc-test.img /tmp/$TARGET/debug/libc-test
qemu-system-x86_64 -nographic -vga none -m 64 \
-kernel /tmp/libc-test.img 2>&1 | tee /tmp/out &
sleep 5
grep "^PASSED .* tests" /tmp/out
;;
*-apple-ios)
libc-test/target/$TARGET/debug/libc-test
;;

View File

@ -14,7 +14,9 @@ fn main() {
let musl = target.contains("musl");
let freebsd = target.contains("freebsd");
let mips = target.contains("mips");
let bsdlike = freebsd || apple;
let netbsd = target.contains("netbsd");
let rumprun = target.contains("rumprun");
let bsdlike = freebsd || apple || netbsd;
let mut cfg = ctest::TestGenerator::new();
// Pull in extra goodies on linux/mingw
@ -90,8 +92,11 @@ fn main() {
cfg.header("sys/statvfs.h");
if !musl {
cfg.header("execinfo.h");
cfg.header("sys/sysctl.h");
if !netbsd {
cfg.header("execinfo.h");
}
}
}
@ -254,6 +259,18 @@ fn main() {
// Rust, but is close enough to *mut
"timegm" if apple => true,
// These functions presumably exist on netbsd but don't look like
// they're implemented on rumprun yet, just let them slide for now.
// Some of them look like they have headers but then don't have
// corresponding actual definitions either...
"backtrace" |
"pthread_main_np" |
"pthread_set_name_np" |
"pthread_stackseg_np" |
"shm_open" |
"shm_unlink" |
"sigaltstack" if rumprun => true,
_ => false,
}
});
@ -276,11 +293,11 @@ fn main() {
(musl && struct_ == "glob_t" && field == "gl_flags")
});
cfg.fn_cname(move |a, b| {
cfg.fn_cname(move |name, cname| {
if windows || android {
b.unwrap_or(a).to_string()
cname.unwrap_or(name).to_string()
} else {
a.to_string()
name.to_string()
}
});

View File

@ -172,7 +172,9 @@ extern {
pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
pub fn ftell(stream: *mut FILE) -> c_long;
pub fn rewind(stream: *mut FILE);
#[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
pub fn feof(stream: *mut FILE) -> c_int;
pub fn ferror(stream: *mut FILE) -> c_int;

View File

@ -35,9 +35,10 @@ macro_rules! __cfg_if_apply {
}
macro_rules! s {
($(pub struct $i:ident { $($field:tt)* })*) => ($(
($($(#[$attr:meta])* pub struct $i:ident { $($field:tt)* })*) => ($(
__item! {
#[repr(C)]
$(#[$attr])*
pub struct $i { $($field)* }
}
impl ::dox::Copy for $i {}

View File

@ -14,6 +14,8 @@ pub type rlim_t = u64;
pub type mach_timebase_info_data_t = mach_timebase_info;
pub type pthread_key_t = c_ulong;
pub type sigset_t = u32;
pub type fsblkcnt_t = ::c_uint;
pub type fsfilcnt_t = ::c_uint;
pub enum timezone {}
@ -161,6 +163,21 @@ s! {
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
}
pub struct Dl_info {
pub dli_fname: *const ::c_char,
pub dli_fbase: *mut ::c_void,
pub dli_sname: *const ::c_char,
pub dli_saddr: *mut ::c_void,
}
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: [::c_char; 8],
}
}
pub const EXIT_FAILURE: ::c_int = 1;
@ -676,7 +693,17 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
pub const SIGSTKSZ: ::size_t = 131072;
pub const FD_SETSIZE: usize = 1024;
pub const ST_NOSUID: ::c_ulong = 2;
extern {
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
pub fn sysctlnametomib(name: *const ::c_char,
mibp: *mut ::c_int,
sizep: *mut ::size_t)
-> ::c_int;
#[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)

View File

@ -12,6 +12,8 @@ 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_key_t = ::c_int;
pub type fsblkcnt_t = ::c_uint;
pub type fsfilcnt_t = ::c_uint;
pub enum timezone {}
@ -103,6 +105,21 @@ s! {
pub struct sched_param {
pub sched_priority: ::c_int,
}
pub struct Dl_info {
pub dli_fname: *const ::c_char,
pub dli_fbase: *mut ::c_void,
pub dli_sname: *const ::c_char,
pub dli_saddr: *mut ::c_void,
}
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: [::c_char; 8],
}
}
pub const EXIT_FAILURE: ::c_int = 1;
@ -522,7 +539,17 @@ pub const SCHED_FIFO: ::c_int = 1;
pub const SCHED_OTHER: ::c_int = 2;
pub const SCHED_RR: ::c_int = 3;
pub const FD_SETSIZE: usize = 1024;
pub const ST_NOSUID: ::c_ulong = 2;
extern {
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut c_char) -> ::c_int;
pub fn sysctlnametomib(name: *const c_char,
mibp: *mut ::c_int,
sizep: *mut ::size_t)
-> ::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)

View File

@ -6,8 +6,6 @@ pub type blkcnt_t = i64;
pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type pthread_t = ::uintptr_t;
pub type fsblkcnt_t = ::c_uint;
pub type fsfilcnt_t = ::c_uint;
s! {
pub struct sockaddr {
@ -16,14 +14,6 @@ s! {
pub sa_data: [::c_char; 14],
}
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: [::c_char; 8],
}
pub struct sockaddr_in6 {
pub sin6_len: u8,
pub sin6_family: sa_family_t,
@ -51,7 +41,9 @@ s! {
pub pw_shell: *mut ::c_char,
pub pw_expire: ::time_t,
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
#[cfg(not(any(target_os = "macos",
target_os = "ios",
target_os = "netbsd")))]
pub pw_fields: ::c_int,
}
@ -102,10 +94,7 @@ pub const SIG_SETMASK: ::c_int = 3;
pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
pub const IPV6_V6ONLY: ::c_int = 27;
pub const FD_SETSIZE: usize = 1024;
pub const ST_RDONLY: ::c_ulong = 1;
pub const ST_NOSUID: ::c_ulong = 2;
pub const NI_MAXHOST: ::socklen_t = 1025;
@ -147,12 +136,6 @@ f! {
}
extern {
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut c_char) -> ::c_int;
pub fn sysctlnametomib(name: *const c_char,
mibp: *mut ::c_int,
sizep: *mut ::size_t)
-> ::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;

View File

@ -1,4 +1,27 @@
pub type clock_t = i64;
pub type suseconds_t = i64;
pub type dev_t = i32;
pub type sigset_t = ::c_uint;
pub type blksize_t = ::uint32_t;
pub type fsblkcnt_t = ::c_uint;
pub type fsfilcnt_t = ::c_uint;
pub type pthread_attr_t = *mut ::c_void;
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;
s! {
pub struct dirent {
pub d_fileno: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_namelen: u8,
__d_padding: [u8; 4],
pub d_name: [::c_char; 256],
}
pub struct glob_t {
pub gl_pathc: ::c_int,
pub gl_matchc: ::c_int,
@ -13,8 +36,189 @@ s! {
__unused6: *mut ::c_void,
__unused7: *mut ::c_void,
}
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: ::uint32_t,
pub st_gen: ::uint32_t,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
}
pub struct statvfs {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_favail: ::fsfilcnt_t,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
}
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,
}
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 siginfo_t {
pub si_signo: ::c_int,
pub si_code: ::c_int,
pub si_errno: ::c_int,
pub si_addr: *mut ::c_void
}
}
pub const O_CLOEXEC: ::c_int = 0x10000;
pub const MS_SYNC : ::c_int = 0x0002;
pub const MS_INVALIDATE : ::c_int = 0x0004;
pub const PTHREAD_STACK_MIN : ::size_t = 2048;
pub const ENOATTR : ::c_int = 83;
pub const EILSEQ : ::c_int = 84;
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;
pub const F_DUPFD_CLOEXEC : ::c_int = 10;
pub const RLIM_NLIMITS: ::c_int = 9;
pub const SO_SNDTIMEO: ::c_int = 0x1005;
pub const SO_RCVTIMEO: ::c_int = 0x1006;
pub const KERN_PROC : ::c_int = 66;
pub const O_DSYNC : ::c_int = 128;
pub const MAP_RENAME : ::c_int = 0x0000;
pub const MAP_NORESERVE : ::c_int = 0x0000;
pub const MAP_HASSEMAPHORE : ::c_int = 0x0000;
pub const EIPSEC : ::c_int = 82;
pub const ENOMEDIUM : ::c_int = 85;
pub const EMEDIUMTYPE : ::c_int = 86;
pub const RUSAGE_THREAD: ::c_int = 1;
pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12;
pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13;
pub const MAP_COPY : ::c_int = 0x0002;
pub const MAP_NOEXTEND : ::c_int = 0x0000;
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_THREADS : ::c_int = 91;
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_TTY_NAME_MAX : ::c_int = 107;
pub const _SC_ATEXIT_MAX : ::c_int = 46;
pub const _SC_CLK_TCK : ::c_int = 3;
pub const _SC_AIO_LISTIO_MAX : ::c_int = 42;
pub const _SC_AIO_MAX : ::c_int = 43;
pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45;
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_PRIORITY_SCHEDULING : ::c_int = 61;
pub const _SC_SEMAPHORES : ::c_int = 67;
pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68;
pub const _SC_SYNCHRONIZED_IO : ::c_int = 75;
pub const _SC_TIMERS : ::c_int = 94;
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_UNIX : ::c_int = 123;
pub const _SC_XOPEN_VERSION : ::c_int = 125;
pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
pub const _SC_PRIORITIZED_IO : ::c_int = 60;
pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
pub const _SC_RTSIG_MAX : ::c_int = 66;
pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
pub const _SC_TIMER_MAX : ::c_int = 93;
pub const SIGSTKSZ: ::size_t = 131072;
pub const FD_SETSIZE: usize = 1024;
pub const ST_NOSUID: ::c_ulong = 2;
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;
extern {
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
}
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
pub fn sysctl(name: *mut ::c_int,
namelen: ::c_uint,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
pub fn sysctlbyname(name: *const ::c_char,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
}

View File

@ -1,44 +1,15 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type clock_t = i64;
pub type time_t = i64;
pub type suseconds_t = i64;
pub type dev_t = i32;
pub type mode_t = u32;
pub type nlink_t = ::uint32_t;
pub type blksize_t = ::uint32_t;
pub type ino_t = ::uint64_t;
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;
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 rlim_t = u64;
pub enum timezone {}
s! {
pub struct dirent {
pub d_fileno: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_namelen: u8,
__d_padding: [u8; 4],
pub d_name: [::c_char; 256],
}
pub struct siginfo_t {
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,
@ -51,60 +22,19 @@ s! {
pub ss_flags: ::c_int,
}
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 Dl_info {
pub dli_fname: *const ::c_char,
pub dli_fbase: *mut ::c_void,
pub dli_sname: *const ::c_char,
pub dli_saddr: *const ::c_void,
}
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,
}
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 struct statvfs {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_favail: ::fsfilcnt_t,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
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: [::int8_t; 8],
}
}
@ -131,7 +61,7 @@ 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 O_CLOEXEC: ::c_int = 0x10000;
pub const O_SYNC : ::c_int = 128;
pub const S_IFIFO : mode_t = 4096;
pub const S_IFCHR : mode_t = 8192;
pub const S_IFBLK : mode_t = 24576;
@ -195,8 +125,6 @@ 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;
@ -280,17 +208,6 @@ 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;
@ -302,7 +219,6 @@ 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;
@ -325,37 +241,10 @@ 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;
@ -369,7 +258,6 @@ 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;
@ -377,7 +265,6 @@ 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;
@ -401,8 +288,6 @@ 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;
@ -420,8 +305,6 @@ 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;
@ -436,17 +319,8 @@ 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;
@ -454,7 +328,6 @@ 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;
@ -481,61 +354,19 @@ 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;
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
pub fn __errno() -> *mut ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void, sz: ::size_t) -> ::size_t;
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
-> ::c_int;
pub fn sysctl(name: *mut ::c_int,
namelen: ::c_uint,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
pub fn sysctlbyname(name: *const ::c_char,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
pub fn pthread_main_np() -> ::c_uint;
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
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;
}
cfg_if! {

View File

@ -1,8 +1,23 @@
pub type clock_t = ::c_uint;
pub type suseconds_t = ::c_int;
pub type dev_t = u64;
pub type blksize_t = ::int32_t;
pub type fsblkcnt_t = ::uint64_t;
pub type fsfilcnt_t = ::uint64_t;
s! {
pub struct dirent {
pub d_fileno: ::ino_t,
pub d_reclen: u16,
pub d_namlen: u16,
pub d_type: u8,
pub d_name: [::c_char; 512],
}
pub struct glob_t {
pub gl_pathc: ::c_int,
pub gl_pathc: ::size_t,
__unused1: ::c_int,
pub gl_offs: ::c_int,
pub gl_offs: ::size_t,
__unused2: ::c_int,
pub gl_pathv: *mut *mut ::c_char,
@ -13,10 +28,264 @@ s! {
__unused6: *mut ::c_void,
__unused7: *mut ::c_void,
__unused8: *mut ::c_void,
__unused9: *mut ::c_void,
}
pub struct sigset_t {
__bits: [u32; 4],
}
pub struct stat {
pub st_dev: ::dev_t,
pub st_mode: ::mode_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_atimensec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtimensec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctimensec: ::c_long,
pub st_birthtime: ::time_t,
pub st_birthtimensec: ::c_long,
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,
pub st_spare: [::uint32_t; 2],
}
pub struct statvfs {
pub f_flag: ::c_ulong,
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_iosize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_bresvd: ::fsblkcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_favail: ::fsfilcnt_t,
pub f_fresvd: ::fsfilcnt_t,
pub f_syncreads: ::uint64_t,
pub f_syncwrites: ::uint64_t,
pub f_asyncreads: ::uint64_t,
pub f_asyncwrites: ::uint64_t,
pub f_fsidx: ::fsid_t,
pub f_fsid: ::c_ulong,
pub f_namemax: ::c_ulong,
pub f_owner: ::uid_t,
pub f_spare: [::uint32_t; 4],
pub f_fstypename: [::c_char; 32],
pub f_mntonname: [::c_char; 1024],
pub f_mntfromname: [::c_char; 1024],
}
pub struct fsid_t {
__fsid_val: [::int32_t; 2],
}
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_addr: *mut ::sockaddr,
pub ai_next: *mut ::addrinfo,
}
pub struct sockaddr_storage {
pub ss_len: u8,
pub ss_family: ::sa_family_t,
__ss_pad1: [u8; 6],
__ss_pad2: i64,
__ss_pad3: [u8; 112],
}
pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_code: ::c_int,
pub si_errno: ::c_int,
__pad1: ::c_int,
__pad2: [u64; 14],
}
pub struct pthread_attr_t {
pta_magic: ::c_uint,
pta_flags: ::c_int,
pta_private: *mut ::c_void,
}
pub struct pthread_mutex_t {
ptm_magic: ::c_uint,
ptm_errorcheck: ::c_uchar,
ptm_pad1: [u8; 3],
ptm_interlock: ::c_uchar,
ptm_pad2: [u8; 3],
ptm_owner: ::pthread_t,
ptm_waiters: *mut u8,
ptm_recursed: ::c_uint,
ptm_spare2: *mut ::c_void,
}
pub struct pthread_mutexattr_t {
ptma_magic: ::c_uint,
ptma_private: *mut ::c_void,
}
pub struct pthread_cond_t {
ptc_magic: ::c_uint,
ptc_lock: ::c_uchar,
ptc_waiters_first: *mut u8,
ptc_waiters_last: *mut u8,
ptc_mutex: *mut ::pthread_mutex_t,
ptc_private: *mut ::c_void,
}
pub struct pthread_rwlock_t {
ptr_magic: ::c_uint,
ptr_interlock: ::c_uchar,
ptr_rblocked_first: *mut u8,
ptr_rblocked_last: *mut u8,
ptr_wblocked_first: *mut u8,
ptr_wblocked_last: *mut u8,
ptr_nreaders: ::c_uint,
ptr_owner: ::pthread_t,
ptr_private: *mut ::c_void,
}
}
pub const O_CLOEXEC: ::c_int = 0x400000;
pub const MS_SYNC : ::c_int = 0x4;
pub const MS_INVALIDATE : ::c_int = 0x2;
pub const RLIM_NLIMITS: ::c_int = 12;
pub const ENOATTR : ::c_int = 93;
pub const EILSEQ : ::c_int = 85;
pub const EOVERFLOW : ::c_int = 84;
pub const ECANCELED : ::c_int = 87;
pub const EIDRM : ::c_int = 82;
pub const ENOMSG : ::c_int = 83;
pub const ENOTSUP : ::c_int = 86;
pub const ELAST : ::c_int = 96;
pub const F_DUPFD_CLOEXEC : ::c_int = 12;
pub const IPV6_JOIN_GROUP: ::c_int = 12;
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
pub const SO_SNDTIMEO: ::c_int = 0x100b;
pub const SO_RCVTIMEO: ::c_int = 0x100c;
pub const KERN_PROC : ::c_int = 14;
pub const O_DSYNC : ::c_int = 0x10000;
pub const MAP_RENAME : ::c_int = 0x20;
pub const MAP_NORESERVE : ::c_int = 0x40;
pub const MAP_HASSEMAPHORE : ::c_int = 0x200;
pub const _SC_IOV_MAX : ::c_int = 32;
pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 47;
pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 48;
pub const _SC_LOGIN_NAME_MAX : ::c_int = 37;
pub const _SC_MQ_PRIO_MAX : ::c_int = 55;
pub const _SC_THREADS : ::c_int = 41;
pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 61;
pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 62;
pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 57;
pub const _SC_THREAD_KEYS_MAX : ::c_int = 58;
pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 64;
pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 65;
pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 63;
pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 66;
pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 67;
pub const _SC_THREAD_STACK_MIN : ::c_int = 59;
pub const _SC_THREAD_THREADS_MAX : ::c_int = 60;
pub const _SC_TTY_NAME_MAX : ::c_int = 68;
pub const _SC_ATEXIT_MAX : ::c_int = 40;
pub const _SC_CLK_TCK : ::c_int = 39;
pub const _SC_AIO_LISTIO_MAX : ::c_int = 51;
pub const _SC_AIO_MAX : ::c_int = 52;
pub const _SC_ASYNCHRONOUS_IO : ::c_int = 50;
pub const _SC_MAPPED_FILES : ::c_int = 33;
pub const _SC_MEMLOCK : ::c_int = 34;
pub const _SC_MEMLOCK_RANGE : ::c_int = 35;
pub const _SC_MEMORY_PROTECTION : ::c_int = 36;
pub const _SC_MESSAGE_PASSING : ::c_int = 53;
pub const _SC_MQ_OPEN_MAX : ::c_int = 54;
pub const _SC_PRIORITY_SCHEDULING : ::c_int = 56;
pub const _SC_SEMAPHORES : ::c_int = 42;
pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 87;
pub const _SC_SYNCHRONIZED_IO : ::c_int = 31;
pub const _SC_TIMERS : ::c_int = 44;
pub const SIGSTKSZ: ::size_t = 0xa000;
pub const FD_SETSIZE: usize = 0x100;
pub const ST_NOSUID: ::c_ulong = 8;
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
ptm_magic: 0x33330003,
ptm_errorcheck: 0,
ptm_interlock: 0,
ptm_waiters: 0 as *mut _,
ptm_owner: 0,
ptm_pad1: [0; 3],
ptm_pad2: [0; 3],
ptm_recursed: 0,
ptm_spare2: 0 as *mut _,
};
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
ptc_magic: 0x55550005,
ptc_lock: 0,
ptc_waiters_first: 0 as *mut _,
ptc_waiters_last: 0 as *mut _,
ptc_mutex: 0 as *mut _,
ptc_private: 0 as *mut _,
};
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
ptr_magic: 0x99990009,
ptr_interlock: 0,
ptr_rblocked_first: 0 as *mut _,
ptr_rblocked_last: 0 as *mut _,
ptr_wblocked_first: 0 as *mut _,
ptr_wblocked_last: 0 as *mut _,
ptr_nreaders: 0,
ptr_owner: 0,
ptr_private: 0 as *mut _,
};
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
extern {
pub fn pthread_setname_np(tid: ::pthread_t, format: *const ::c_char, name: *const ::c_void);
}
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
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,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *const ::c_void,
newlen: ::size_t)
-> ::c_int;
}

View File

@ -1,4 +1,27 @@
pub type clock_t = i64;
pub type suseconds_t = i64;
pub type dev_t = i32;
pub type sigset_t = ::c_uint;
pub type blksize_t = ::uint32_t;
pub type fsblkcnt_t = ::c_uint;
pub type fsfilcnt_t = ::c_uint;
pub type pthread_attr_t = *mut ::c_void;
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;
s! {
pub struct dirent {
pub d_fileno: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_namelen: u8,
__d_padding: [u8; 4],
pub d_name: [::c_char; 256],
}
pub struct glob_t {
pub gl_pathc: ::c_int,
__unused1: ::c_int,
@ -15,8 +38,190 @@ s! {
__unused8: *mut ::c_void,
__unused9: *mut ::c_void,
}
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: ::uint32_t,
pub st_gen: ::uint32_t,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
}
pub struct statvfs {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_favail: ::fsfilcnt_t,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
}
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,
}
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 siginfo_t {
pub si_signo: ::c_int,
pub si_code: ::c_int,
pub si_errno: ::c_int,
__pad1: ::c_int,
__pad2: [u8; 240],
}
}
pub const O_CLOEXEC: ::c_int = 0x10000;
pub const MS_SYNC : ::c_int = 0x0002;
pub const MS_INVALIDATE : ::c_int = 0x0004;
pub const PTHREAD_STACK_MIN : ::size_t = 2048;
pub const ENOATTR : ::c_int = 83;
pub const EILSEQ : ::c_int = 84;
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;
pub const F_DUPFD_CLOEXEC : ::c_int = 10;
pub const RLIM_NLIMITS: ::c_int = 9;
pub const SO_SNDTIMEO: ::c_int = 0x1005;
pub const SO_RCVTIMEO: ::c_int = 0x1006;
pub const KERN_PROC : ::c_int = 66;
pub const O_DSYNC : ::c_int = 128;
pub const MAP_RENAME : ::c_int = 0x0000;
pub const MAP_NORESERVE : ::c_int = 0x0000;
pub const MAP_HASSEMAPHORE : ::c_int = 0x0000;
pub const EIPSEC : ::c_int = 82;
pub const ENOMEDIUM : ::c_int = 85;
pub const EMEDIUMTYPE : ::c_int = 86;
pub const RUSAGE_THREAD: ::c_int = 1;
pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12;
pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13;
pub const MAP_COPY : ::c_int = 0x0002;
pub const MAP_NOEXTEND : ::c_int = 0x0000;
pub const _SC_CLK_TCK : ::c_int = 3;
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_THREADS : ::c_int = 91;
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_TTY_NAME_MAX : ::c_int = 107;
pub const _SC_ATEXIT_MAX : ::c_int = 46;
pub const _SC_AIO_LISTIO_MAX : ::c_int = 42;
pub const _SC_AIO_MAX : ::c_int = 43;
pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45;
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_PRIORITY_SCHEDULING : ::c_int = 61;
pub const _SC_SEMAPHORES : ::c_int = 67;
pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68;
pub const _SC_SYNCHRONIZED_IO : ::c_int = 75;
pub const _SC_TIMERS : ::c_int = 94;
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_UNIX : ::c_int = 123;
pub const _SC_XOPEN_VERSION : ::c_int = 125;
pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
pub const _SC_PRIORITIZED_IO : ::c_int = 60;
pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
pub const _SC_RTSIG_MAX : ::c_int = 66;
pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
pub const _SC_TIMER_MAX : ::c_int = 93;
pub const SIGSTKSZ: ::size_t = 131072;
pub const FD_SETSIZE: usize = 1024;
pub const ST_NOSUID: ::c_ulong = 2;
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;
extern {
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
}
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
pub fn sysctl(name: *mut ::c_int,
namelen: ::c_uint,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
pub fn sysctlbyname(name: *const ::c_char,
oldp: *mut ::c_void,
oldlenp: *mut ::size_t,
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
}

View File

@ -55,6 +55,7 @@ s! {
__reserved: [c_long; 16],
}
#[cfg_attr(target_os = "netbsd", repr(packed))]
pub struct in_addr {
pub s_addr: in_addr_t,
}
@ -77,13 +78,6 @@ s! {
pub ipv6mr_interface: ::c_uint,
}
pub struct Dl_info {
pub dli_fname: *const ::c_char,
pub dli_fbase: *mut ::c_void,
pub dli_sname: *const ::c_char,
pub dli_saddr: *mut ::c_void,
}
pub struct hostent {
pub h_name: *mut ::c_char,
pub h_aliases: *mut *mut ::c_char,
@ -122,6 +116,7 @@ cfg_if! {
}
extern {
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "connect$UNIX2003")]
@ -168,11 +163,13 @@ extern {
pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
#[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
#[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
@ -199,8 +196,10 @@ extern {
link_name = "opendir$INODE64")]
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "opendir$INODE64$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
#[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
result: *mut *mut ::dirent) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
@ -268,6 +267,7 @@ extern {
pub fn sleep(secs: ::c_uint) -> ::c_uint;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "nanosleep$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
pub fn nanosleep(rqtp: *const timespec,
rmtp: *mut timespec) -> ::c_int;
pub fn tcgetpgrp(fd: ::c_int) -> pid_t;
@ -293,6 +293,8 @@ extern {
pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
offset: off_t) -> ::ssize_t;
pub fn umask(mask: mode_t) -> mode_t;
#[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
@ -320,6 +322,7 @@ extern {
pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
#[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
@ -332,6 +335,7 @@ extern {
overwrite: ::c_int) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "unsetenv$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
pub fn unsetenv(name: *const c_char) -> ::c_int;
pub fn symlink(path1: *const c_char,
@ -348,6 +352,7 @@ extern {
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "setrlimit$UNIX2003")]
pub fn setrlimit(resource: ::c_int, rlim: *const rlimit) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
pub fn getdtablesize() -> ::c_int;
@ -377,6 +382,7 @@ extern {
pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t,
state: ::c_int) -> ::c_int;
pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
pub fn sched_yield() -> ::c_int;
pub fn pthread_key_create(key: *mut pthread_key_t,
dtor: ::dox::Option<unsafe extern fn(*mut ::c_void)>)
@ -452,6 +458,7 @@ extern {
pub fn sigaltstack(ss: *const stack_t,
oss: *mut stack_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
pub fn utimes(filename: *const ::c_char,
times: *const ::timeval) -> ::c_int;
pub fn dlopen(filename: *const ::c_char,
@ -469,10 +476,13 @@ extern {
pub fn freeaddrinfo(res: *mut addrinfo);
pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
#[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "mktime$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
pub fn mktime(tm: *mut tm) -> time_t;
}
@ -482,11 +492,13 @@ extern {
pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> ::c_int;
pub fn freeifaddrs(ifa: *mut ifaddrs);
#[cfg_attr(target_os = "macos", link_name = "glob$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__glob30")]
pub fn glob(pattern: *const c_char,
flags: ::c_int,
errfunc: ::dox::Option<extern "C" fn(epath: *const c_char,
errno: ::c_int) -> ::c_int>,
pglob: *mut glob_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__globfree30")]
pub fn globfree(pglob: *mut glob_t);
pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
@ -511,6 +523,7 @@ extern {
-> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "putenv$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
pub fn putenv(string: *mut c_char) -> ::c_int;
pub fn readlink(path: *const c_char,
buf: *mut c_char,
@ -519,6 +532,7 @@ extern {
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "msync$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__msync13")]
pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
pub fn sysconf(name: ::c_int) -> c_long;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
@ -539,6 +553,7 @@ extern {
flags: ::c_int) -> ::ssize_t;
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
pub fn getpwuid_r(uid: ::uid_t,
pwd: *mut passwd,
buf: *mut ::c_char,
@ -547,15 +562,21 @@ extern {
pub fn posix_memalign(memptr: *mut *mut ::c_void,
align: ::size_t,
size: ::size_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
pub fn sigfillset(set: *mut sigset_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
link_name = "select$1050")]
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "select$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__select50")]
pub fn select(nfds: ::c_int,
readfs: *mut fd_set,
writefds: *mut fd_set,
@ -565,6 +586,7 @@ extern {
link_name = "pselect$1050")]
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "pselect$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
pub fn pselect(nfds: ::c_int,
readfs: *mut fd_set,
writefds: *mut fd_set,
@ -575,6 +597,7 @@ extern {
offset: ::off_t,
whence: ::c_int) -> ::c_int;
pub fn ftello(stream: *mut ::FILE) -> ::off_t;
#[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
pub fn timegm(tm: *mut ::tm) -> time_t;
pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;

View File

@ -98,6 +98,13 @@ s! {
#[cfg(target_env = "musl")]
pub sched_ss_max_repl: ::c_int,
}
pub struct Dl_info {
pub dli_fname: *const ::c_char,
pub dli_fbase: *mut ::c_void,
pub dli_sname: *const ::c_char,
pub dli_saddr: *mut ::c_void,
}
}
// intentionally not public, only used for fd_set