'\"macro stdmacro
.if n .pH g2.acct @(#)acct @(#)acct	40.26
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} acct 2 "" "\&"
.if \nX=1 .ds x} acct 2 ""
.if \nX=2 .ds x} acct 2 "" "\&"
.if \nX=3 .ds x} acct "" "" "\&"
.TH \*(x}
.SH NAME
\f4acct\f1 \- enable or disable process accounting
.SH SYNOPSIS
\f4#include <unistd.h>\f1
.PP
\f4int acct(const char \(**path);\f1
.SH DESCRIPTION
\f4acct\fP
enables or disables the system process accounting routine.
If the routine is enabled, an accounting record will be written in an
accounting file for each process that terminates.
The termination of a process can be caused by one of two things: an
\f4exit\fP
call or a signal
[see
\f4exit\fP(2) and \f4signal\fP(2)].
The effective user
.SM ID
of the process calling \f4acct\f1 must be superuser.
.PP
.I path\^
points to a pathname naming the accounting file.
The accounting file format is given in
\f4acct\fP(4).
.PP
The accounting routine is enabled if
.I path\^
is non-zero and no errors occur during the system call.
It is disabled if
.I path\^
is \f4(char *)NULL\fP and no errors occur during the system call.
.PP
\f4acct\fP
will fail if one or more of the following are true:
.TP 20
\f4EACCES\fP
The file named by
.I path\^
is not an ordinary file.
.TP
\f4EBUSY\fP
An attempt is being made to enable accounting using the same file
that is currently being used.
.TP
\f4EFAULT\fP
.I path\^
points to an illegal address.
.TP
\f4ELOOP\fP
Too many symbolic links were encountered in translating \f2path\f1.
.TP
\f4ENAMETOOLONG\fP
The length of the \f2path\f1 argument exceeds {\f4PATH_MAX\f1}, or the
length of a \f2path\f1 component exceeds {\f4NAME_MAX\f1} while
\f4_POSIX_NO_TRUNC\f1 is in effect.
.TP
\f4ENOTDIR\fP
A component of the path prefix is not a directory.
.TP
\f4ENOENT\fP
One or more components of the accounting file pathname do not exist.
.TP
\f4EPERM\fP
The effective user
of the calling process is not superuser.
.TP
\f4EROFS\fP
The named file resides on a read-only file system.
.SH SEE ALSO
\f4exit\fP(2), \f4signal\fP(2).
.br
\f4acct\fP(4) in the \f2System Administrator's Reference Manual\f1.
.SH "DIAGNOSTICS"
Upon successful completion, a value of 0 is returned. Otherwise, a
value of \-1 is returned and
\f4errno\fP
is set to indicate the error.
.\"	@(#)acct.2	6.2 of 9/6/83
.Ee
