Skip to content

Merging a number of PRs into one #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Jan 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c618f36
add openbsd support to libc-test
semarie Dec 21, 2015
9e87079
there are no `pw_fields` in `struct passwd` under openbsd
semarie Dec 21, 2015
15cb336
move Dl_info struct per system
semarie Dec 21, 2015
85008bd
drop undefined constants under openbsd
semarie Dec 21, 2015
27fd4f8
rename syscalls constants to follow name under openbsd
semarie Dec 21, 2015
040976b
change proto (uint -> int) for pthread_*_np() functions
semarie Dec 21, 2015
3465481
more proto change on openbsd
semarie Dec 21, 2015
5f75552
change proto for getnameinfo()
semarie Dec 21, 2015
c5eadb3
remove backtrace() prototype that don't exists under
semarie Dec 21, 2015
d732678
change type size to match openbsd C
semarie Dec 21, 2015
b1a108c
change sign for `blksize_t` type under openbsd
semarie Dec 21, 2015
6dc3868
use proper type of si_addr in siginfo_t
semarie Dec 21, 2015
0f8571b
properly define SIGSTKSZ under openbsd
semarie Dec 21, 2015
3de62ef
define TMP_MAX differently for openbsdlike
semarie Dec 21, 2015
ee8c050
define NI_MAXHOST per system
semarie Dec 21, 2015
6b84742
provide getentropy(2) instead of SYS_entropy
semarie Dec 22, 2015
6c8a63a
keep openbsd name for dirent field member
semarie Dec 23, 2015
9d2493e
Add poll API
diwic Dec 25, 2015
2cdb21e
Use docker for MIPS
Dec 25, 2015
52f4f39
Add SO_REUSEPORT for Android
SimonSapin Nov 22, 2015
0a64d24
Add ioctl constants
richard-uk1 Dec 30, 2015
6ac75c1
Fix mips fallout on new toolchain
Dec 27, 2015
0b102fd
android has `posix_memalign` for API 16+ since NDK r10d
tamird Jan 6, 2016
0e67fab
Merge branch 'openbsd-cleanup' of https://github.com/semarie/libc int…
alexcrichton Jan 10, 2016
fc1b0ad
Merge branch 'master' of https://github.com/diwic/libc into merge
alexcrichton Jan 10, 2016
4506d29
Merge branch 'mips3' of https://github.com/polachok/libc into merge
alexcrichton Jan 10, 2016
a5d830a
Move docker container and don't re-symlink mips compilers
alexcrichton Jan 10, 2016
0422dba
Merge branch 'add_ioctl_constants' of https://github.com/derekdreery/…
alexcrichton Jan 10, 2016
2d05930
Merge branch 'android-posix-memalign' of https://github.com/tamird/li…
alexcrichton Jan 10, 2016
6cf54d5
Fix constant values for MIPS
alexcrichton Jan 11, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ matrix:
env: TARGET=arm-unknown-linux-gnueabihf
rust: nightly
- os: linux
env: TARGET=mips-unknown-linux-gnu
env: TARGET=mips-unknown-linux-gnu DOCKER=alexcrichton/rust-libc-mips:2016-01-10
rust: nightly
- os: linux
env: TARGET=aarch64-unknown-linux-gnu
Expand Down
2 changes: 1 addition & 1 deletion ci/cargo-config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ linker = "arm-linux-androideabi-gcc"
linker = "arm-linux-gnueabihf-gcc-4.7"

[target.mips-unknown-linux-gnu]
linker = "mips-linux-gnu-gcc"
linker = "mips-linux-gnu-gcc-5"

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
12 changes: 12 additions & 0 deletions ci/mips/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:15.10

RUN apt-get update
RUN apt-get install -y --force-yes --no-install-recommends \
software-properties-common
RUN add-apt-repository ppa:angelsl/mips-cross
RUN apt-get update
RUN apt-get install -y --force-yes --no-install-recommends \
gcc-5-mips-linux-gnu libc6-dev-mips-cross \
gcc-5-mipsel-linux-gnu libc6-dev-mipsel-cross
RUN apt-get install -y --force-yes --no-install-recommends \
build-essential qemu-user
29 changes: 14 additions & 15 deletions ci/run-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ if [ "$TRAVIS" = "true" ]; then
;;

