Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getpriority(2) [osf1 man page]

getpriority(2)							System Calls Manual						    getpriority(2)

NAME
getpriority, setpriority - Gets or sets process scheduling priority SYNOPSIS
#include <sys/resource.h> int getpriority( int which, id_t who); int setpriority( int which, id_t who, int priority); [Tru64 UNIX] The following declaration of the who parameter for getpriority() and setpriority() does not conform to current standards and is supported only for backward compatibility: int who STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: getpriority(), setpriority(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies one of PRIO_PROCESS (process priority), PRIO_PGRP (process group priority), or PRIO_USER (user priority). Specifies a numeric value interpreted relative to the which parameter (a process identifier, process group identifier, and a user ID, respectively). A 0 (zero) value for the who parameter denotes the current process, process group, or user. Specifies a value in the range -20 to 20. The default priority is 0 (zero); negative priorities cause more favorable scheduling. DESCRIPTION
The getpriority() function obtains the current priority of a process, process group, or user. The getpriority() function returns the high- est priority (lowest numerical value) pertaining to any of the specified processes. The setpriority() function sets the scheduling priority of a process, process group, or user. If you specify more than one process, the setpriority() function sets the priorities of all of the specified processes to the specified value. If the specified value is less than -20, a value of -20 is used; if it is greater than 20, a value of 20 is used. RETURN VALUES
Upon successful completion, the getpriority() function returns an integer in the range -20 to 20. Otherwise, -1 is returned and errno is set to indicated the error. Because 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 -1 is an error or a legitimate value. Upon successful completion, the setpriority() function returns 0 (zero). Otherwise, the function returns -1 and sets errno to indicate the error. ERRORS
The getpriority() and setpriority() functions set errno to the specified values for the following conditions: No process was located using the which and who parameter values specified. The which parameter was not recognized. In addition to the errors indicated above, the setpriority() function can fail with errno set to one of the following values: The process does not have ownership rights with respect to the target process's real user ID. The process is trying to raise its priority and does not have the appropriate privilege. RELATED INFORMATION
Functions: exec(2), nice(3) Standards: standards(5) delim off getpriority(2)

Check Out this Related Man Page

GETPRIORITY(2)						      BSD System Calls Manual						    GETPRIORITY(2)

NAME
getpriority, setpriority -- get/set program scheduling priority SYNOPSIS
#include <sys/time.h> #include <sys/resource.h> int getpriority(int which, int who); int setpriority(int which, int who, int prio); DESCRIPTION
The scheduling priority of the process, process group, or user, as indicated by which and who is obtained with the getpriority() call and set with the setpriority() call. Which is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER, and 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 zero value of who denotes the current process, process group, or user. Prio is a value in the range -20 to 20. The default priority is 0; lower priorities cause more favorable scheduling. The getpriority() call returns the highest priority (lowest numerical value) enjoyed by any of the specified processes. The setpriority() call sets the priorities of all of the specified processes to the specified value. Only the super-user may lower priorities. RETURN VALUES
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. The setpriority() call returns 0 if there is no error, or -1 if there is. ERRORS
Getpriority() and setpriority() will fail if: [ESRCH] No process was located using the which and who values specified. [EINVAL] Which was not one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER. In addition to the errors indicated above, setpriority() 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 super-user attempted to lower a process priority. SEE ALSO
nice(1), fork(2), renice(8) HISTORY
The getpriority() function call appeared in 4.2BSD. 4th Berkeley Distribution June 4, 1993 4th Berkeley Distribution
Man Page