version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
GETPRIORITY |
|
|
2 |
!!!GETPRIORITY |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
NOTE |
|
|
9 |
CONFORMING TO |
|
|
10 |
SEE ALSO |
|
|
11 |
---- |
|
|
12 |
!!NAME |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
getpriority, setpriority - get/set program scheduling priority |
|
|
16 |
!!SYNOPSIS |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__#include __ |
|
|
20 |
#include __ |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
__int getpriority(int__ ''which''__, int__ |
|
|
24 |
''who''__); |
|
|
25 |
int setpriority(int__ ''which''__, int__ |
|
|
26 |
''who''__, int__ ''prio''__);__ |
|
|
27 |
!!DESCRIPTION |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
The scheduling priority of the process, process group, or |
|
|
31 |
user, as indicated by ''which'' and ''who'' is |
|
|
32 |
obtained with the __getpriority__ call and set with the |
|
|
33 |
__setpriority__ call. ''Which'' is one of |
|
|
34 |
__PRIO_PROCESS__, __PRIO_PGRP__, or __PRIO_USER__, |
|
|
35 |
and ''who'' is interpreted relative to ''which'' (a |
|
|
36 |
process identifier for __PRIO_PROCESS__, process group |
|
|
37 |
identifier for __PRIO_PGRP__, and a user ID for |
|
|
38 |
__PRIO_USER__). A zero value of ''who'' denotes the |
|
|
39 |
current process, process group, or user. ''Prio'' is a |
|
|
40 |
value in the range -20 to 20. The default priority is 0; |
|
|
41 |
lower priorities cause more favorable |
|
|
42 |
scheduling. |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
The __getpriority__ call returns the highest priority |
|
|
46 |
(lowest numerical value) enjoyed by any of the specified |
|
|
47 |
processes. The __setpriority__ call sets the priorities |
|
|
48 |
of all of the specified processes to the specified value. |
|
|
49 |
Only the super-user may lower priorities. |
|
|
50 |
!!RETURN VALUE |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
Since __getpriority__ can legitimately return the value |
|
|
54 |
-1, it is necessary to clear the external variable |
|
|
55 |
''errno'' prior to the call, then check it afterwards to |
|
|
56 |
determine if a -1 is an error or a legitimate value. The |
|
|
57 |
__setpriority__ call returns 0 if there is no error, or |
|
|
58 |
-1 if there is. |
|
|
59 |
!!ERRORS |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
__ESRCH__ |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
No process was located using the ''which'' and ''who'' |
|
|
66 |
values specified. |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
__EINVAL__ |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
''Which'' was not one of __PRIO_PROCESS__, |
|
|
73 |
__PRIO_PGRP__, or __PRIO_USER__. |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
In addition to the errors indicated above, |
|
|
77 |
__setpriority__ will fail if: |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
__EPERM__ |
|
|
81 |
|
|
|
82 |
|
|
|
83 |
A process was located, but neither its effective nor real |
|
|
84 |
user ID matched the effective user ID of the |
|
|
85 |
caller. |
|
|
86 |
|
|
|
87 |
|
|
|
88 |
__EACCES__ |
|
|
89 |
|
|
|
90 |
|
|
|
91 |
A non super-user attempted to lower a process |
|
|
92 |
priority. |
|
|
93 |
!!NOTE |
|
|
94 |
|
|
|
95 |
|
|
|
96 |
Including '''' is not required these |
|
|
97 |
days, but increases portability. (Indeed, |
|
|
98 |
'''' defines the ''rusage'' |
|
|
99 |
structure with fields of type ''struct timeval'' defined |
|
|
100 |
in ''''.) |
|
|
101 |
!!CONFORMING TO |
|
|
102 |
|
|
|
103 |
|
|
|
104 |
SVr4, 4.4BSD (these function calls first appeared in |
|
|
105 |
4.2BSD). |
|
|
106 |
!!SEE ALSO |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
nice(1), fork(2), |
|
|
110 |
renice(8) |
|
|
111 |
---- |