sched_getscheduler() / sched_setscheduler()

This commit is contained in:
Alexander Polakov 2015-11-26 14:00:03 +03:00 committed by root
parent 94e9b3c704
commit e09951cb50
2 changed files with 20 additions and 0 deletions

View File

@ -99,6 +99,10 @@ s! {
pub f_fsid: ::c_ulong,
pub f_namemax: ::c_ulong,
}
pub struct sched_param {
pub sched_priority: ::c_int,
}
}
pub const EXIT_FAILURE: ::c_int = 1;
@ -536,6 +540,8 @@ extern {
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
len: ::off_t) -> ::c_int;
pub fn sched_setscheduler(pid: ::pid_t, policy: ::c_int, param: *const sched_param) -> ::c_int;
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
}
cfg_if! {

View File

@ -86,6 +86,18 @@ s! {
pub tm_gmtoff: ::c_long,
pub tm_zone: *const ::c_char,
}
pub struct sched_param {
pub sched_priority: ::c_int,
#[cfg(target_env = "musl")]
pub sched_ss_low_priority: ::c_int,
#[cfg(target_env = "musl")]
pub sched_ss_repl_period: ::timespec,
#[cfg(target_env = "musl")]
pub sched_ss_init_budget: ::timespec,
#[cfg(target_env = "musl")]
pub sched_ss_max_repl: ::c_int,
}
}
// intentionally not public, only used for fd_set
@ -377,6 +389,8 @@ extern {
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
pub fn setgroups(ngroups: ::size_t,
ptr: *const ::gid_t) -> ::c_int;
pub fn sched_setscheduler(pid: ::pid_t, policy: ::c_int, param: *const sched_param) -> ::c_int;
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
}
cfg_if! {