| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 2: System Calls Oracle Solaris 11 Information Library |
- get, put, or write extended accounting data
#include <sys/exacct.h>size_tgetacct(idtype_tidtype,id_tid,void *buf,size_tbufsize);
intputacct(idtype_tidtype,id_tid,void *buf,size_tbufsize,intflags);
intwracct(idtype_tidtype,id_tid,intflags);
These functions provide access to the extended accounting facility.
Thegetacct() function returns extended accounting buffers from the kernel for currentlyexecuting tasks and processes. The resulting data buffer is a packedexacctobject that can be unpacked usingea_unpack_object() (seeea_pack_object(3EXACCT)) and subsequently manipulatedusing the functions of the extended accounting library,libexacct(3LIB).
Theputacct() function provides privileged processes the ability to tag accounting recordswith additional data specific to that process. For instance, a queueingfacility might want to record to which queue a given task orprocess was submitted prior to running. Theflags argument determines whether thecontents ofbuf should be treated as raw data (EP_RAW) or asan embeddedexacct structure (EP_EXACCT_OBJECT). In the case ofEP_EXACCT_OBJECT,buf mustbe a packedexacct object as returned byea_pack_object(3EXACCT). The use ofan inappropriate flag or the inclusion of corruptexacct data will likely corruptthe enclosingexacct file.
Thewracct() function requests the kernel to write, given its internal stateof resource usage, the appropriate data for the specified task or process.The flags field determines whether a partial (EW_PARTIAL) or interval record (EW_INTERVAL) iswritten.
These functions require root privilege, as they allow inquiry or reporting relevantto system tasks and processes other than the invoking process. Theputacct()andwracct() functions also cause the kernel to write records to thesystem's extended accounting files.
Thegetacct() function returns the number of bytes required to represent theextended accounting record for the requested system task or process. Ifbufsize exceeds the returned size,buf will contain a valid accounting recordbuffer. Ifbufsize is less than the return value,buf will contain thefirstbufsize bytes of the record. Ifbufsize is 0,getacct() returnsonly the number of bytes required to represent the extended accounting record.In the event of failure,-1 is returned anderrno is setto indicate the error.
Theputacct() andwracct() functions return0 if the record was successfullywritten. Otherwise,-1 is returned anderrno is set to indicate theerror.
Thegetacct(),putacct(), andwracct() functions will fail if:
Theidtype argument was notP_TASKID orP_PID.
The file system containing the extended accounting file is full. Thewracct() orputacct() function will fail if the record size would exceed the amount of space remaining on the file system.
The extended accounting facility for the requestedidtype_t is not active. Eitherputacct() attempted to write a task record when the task accounting file was unset, orgetacct() attempted to retrieve accounting data for a process when extended process accounting was inactive.
The {PRIV_SYS_ACCT} privilege is not asserted in the effective set of the calling process.
Theid argument does not refer to a presently active system task ID or process ID.
Theputacct() andwracct() functions will fail if:
Theflags argument is neitherEW_PARTIAL norEW_INTERVAL.
Seeattributes(5) for descriptions of the following attributes:
|
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |