|
|
1.1 root 1: .\" Copyright (c) 1980 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)getpriority.2 6.5 (Berkeley) 5/22/86
6: .\"
7: .TH GETPRIORITY 2 "May 22, 1986"
8: .UC 4
9: .SH NAME
10: getpriority, setpriority \- get/set program scheduling priority
11: .SH SYNOPSIS
12: .nf
13: .ft B
14: #include <sys/resource.h>
15: .PP
16: .ft B
17: prio = getpriority(which, who)
18: int prio, which, who;
19: .PP
20: .ft B
21: setpriority(which, who, prio)
22: int which, who, prio;
23: .fi
24: .SH DESCRIPTION
25: The scheduling
26: priority of the process, process group, or user, as indicated by
27: .I which
28: and
29: .I who
30: is obtained with the
31: .I getpriority
32: call and set with the
33: .I setpriority
34: call.
35: .I Which
36: is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER, and
37: .I who
38: is interpreted relative to
39: .I which
40: (a process identifier for PRIO_PROCESS, process group
41: identifier for PRIO_PGRP, and a user ID for PRIO_USER).
42: A zero value of
43: .I who
44: denotes the current process, process group, or user.
45: .I Prio
46: is a value in the range \-20 to 20. The default priority is 0;
47: lower priorities cause more favorable scheduling.
48: .PP
49: The
50: .I getpriority
51: call returns the highest priority (lowest numerical value)
52: enjoyed by any of the specified processes. The
53: .I setpriority
54: call sets the priorities of all of the specified processes
55: to the specified value. Only the super-user may lower priorities.
56: .SH "RETURN VALUE
57: Since
58: .I getpriority
59: can legitimately return the value \-1, it is necessary
60: to clear the external variable \fIerrno\fP prior to the
61: call, then check it afterward to determine
62: if a \-1 is an error or a legitimate value.
63: The
64: .I setpriority
65: call returns 0 if there is no error, or
66: \-1 if there is.
67: .SH ERRORS
68: .I Getpriority
69: and
70: .I setpriority
71: may return one of the following errors:
72: .TP 15
73: [ESRCH]
74: No process was located using the
75: .I which
76: and
77: .I who
78: values specified.
79: .TP 15
80: [EINVAL]
81: .I Which
82: was not one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER.
83: .PP
84: In addition to the errors indicated above,
85: .I setpriority
86: may fail with one of the following errors returned:
87: .TP 15
88: [EPERM]
89: A process was located, but neither its effective nor real user
90: ID matched the effective user ID of the caller.
91: .TP 15
92: [EACCES]
93: A non super-user attempted to lower a process priority.
94: .SH "SEE ALSO"
95: nice(1), fork(2), renice(8)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.