]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/acct.2
getent.1, _syscall.2, acct.2, adjtimex.2, bdflush.2, brk.2, cacheflush.2, getsid...
[thirdparty/man-pages.git] / man2 / acct.2
CommitLineData
fea681da
MK
1.\" Copyright (c) 1993 Michael Haardt
2.\" (michael@moria.de),
3.\" Fri Apr 2 11:32:09 MET DST 1993
4.\"
6a8d8745 5.\" %%%LICENSE_START(GPLv2+_doc_full)
fea681da
MK
6.\" This is free documentation; you can redistribute it and/or
7.\" modify it under the terms of the GNU General Public License as
8.\" published by the Free Software Foundation; either version 2 of
9.\" the License, or (at your option) any later version.
10.\"
11.\" The GNU General Public License's references to "object code"
12.\" and "executables" are to be interpreted as the output of any
13.\" document formatting or typesetting system, including
14.\" intermediate and printed output.
15.\"
16.\" This manual is distributed in the hope that it will be useful,
17.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19.\" GNU General Public License for more details.
20.\"
21.\" You should have received a copy of the GNU General Public
c715f741
MK
22.\" License along with this manual; if not, see
23.\" <http://www.gnu.org/licenses/>.
6a8d8745 24.\" %%%LICENSE_END
fea681da
MK
25.\"
26.\" Modified 1993-07-22 by Rik Faith <faith@cs.unc.edu>
27.\" Modified 1993-08-10 by Alan Cox <iiitac@pyramid.swansea.ac.uk>
28.\" Modified 1998-11-04 by Tigran Aivazian <tigran@sco.com>
29.\" Modified 2004-05-27, 2004-06-17, 2004-06-23 by Michael Kerrisk
30.\"
3cde6db5 31.TH ACCT 2 2008-06-16 "Linux" "Linux Programmer's Manual"
fea681da
MK
32.SH NAME
33acct \- switch process accounting on or off
34.SH SYNOPSIS
35.ad l
36.nf
37.B #include <unistd.h>
38.sp
39.BI "int acct(const char *" filename );
40.fi
41.ad b
cc4615cc
MK
42.sp
43.in -4n
44Feature Test Macro Requirements for glibc (see
45.BR feature_test_macros (7)):
46.in
47.sp
48.BR acct ():
49_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
fea681da 50.SH DESCRIPTION
3cde6db5 51The
61792fc6 52.BR acct ()
3cde6db5
MK
53system call enables or disables process accounting.
54If called with the name of an existing file as its argument,
55accounting is turned on,
56and records for each terminating process are appended to
c13182ef
MK
57\fIfilename\fP as it terminates.
58An argument of NULL causes accounting to be turned off.
47297adb 59.SH RETURN VALUE
c13182ef
MK
60On success, zero is returned.
61On error, \-1 is returned, and
fea681da
MK
62.I errno
63is set appropriately.
64.SH ERRORS
65.TP
66.B EACCES
67Write permission is denied for the specified file,
68or search permission is denied for one of the directories
69in the path prefix of
70.I filename
71(see also
ad7cc990 72.BR path_resolution (7)),
fea681da
MK
73or
74.I filename
75is not a regular file.
76.TP
77.B EFAULT
78.I filename
79points outside your accessible address space.
80.TP
81.B EIO
82Error writing to the file
83.IR filename .
84.TP
85.B EISDIR
c13182ef 86.I filename
fea681da
MK
87is a directory.
88.TP
89.B ELOOP
c13182ef 90Too many symbolic links were encountered in resolving
fea681da
MK
91.IR filename .
92.TP
93.B ENAMETOOLONG
94.I filename
95was too long.
96.TP
97.B ENFILE
98The system limit on the total number of open files has been reached.
99.TP
100.B ENOENT
101The specified filename does not exist.
102.TP
103.B ENOMEM
104Out of memory.
105.TP
106.B ENOSYS
107BSD process accounting has not been enabled when the operating system
108kernel was compiled.
109The kernel configuration parameter controlling this feature is
682edefb 110.BR CONFIG_BSD_PROCESS_ACCT .
fea681da
MK
111.TP
112.B ENOTDIR
c13182ef
MK
113A component used as a directory in
114.I filename
fea681da
MK
115is not in fact a directory.
116.TP
117.B EPERM
118The calling process has insufficient privilege to enable process accounting.
119On Linux the
120.B CAP_SYS_PACCT
121capability is required.
122.TP
123.B EROFS
c13182ef 124.I filename
fea681da
MK
125refers to a file on a read-only file system.
126.TP
127.B EUSERS
128There are no more free file structures or we ran out of memory.
47297adb 129.SH CONFORMING TO
c13182ef
MK
130SVr4, 4.3BSD (but not POSIX).
131.\" SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS.
97c1eac8
MK
132.\" Also AIX and HP-UX document EBUSY (attempt is made
133.\" to enable accounting when it is already enabled), as does Solaris
134.\" (attempt is made to enable accounting using the same file that is
135.\" currently being used).
fea681da 136.SH NOTES
3cde6db5 137No accounting is produced for programs running when a system crash occurs.
24b74457 138In particular, nonterminating processes are never accounted for.
3cde6db5
MK
139
140The structure of the records written to the accounting file is described in
141.BR acct (5).
47297adb 142.SH SEE ALSO
cbc2a267 143.BR acct (5)