xref: /original-bsd/lib/libc/sys/acct.2 (revision da6ea800)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)acct.2	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt ACCT 2
10.Os BSD 4
11.Sh NAME
12.Nm acct
13.Nd enable or disable process accounting
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Ft int
17.Fn acct "const char *file"
18.Sh DESCRIPTION
19The
20.Fn acct
21call enables or disables the collection of system accounting
22records.
23If the argument
24.Fa file
25is a nil pointer, accounting is disabled.
26If
27.Fa file
28is an
29.Em existing
30pathname (null-terminated), record collection is enabled and for
31every process initiated which terminates under normal
32conditions an accounting record is appended to
33.Fa file .
34Abnormal conditions of termination are reboots
35or other fatal system problems.
36Records for processes which never terminate can not be
37produced by
38.Fn acct .
39.Pp
40For more information on the record structure used by
41.Fn acct ,
42see
43.Pa /usr/include/sys/acct.h
44and
45.Xr acct 5 .
46.Pp
47This call is permitted only to the super-user.
48.Sh NOTES
49Accounting is automatically disabled when the file system the
50accounting file resides on runs out of space; it is enabled when
51space once again becomes available.
52.Sh RETURN VALUES
53On error -1 is returned.
54The file must exist and the call may be exercised only by the super-user.
55.Sh ERRORS
56.Fn Acct
57will fail if one of the following is true:
58.Bl -tag -width Er
59.It Bq Er EPERM
60The caller is not the super-user.
61.It Bq Er ENOTDIR
62A component of the path prefix is not a directory.
63.It Bq Er EINVAL
64The pathname contains a character with the high-order bit set.
65.It Bq Er ENAMETOOLONG
66A component of a pathname exceeded 255 characters,
67or an entire path name exceeded 1023 characters.
68.It Bq Er ENOENT
69The named file does not exist.
70.It Bq Er EACCES
71Search permission is denied for a component of the path prefix,
72or the path name is not a regular file.
73.It Bq Er ELOOP
74Too many symbolic links were encountered in translating the pathname.
75.It Bq Er EROFS
76The named file resides on a read-only file system.
77.It Bq Er EFAULT
78.Fa File
79points outside the process's allocated address space.
80.It Bq Er EIO
81An I/O error occurred while reading from or writing to the file system.
82.El
83.Sh SEE ALSO
84.Xr acct 5 ,
85.Xr sa 8
86.Sh HISTORY
87An
88.Nm
89function call appeared in Version 7 AT&T UNIX.
90