[Previous] [Contents] [Index] [Next]

sched_getparam()

Get the current priority of a process

Synopsis:

#include <sched.h>

int sched_getparam( pid_t pid,
                    struct sched_param * param );

Library:

libc

Description:

The sched_getparam() function gets the current priority of the process specified by pid, and puts it in the sched_priority member of the sched_param structure pointed to by param.

If pid is zero, the priority of the calling process is returned.

Returns:

0
Success
-1
An error occurred (errno is set).

Errors:

EPERM
The calling process doesn't have sufficient privilege to get the priority.
ESRCH
The process pid doesn't exist.

Classification:

POSIX 1003.1 (Realtime Extensions)

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

Caveats:

Currently, the implementation of sched_getparam() isn't 100% POSIX 1003.1-1996. The sched_getparam() function returns the scheduling parameters 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_getparam() should return -1 and set errno to EPERM in a multithreaded application.

See also:

errno, getprio(), sched_get_priority_max(), sched_get_priority_min(), sched_getscheduler(), sched_setparam(), sched_setscheduler(), sched_yield(), setprio()


[Previous] [Contents] [Index] [Next]