System Calls getacct(2)
NAME
getacct, putacct, wracct - get, put, or write extended
accounting data
SYNOPSIS
#include
sizet getacct(idtypet idtype, idt id, void *buf, sizet bufsize);
int putacct(idtypet idtype, idt id, void *buf, sizet bufsize, int flags);
int wracct(idtypet idtype, idt id, int flags);
DESCRIPTION
These functions provide access to the extended accounting
facility.
The getacct() function returns extended accounting buffers
from the kernel for currently executing tasks and processes.
The resulting data buffer is a packed exacct object that can
be unpacked using eaunpackobject() (see
eapackobject(3EXACT)) and subsequently manipulated using
the functions of the extended accounting library,
libexacct(3LIB).
The putacct() function provides privileged processes the
ability to tag accounting records with additional data
specific to that process. For instance, a queueing facility
might want to record to which queue a given task or process
was submitted prior to running. The flags argument deter-
mines whether the contents of buf should be treated as raw
data (EPRAW) or as an embedded exacct structure
(EPEXACTOBJECT). In the case of EPEXACTOBJECT, buf
must be a packed exacct object as returned by
eapackobject(3EXACT). The use of an inappropriate flag or
the inclusion of corrupt exacct data will likely corrupt the
enclosing exacct file.
The wracct() function requests the kernel to write, given
its internal state of resource usage, the appropriate data
for the specified task or process. The flags field deter-
mines whether a partial (EWPARTIAL) or interval record
(EWINTERVAL) is written.
SunOS 5.11 Last change: 20 Jan 2003 1
System Calls getacct(2)
These functions require root privilege, as they allow
inquiry or reporting relevant to system tasks and processes
other than the invoking process. The putacct() and wracct()
functions also cause the kernel to write records to the
system's extended accounting files.
RETURN VALUES
The getacct() function returns the number of bytes required
to represent the extended accounting record for the
requested system task or process. If bufsize exceeds the
returned size, buf will contain a valid accounting record
buffer. If bufsize is less than the return value, buf will
contain the first bufsize bytes of the record. If bufsize is
0, getacct() returns only the number of bytes required to
represent the extended accounting record. In the event of
failure, -1 is returned and errno is set to indicate the
error.
The putacct() and wracct() functions return 0 if the record
was successfully written. Otherwise, -1 is returned and
errno is set to indicate the error.
ERORS
The getacct(), putacct(), and wracct() functions will fail
if:
EINVAL The idtype argument was not PTASKID or PID.
ENOSPC The file system containing the extended
accounting file is full. The wracct() or
putacct() function will fail if the record
size would exceed the amount of space remain-
ing on the file system.
ENOTACTIVE The extended accounting facility for the
requested idtypet is not active. Either
putacct() attempted to write a task record
when the task accounting file was unset, or
getacct() attempted to retrieve accounting
data for a process when extended process
accounting was inactive.
EPERM The {PRIVSYSACT} privilege is not asserted
in the effective set of the calling process.
ERSCH The id argument does not refer to a presently
active system task ID or process ID.
SunOS 5.11 Last change: 20 Jan 2003 2
System Calls getacct(2)
The putacct() and wracct() functions will fail if:
EINVAL The flags argument is neither EWPARTIAL nor
EWINTERVAL.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
MT-Level Async-Signal-Safe
SEE ALSO
eapackobject(3EXACT), libexacct(3LIB)attributes(5)
SunOS 5.11 Last change: 20 Jan 2003 3
|