home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
gnu
/
man
/
cat2
/
getpriority.0
< prev
next >
Wrap
Text File
|
1993-12-07
|
3KB
|
67 lines
GETPRIORITY(2) UNIX Programmer's Manual GETPRIORITY(2)
NNAAMMEE
ggeettpprriioorriittyy, sseettpprriioorriittyy - get/set program scheduling priority
SSYYNNOOPPSSIISS
##iinncclluuddee <<ssyyss//ttiimmee..hh>>
##iinncclluuddee <<ssyyss//rreessoouurrccee..hh>>
_i_n_t
ggeettpprriioorriittyy(_i_n_t _w_h_i_c_h, _i_n_t _w_h_o)
_i_n_t
sseettpprriioorriittyy(_i_n_t _w_h_i_c_h, _i_n_t _w_h_o, _i_n_t _p_r_i_o)
DDEESSCCRRIIPPTTIIOONN
The scheduling priority of the process, process group, or user, as indi
cated by _w_h_i_c_h and _w_h_o is obtained with the ggeettpprriioorriittyy() call and set
with the sseettpprriioorriittyy() call. _W_h_i_c_h is one of PRIO_PROCESS, PRIO_PGRP, or
PRIO_USER, and _w_h_o is interpreted relative to _w_h_i_c_h (a process identifier
for PRIO_PROCESS, process group identifier for PRIO_PGRP, and a user ID
for PRIO_USER). A zero value of _w_h_o denotes the current process, process
group, or user. _P_r_i_o is a value in the range 20 to 20. The default
priority is 0; lower priorities cause more favorable scheduling.
The ggeettpprriioorriittyy() call returns the highest priority (lowest numerical
value) enjoyed by any of the specified processes. The sseettpprriioorriittyy() call
sets the priorities of all of the specified processes to the specified
value. Only the superuser may lower priorities.
RREETTUURRNN VVAALLUUEESS
Since ggeettpprriioorriittyy() can legitimately return the value 1, it is necessary
to clear the external variable _e_r_r_n_o prior to the call, then check it af
terward to determine if a 1 is an error or a legitimate value. The
sseettpprriioorriittyy() call returns 0 if there is no error, or 1 if there is.
EERRRROORRSS
GGeettpprriioorriittyy() and sseettpprriioorriittyy() will fail if:
[ESRCH] No process was located using the _w_h_i_c_h and _w_h_o values spec
ified.
[EINVAL] _W_h_i_c_h was not one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER.
In addition to the errors indicated above, sseettpprriioorriittyy() will fail if:
[EPERM] A process was located, but neither its effective nor real
user ID matched the effective user ID of the caller.
[EACCES] A non superuser attempted to lower a process priority.
SSEEEE AALLSSOO
nice(1), fork(2), renice(8)
HHIISSTTOORRYY
The ggeettpprriioorriittyy function call appeared in 4.2BSD.
4th Berkeley Distribution March 10, 1991 1