Merge pull request #2 from alexcrichton/freebsd

Freebsd
This commit is contained in:
Alex Crichton 2015-09-18 18:40:38 -07:00
commit fa3f6e729e
23 changed files with 1279 additions and 1459 deletions

View File

@ -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) [![Build status](https://ci.appveyor.com/api/projects/status/v0414slj8y8nga0p?svg=true)](https://ci.appveyor.com/project/alexcrichton/libc)
[Documentation](http://alexcrichton.com/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}`

View File

@ -26,3 +26,7 @@ build: false
test_script: test_script:
- cargo test - cargo test
- cargo run --manifest-path libc-test/Cargo.toml - cargo run --manifest-path libc-test/Cargo.toml
branches:
only:
- autotest

38
ci/Vagrantfile vendored Normal file
View File

@ -0,0 +1,38 @@
# 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.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'
bsd.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
end
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

View File

@ -20,25 +20,34 @@ install() {
sudo apt-get install $@ sudo apt-get install $@
} }
if [ "$TARGET" = "arm-linux-androideabi" ]; then case "$TARGET" in
# Pull a pre-built docker image for testing android, then run tests entirely # Pull a pre-built docker image for testing android, then run tests entirely
# within that image. #d within that image.
arm-linux-androideabi)
docker pull alexcrichton/rust-libc-test docker pull alexcrichton/rust-libc-test
exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \ exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \
sh ci/run.sh $TARGET sh ci/run.sh $TARGET
elif [ "$TARGET" = "x86_64-unknown-linux-musl" ]; then ;;
x86_64-unknown-linux-musl)
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
install musl-tools install musl-tools
export CC=musl-gcc export CC=musl-gcc
elif [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then ;;
arm-unknown-linux-gnueabihf)
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
install gcc-4.7-arm-linux-gnueabihf qemu-user install gcc-4.7-arm-linux-gnueabihf qemu-user
export CC=arm-linux-gnueabihf-gcc-4.7 export CC=arm-linux-gnueabihf-gcc-4.7
elif [ "$TARGET" = "aarch64-unknown-linux-gnu" ]; then ;;
aarch64-unknown-linux-gnu)
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib curl -s $EXTRA_TARGETS/$TARGET.tar.gz | tar xzf - -C $HOME/rust/lib/rustlib
install gcc-aarch64-linux-gnu qemu-user install gcc-aarch64-linux-gnu qemu-user
export CC=aarch64-linux-gnu-gcc export CC=aarch64-linux-gnu-gcc
elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then ;;
mips-unknown-linux-gnu)
# Download pre-built and custom MIPS libs and then also instsall the MIPS # Download pre-built and custom MIPS libs and then also instsall the MIPS
# compiler according to this post: # compiler according to this post:
# http://sathisharada.blogspot.com/2014_10_01_archive.html # http://sathisharada.blogspot.com/2014_10_01_archive.html
@ -51,7 +60,9 @@ elif [ "$TARGET" = "mips-unknown-linux-gnu" ]; then
install emdebian-archive-keyring install emdebian-archive-keyring
install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes install qemu-user gcc-4.4-mips-linux-gnu -y --force-yes
export CC=mips-linux-gnu-gcc export CC=mips-linux-gnu-gcc
else ;;
*)
# Download the rustlib folder from the relevant portion of main distribution's # Download the rustlib folder from the relevant portion of main distribution's
# tarballs. # tarballs.
curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \ curl -s $MAIN_TARGETS/rust-$TRAVIS_RUST_VERSION-$HOST.tar.gz | \
@ -65,7 +76,9 @@ else
if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then if [ "$TARGET" = "i686-unknown-linux-gnu" ]; then
install gcc-multilib install gcc-multilib
fi fi
fi ;;
esac
mkdir .cargo mkdir .cargo
cp ci/cargo-config .cargo/config cp ci/cargo-config .cargo/config

View File

