17 #ifndef __LINUX_SCHED_HPP__ 18 #define __LINUX_SCHED_HPP__ 22 #error "linux/sched.hpp is only available on Linux systems." 28 #include <linux/sched.h> 31 #include <sys/types.h> 60 return ErrnoError(
"Failed to get scheduler policy");
79 return Error(
"Non-real-time scheduling policies only support priority = 0");
83 param.sched_priority = priority;
85 if (sched_setscheduler(pid.
isSome() ? pid.
get() : 0, policy, ¶m) == -1) {
86 return ErrnoError(
"Failed to set scheduler policy");
95 #endif // __LINUX_SCHED_HPP__
Definition: nothing.hpp:16
Definition: errorbase.hpp:36
T & get()&
Definition: try.hpp:80
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
Definition: errorbase.hpp:50
Policy
Definition: sched.hpp:41
bool isSome() const
Definition: try.hpp:77