diff --git a/.travis.yml b/.travis.yml index 0608b666..333fb225 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/ci/cargo-config b/ci/cargo-config index e738f189..41e232e5 100644 --- a/ci/cargo-config +++ b/ci/cargo-config @@ -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" diff --git a/ci/mips/Dockerfile b/ci/mips/Dockerfile new file mode 100644 index 00000000..6da6f684 --- /dev/null +++ b/ci/mips/Dockerfile @@ -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 diff --git a/ci/run-travis.sh b/ci/run-travis.sh index b7a50b77..75ce8ba1 100644 --- a/ci/run-travis.sh +++ b/ci/run-travis.sh @@ -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 @@ -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 @@ -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 diff --git a/ci/run.sh b/ci/run.sh index ee08bc3b..14985be9 100644 --- a/ci/run.sh +++ b/ci/run.sh @@ -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) diff --git a/libc-test/build.rs b/libc-test/build.rs index f94f7051..f425624d 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -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 @@ -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"); @@ -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 { @@ -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"); } } @@ -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 @@ -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") => { @@ -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, diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 378fc4b7..406acd10 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -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, diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 508fc6b7..d41829ce 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -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, diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 144240d4..14afc347 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -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 { @@ -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, } @@ -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; @@ -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; diff --git a/src/unix/bsd/openbsdlike/bitrig.rs b/src/unix/bsd/openbsdlike/bitrig.rs index e7b0f59c..ecb0bfda 100644 --- a/src/unix/bsd/openbsdlike/bitrig.rs +++ b/src/unix/bsd/openbsdlike/bitrig.rs @@ -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; @@ -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, diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs index 85a77dc9..72d681c8 100644 --- a/src/unix/bsd/openbsdlike/mod.rs +++ b/src/unix/bsd/openbsdlike/mod.rs @@ -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, @@ -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; @@ -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; } diff --git a/src/unix/bsd/openbsdlike/netbsd.rs b/src/unix/bsd/openbsdlike/netbsd.rs index fd3b8c81..f2a10f4c 100644 --- a/src/unix/bsd/openbsdlike/netbsd.rs +++ b/src/unix/bsd/openbsdlike/netbsd.rs @@ -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; @@ -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, diff --git a/src/unix/bsd/openbsdlike/openbsd.rs b/src/unix/bsd/openbsdlike/openbsd.rs index 28e7a4fe..fddde450 100644 --- a/src/unix/bsd/openbsdlike/openbsd.rs +++ b/src/unix/bsd/openbsdlike/openbsd.rs @@ -2,9 +2,9 @@ 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 blksize_t = ::int32_t; +pub type fsblkcnt_t = ::uint64_t; +pub type fsfilcnt_t = ::uint64_t; pub type pthread_attr_t = *mut ::c_void; pub type pthread_mutex_t = *mut ::c_void; pub type pthread_mutexattr_t = *mut ::c_void; @@ -17,7 +17,7 @@ s! { pub d_off: ::off_t, pub d_reclen: u16, pub d_type: u8, - pub d_namelen: u8, + pub d_namlen: u8, __d_padding: [u8; 4], pub d_name: [::c_char; 256], } @@ -99,8 +99,15 @@ s! { pub si_signo: ::c_int, pub si_code: ::c_int, pub si_errno: ::c_int, - pub si_addr: *mut ::c_void, - __pad: [u8; 116], + pub si_addr: *mut ::c_char, + __pad: [u8; 108], + } + + 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, } } @@ -140,9 +147,6 @@ 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; @@ -197,7 +201,7 @@ 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 SIGSTKSZ: ::size_t = 40960; pub const FD_SETSIZE: usize = 1024; @@ -208,26 +212,28 @@ 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 HW_AVAILCPU: ::c_int = 25; pub const KERN_PROC_ARGS: ::c_int = 55; -// syscall numbers -pub const NR_GETENTROPY: ::c_int = 7; +pub const TMP_MAX : ::c_uint = 0x7fffffff; + +pub const NI_MAXHOST: ::size_t = 256; extern { - pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) + 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: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; - pub fn sysctl(name: *mut ::c_int, + pub fn sysctl(name: *const ::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 getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; } diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 4060b4ee..ee3a9745 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -91,6 +91,12 @@ s! { pub iov_base: *mut ::c_void, pub iov_len: ::size_t, } + + pub struct pollfd { + pub fd: ::c_int, + pub events: ::c_short, + pub revents: ::c_short, + } } pub const WNOHANG: ::c_int = 1; @@ -117,6 +123,13 @@ pub const S_ISUID: ::c_int = 0x800; pub const S_ISGID: ::c_int = 0x400; pub const S_ISVTX: ::c_int = 0x200; +pub const POLLIN: ::c_short = 0x1; +pub const POLLPRI: ::c_short = 0x2; +pub const POLLOUT: ::c_short = 0x4; +pub const POLLERR: ::c_short = 0x8; +pub const POLLHUP: ::c_short = 0x10; +pub const POLLNVAL: ::c_short = 0x20; + cfg_if! { if #[cfg(feature = "default")] { // cargo build, don't pull in anything extra as the libstd dep @@ -281,6 +294,9 @@ extern { link_name = "pause$UNIX2003")] pub fn pause() -> ::c_int; pub fn pipe(fds: *mut ::c_int) -> ::c_int; + pub fn posix_memalign(memptr: *mut *mut ::c_void, + align: ::size_t, + size: ::size_t) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "read$UNIX2003")] pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) @@ -548,6 +564,9 @@ extern { #[cfg_attr(all(target_os = "macos", target_arch = "x86"), link_name = "recvmsg$UNIX2003")] pub fn recvmsg(fd: ::c_int, msg: *mut msghdr, flags: ::c_int) -> ::ssize_t; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "poll$UNIX2003")] + pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; } // TODO: get rid of this #[cfg(not(...))] @@ -608,9 +627,6 @@ extern { buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut passwd) -> ::c_int; - 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")] diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index f00cebd0..91813754 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -22,6 +22,7 @@ pub type sigset_t = c_ulong; pub type time64_t = i64; pub type fsfilcnt_t = ::c_ulong; pub type fsblkcnt_t = ::c_ulong; +pub type nfds_t = ::c_uint; s! { pub struct stat { @@ -373,6 +374,7 @@ pub const SO_RCVBUF: ::c_int = 8; pub const SO_KEEPALIVE: ::c_int = 9; pub const SO_OOBINLINE: ::c_int = 10; pub const SO_LINGER: ::c_int = 13; +pub const SO_REUSEPORT: ::c_int = 15; pub const SO_RCVLOWAT: ::c_int = 18; pub const SO_SNDLOWAT: ::c_int = 19; pub const SO_RCVTIMEO: ::c_int = 20; @@ -395,10 +397,7 @@ pub const O_NDELAY: ::c_int = 0x800; pub const NI_MAXHOST: ::size_t = 1025; pub const NCCS: usize = 19; -pub const TCXONC: ::c_int = 0x540A; -pub const TCFLSH: ::c_int = 0x540B; pub const TCSBRKP: ::c_int = 0x5425; -pub const TCGETS: ::c_int = 0x5401; pub const TCSANOW: ::c_int = 0; pub const TCSADRAIN: ::c_int = 0x1; pub const TCSAFLUSH: ::c_int = 0x2; @@ -473,6 +472,38 @@ pub const F_GETLK: ::c_int = 5; pub const F_GETOWN: ::c_int = 9; pub const F_SETOWN: ::c_int = 8; +pub const TCGETS: ::c_int = 0x5401; +pub const TCSETS: ::c_int = 0x5402; +pub const TCSETSW: ::c_int = 0x5403; +pub const TCSETSF: ::c_int = 0x5404; +pub const TCGETA: ::c_int = 0x5405; +pub const TCSETA: ::c_int = 0x5406; +pub const TCSETAW: ::c_int = 0x5407; +pub const TCSETAF: ::c_int = 0x5408; +pub const TCSBRK: ::c_int = 0x5409; +pub const TCXONC: ::c_int = 0x540A; +pub const TCFLSH: ::c_int = 0x540B; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCINQ: ::c_int = 0x541B; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCGPGRP: ::c_int = 0x540F; +pub const TIOCSPGRP: ::c_int = 0x5410; +pub const TIOCOUTQ: ::c_int = 0x5411; +pub const TIOCSTI: ::c_int = 0x5412; +pub const TIOCGWINSZ: ::c_int = 0x5413; +pub const TIOCSWINSZ: ::c_int = 0x5414; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMSET: ::c_int = 0x5418; +pub const FIONREAD: ::c_int = 0x541B; +pub const TIOCCONS: ::c_int = 0x541D; + f! { pub fn sigemptyset(set: *mut sigset_t) -> ::c_int { *set = 0; @@ -508,7 +539,7 @@ f! { return 0 } pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int { - ioctl(fd, TCGETS, termios) + ioctl(fd, ::TCGETS, termios) } pub fn tcsetattr(fd: ::c_int, optional_actions: ::c_int, @@ -516,10 +547,10 @@ f! { ioctl(fd, optional_actions, termios) } pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int { - ioctl(fd, TCXONC, action as *mut ::c_void) + ioctl(fd, ::TCXONC, action as *mut ::c_void) } pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int { - ioctl(fd, TCFLSH, action as *mut ::c_void) + ioctl(fd, ::TCFLSH, action as *mut ::c_void) } pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int { ioctl(fd, TCSBRKP, duration as *mut ::c_void) diff --git a/src/unix/notbsd/linux/mips.rs b/src/unix/notbsd/linux/mips.rs index 41f17368..2a1dc926 100644 --- a/src/unix/notbsd/linux/mips.rs +++ b/src/unix/notbsd/linux/mips.rs @@ -63,7 +63,7 @@ s! { } pub struct sigaction { - pub sa_flags: ::c_uint, + pub sa_flags: ::c_int, pub sa_sigaction: ::sighandler_t, pub sa_mask: sigset_t, _restorer: *mut ::c_void, @@ -190,7 +190,7 @@ pub const RLIMIT_AS: ::c_int = 6; pub const RLIMIT_RSS: ::c_int = 7; pub const RLIMIT_NPROC: ::c_int = 8; pub const RLIMIT_MEMLOCK: ::c_int = 9; -pub const RLIMIT_NLIMITS: ::c_int = 15; +pub const RLIMIT_NLIMITS: ::c_int = 16; pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff; pub const O_APPEND: ::c_int = 8; @@ -198,10 +198,10 @@ pub const O_CREAT: ::c_int = 256; pub const O_EXCL: ::c_int = 1024; pub const O_NOCTTY: ::c_int = 2048; pub const O_NONBLOCK: ::c_int = 128; -pub const O_SYNC: ::c_int = 0x10; -pub const O_RSYNC: ::c_int = 0x10; +pub const O_SYNC: ::c_int = 0x4010; +pub const O_RSYNC: ::c_int = 0x4010; pub const O_DSYNC: ::c_int = 0x10; -pub const O_FSYNC: ::c_int = 0x10; +pub const O_FSYNC: ::c_int = 0x4010; pub const O_ASYNC: ::c_int = 0x1000; pub const O_NDELAY: ::c_int = 0x80; @@ -357,6 +357,7 @@ pub const SIG_UNBLOCK: ::c_int = 0x2; pub const PTHREAD_STACK_MIN: ::size_t = 131072; pub const MS_VERBOSE: ::c_ulong = 0x8000; +pub const MS_RMT_MASK: ::c_ulong = 0x2800051; pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; @@ -431,6 +432,38 @@ pub const F_SETOWN: ::c_int = 24; pub const SFD_NONBLOCK: ::c_int = 0x80; +pub const TCGETS: ::c_ulong = 0x540d; +pub const TCSETS: ::c_ulong = 0x540e; +pub const TCSETSW: ::c_ulong = 0x540f; +pub const TCSETSF: ::c_ulong = 0x5410; +pub const TCGETA: ::c_ulong = 0x5401; +pub const TCSETA: ::c_ulong = 0x5402; +pub const TCSETAW: ::c_ulong = 0x5403; +pub const TCSETAF: ::c_ulong = 0x5404; +pub const TCSBRK: ::c_ulong = 0x5405; +pub const TCXONC: ::c_ulong = 0x5406; +pub const TCFLSH: ::c_ulong = 0x5407; +pub const TIOCGSOFTCAR: ::c_ulong = 0x5481; +pub const TIOCSSOFTCAR: ::c_ulong = 0x5482; +pub const TIOCINQ: ::c_ulong = 0x467f; +pub const TIOCLINUX: ::c_ulong = 0x5483; +pub const TIOCGSERIAL: ::c_ulong = 0x5484; +pub const TIOCEXCL: ::c_ulong = 0x740d; +pub const TIOCNXCL: ::c_ulong = 0x740e; +pub const TIOCSCTTY: ::c_ulong = 0x5480; +pub const TIOCGPGRP: ::c_ulong = 0x40047477; +pub const TIOCSPGRP: ::c_ulong = 0x80047476; +pub const TIOCOUTQ: ::c_ulong = 0x7472; +pub const TIOCSTI: ::c_ulong = 0x5472; +pub const TIOCGWINSZ: ::c_ulong = 0x40087468; +pub const TIOCSWINSZ: ::c_ulong = 0x80087467; +pub const TIOCMGET: ::c_ulong = 0x741d; +pub const TIOCMBIS: ::c_ulong = 0x741b; +pub const TIOCMBIC: ::c_ulong = 0x741c; +pub const TIOCMSET: ::c_ulong = 0x741a; +pub const FIONREAD: ::c_ulong = 0x467f; +pub const TIOCCONS: ::c_ulong = 0x80047478; + extern { pub fn sysctl(name: *mut ::c_int, namelen: ::c_int, @@ -454,7 +487,7 @@ extern { hostlen: ::socklen_t, serv: *mut ::c_char, sevlen: ::socklen_t, - flags: ::c_uint) -> ::c_int; - pub fn eventfd(init: ::c_int, flags: ::c_int) -> ::c_int; + flags: ::c_int) -> ::c_int; + pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; pub fn ptrace(request: ::c_uint, ...) -> ::c_long; } diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 512d5adc..18b7b4f6 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -14,6 +14,7 @@ pub type fsfilcnt_t = ::c_ulong; pub type key_t = ::c_int; pub type shmatt_t = ::c_ulong; pub type mqd_t = ::c_int; +pub type nfds_t = ::c_ulong; pub enum fpos64_t {} // TODO: fill this out with a struct @@ -368,7 +369,6 @@ pub const MS_RELATIME: ::c_ulong = 0x200000; pub const MS_KERNMOUNT: ::c_ulong = 0x400000; pub const MS_I_VERSION: ::c_ulong = 0x800000; pub const MS_STRICTATIME: ::c_ulong = 0x01000000; -pub const MS_RMT_MASK: ::c_ulong = 0x800051; pub const EPOLLRDHUP: ::c_int = 0x2000; pub const EPOLLONESHOT: ::c_int = 0x40000000; diff --git a/src/unix/notbsd/linux/musl.rs b/src/unix/notbsd/linux/musl.rs index 7a244e49..f9cf4e96 100644 --- a/src/unix/notbsd/linux/musl.rs +++ b/src/unix/notbsd/linux/musl.rs @@ -394,6 +394,7 @@ pub const EPOLLWAKEUP: ::c_int = 0x20000000; pub const MS_NOSEC: ::c_ulong = 0x10000000; pub const MS_BORN: ::c_ulong = 0x20000000; +pub const MS_RMT_MASK: ::c_ulong = 0x800051; pub const MADV_HUGEPAGE: ::c_int = 14; pub const MADV_NOHUGEPAGE: ::c_int = 15; @@ -426,6 +427,38 @@ pub const TCSANOW: ::c_int = 0; pub const TCSADRAIN: ::c_int = 1; pub const TCSAFLUSH: ::c_int = 2; +pub const TCGETS: ::c_ulong = 0x5401; +pub const TCSETS: ::c_ulong = 0x5402; +pub const TCSETSW: ::c_ulong = 0x5403; +pub const TCSETSF: ::c_ulong = 0x5404; +pub const TCGETA: ::c_ulong = 0x5405; +pub const TCSETA: ::c_ulong = 0x5406; +pub const TCSETAW: ::c_ulong = 0x5407; +pub const TCSETAF: ::c_ulong = 0x5408; +pub const TCSBRK: ::c_ulong = 0x5409; +pub const TCXONC: ::c_ulong = 0x540A; +pub const TCFLSH: ::c_ulong = 0x540B; +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; +pub const TIOCINQ: ::c_ulong = 0x541B; +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; +pub const TIOCEXCL: ::c_ulong = 0x540C; +pub const TIOCNXCL: ::c_ulong = 0x540D; +pub const TIOCSCTTY: ::c_ulong = 0x540E; +pub const TIOCGPGRP: ::c_ulong = 0x540F; +pub const TIOCSPGRP: ::c_ulong = 0x5410; +pub const TIOCOUTQ: ::c_ulong = 0x5411; +pub const TIOCSTI: ::c_ulong = 0x5412; +pub const TIOCGWINSZ: ::c_ulong = 0x5413; +pub const TIOCSWINSZ: ::c_ulong = 0x5414; +pub const TIOCMGET: ::c_ulong = 0x5415; +pub const TIOCMBIS: ::c_ulong = 0x5416; +pub const TIOCMBIC: ::c_ulong = 0x5417; +pub const TIOCMSET: ::c_ulong = 0x5418; +pub const FIONREAD: ::c_ulong = 0x541B; +pub const TIOCCONS: ::c_ulong = 0x541D; + extern { pub fn getnameinfo(sa: *const ::sockaddr, salen: ::socklen_t, diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index b2d96438..90e3d258 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -284,6 +284,7 @@ pub const ST_RELATIME: ::c_ulong = 4096; pub const NI_MAXHOST: ::socklen_t = 1025; pub const MS_VERBOSE: ::c_ulong = 0x8000; +pub const MS_RMT_MASK: ::c_ulong = 0x800051; pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; @@ -375,6 +376,38 @@ pub const TCSANOW: ::c_int = 0; pub const TCSADRAIN: ::c_int = 1; pub const TCSAFLUSH: ::c_int = 2; +pub const TCGETS: ::c_ulong = 0x5401; +pub const TCSETS: ::c_ulong = 0x5402; +pub const TCSETSW: ::c_ulong = 0x5403; +pub const TCSETSF: ::c_ulong = 0x5404; +pub const TCGETA: ::c_ulong = 0x5405; +pub const TCSETA: ::c_ulong = 0x5406; +pub const TCSETAW: ::c_ulong = 0x5407; +pub const TCSETAF: ::c_ulong = 0x5408; +pub const TCSBRK: ::c_ulong = 0x5409; +pub const TCXONC: ::c_ulong = 0x540A; +pub const TCFLSH: ::c_ulong = 0x540B; +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; +pub const TIOCINQ: ::c_ulong = 0x541B; +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; +pub const TIOCEXCL: ::c_ulong = 0x540C; +pub const TIOCNXCL: ::c_ulong = 0x540D; +pub const TIOCSCTTY: ::c_ulong = 0x540E; +pub const TIOCGPGRP: ::c_ulong = 0x540F; +pub const TIOCSPGRP: ::c_ulong = 0x5410; +pub const TIOCOUTQ: ::c_ulong = 0x5411; +pub const TIOCSTI: ::c_ulong = 0x5412; +pub const TIOCGWINSZ: ::c_ulong = 0x5413; +pub const TIOCSWINSZ: ::c_ulong = 0x5414; +pub const TIOCMGET: ::c_ulong = 0x5415; +pub const TIOCMBIS: ::c_ulong = 0x5416; +pub const TIOCMBIC: ::c_ulong = 0x5417; +pub const TIOCMSET: ::c_ulong = 0x5418; +pub const FIONREAD: ::c_ulong = 0x541B; +pub const TIOCCONS: ::c_ulong = 0x541D; + cfg_if! { if #[cfg(any(target_arch = "arm", target_arch = "x86", target_arch = "x86_64"))] {