1getacct(2)                       System Calls                       getacct(2)
2
3
4

NAME

6       getacct, putacct, wracct - get, put, or write extended accounting data
7

SYNOPSIS

9       #include <sys/exacct.h>
10
11       size_t getacct(idtype_t idtype, id_t id, void *buf, size_t bufsize);
12
13
14       int putacct(idtype_t idtype, id_t id, void *buf, size_t bufsize, int flags);
15
16
17       int wracct(idtype_t idtype, id_t id, int flags);
18
19

DESCRIPTION

21       These functions provide access to the extended accounting facility.
22
23
24       The  getacct()  function  returns  extended accounting buffers from the
25       kernel for currently executing tasks and processes. The resulting  data
26       buffer   is   a  packed  exacct  object  that  can  be  unpacked  using
27       ea_unpack_object()  (see  ea_pack_object(3EXACCT))   and   subsequently
28       manipulated  using  the  functions  of the extended accounting library,
29       libexacct(3LIB).
30
31
32       The putacct() function provides privileged processes the ability to tag
33       accounting  records with additional data specific to that process.  For
34       instance, a queueing facility might want to record  to  which  queue  a
35       given  task  or process was submitted prior to running. The flags argu‐
36       ment determines whether the contents of buf should be  treated  as  raw
37       data (EP_RAW) or as an embedded exacct structure (EP_EXACCT_OBJECT). In
38       the case of EP_EXACCT_OBJECT, buf must be a  packed  exacct  object  as
39       returned  by  ea_pack_object(3EXACCT). The use of an inappropriate flag
40       or the inclusion of corrupt exacct data will likely corrupt the enclos‐
41       ing exacct file.
42
43
44       The  wracct() function requests the kernel to write, given its internal
45       state of resource usage, the appropriate data for the specified task or
46       process.  The  flags field determines whether a partial (EW_PARTIAL) or
47       interval record (EW_INTERVAL) is written.
48
49
50       These functions require  root  privilege,  as  they  allow  inquiry  or
51       reporting  relevant to system tasks and processes other than the invok‐
52       ing process. The putacct() and wracct() functions also cause the kernel
53       to write records to the system's extended accounting files.
54

RETURN VALUES

56       The  getacct()  function returns the number of bytes required to repre‐
57       sent the extended accounting record for the requested  system  task  or
58       process.   If  bufsize  exceeds  the  returned size, buf will contain a
59       valid accounting record buffer. If bufsize  is  less  than  the  return
60       value,  buf will contain the first bufsize bytes of the record. If buf‐
61       size is 0, getacct() returns only the number of  bytes required to rep‐
62       resent  the  extended accounting record. In the event of failure, −1 is
63       returned and errno is set to indicate the error.
64
65
66       The putacct() and wracct() functions return 0 if the  record  was  suc‐
67       cessfully  written. Otherwise, −1 is returned and errno is set to indi‐
68       cate the error.
69

ERRORS

71       The getacct(), putacct(), and wracct() functions will fail if:
72
73       EINVAL        The idtype argument was not P_TASKID or P_PID.
74
75
76       ENOSPC        The file system containing the extended  accounting  file
77                     is full.  The wracct() or putacct() function will fail if
78                     the record size would exceed the amount of space  remain‐
79                     ing on the file system.
80
81
82       ENOTACTIVE    The   extended  accounting  facility  for  the  requested
83                     idtype_t is not active.  Either  putacct()  attempted  to
84                     write  a  task  record  when the task accounting file was
85                     unset, or getacct() attempted to retrieve accounting data
86                     for  a process when extended process accounting was inac‐
87                     tive.
88
89
90       EPERM         The {PRIV_SYS_ACCT} privilege  is  not  asserted  in  the
91                     effective set of the calling process.
92
93
94       ERSCH         The id argument does not refer to a presently active sys‐
95                     tem task ID or process ID.
96
97
98
99       The putacct() and wracct() functions will fail if:
100
101       EINVAL    The flags argument is neither EW_PARTIAL nor EW_INTERVAL.
102
103

ATTRIBUTES

105       See attributes(5) for descriptions of the following attributes:
106
107
108
109
110       ┌─────────────────────────────┬─────────────────────────────┐
111       │ATTRIBUTE  TYPE              │ATTRIBUTE                   V│ALUE
112       ├─────────────────────────────┼─────────────────────────────┤
113       │MT-Level                     │Async-Signal-Safe            │
114       └─────────────────────────────┴─────────────────────────────┘
115

SEE ALSO

117       ea_pack_object(3EXACCT), libexacct(3LIB)attributes(5)
118
119
120
121SunOS 5.11                        20 Jan 2003                       getacct(2)
Impressum