@ -8,19 +8,28 @@ set -ex
TARGET=$1 TARGET=$1
cargo build --manifest-path libc-test/Cargo.toml --target $TARGET 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 & emulator @test -no-window &
adb wait-for-device adb wait-for-device
adb push /root/target/$TARGET/debug/libc-test /data/libc-test adb push /root/target/$TARGET/debug/libc-test /data/libc-test
adb shell /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 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-* mips-unknown-linux-gnu)
echo skip 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 cargo run --manifest-path libc-test/Cargo.toml --target $TARGET
fi ;;
esac

View File

@ -12,6 +12,8 @@ fn main() {
let android = target.contains("android"); let android = target.contains("android");
let darwin = target.contains("apple-darwin"); let darwin = target.contains("apple-darwin");
let musl = target.contains("musl"); let musl = target.contains("musl");
let freebsd = target.contains("freebsd");
let bsdlike = freebsd || darwin;
let mut cfg = ctest::TestGenerator::new(); let mut cfg = ctest::TestGenerator::new();
// Pull in extra goodies on linux/mingw // Pull in extra goodies on linux/mingw
@ -39,14 +41,6 @@ fn main() {
.header("time.h") .header("time.h")
.header("wchar.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 { if windows {
cfg.header("winsock2.h"); // must be before windows.h cfg.header("winsock2.h"); // must be before windows.h
@ -84,10 +78,11 @@ fn main() {
cfg.header("utime.h"); cfg.header("utime.h");
cfg.header("pwd.h"); cfg.header("pwd.h");
cfg.header("grp.h"); cfg.header("grp.h");
}
if android { if android {
cfg.header("arpa/inet.h"); cfg.header("arpa/inet.h");
} else { } else if !windows {
cfg.header("glob.h"); cfg.header("glob.h");
cfg.header("ifaddrs.h"); cfg.header("ifaddrs.h");
@ -98,17 +93,23 @@ fn main() {
} }
if darwin { if darwin {
cfg.header("mach-o/dyld.h");
cfg.header("mach/mach_time.h");
cfg.header("malloc/malloc.h"); cfg.header("malloc/malloc.h");
cfg.header("crt_externs.h"); cfg.header("crt_externs.h");
} else {
cfg.header("malloc.h");
} }
} if linux || android {
if target.contains("linux") { cfg.header("netpacket/packet.h");
cfg.header("net/ethernet.h");
cfg.header("malloc.h");
cfg.header("sys/prctl.h"); cfg.header("sys/prctl.h");
} }
if freebsd {
cfg.header("pthread_np.h");
}
cfg.type_name(move |ty, is_struct| { cfg.type_name(move |ty, is_struct| {
match ty { match ty {
// Just pass all these through, no need for a "struct" prefix // 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(), "ssize_t" if windows => "SSIZE_T".to_string(),
// OSX calls this something else // 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(), 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 "strerror_r" if linux => true, // actually xpg-something-or-other
// typed 2nd arg on linux and android // 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 "dlerror" if android => true, // const-ness is added

File diff suppressed because it is too large Load Diff

View File

@ -2,5 +2,5 @@ pub const PTHREAD_STACK_MIN: ::size_t = 2048;
pub const KERN_PROC_PATHNAME: ::c_int = 12; pub const KERN_PROC_PATHNAME: ::c_int = 12;
extern { extern {
pub fn __error() -> *const ::c_int; pub fn __error() -> *mut ::c_int;
} }

View File

@ -1,10 +1,12 @@
pub type pthread_t = uintptr_t; pub type clock_t = i32;
pub type dev_t = u32;
pub type ino_t = u32;
pub type mode_t = u16;
pub type nlink_t = u16;
pub type blksize_t = u32;
pub type fflags_t = u32;
pub type pthread_attr_t = *mut ::c_void;
pub type rlim_t = i64; 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_mutex_t = *mut ::c_void;
pub type pthread_mutexattr_t = *mut ::c_void; pub type pthread_mutexattr_t = *mut ::c_void;
pub type pthread_cond_t = *mut ::c_void; pub type pthread_cond_t = *mut ::c_void;
@ -32,7 +34,7 @@ s! {
pub struct sockaddr_storage { pub struct sockaddr_storage {
pub ss_len: u8, pub ss_len: u8,
pub ss_family: sa_family_t, pub ss_family: ::sa_family_t,
__ss_pad1: [u8; 6], __ss_pad1: [u8; 6],
__ss_align: i64, __ss_align: i64,
__ss_pad2: [u8; 112], __ss_pad2: [u8; 112],
@ -43,41 +45,38 @@ s! {
pub ai_family: ::c_int, pub ai_family: ::c_int,
pub ai_socktype: ::c_int, pub ai_socktype: ::c_int,
pub ai_protocol: ::c_int, pub ai_protocol: ::c_int,
pub ai_addrlen: socklen_t, pub ai_addrlen: ::socklen_t,
pub ai_canonname: *mut c_char, pub ai_canonname: *mut ::c_char,
pub ai_addr: *mut ::sockaddr, pub ai_addr: *mut ::sockaddr,
pub ai_next: *mut addrinfo, 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 { pub struct sigset_t {
bits: [u32; 4], bits: [u32; 4],
} }
pub struct siginfo_t { pub struct siginfo_t {
pub _signo: ::c_int, pub si_signo: ::c_int,
pub _errno: ::c_int, pub si_errno: ::c_int,
pub _code: ::c_int, pub si_code: ::c_int,
pub _pid: ::pid_t, pub si_pid: ::pid_t,
pub _uid: ::uid_t, pub si_uid: ::uid_t,
pub _status: ::c_int, pub si_status: ::c_int,
pub si_addr: *mut ::c_void pub si_addr: *mut ::c_void,
_pad: [::c_int; 12],
} }
pub struct sigaction { pub struct sigaction {
pub sa_sigaction: sighandler_t, pub sa_sigaction: ::sighandler_t,
pub sa_flags: ::c_int, pub sa_flags: ::c_int,
pub sa_mask: sigset_t, 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; pub const EXIT_FAILURE: ::c_int = 1;
@ -90,11 +89,11 @@ pub const SEEK_END: ::c_int = 2;
pub const _IOFBF: ::c_int = 0; pub const _IOFBF: ::c_int = 0;
pub const _IONBF: ::c_int = 2; pub const _IONBF: ::c_int = 2;
pub const _IOLBF: ::c_int = 1; pub const _IOLBF: ::c_int = 1;
pub const BUFSIZ: c_uint = 1024; pub const BUFSIZ: ::c_uint = 1024;
pub const FOPEN_MAX: c_uint = 20; pub const FOPEN_MAX: ::c_uint = 20;
pub const FILENAME_MAX: c_uint = 1024; pub const FILENAME_MAX: ::c_uint = 1024;
pub const L_tmpnam: c_uint = 1024; pub const L_tmpnam: ::c_uint = 1024;
pub const TMP_MAX: c_uint = 308915776; pub const TMP_MAX: ::c_uint = 308915776;
pub const O_RDONLY: ::c_int = 0; pub const O_RDONLY: ::c_int = 0;
pub const O_WRONLY: ::c_int = 1; pub const O_WRONLY: ::c_int = 1;
@ -492,23 +491,23 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
extern { extern {
pub fn mprotect(addr: *const ::c_void, len: size_t, prot: c_int) pub fn mprotect(addr: *const ::c_void, len: size_t, prot: ::c_int)
-> c_int; -> ::c_int;
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
-> ::c_int; -> ::c_int;
pub fn sysctl(name: *const c_int, pub fn sysctl(name: *const ::c_int,
namelen: c_uint, namelen: ::c_uint,
oldp: *mut ::c_void, oldp: *mut ::c_void,
oldlenp: *mut size_t, oldlenp: *mut size_t,
newp: *const ::c_void, newp: *const ::c_void,
newlen: size_t) newlen: size_t)
-> c_int; -> ::c_int;
pub fn sysctlbyname(name: *const c_char, pub fn sysctlbyname(name: *const ::c_char,
oldp: *mut ::c_void, oldp: *mut ::c_void,
oldlenp: *mut size_t, oldlenp: *mut size_t,
newp: *const ::c_void, newp: *const ::c_void,
newlen: size_t) newlen: size_t)
-> c_int; -> ::c_int;
pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::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 pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
} }

View File

@ -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_long = i32;
pub type c_ulong = u32; pub type c_ulong = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type size_t = u32; pub type size_t = u32;
pub type ptrdiff_t = i32; pub type ptrdiff_t = i32;
pub type clock_t = i32;
pub type time_t = i32; pub type time_t = i32;
pub type suseconds_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 intptr_t = i32;
pub type uintptr_t = u32; 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 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! { s! {
pub struct stat { pub struct stat {

View File

@ -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_long = i64;
pub type c_ulong = u64; pub type c_ulong = u64;
pub type c_float = f32;
pub type c_double = f64;
pub type size_t = u64; pub type size_t = u64;
pub type ptrdiff_t = i64; pub type ptrdiff_t = i64;
pub type clock_t = i32;
pub type time_t = i64; pub type time_t = i64;
pub type suseconds_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 intptr_t = i64;
pub type uintptr_t = u64; 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 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! { s! {
pub struct stat { pub struct stat {

View File

@ -1,3 +1,12 @@
pub type c_char = i8;
pub type wchar_t = i32;
pub type off_t = i64;
pub type useconds_t = u32;
pub type blkcnt_t = i64;
pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type pthread_t = uintptr_t;
s! { s! {
pub struct sockaddr { pub struct sockaddr {
pub sa_len: u8, pub sa_len: u8,
@ -39,12 +48,19 @@ s! {
pub pw_dir: *mut ::c_char, pub pw_dir: *mut ::c_char,
pub pw_shell: *mut ::c_char, pub pw_shell: *mut ::c_char,
pub pw_expire: ::time_t, pub pw_expire: ::time_t,
#[cfg(not(target_os = "macos"))]
pub pw_fields: ::c_int,
} }
pub struct stack_t { pub struct ifaddrs {
pub ss_sp: *mut ::c_void, pub ifa_next: *mut ifaddrs,
pub ss_size: ::size_t, pub ifa_name: *mut ::c_char,
pub ss_flags: ::c_int, 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
} }
} }
@ -53,17 +69,19 @@ pub const FIOCLEX: c_ulong = 0x20006601;
pub const SA_ONSTACK: ::c_int = 0x0001; pub const SA_ONSTACK: ::c_int = 0x0001;
pub const SA_SIGINFO: ::c_int = 0x0040; pub const SA_SIGINFO: ::c_int = 0x0040;
pub const SIGSTKSZ: ::size_t = 131072;
pub const SIGBUS: ::c_int = 10; pub const SIGBUS: ::c_int = 10;
pub const SIG_SETMASK: ::c_int = 3; pub const SIG_SETMASK: ::c_int = 3;
pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
pub const IPV6_V6ONLY: ::c_int = 27;
extern { extern {
pub fn mincore(addr: *const ::c_void, len: size_t, 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, pub fn sysctlnametomib(name: *const c_char,
mibp: *mut c_int, mibp: *mut ::c_int,
sizep: *mut size_t) sizep: *mut size_t)
-> c_int; -> ::c_int;
pub fn setgroups(ngroups: ::c_int, pub fn setgroups(ngroups: ::c_int,
ptr: *const ::gid_t) -> ::c_int; ptr: *const ::gid_t) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;

View File

@ -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,
}
}

File diff suppressed because it is too large Load Diff

View File

@ -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,
}
}

View File

@ -3,6 +3,25 @@
//! More functions and definitions can be found in the more specific modules //! More functions and definitions can be found in the more specific modules
//! according to the platform in question. //! 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! { s! {
pub struct utimbuf { pub struct utimbuf {
pub actime: time_t, pub actime: time_t,
@ -493,9 +512,6 @@ extern {
buf: *mut ::c_char, buf: *mut ::c_char,
buflen: ::size_t, buflen: ::size_t,
result: *mut *mut passwd) -> ::c_int; 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, pub fn posix_memalign(memptr: *mut *mut ::c_void,
align: ::size_t, align: ::size_t,
size: ::size_t) -> ::c_int; size: ::size_t) -> ::c_int;

View File

@ -14,7 +14,6 @@ pub type ino_t = u32;
pub type ssize_t = i32; pub type ssize_t = i32;
pub type blkcnt_t = i32; pub type blkcnt_t = i32;
pub type blksize_t = i32; pub type blksize_t = i32;
pub type mode_t = u32;
pub type nlink_t = u32; pub type nlink_t = u32;
s! { s! {

View File

@ -4,6 +4,7 @@ pub type useconds_t = u32;
pub type dev_t = u64; pub type dev_t = u64;
pub type socklen_t = u32; pub type socklen_t = u32;
pub type pthread_t = c_ulong; pub type pthread_t = c_ulong;
pub type mode_t = u32;
s! { s! {
pub struct glob_t { pub struct glob_t {
@ -259,6 +260,8 @@ cfg_if! {
newlen: size_t) newlen: size_t)
-> ::c_int; -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::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;
} }
} }
} }

View File

@ -13,8 +13,8 @@ pub type ino_t = u32;
pub type off_t = i32; pub type off_t = i32;
pub type ssize_t = i32; pub type ssize_t = i32;
pub type blkcnt_t = i32; pub type blkcnt_t = i32;
pub type blksize_t = i32; pub type blksize_t = i32;
pub type mode_t = u32;
pub type nlink_t = u32; pub type nlink_t = u32;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;

View File

@ -1,9 +1,9 @@
//! AArch64-specific definitions for 64-bit linux-like values //! AArch64-specific definitions for 64-bit linux-like values
pub type c_char = u8; pub type c_char = u8;
pub type wchar_t = u32;
pub type nlink_t = u32; pub type nlink_t = u32;
pub type blksize_t = i32; pub type blksize_t = i32;
pub type wchar_t = u32;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8; pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8;

View File

@ -11,7 +11,6 @@ pub type intptr_t = i64;
pub type uintptr_t = u64; pub type uintptr_t = u64;
pub type ino_t = u64; pub type ino_t = u64;
pub type off_t = i64; pub type off_t = i64;
pub type mode_t = u32;
pub type ssize_t = i64; pub type ssize_t = i64;
pub type blkcnt_t = i64; pub type blkcnt_t = i64;

View File

@ -1,9 +1,9 @@
//! x86_64-specific definitions for 64-bit linux-like values //! x86_64-specific definitions for 64-bit linux-like values
pub type c_char = i8; pub type c_char = i8;
pub type wchar_t = i32;
pub type nlink_t = u64; pub type nlink_t = u64;
pub type blksize_t = i64; pub type blksize_t = i64;
pub type wchar_t = i32;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;

View File

@ -1,24 +1,6 @@
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 rlim_t = c_ulong;
pub type sa_family_t = u16; pub type sa_family_t = u16;
pub type sighandler_t = size_t; pub type pthread_key_t = ::c_uint;
pub type pthread_key_t = c_uint;
pub enum timezone {} pub enum timezone {}
@ -58,10 +40,10 @@ s! {
} }
pub struct addrinfo { pub struct addrinfo {
pub ai_flags: c_int, pub ai_flags: ::c_int,
pub ai_family: c_int, pub ai_family: ::c_int,
pub ai_socktype: c_int, pub ai_socktype: ::c_int,
pub ai_protocol: c_int, pub ai_protocol: ::c_int,
pub ai_addrlen: socklen_t, pub ai_addrlen: socklen_t,
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
@ -76,53 +58,53 @@ s! {
} }
pub struct sockaddr_ll { pub struct sockaddr_ll {
pub sll_family: c_ushort, pub sll_family: ::c_ushort,
pub sll_protocol: c_ushort, pub sll_protocol: ::c_ushort,
pub sll_ifindex: c_int, pub sll_ifindex: ::c_int,
pub sll_hatype: c_ushort, pub sll_hatype: ::c_ushort,
pub sll_pkttype: c_uchar, pub sll_pkttype: ::c_uchar,
pub sll_halen: c_uchar, pub sll_halen: ::c_uchar,
pub sll_addr: [c_uchar; 8] pub sll_addr: [::c_uchar; 8]
} }
} }
pub const EXIT_FAILURE: c_int = 1; pub const EXIT_FAILURE: ::c_int = 1;
pub const EXIT_SUCCESS: c_int = 0; pub const EXIT_SUCCESS: ::c_int = 0;
pub const RAND_MAX: c_int = 2147483647; pub const RAND_MAX: ::c_int = 2147483647;
pub const EOF: c_int = -1; pub const EOF: ::c_int = -1;
pub const SEEK_SET: c_int = 0; pub const SEEK_SET: ::c_int = 0;
pub const SEEK_CUR: c_int = 1; pub const SEEK_CUR: ::c_int = 1;
pub const SEEK_END: c_int = 2; pub const SEEK_END: ::c_int = 2;
pub const _IOFBF: c_int = 0; pub const _IOFBF: ::c_int = 0;
pub const _IONBF: c_int = 2; pub const _IONBF: ::c_int = 2;
pub const _IOLBF: c_int = 1; pub const _IOLBF: ::c_int = 1;
pub const F_DUPFD: c_int = 0; pub const F_DUPFD: ::c_int = 0;
pub const F_GETFD: c_int = 1; pub const F_GETFD: ::c_int = 1;
pub const F_SETFD: c_int = 2; pub const F_SETFD: ::c_int = 2;
pub const F_GETFL: c_int = 3; pub const F_GETFL: ::c_int = 3;
pub const F_SETFL: c_int = 4; pub const F_SETFL: ::c_int = 4;
pub const SIGTRAP: c_int = 5; pub const SIGTRAP: ::c_int = 5;
pub const PTHREAD_CREATE_JOINABLE: c_int = 0; pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: c_int = 1; pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
pub const CLOCK_REALTIME: c_int = 0; pub const CLOCK_REALTIME: ::c_int = 0;
pub const CLOCK_MONOTONIC: c_int = 1; pub const CLOCK_MONOTONIC: ::c_int = 1;
pub const RLIMIT_CPU: c_int = 0; pub const RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: c_int = 1; pub const RLIMIT_FSIZE: ::c_int = 1;
pub const RLIMIT_DATA: c_int = 2; pub const RLIMIT_DATA: ::c_int = 2;
pub const RLIMIT_STACK: c_int = 3; pub const RLIMIT_STACK: ::c_int = 3;
pub const RLIMIT_CORE: c_int = 4; pub const RLIMIT_CORE: ::c_int = 4;
pub const RLIMIT_LOCKS: c_int = 10; pub const RLIMIT_LOCKS: ::c_int = 10;
pub const RLIMIT_SIGPENDING: c_int = 11; pub const RLIMIT_SIGPENDING: ::c_int = 11;
pub const RLIMIT_MSGQUEUE: c_int = 12; pub const RLIMIT_MSGQUEUE: ::c_int = 12;
pub const RLIMIT_NICE: c_int = 13; pub const RLIMIT_NICE: ::c_int = 13;
pub const RLIMIT_RTPRIO: c_int = 14; pub const RLIMIT_RTPRIO: ::c_int = 14;
pub const RUSAGE_SELF: c_int = 0; pub const RUSAGE_SELF: ::c_int = 0;
pub const O_RDONLY: ::c_int = 0; pub const O_RDONLY: ::c_int = 0;
pub const O_WRONLY: ::c_int = 1; pub const O_WRONLY: ::c_int = 1;
@ -289,6 +271,9 @@ pub const TCP_INFO: ::c_int = 11;
pub const TCP_QUICKACK: ::c_int = 12; pub const TCP_QUICKACK: ::c_int = 12;
pub const TCP_CONGESTION: ::c_int = 13; 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 SO_DEBUG: ::c_int = 1;
pub const SHUT_RD: ::c_int = 0; pub const SHUT_RD: ::c_int = 0;