.TH acct() "" "" "System Call (libc)"
.PC "Enable/disable process accounting"
.B "#include <acct.h>"
\fBacct(\^\fIfile\^\fB)\fR
\fBchar *\^\fIfile\fB\^;\fR
.PP
.I "Process accounting"
records who initiates each system process and how long each process
takes to execute.
These data can be analyzed, to administer the system most
efficiently.
.PP
The system call
.B acct()
enables or disables process accounting.
If
.I file
is not NULL, then accounting is turned on;
if
.I file
is NULL, however, then process accounting is turned off.
.PP
It is usual, but not necessary, that
.I file
be \fB/usr/adm/acct\fR.
.I file
must exist.
When enabled, the system appends a raw accounting data record
in the format described by
.B acct.h
to
.I file
as each process terminates.
.PP
.B acct()
is restricted to the superuser.
.SH "See Also"
.Xr ac, ac
.Xr acct.h, acct.h
.Xr accton, accton
.Xr exit(), exit
.Xr libc, libc
.Xr sa, sa
.Xr times(), times
.SH Diagnostics
Successful calls return zero.
.B acct()
returns \-1 for errors, such as nonexistent
.I file
or invocation by a user other than the superuser.
.SH Notes
The system writes accounting records for a process only when the
process exits.
Processes that never terminate and
processes running at the time of a system crash
do not produce accounting information.
