xref: /386bsd/usr/src/lib/libc/sys/acct.2 (revision a2142627)
1.\" Copyright (c) 1980, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     @(#)acct.2	6.5 (Berkeley) 3/10/91
33.\"
34.Dd March 10, 1991
35.Dt ACCT 2
36.Os BSD 4
37.Sh NAME
38.Nm acct
39.Nd enable or disable process accounting
40.Sh SYNOPSIS
41.Fd #include <unistd.h>
42.Ft int
43.Fn acct "const char *file"
44.Sh DESCRIPTION
45The
46.Fn acct
47call enables or disables the collection of system accounting
48records.
49If the argument
50.Fa file
51is a nil pointer, accounting is disabled.
52If
53.Fa file
54is an
55.Em existing
56pathname (null-terminated), record collection is enabled and for
57every process initiated which terminates under normal
58conditions an accounting record is appended to
59.Fa file .
60Abnormal conditions of termination are reboots
61or other fatal system problems.
62Records for processes which never terminate can not be
63produced by
64.Fn acct .
65.Pp
66For more information on the record structure used by
67.Fn acct ,
68see
69.Pa /usr/include/sys/acct.h
70and
71.Xr acct 5 .
72.Pp
73This call is permitted only to the super-user.
74.Sh NOTES
75Accounting is automatically disabled when the file system the
76accounting file resides on runs out of space; it is enabled when
77space once again becomes available.
78.Sh RETURN VALUES
79On error -1 is returned.
80The file must exist and the call may be exercised only by the super-user.
81.Sh ERRORS
82.Fn Acct
83will fail if one of the following is true:
84.Bl -tag -width Er
85.It Bq Er EPERM
86The caller is not the super-user.
87.It Bq Er ENOTDIR
88A component of the path prefix is not a directory.
89.It Bq Er EINVAL
90The pathname contains a character with the high-order bit set.
91.It Bq Er ENAMETOOLONG
92A component of a pathname exceeded 255 characters,
93or an entire path name exceeded 1023 characters.
94.It Bq Er ENOENT
95The named file does not exist.
96.It Bq Er EACCES
97Search permission is denied for a component of the path prefix,
98or the path name is not a regular file.
99.It Bq Er ELOOP
100Too many symbolic links were encountered in translating the pathname.
101.It Bq Er EROFS
102The named file resides on a read-only file system.
103.It Bq Er EFAULT
104.Fa File
105points outside the process's allocated address space.
106.It Bq Er EIO
107An I/O error occurred while reading from or writing to the file system.
108.El
109.Sh SEE ALSO
110.Xr acct 5 ,
111.Xr sa 8
112.Sh HISTORY
113An
114.Nm
115function call appeared in Version 7 AT&T UNIX.
116