getjusage(2)getjusage(2)NAMEgetjusage - get job usage information
SYNOPSIS
#include <sys/resource.h>
int getjusage(jid_t jid, int resource, struct jobrusage *up)
DESCRIPTION
The getjusage function retrieves the resource usage values for the
specified job ID. If the jid parameter is zero, usage values for the
current job will be returned. If jid is non-zero, it represents the job
ID of the job for which usages values are retrieved. The resource
parameter specifies the resource for which the usage values are returned.
Allowable values are taken from the JLIMIT_xxx macros found in the
sys/resource.h file. For example, the JLIMIT_CPU macro is for cpu time.
The up parameter points to a jobrusage structure in the user program
where the usage values will be returned.
If the job ID of the caller is different from job specified by jid, the
real or effective user ID of the caller must match the user ID of the
user associated with the job. User association is established by the
user parmater for makenewjob. Otherwise, the getjusage function checks
for the CAP_MAC_READ capability. See the capability(4) and
capabilities(4) man pages for more information on the capability
mechanism that provides fine grained control over the privileges of a
process.
ERRORS
Under the following conditions, the getjusage function fails and sets
errno to:
[ENOPKG] The job limits software is not installed.
[ENOJOB] A job with the specified job ID cannot be found.
[EINVAL] The limit denoted by resource is invalid.
[EPERM] The caller does not have permission to access the usage
information.
[EFAULT] The the address of up is invalid.
SEE ALSOgetjlimit(2), getrusage(3).
DIAGNOSTICS
Upon successful completion, getjusage returns a value of 0. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
Page 1