Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fork(2)

nice(1)



GETPRIORITY(2)          COMMAND REFERENCE          GETPRIORITY(2)



NAME
     getpriority, setpriority - get/set program scheduling
     priority

SYNOPSIS
     #include <sys/time.h>
     #include <sys/resource.h>

     prio = getpriority(which, who)
     int prio, which, who;

     setpriority(which, who, prio)
     int which, who, prio;

DESCRIPTION
     The scheduling priority of the process, process group, or
     user, as indicated by which and who is returned in prio with
     the getpriority call and set to prio with the setpriority
     call.

     Which is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER,
     defined in <sys/resource.h>:

          #define PRIO_PROCESS     0    /* process */
          #define PRIO_PGRP   1    /* process group */
          #define PRIO_USER   2    /* user id */

     Who is interpreted relative to which: a process identifier
     for PRIO_PROCESS, process group identifier for PRIO_PGRP,
     and a user ID for PRIO_USER.

     A value of 0 for who, in either getpriority or setpriority,
     will indicate the operations are to apply to the current
     process, process group, or user.

     The getpriority call returns in prio the highest priority
     (lowest numerical value) enjoyed by any of the specified
     processes.  Here, prio will be one of 40 values in the range
     -20 to 19.  The default priority is 0; lower priorities
     cause more favorable scheduling.

     The setpriority call sets to prio the priorities of all of
     the specified processes to the specified value.  Only the
     super-user may lower priorities.

DIAGNOSTICS
     Getpriority and setpriority may return one of the following
     errors:

     [ESRCH]      No process(es) are located using the which and
                  who values specified.




Printed 4/6/89                                                  1





GETPRIORITY(2)          COMMAND REFERENCE          GETPRIORITY(2)



     [EINVAL]     Which is not one of PRIO_PROCESS, PRIO_PGRP, or
                  PRIO_USER.

     In addition to the errors indicated above, setpriority may
     fail with one of the following errors returned:

     [EACCES]     A process is located, but neither its effective
                  nor real user ID matched the effective user ID
                  of the caller, and the caller is not the
                  super-user.

     [EACCES]     A non super-user is attempting to change a
                  process priority to a negative value.

RETURN VALUE
     Setpriority returns 0 if there is no error, or -1 if there
     is, setting errno to indicate the error.  Getpriority
     returns the process' priority.  Since getpriority can
     legitimately return the value -1, it is necessary to clear
     the external variable errno prior to the call, then check it
     afterward to determine if a -1 is an error or a legitimate
     value.

CAVEATS
     If a prio larger than 19 is given to setpriority, it will be
     changed to 19 and the priority set accordingly.

SEE ALSO
     fork(2) and nice(1).


























Printed 4/6/89                                                  2



%%index%%
na:408,119;
sy:527,1615;
de:2142,2113;
di:4255,543;5278,673;
rv:5951,862;
ca:6813,326;
se:7139,148;
%%index%%000000000133

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026