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.

Note:
  • In QNX Neutrino, scheduling is associated with threads, not processes, so sched_getscheduler() gets the scheduling policy for thread 1 in the process pid, or for the calling thread if pid is 0.
  • In order to get the scheduling policy for a thread whose real or saved user ID is different from the calling process's real or effective user ID, your process must have the PROCMGR_AID_SCHEDULE ability enabled. For more information, see procmgr_ability().

Returns:

The scheduling policy, or -1 if an error occurred (errno is set).

Errors:

EPERM
The calling process doesn't have sufficient privilege to get the scheduling policy; see procmgr_ability().
ESRCH
The process pid doesn't exist.

Classification:

POSIX 1003.1 PS

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes