Annotation of cci/usr/src/man/man2/getpriority.2, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.