Chapter Contents

Previous

Next
getpriority

getpriority



Determine Process Priority

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
USAGE NOTES
EXAMPLE
RELATED FUNCTIONS


SYNOPSIS

#include <sys/resource.h>
int getpriority(int kind, int id);


DESCRIPTION

The getpriority function obtains the UNIX System Services priority of a process, a process group or a user. The priority is an integer between -20 and 19 which is used in scheduling process execution. Lower priority numbers are considered more urgent. These priority numbers are translated by UNIX System Services in a site-specific manner into OS/390 SRM (system resources manager) specifications that control the priority of both UNIX System Services and non-UNIX System Services OS/390 processing. See the IBM Publication UNIX System Services OS/390 Planning (SC23-3015) for more information on UNIX System Services priorities and their interpretation.

The kind argument to getpriority should be specified as a symbolic constant indicating what kind of priority information is needed. The permissible values are:

PRIO_PROCESS
Specifies that the id argument is the pid of the process whose priority is wanted.

PRIO_PGRP
Specifies that the id argument is the pid of the process group whose priority is wanted.

PRIO_USER
Specifies that the id argument is the uid of the user whose priority is wanted.

The id argument specifies the process id, process group id, or user id whose priority is needed. If id is 0, the calling process id, process group id, or user is indicated.

If there is more than one process running that matches the arguments, for instance, multiple processes for a specified user, the smallest priority value for any process is returned.


RETURN VALUE

getpriority returns the requested priority if successful, or -1 if unsuccessful. Since -1 can also be returned as a priority value, you should set errno to 0 before calling getpriority, and test it for a non-zero value after the call to determine whether an error occurred.


USAGE NOTES

The getpriority 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

chpriority, setpriority


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.