diff options
author | Marco A L Barbosa <malbarbo@gmail.com> | 2017-06-20 20:47:41 -0300 |
---|---|---|
committer | Marco A L Barbosa <malbarbo@gmail.com> | 2017-06-20 20:47:41 -0300 |
commit | 7df3af34ff4cc977fcd10ed5f4eed65ad5ecbb32 (patch) | |
tree | eb62094a902a7b3bdad629a4beedc5652738cdfa | |
parent | f22bfe3a66c2469ab606d5fa1134a3ed91873cf3 (diff) | |
parent | 299e3f6e66285d3adfd7d7eb0aa103d38dbd4a39 (diff) | |
download | rust-libc-7df3af34ff4cc977fcd10ed5f4eed65ad5ecbb32.tar.gz |
Merge branch 'master' of https://github.com/rust-lang/libc into emscripten
Conflicts:
Cargo.lock
src/unix/notbsd/linux/mips/mod.rs
-rw-r--r-- | Cargo.lock | 16 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/unix/bsd/apple/mod.rs | 16 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/dragonfly/mod.rs | 8 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/freebsd/mod.rs | 9 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/mod.rs | 20 | ||||
-rw-r--r-- | src/unix/bsd/mod.rs | 16 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/mod.rs | 11 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/mod.rs | 13 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/openbsdlike/mod.rs | 4 | ||||
-rw-r--r-- | src/unix/notbsd/android/mod.rs | 1 | ||||
-rw-r--r-- | src/unix/notbsd/linux/mips/mips32.rs | 53 | ||||
-rw-r--r-- | src/unix/notbsd/linux/mips/mips64.rs | 22 | ||||
-rw-r--r-- | src/unix/notbsd/linux/mips/mod.rs | 66 | ||||
-rw-r--r-- | src/windows.rs | 12 |
15 files changed, 146 insertions, 123 deletions
diff --git a/Cargo.lock b/Cargo.lock index 410b02a802..cd0b7c0f29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,7 +3,7 @@ name = "libc-test" version = "0.1.0" dependencies = [ "ctest 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.23", + "libc 0.2.24", ] [[package]] @@ -16,13 +16,13 @@ name = "ctest" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_syntax 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gcc" -version = "0.3.46" +version = "0.3.51" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -43,11 +43,11 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.23" +version = "0.2.24" [[package]] name = "libc" -version = "0.2.23" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -66,7 +66,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -100,9 +100,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "32866f4d103c4e438b1db1158aa1b1a80ee078e5d77a59a2f906fd62a577389c" "checksum ctest 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4714dea251b5a487400bd9f772810cca11e5fe361e1918805c9f1ce35d177e22" -"checksum gcc 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "181e3cebba1d663bd92eb90e2da787e10597e027eb00de8d742b260a7850948f" +"checksum gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)" = "120d07f202dcc3f72859422563522b66fe6463a4c513df062874daad05f85f0a" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)" = "e7eb6b826bfc1fdea7935d46556250d1799b7fe2d9f7951071f4291710665e3e" +"checksum libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)" = "38f5c2b18a287cf78b4097db62e20f43cace381dc76ae5c0a3073067f78b7ddc" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum syntex_syntax 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = "82b078749c05271b2aebae7230331c903c38128d5a3dec72625d9e3a411a5b69" diff --git a/Cargo.toml b/Cargo.toml index 3914fd6aa8..ecebaed935 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libc" -version = "0.2.23" +version = "0.2.24" authors = ["The Rust Project Developers"] license = "MIT/Apache-2.0" readme = "README.md" diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 148188b107..44e935e378 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -448,14 +448,8 @@ pub const _PC_PIPE_BUF: ::c_int = 6; pub const _PC_CHOWN_RESTRICTED: ::c_int = 7; pub const _PC_NO_TRUNC: ::c_int = 8; pub const _PC_VDISABLE: ::c_int = 9; -pub const O_RDONLY: ::c_int = 0; -pub const O_WRONLY: ::c_int = 1; -pub const O_RDWR: ::c_int = 2; -pub const O_APPEND: ::c_int = 8; -pub const O_CREAT: ::c_int = 512; -pub const O_EXCL: ::c_int = 2048; -pub const O_NOCTTY: ::c_int = 131072; -pub const O_TRUNC: ::c_int = 1024; +pub const O_DSYNC: ::c_int = 0x400000; +pub const O_NOCTTY: ::c_int = 0x20000; pub const O_CLOEXEC: ::c_int = 0x1000000; pub const O_DIRECTORY: ::c_int = 0x100000; pub const S_IFIFO: mode_t = 4096; @@ -671,8 +665,6 @@ pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x0020; pub const AT_SYMLINK_FOLLOW: ::c_int = 0x0040; pub const AT_REMOVEDIR: ::c_int = 0x0080; -pub const O_ACCMODE: ::c_int = 3; - pub const TIOCMODG: ::c_ulong = 0x40047403; pub const TIOCMODS: ::c_ulong = 0x80047404; pub const TIOCM_LE: ::c_int = 0x1; @@ -1024,10 +1016,6 @@ pub const LOCK_EX: ::c_int = 2; pub const LOCK_NB: ::c_int = 4; pub const LOCK_UN: ::c_int = 8; -pub const O_DSYNC: ::c_int = 4194304; -pub const O_SYNC: ::c_int = 128; -pub const O_NONBLOCK: ::c_int = 4; - pub const MAP_COPY: ::c_int = 0x0002; pub const MAP_RENAME: ::c_int = 0x0020; pub const MAP_NORESERVE: ::c_int = 0x0040; diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index e60825a522..889e77f0ce 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -138,6 +138,7 @@ pub const PTHREAD_STACK_MIN: ::size_t = 1024; pub const SIGSTKSZ: ::size_t = 40960; pub const MADV_INVAL: ::c_int = 10; pub const O_CLOEXEC: ::c_int = 0x00020000; +pub const O_DIRECTORY: ::c_int = 0x08000000; pub const F_GETLK: ::c_int = 7; pub const F_SETLK: ::c_int = 8; pub const F_SETLKW: ::c_int = 9; @@ -404,6 +405,13 @@ pub const TIOCMODG: ::c_uint = 0x40047403; pub const TIOCMODS: ::c_ulong = 0x80047404; pub const TIOCREMOTE: ::c_ulong = 0x80047469; +// Constants used by "at" family of system calls. +pub const AT_FDCWD: ::c_int = 0xFFFAFDCD; // invalid file descriptor +pub const AT_SYMLINK_NOFOLLOW: ::c_int = 1; +pub const AT_REMOVEDIR: ::c_int = 2; +pub const AT_EACCESS: ::c_int = 4; +pub const AT_SYMLINK_FOLLOW: ::c_int = 8; + extern { pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index fb113ded33..fa32eefb40 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -139,6 +139,9 @@ pub const SF_NODISKIO: ::c_int = 0x00000001; pub const SF_MNOWAIT: ::c_int = 0x00000002; pub const SF_SYNC: ::c_int = 0x00000004; pub const O_CLOEXEC: ::c_int = 0x00100000; +pub const O_DIRECTORY: ::c_int = 0x00020000; +pub const O_EXEC: ::c_int = 0x00040000; +pub const O_TTY_INIT: ::c_int = 0x00080000; pub const F_GETLK: ::c_int = 11; pub const F_SETLK: ::c_int = 12; pub const F_SETLKW: ::c_int = 13; @@ -508,6 +511,12 @@ pub const P_ALL: idtype_t = 7; pub const B460800: ::speed_t = 460800; pub const B921600: ::speed_t = 921600; +pub const AT_FDCWD: ::c_int = -100; +pub const AT_EACCESS: ::c_int = 0x100; +pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200; +pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; +pub const AT_REMOVEDIR: ::c_int = 0x800; + extern { pub fn __error() -> *mut ::c_int; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 4e635ffbfd..e1e75996a4 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -272,15 +272,9 @@ pub const FILENAME_MAX: ::c_uint = 1024; pub const L_tmpnam: ::c_uint = 1024; pub const TMP_MAX: ::c_uint = 308915776; -pub const O_RDONLY: ::c_int = 0; -pub const O_WRONLY: ::c_int = 1; -pub const O_RDWR: ::c_int = 2; -pub const O_ACCMODE: ::c_int = 3; -pub const O_APPEND: ::c_int = 8; -pub const O_CREAT: ::c_int = 512; -pub const O_EXCL: ::c_int = 2048; pub const O_NOCTTY: ::c_int = 32768; -pub const O_TRUNC: ::c_int = 1024; +pub const O_DIRECT: ::c_int = 0x00010000; + pub const S_IFIFO: mode_t = 4096; pub const S_IFCHR: mode_t = 8192; pub const S_IFBLK: mode_t = 24576; @@ -452,11 +446,6 @@ pub const F_SETFD: ::c_int = 2; pub const F_GETFL: ::c_int = 3; pub const F_SETFL: ::c_int = 4; -pub const AT_EACCESS: ::c_int = 0x100; -pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200; -pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; -pub const AT_REMOVEDIR: ::c_int = 0x800; - pub const SIGTRAP: ::c_int = 5; pub const GLOB_APPEND : ::c_int = 0x0001; @@ -687,9 +676,6 @@ pub const LOCK_EX: ::c_int = 2; pub const LOCK_NB: ::c_int = 4; pub const LOCK_UN: ::c_int = 8; -pub const O_SYNC: ::c_int = 128; -pub const O_NONBLOCK: ::c_int = 4; - pub const MAP_COPY: ::c_int = 0x0002; pub const MAP_RENAME: ::c_int = 0x0020; pub const MAP_NORESERVE: ::c_int = 0x0040; @@ -876,8 +862,6 @@ pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t; pub const CRTSCTS: ::tcflag_t = 0x00030000; -pub const AT_FDCWD: ::c_int = -100; - f! { pub fn WIFCONTINUED(status: ::c_int) -> bool { status == 0x13 diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index deddca042d..e14b5b5f65 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -187,10 +187,22 @@ pub const ST_RDONLY: ::c_ulong = 1; pub const NCCS: usize = 20; +pub const O_ACCMODE: ::c_int = 0x3; +pub const O_RDONLY: ::c_int = 0; +pub const O_WRONLY: ::c_int = 1; +pub const O_RDWR: ::c_int = 2; +pub const O_APPEND: ::c_int = 8; +pub const O_CREAT: ::c_int = 512; +pub const O_TRUNC: ::c_int = 1024; +pub const O_EXCL: ::c_int = 2048; pub const O_ASYNC: ::c_int = 0x40; -pub const O_FSYNC: ::c_int = 0x80; -pub const O_NDELAY: ::c_int = 0x4; +pub const O_SYNC: ::c_int = 0x80; +pub const O_NONBLOCK: ::c_int = 0x4; pub const O_NOFOLLOW: ::c_int = 0x100; +pub const O_SHLOCK: ::c_int = 0x10; +pub const O_EXLOCK: ::c_int = 0x20; +pub const O_FSYNC: ::c_int = O_SYNC; +pub const O_NDELAY: ::c_int = O_NONBLOCK; pub const F_GETOWN: ::c_int = 5; pub const F_SETOWN: ::c_int = 6; diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 1471e6f384..32991e84ff 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -127,16 +127,7 @@ 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 O_RDONLY : ::c_int = 0; -pub const O_WRONLY : ::c_int = 1; -pub const O_RDWR : ::c_int = 2; -pub const O_ACCMODE : ::c_int = 3; -pub const O_APPEND : ::c_int = 8; -pub const O_CREAT : ::c_int = 512; -pub const O_EXCL : ::c_int = 2048; pub const O_NOCTTY : ::c_int = 32768; -pub const O_TRUNC : ::c_int = 1024; -pub const 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; @@ -478,8 +469,6 @@ pub const LOCK_EX: ::c_int = 2; pub const LOCK_NB: ::c_int = 4; pub const LOCK_UN: ::c_int = 8; -pub const O_NONBLOCK : ::c_int = 4; - pub const IPPROTO_RAW : ::c_int = 255; pub const _SC_ARG_MAX : ::c_int = 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 053a2b424c..47e077ebcc 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -270,9 +270,9 @@ pub const O_CLOEXEC: ::c_int = 0x400000; pub const O_ALT_IO: ::c_int = 0x40000; pub const O_NOSIGPIPE: ::c_int = 0x1000000; pub const O_SEARCH: ::c_int = 0x800000; -pub const O_EXLOCK: ::c_int = 0x20; -pub const O_SHLOCK: ::c_int = 0x10; pub const O_DIRECTORY: ::c_int = 0x200000; +pub const O_DIRECT : ::c_int = 0x00080000; +pub const O_RSYNC : ::c_int = 0x00020000; pub const MS_SYNC : ::c_int = 0x4; pub const MS_INVALIDATE : ::c_int = 0x2; @@ -644,6 +644,15 @@ pub const P_PGID: idtype_t = 4; pub const B460800: ::speed_t = 460800; pub const B921600: ::speed_t = 921600; +// dirfd() is a macro on netbsd to access +// the first field of the struct where dirp points to: +// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36 +f! { + pub fn dirfd(dirp: *mut ::DIR) -> ::c_int { + unsafe { *(dirp as *const ::c_int) } + } +} + extern { pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; diff --git a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs index 76e458c475..88fbc418df 100644 --- a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs @@ -1,3 +1,5 @@ +use unix::bsd::O_SYNC; + pub type clock_t = i64; pub type suseconds_t = ::c_long; pub type dev_t = i32; @@ -140,6 +142,8 @@ pub const UT_LINESIZE: usize = 8; pub const UT_HOSTSIZE: usize = 256; pub const O_CLOEXEC: ::c_int = 0x10000; +pub const O_DIRECTORY: ::c_int = 0x20000; +pub const O_RSYNC: ::c_int = O_SYNC; pub const MS_SYNC : ::c_int = 0x0002; pub const MS_INVALIDATE : ::c_int = 0x0004; diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index af8c51c9cb..3b4b49e478 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -174,6 +174,7 @@ pub const SA_RESTART: ::c_int = 0x10000000; pub const SA_NOCLDSTOP: ::c_int = 0x00000001; pub const EPOLL_CLOEXEC: ::c_int = 0x80000; +pub const EPOLLONESHOT: ::c_int = 0x40000000; pub const EFD_CLOEXEC: ::c_int = 0x80000; diff --git a/src/unix/notbsd/linux/mips/mips32.rs b/src/unix/notbsd/linux/mips/mips32.rs index 042495e70e..59c2486efe 100644 --- a/src/unix/notbsd/linux/mips/mips32.rs +++ b/src/unix/notbsd/linux/mips/mips32.rs @@ -10,9 +10,6 @@ pub type ino_t = u32; pub type blkcnt_t = i32; pub type blksize_t = i32; pub type nlink_t = u32; -pub type fsblkcnt_t = ::c_ulong; -pub type fsfilcnt_t = ::c_ulong; -pub type rlim_t = c_ulong; s! { pub struct aiocb { @@ -107,19 +104,6 @@ s! { pub _pad: [::c_int; 29], } - pub struct glob64_t { - pub gl_pathc: ::size_t, - pub gl_pathv: *mut *mut ::c_char, - pub gl_offs: ::size_t, - pub gl_flags: ::c_int, - - __unused1: *mut ::c_void, - __unused2: *mut ::c_void, - __unused3: *mut ::c_void, - __unused4: *mut ::c_void, - __unused5: *mut ::c_void, - } - pub struct ipc_perm { pub __key: ::key_t, pub uid: ::uid_t, @@ -238,15 +222,6 @@ s! { pub mem_unit: ::c_uint, pub _f: [::c_char; 8], } - - // FIXME this is actually a union - pub struct sem_t { - #[cfg(target_pointer_width = "32")] - __size: [::c_char; 16], - #[cfg(target_pointer_width = "64")] - __size: [::c_char; 32], - __align: [::c_long; 0], - } } pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; @@ -257,31 +232,3 @@ pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff; pub const SYS_gettid: ::c_long = 4222; // Valid for O32 - -#[link(name = "util")] -extern { - pub fn sysctl(name: *mut ::c_int, - namelen: ::c_int, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; - pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; - pub fn backtrace(buf: *mut *mut ::c_void, - sz: ::c_int) -> ::c_int; - pub fn glob64(pattern: *const ::c_char, - flags: ::c_int, - errfunc: ::dox::Option<extern fn(epath: *const ::c_char, - errno: ::c_int) - -> ::c_int>, - pglob: *mut glob64_t) -> ::c_int; - pub fn globfree64(pglob: *mut glob64_t); - pub fn ptrace(request: ::c_uint, ...) -> ::c_long; - pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t, - cpusetsize: ::size_t, - cpuset: *mut ::cpu_set_t) -> ::c_int; - pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t, - cpusetsize: ::size_t, - cpuset: *const ::cpu_set_t) -> ::c_int; -} diff --git a/src/unix/notbsd/linux/mips/mips64.rs b/src/unix/notbsd/linux/mips/mips64.rs index dacd4bda1e..1f28ea81f0 100644 --- a/src/unix/notbsd/linux/mips/mips64.rs +++ b/src/unix/notbsd/linux/mips/mips64.rs @@ -3,12 +3,9 @@ pub type blksize_t = i64; pub type c_char = i8; pub type c_long = i64; pub type c_ulong = u64; -pub type fsblkcnt_t = ::c_ulong; -pub type fsfilcnt_t = ::c_ulong; pub type ino_t = u64; pub type nlink_t = u64; pub type off_t = i64; -pub type rlim_t = ::c_ulong; pub type suseconds_t = i64; pub type time_t = i64; pub type wchar_t = i32; @@ -187,6 +184,14 @@ s! { pub c_cc: [::cc_t; ::NCCS], } + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + pub struct sysinfo { pub uptime: ::c_long, pub loads: [::c_ulong; 3], @@ -203,12 +208,6 @@ s! { pub mem_unit: ::c_uint, pub _f: [::c_char; 0], } - - // FIXME this is actually a union - pub struct sem_t { - __size: [::c_char; 32], - __align: [::c_long; 0], - } } pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; @@ -219,8 +218,3 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; pub const RLIM_INFINITY: ::rlim_t = 0xffff_ffff_ffff_ffff; pub const SYS_gettid: ::c_long = 5178; // Valid for n64 - -#[link(name = "util")] -extern { - pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; -} diff --git a/src/unix/notbsd/linux/mips/mod.rs b/src/unix/notbsd/linux/mips/mod.rs index 9b861ea70b..65e4b71799 100644 --- a/src/unix/notbsd/linux/mips/mod.rs +++ b/src/unix/notbsd/linux/mips/mod.rs @@ -3,6 +3,34 @@ pub type dev_t = u64; pub type ino64_t = u64; pub type off64_t = i64; pub type blkcnt64_t = i64; +pub type fsblkcnt_t = ::c_ulong; +pub type fsfilcnt_t = ::c_ulong; +pub type rlim_t = c_ulong; +pub type __priority_which_t = ::c_uint; + +s! { + pub struct glob64_t { + pub gl_pathc: ::size_t, + pub gl_pathv: *mut *mut ::c_char, + pub gl_offs: ::size_t, + pub gl_flags: ::c_int, + + __unused1: *mut ::c_void, + __unused2: *mut ::c_void, + __unused3: *mut ::c_void, + __unused4: *mut ::c_void, + __unused5: *mut ::c_void, + } + + // FIXME this is actually a union + pub struct sem_t { + #[cfg(target_pointer_width = "32")] + __size: [::c_char; 16], + #[cfg(target_pointer_width = "64")] + __size: [::c_char; 32], + __align: [::c_long; 0], + } +} pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; @@ -503,6 +531,44 @@ pub const B3000000: ::speed_t = 0o010015; pub const B3500000: ::speed_t = 0o010016; pub const B4000000: ::speed_t = 0o010017; +#[link(name = "util")] +extern { + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; + pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; + pub fn backtrace(buf: *mut *mut ::c_void, + sz: ::c_int) -> ::c_int; + pub fn glob64(pattern: *const ::c_char, + flags: ::c_int, + errfunc: ::dox::Option<extern fn(epath: *const ::c_char, + errno: ::c_int) + -> ::c_int>, + pglob: *mut glob64_t) -> ::c_int; + pub fn globfree64(pglob: *mut glob64_t); + pub fn ptrace(request: ::c_uint, ...) -> ::c_long; + pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t, + cpusetsize: ::size_t, + cpuset: *mut ::cpu_set_t) -> ::c_int; + pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t, + cpusetsize: ::size_t, + cpuset: *const ::cpu_set_t) -> ::c_int; + pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; + pub fn setpriority(which: ::__priority_which_t, who: ::id_t, + prio: ::c_int) -> ::c_int; + pub fn pthread_getaffinity_np(thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *mut ::cpu_set_t) -> ::c_int; + pub fn pthread_setaffinity_np(thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *const ::cpu_set_t) -> ::c_int; + pub fn sched_getcpu() -> ::c_int; +} + cfg_if! { if #[cfg(target_arch = "mips")] { mod mips32; diff --git a/src/windows.rs b/src/windows.rs index 6c8332a62e..385b66758c 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -43,6 +43,18 @@ s! { pub modtime: time64_t, } + pub struct tm { + tm_sec: ::c_int, + tm_min: ::c_int, + tm_hour: ::c_int, + tm_mday: ::c_int, + tm_mon: ::c_int, + tm_year: ::c_int, + tm_wday: ::c_int, + tm_yday: ::c_int, + tm_isdst: ::c_int, + } + pub struct timeval { pub tv_sec: c_long, pub tv_usec: c_long, |