Add SCHED_* constants for linux & freebsd

This commit is contained in:
Alexander Polakov 2015-11-27 03:02:44 +03:00 committed by root
parent e09951cb50
commit 26974c7ff7
3 changed files with 15 additions and 0 deletions

View File

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

View File

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

View File

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