diff --git a/libc-test/build.rs b/libc-test/build.rs index ccb902d9..a693b0d9 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -13,6 +13,7 @@ fn main() { let apple = target.contains("apple"); let musl = target.contains("musl"); let freebsd = target.contains("freebsd"); + let mips = target.contains("mips"); let bsdlike = freebsd || apple; let mut cfg = ctest::TestGenerator::new(); @@ -112,10 +113,12 @@ fn main() { if !musl { cfg.header("linux/netlink.h"); } + cfg.header("sched.h"); } if freebsd { cfg.header("pthread_np.h"); + cfg.header("sched.h"); } cfg.type_name(move |ty, is_struct| { @@ -222,6 +225,8 @@ fn main() { "RLIMIT_NLIMITS" | "TCP_COOKIE_TRANSACTIONS" | "RLIMIT_RTTIME" if musl => true, + // work around super old mips toolchain + "SCHED_IDLE" => mips, _ => false, } diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 153e2b54..dab2d036 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -518,6 +518,10 @@ 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 SCHED_FIFO: ::c_int = 1; +pub const SCHED_OTHER: ::c_int = 2; +pub const SCHED_RR: ::c_int = 3; + extern { pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 6619c158..ac6d8cca 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -281,6 +281,12 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; pub const __SIZEOF_PTHREAD_COND_T: usize = 48; +pub const SCHED_OTHER: ::c_int = 0; +pub const SCHED_FIFO: ::c_int = 1; +pub const SCHED_RR: ::c_int = 2; +pub const SCHED_BATCH: ::c_int = 3; +pub const SCHED_IDLE: ::c_int = 5; + extern { pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int;