DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

sched_rr_get_interval(S)


sched_rr_get_interval -- get time limit for currently running process

Syntax

cc . . . -lc

#include <sched.h>

int sched_rr_get_interval(pid_t pid, struct timespec *min);

Description

sched_rr_get_interval returns in min the amount of time left before the SCHED_RR process will complete its time slice. A process is not guaranteed to complete its time slice because it may be preempted at any time by a process with a higher priority. If the process has not completed its time slice before being preempted, it is returned to the head of the queue of processes to be run for its priority. If its time slice is completed it will be returned to the end of the queue of processes to be run for its priority.

If pid is 0, the time limit for the calling process is returned.

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_rr_get_interval will sleep while this occurs.

The resolution of time values returned is 10,000 microseconds (10 milliseconds), corresponding to the value of HZ within the kernel.

Return values

Upon successful completion sched_rr_get_interval returns zero. If an error has occurred the function returns -1, and errno is set to indicate the error.

Diagnostics

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

[ENOSYS]
The function is not supported.

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

Examples

The following example illustrates the use of sched_rr_get_interval:
struct timespec tmin;
...
if(sched_getscheduler(0) == SCHED_RR && sched_rr_get_interval(0,&tmin) == 0) {
   if(tmin.tv_nsec > 70000000) {
      ...
   }
   ...

Files


/usr/lib/libc.a
linking library

See also

sched_get_priority_max(S), sched_getparam(S), sched_getscheduler(S), sched_setparam(S), sched_setscheduler(S), sched_yield(S)

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.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003