DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sched_getscheduler(S-osr5)


sched_getscheduler -- get scheduling policy

Syntax

cc . . . -lc

#include <sched.h>

int sched_getscheduler(pid_t pid);

Description

sched_getscheduler returns the scheduling policy of the process specified by pid.

On MPX systems, if pid specifies a process currently running on a different CPU then the process specified by pid will be taken off the CPU. This is the equivalent of the process specified by pid making a call to sched_yield. The process which made the call to sched_getscheduler will sleep while this occurs.

If pid is 0, the scheduling policy of the calling process is returned.

Return values

Upon successful completion sched_getscheduler returns the scheduling policy of the target process. If an error has occurred sched_getscheduler returns -1 and errno is set to indicate the error.

Diagnostics

If sched_getscheduler terminates due to an error, it will set errno to one of the following values:

[ENOSYS]
The function is not supported.

[EPERM]
The requesting process does not have the privilege to get the scheduling policy for the process specified by pid.

[ESRCH]
The process, specified by pid, does not exist.

Examples

The following example illustrates the use of sched_getscheduler:
   int pid;
   ...
   switch(sched_getscheduler(pid)) {
      case SCHED_OTHER :
                         ...
                         break;
      case SCHED_FIFO  :
                         ...
                         break;
      case SCHED_RR    :
                         ...
                         break;
      default          :
                         ...
                         break;
   }

Files


/usr/lib/libc.a
linking library

See also

sched_get_priority_max(S-osr5), sched_getparam(S-osr5), sched_rr_get_interval(S-osr5), sched_setparam(S-osr5), sched_setscheduler(S-osr5), sched_yield(S-osr5)

Standards conformance

Text reprinted and/or adapted from IEEE Std 1003.1b-1993, IEEE Standard for Information Technology, POSIX Part 1: System Application Program Interface (API) Amendment 1: Realtime Extensions [C Language], copyright © 1993 by the Institute of Electrical and Electronics Engineers, Inc. The IEEE takes no responsibility for and will assume no liability for damages resulting from the reader's misinterpretation of said information resulting from the placement and context in this publication. Information is reproduced with the permission of the IEEE.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005