![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
| setpriority | 
| Portability: | UNIX compatible | 
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| USAGE NOTES | |
| EXAMPLE | |
| RELATED FUNCTIONS | 
| SYNOPSIS | 
#include <sys/resource.h>
int setpriority(int kind, int id, 
                int prio);
| DESCRIPTION | 
The 
setpriority
 function
changes
the UNIX System Services priority of a process, or the priority of all processes
in a process group or belonging to a user. See the 
getpriority
 function description in section getpriority for further information on UNIX System
Services priorities.
The 
kind
 argument
to 
setpriority
 should be
specified as a symbolic constant indicating the scope of the priority change.
The permissible values are: 
PRIO_PROCESS
 -
specifies that the 
id
 argument
is the pid of the process whose priority is to be changed
PRIO_PGRP
 -
specifies that the 
id
 argument
is the pid of the process group whose processes should be changed in priority
PRIO_USER
 -
specifies that the 
id
 argument
is the uid of the user whose processes are to be changed in priority.
The 
id
 argument specifies
the process id, process group id, or user id whose priority should be changed.
If 
id
 is 
0
, it specifies the calling process, process
group or user. 
The 
prio
 argument
specifies the requested new priority. It should be a signed integer between
-20 to 19. Lower numbers indicate higher priority. 
Note:   UNIX System
Services sites must enable the use of the 
setpriority
 function. If the use of 
setpriority
 has not been enabled, any use of 
setpriority
 will fail with 
errno
 set to 
ENOSYS
.  ![[cautionend]](../common/images/cautend.gif)
| RETURN VALUE | 
setpriority
 returns 
0
 if successful,
or 
-1
 if unsuccessful. 
| USAGE NOTES | 
The 
setpriority
 function can only be used with MVS 5.2.2 or a later release.
| EXAMPLE | 
Refer to chpriority for an example that demonstrates the use of the UNIX System Services
process
priority functions 
chpriority
, 
getpriority
, and 
setpriority
. 
| RELATED FUNCTIONS | 
![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
![]() Top of Page  | 
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.