Open nekopsykose opened 9 months ago
technically, this is slightly incorrect because if the extra fields are actually used (outside of linux i guess lol), it would just setschedparam and overwrite the other fields with 0's. a correct solution would be to sched_getscheduler() first and change the priority on that object. but from what i can tell not everyone does that either for linux code:
a proper version would be
let sched_param = unsafe {
let mut param = std::mem::MaybeUninit::uninit();
if -1 == libc::sched_getparam(0, param.as_mut_ptr()) {
panic!("failed to sched_getparam");
}
(*param.as_mut_ptr()).sched_priority = 99;
param.assume_init()
};
these interfaces are 'fun'
closes #4
i don't know how to write this without unsafe. normally Default::default() exists but it's not implemented in this case..