Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

wracct(1m) [opensolaris man page]

wracct(1M)						  System Administration Commands						wracct(1M)

NAME
wracct - write extended accounting records for active processes and tasks SYNOPSIS
/usr/sbin/wracct -i id_list [-t record_type] {process | task} DESCRIPTION
The wracct utility allows the administrator to invoke the extended accounting system, if active, to write intermediate records representing the resource usage of a selected set of processes or tasks. For tasks, a record_type option is also supported, allowing the administrator to request the writing of: o an interval record, which reflects task usage since a previous interval record (or since task creation if there is no interval record), or o a partial record, which reflects usage since task creation. OPTIONS
The following options are supported: -i id_list Select the IDs of the tasks or processes to write records for. Specify id_list as a comma- or space-separated list of IDs, presented as a single argument. For some shells, this requires appropriate quoting of the argument. -t record_type Select type of record to write for the selected task or process. For tasks, record_type can be partial or interval. par- tial is the default type, and the only type available for process records. OPERANDS
The following operands are supported: process Treat the given ID as a process ID for the purposes of constructing and writing an extended accounting record. task Treat the given ID as a task ID for the purposes of constructing and writing an extended accounting record. EXAMPLES
Example 1 Writing a Partial Record Write a partial record for all active sendmail processes. # /usr/sbin/wracct -i "`pgrep sendmail`" process Example 2 Writing an Interval Record Write an interval record for the task with ID 182. # /usr/sbin/wracct -t interval -i 182 task EXIT STATUS
The following exit values are returned: 0 Successful completion. 1 An error occurred. 2 Invalid command line options were specified. 3 Pertinent components of extended accounting facility are not active. FILES
/var/adm/exacct/task /var/adm/exacct/proc Extended accounting data files. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
acctadm(1M), attributes(5) SunOS 5.11 13 July 2005 wracct(1M)

Check Out this Related Man Page

getacct(2)							   System Calls 							getacct(2)

NAME
getacct, putacct, wracct - get, put, or write extended accounting data SYNOPSIS
#include <sys/exacct.h> size_t getacct(idtype_t idtype, id_t id, void *buf, size_t bufsize); int putacct(idtype_t idtype, id_t id, void *buf, size_t bufsize, int flags); int wracct(idtype_t idtype, id_t 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 ea_unpack_object() (see ea_pack_object(3EXACCT)) 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 determines whether the contents of buf should be treated as raw data (EP_RAW) or as an embedded exacct structure (EP_EXACCT_OBJECT). In the case of EP_EXACCT_OBJECT, buf must be a packed exacct object as returned by ea_pack_object(3EXACCT). 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 determines whether a partial (EW_PARTIAL) or interval record (EW_INTERVAL) is written. 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 indi- cate the error. ERRORS
The getacct(), putacct(), and wracct() functions will fail if: EINVAL The idtype argument was not P_TASKID or P_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 remaining on the file system. ENOTACTIVE The extended accounting facility for the requested idtype_t 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 {PRIV_SYS_ACCT} 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. The putacct() and wracct() functions will fail if: EINVAL The flags argument is neither EW_PARTIAL nor EW_INTERVAL. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ |ATTRIBUTE TYPE |ATTRIBUTE VALUE +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
ea_pack_object(3EXACCT), libexacct(3LIB)attributes(5) SunOS 5.11 20 Jan 2003 getacct(2)
Man Page