*)
# Download the rustlib folder from the relevant portion of main distribution's
# tarballs.
# Download the rustlib folder from the relevant portion of main
# distribution's tarballs.
dir=rust-std-$TARGET
pkg=rust-std
if [ "$TRAVIS_RUST_VERSION" = "1.0.0" ]; then
Expand All @@ -58,12 +58,24 @@ fi
# travis has (sharing it via `-v`) and otherwise the tests run entirely within
# the container.
if [ "$DOCKER" != "" ]; then
args=""

case "$TARGET" in
mips-unknown-linux-gnu)
args="$args -e CC=mips-linux-gnu-gcc-5"
;;

*)
;;
esac

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 \
$args \
-w /checkout \
-it $DOCKER \
ci/run.sh $TARGET
Expand All @@ -88,19 +100,6 @@ case "$TARGET" in
*-apple-ios)
;;

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
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
;;

*)
# clang has better error messages and implements alignof more broadly
export CC=clang
Expand Down
2 changes: 1 addition & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ case "$TARGET" in
;;

mips-unknown-linux-gnu)
qemu-mips -L /usr/mips-linux-gnu libc-test/target/$TARGET/debug/libc-test
qemu-mips -L /usr/mips-linux-gnu /tmp/$TARGET/debug/libc-test
;;

aarch64-unknown-linux-gnu)
Expand Down
24 changes: 20 additions & 4 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ fn main() {
let freebsd = target.contains("freebsd");
let mips = target.contains("mips");
let netbsd = target.contains("netbsd");
let openbsd = target.contains("openbsd");
let rumprun = target.contains("rumprun");
let bsdlike = freebsd || apple || netbsd;
let bsdlike = freebsd || apple || netbsd || openbsd;
let mut cfg = ctest::TestGenerator::new();

// Pull in extra goodies on linux/mingw
Expand Down Expand Up @@ -61,6 +62,9 @@ fn main() {
} else {
cfg.header("ctype.h");
cfg.header("dirent.h");
if openbsd {
cfg.header("sys/socket.h");
}
cfg.header("net/if.h");
cfg.header("netdb.h");
cfg.header("netinet/in.h");
Expand Down Expand Up @@ -88,6 +92,7 @@ fn main() {
cfg.header("sys/uio.h");
cfg.header("sched.h");
cfg.header("termios.h");
cfg.header("poll.h");
}

if android {
Expand All @@ -96,13 +101,15 @@ fn main() {
} else if !windows {
cfg.header("glob.h");
cfg.header("ifaddrs.h");
cfg.header("sys/quota.h");
if !openbsd {
cfg.header("sys/quota.h");
}
cfg.header("sys/statvfs.h");

if !musl {
cfg.header("sys/sysctl.h");

if !netbsd {
if !netbsd && !openbsd {
cfg.header("execinfo.h");
}
}
Expand Down Expand Up @@ -161,6 +168,13 @@ fn main() {
cfg.header("sys/ioctl_compat.h");
}

if openbsd {
cfg.header("ufs/ufs/quota.h");
cfg.header("rpcsvc/rex.h");
cfg.header("pthread_np.h");
cfg.header("sys/syscall.h");
}

cfg.type_name(move |ty, is_struct| {
match ty {
// Just pass all these through, no need for a "struct" prefix
Expand Down Expand Up @@ -200,6 +214,8 @@ fn main() {
let target2 = target.clone();
cfg.field_name(move |struct_, field| {
match field {
"st_birthtime" if openbsd && struct_ == "stat" => "__st_birthtime".to_string(),
"st_birthtime_nsec" if openbsd && struct_ == "stat" => "__st_birthtimensec".to_string(),
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
Expand Down Expand Up @@ -303,7 +319,7 @@ fn main() {
"strerror_r" if linux => true, // actually xpg-something-or-other

// typed 2nd arg on linux and android
"gettimeofday" if linux || android || freebsd => true,
"gettimeofday" if linux || android || freebsd || openbsd => true,

// not declared in newer android toolchains
"getdtablesize" if android => true,
Expand Down
9 changes: 9 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,16 @@ pub const VT1: ::c_int = 0x00010000;
pub const IUTF8: ::tcflag_t = 0x00004000;
pub const CRTSCTS: ::tcflag_t = 0x00030000;

pub const NI_MAXHOST: ::socklen_t = 1025;

extern {
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
hostlen: ::socklen_t,
serv: *mut ::c_char,
sevlen: ::socklen_t,
flags: ::c_int) -> ::c_int;
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
pub fn sysctlnametomib(name: *const ::c_char,
Expand Down
9 changes: 9 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,16 @@ pub const ST_NOSUID: ::c_ulong = 2;

pub const HW_AVAILCPU: ::c_int = 25;

pub const NI_MAXHOST: ::size_t = 1025;

extern {
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
hostlen: ::size_t,
serv: *mut ::c_char,
servlen: ::size_t,
flags: ::c_int) -> ::c_int;
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
pub fn sysctlnametomib(name: *const ::c_char,
Expand Down
13 changes: 3 additions & 10 deletions src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub type blkcnt_t = i64;
pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type pthread_t = ::uintptr_t;
pub type nfds_t = ::c_uint;

s! {
pub struct sockaddr {
Expand Down Expand Up @@ -43,7 +44,8 @@ s! {

#[cfg(not(any(target_os = "macos",
target_os = "ios",
target_os = "netbsd")))]
target_os = "netbsd",
target_os = "openbsd")))]
pub pw_fields: ::c_int,
}

Expand Down Expand Up @@ -146,8 +148,6 @@ pub const IPV6_V6ONLY: ::c_int = 27;

pub const ST_RDONLY: ::c_ulong = 1;

pub const NI_MAXHOST: ::socklen_t = 1025;

pub const CTL_HW: ::c_int = 6;
pub const HW_NCPU: ::c_int = 3;

Expand Down Expand Up @@ -321,13 +321,6 @@ extern {
pub fn setgroups(ngroups: ::c_int,
ptr: *const ::gid_t) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
hostlen: ::socklen_t,
serv: *mut ::c_char,
sevlen: ::socklen_t,
flags: ::c_int) -> ::c_int;
pub fn kqueue() -> ::c_int;
pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int;
pub fn syscall(num: ::c_int, ...) -> ::c_int;
Expand Down
18 changes: 18 additions & 0 deletions src/unix/bsd/openbsdlike/bitrig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ s! {
pub si_errno: ::c_int,
pub si_addr: *mut ::c_void
}

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 const O_CLOEXEC: ::c_int = 0x10000;
Expand Down Expand Up @@ -208,7 +215,18 @@ pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
pub const HW_AVAILCPU: ::c_int = 25;
pub const KERN_PROC_ARGS: ::c_int = 55;

pub const TMP_MAX : ::c_uint = 0x7fffffff;

pub const NI_MAXHOST: ::size_t = 256;

extern {
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
hostlen: ::size_t,
serv: *mut ::c_char,
servlen: ::size_t,
flags: ::c_int) -> ::c_int;
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
pub fn sysctl(name: *mut ::c_int,
Expand Down
13 changes: 2 additions & 11 deletions src/unix/bsd/openbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ s! {
pub ss_flags: ::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: *const ::c_void,
}

pub struct sockaddr_in {
pub sin_len: u8,
pub sin_family: ::sa_family_t,
Expand Down Expand Up @@ -64,7 +57,6 @@ 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;
Expand Down Expand Up @@ -368,13 +360,12 @@ extern {
#[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
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 pthread_main_np() -> ::c_uint;
pub fn pthread_main_np() -> ::c_int;
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;
sinfo: *mut ::stack_t) -> ::c_int;
pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
}

Expand Down
18 changes: 18 additions & 0 deletions src/unix/bsd/openbsdlike/netbsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ s! {
pub dqb_btime: ::int32_t,
pub dqb_itime: ::int32_t,
}

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 const O_CLOEXEC: ::c_int = 0x400000;
Expand Down Expand Up @@ -313,7 +320,18 @@ pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;

pub const CRTSCTS: ::tcflag_t = 0x00010000;

pub const TMP_MAX : ::c_uint = 308915776;

pub const NI_MAXHOST: ::socklen_t = 1025;

extern {
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
hostlen: ::socklen_t,
serv: *mut ::c_char,
sevlen: ::socklen_t,
flags: ::c_int) -> ::c_int;
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
pub fn sysctl(name: *const ::c_int,
Expand Down
Loading