Get the current scheduling policy for a process
#include <sched.h> int sched_getscheduler( pid_t pid );
- The ID of the process whose scheduling policy you want to find, or zero if you want to get the policy for the current process.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The sched_getscheduler() function gets the current scheduling policy of process pid. If pid is zero, the scheduling policy of the calling process is returned.
The scheduling policy, or -1 if an error occurred (errno is set).
- The process pid doesn't exist.
In a multithreaded program, sched_getscheduler() returns the scheduling policy for thread 1 in the process pid, or for the calling thread if pid is 0.