'\" te
.\"  Copyright (c) 2003, Sun Microsystems, Inc.  All Rights Reserved  Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ACCT 2 "Jan 20, 2003"
.SH NAME
acct \- enable or disable process accounting
.SH SYNOPSIS
.LP
.nf
#include <unistd.h>

\fBint\fR \fBacct\fR(\fBconst char *\fR\fIpath\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBacct()\fR function 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 either an \fBexit\fR(2) call or a \fBsignal\fR(3C)). The
effective user \fBID\fR of the process calling \fBacct()\fR must have the
appropriate privileges.
.sp
.LP
The \fIpath\fR argument points to the pathname of the accounting file, whose
file format is described on the \fBacct.h\fR(3HEAD) manual page.
.sp
.LP
The accounting routine is enabled if \fIpath\fR is non-zero and no errors occur
during the function. It is disabled if \fIpath\fR is  \fB(char *)NULL\fR  and
no errors occur during the function.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
returned and \fBerrno\fR is set to indicate the error.
.SH ERRORS
.sp
.LP
The \fBacct()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEACCES\fR\fR
.ad
.RS 16n
The file named by \fIpath\fR is not an ordinary file.
.RE

.sp
.ne 2
.na
\fB\fBEBUSY\fR\fR
.ad
.RS 16n
An attempt is being made to enable accounting using the same file that is
currently being used.
.RE

.sp
.ne 2
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 16n
The \fIpath\fR argument points to an illegal address.
.RE

.sp
.ne 2
.na
\fB\fBELOOP\fR\fR
.ad
.RS 16n
Too many symbolic links were encountered in translating \fIpath\fR.
.RE

.sp
.ne 2
.na
\fB\fBENAMETOOLONG\fR\fR
.ad
.RS 16n
The length of the  \fIpath\fR argument exceeds {\fBPATH_MAX\fR}, or the length
of a \fIpath\fR argument exceeds {\fBNAME_MAX\fR} while \fB_POSIX_NO_TRUNC\fR
is in effect.
.RE

.sp
.ne 2
.na
\fB\fBENOENT\fR\fR
.ad
.RS 16n
One or more components of the accounting file pathname do not exist.
.RE

.sp
.ne 2
.na
\fB\fBENOTDIR\fR\fR
.ad
.RS 16n
A component of the path prefix is not a directory.
.RE

.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 16n
The {\fBPRIV_SYS_ACCT\fR} privilege is not asserted in the effective set of the
calling process.
.RE

.sp
.ne 2
.na
\fB\fBEROFS\fR\fR
.ad
.RS 16n
The named file resides on a read-only file system.
.RE

.SH SEE ALSO
.sp
.LP
\fBexit\fR(2), \fBacct.h\fR(3HEAD), \fBsignal\fR(3C), \fBprivileges\fR(5)