|
|
1.1 ! root 1: .\" Copyright (c) 1980 The Regents of the University of California. ! 2: .\" All rights reserved. ! 3: .\" ! 4: .\" Redistribution and use in source and binary forms are permitted provided ! 5: .\" that: (1) source distributions retain this entire copyright notice and ! 6: .\" comment, and (2) distributions including binaries display the following ! 7: .\" acknowledgement: ``This product includes software developed by the ! 8: .\" University of California, Berkeley and its contributors'' in the ! 9: .\" documentation or other materials provided with the distribution and in ! 10: .\" all advertising materials mentioning features or use of this software. ! 11: .\" Neither the name of the University nor the names of its contributors may ! 12: .\" be used to endorse or promote products derived from this software without ! 13: .\" specific prior written permission. ! 14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 17: .\" ! 18: .\" @(#)getpriority.2 6.8 (Berkeley) 6/23/90 ! 19: .\" ! 20: .TH GETPRIORITY 2 "June 23, 1990" ! 21: .UC 4 ! 22: .SH NAME ! 23: getpriority, setpriority \- get/set program scheduling priority ! 24: .SH SYNOPSIS ! 25: .nf ! 26: .ft B ! 27: #include <sys/time.h> ! 28: #include <sys/resource.h> ! 29: .PP ! 30: .ft B ! 31: prio = getpriority(which, who) ! 32: int prio, which, who; ! 33: .PP ! 34: .ft B ! 35: setpriority(which, who, prio) ! 36: int which, who, prio; ! 37: .fi ! 38: .SH DESCRIPTION ! 39: The scheduling ! 40: priority of the process, process group, or user, as indicated by ! 41: .I which ! 42: and ! 43: .I who ! 44: is obtained with the ! 45: .I getpriority ! 46: call and set with the ! 47: .I setpriority ! 48: call. ! 49: .I Which ! 50: is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER, and ! 51: .I who ! 52: is interpreted relative to ! 53: .I which ! 54: (a process identifier for PRIO_PROCESS, process group ! 55: identifier for PRIO_PGRP, and a user ID for PRIO_USER). ! 56: A zero value of ! 57: .I who ! 58: denotes the current process, process group, or user. ! 59: .I Prio ! 60: is a value in the range \-20 to 20. The default priority is 0; ! 61: lower priorities cause more favorable scheduling. ! 62: .PP ! 63: The ! 64: .I getpriority ! 65: call returns the highest priority (lowest numerical value) ! 66: enjoyed by any of the specified processes. The ! 67: .I setpriority ! 68: call sets the priorities of all of the specified processes ! 69: to the specified value. Only the super-user may lower priorities. ! 70: .SH "RETURN VALUE ! 71: Since ! 72: .I getpriority ! 73: can legitimately return the value \-1, it is necessary ! 74: to clear the external variable \fIerrno\fP prior to the ! 75: call, then check it afterward to determine ! 76: if a \-1 is an error or a legitimate value. ! 77: The ! 78: .I setpriority ! 79: call returns 0 if there is no error, or ! 80: \-1 if there is. ! 81: .SH ERRORS ! 82: .I Getpriority ! 83: and ! 84: .I setpriority ! 85: may return one of the following errors: ! 86: .TP 15 ! 87: [ESRCH] ! 88: No process was located using the ! 89: .I which ! 90: and ! 91: .I who ! 92: values specified. ! 93: .TP 15 ! 94: [EINVAL] ! 95: .I Which ! 96: was not one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER. ! 97: .PP ! 98: In addition to the errors indicated above, ! 99: .I setpriority ! 100: may fail with one of the following errors returned: ! 101: .TP 15 ! 102: [EPERM] ! 103: A process was located, but neither its effective nor real user ! 104: ID matched the effective user ID of the caller. ! 105: .TP 15 ! 106: [EACCES] ! 107: A non super-user attempted to lower a process priority. ! 108: .SH "SEE ALSO" ! 109: 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.