sched_getscheduler
![]() |
![]() |
![]() |
![]() |
sched_getscheduler()
Get the current scheduling policy for a process
Synopsis:
#include <sched.h> int sched_getscheduler( pid_t pid );
Arguments:
- 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.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
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.
Returns:
The scheduling policy, or -1 if an error occurred (errno is set).
Errors:
- ESRCH
- The process pid doesn't exist.
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
Caveats:
Currently, the implementation of sched_getscheduler() isn't 100% POSIX 1003.1-1996. The sched_getscheduler() function returns the scheduling policy for thread 1 in the process pid, or for the calling thread if pid is 0.
If you depend on this in new code, it will not be portable. POSIX 1003.1 says sched_getscheduler() should return -1 and set errno to EPERM in a multithreaded application.
See also:
errno, getprio(), sched_getparam(), sched_get_priority_max(), sched_get_priority_min(), sched_setparam(), sched_setscheduler(), sched_yield(), setprio()
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)
