]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/acct.2
sched_setaffinity.2: tfix in example shell session (s/grep/egrep)
[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.\"
1dd72f9c 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.\"
97986708 31.TH ACCT 2 2016-03-15 "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>
399d0bad 38.PP
fea681da
MK
39.BI "int acct(const char *" filename );
40.fi
41.ad b
399d0bad 42.PP
cc4615cc
MK
43.in -4n
44Feature Test Macro Requirements for glibc (see
45.BR feature_test_macros (7)):
46.in
399d0bad 47.PP
cc4615cc 48.BR acct ():
d0544534
MK
49.nf
50 Since glibc 2.21:
51.\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8
52 _DEFAULT_SOURCE
53 In glibc 2.19 and 2.20:
54 _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
55 Up to and including glibc 2.19:
56 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
57.fi
fea681da 58.SH DESCRIPTION
3cde6db5 59The
61792fc6 60.BR acct ()
3cde6db5
MK
61system call enables or disables process accounting.
62If called with the name of an existing file as its argument,
63accounting is turned on,
64and records for each terminating process are appended to
c6fa0841
MK
65.I filename
66as it terminates.
c13182ef 67An argument of NULL causes accounting to be turned off.
47297adb 68.SH RETURN VALUE
c13182ef
MK
69On success, zero is returned.
70On error, \-1 is returned, and
fea681da
MK
71.I errno
72is set appropriately.
73.SH ERRORS
74.TP
75.B EACCES
76Write permission is denied for the specified file,
77or search permission is denied for one of the directories
78in the path prefix of
79.I filename
80(see also
ad7cc990 81.BR path_resolution (7)),
fea681da
MK
82or
83.I filename
84is not a regular file.
85.TP
86.B EFAULT
87.I filename
88points outside your accessible address space.
89.TP
90.B EIO
91Error writing to the file
92.IR filename .
93.TP
94.B EISDIR
c13182ef 95.I filename
fea681da
MK
96is a directory.
97.TP
98.B ELOOP
c13182ef 99Too many symbolic links were encountered in resolving
fea681da
MK
100.IR filename .
101.TP
102.B ENAMETOOLONG
103.I filename
104was too long.
105.TP
106.B ENFILE
e258766b 107The system-wide limit on the total number of open files has been reached.
fea681da
MK
108.TP
109.B ENOENT
e82c4748 110The specified file does not exist.
fea681da
MK
111.TP
112.B ENOMEM
113Out of memory.
114.TP
115.B ENOSYS
116BSD process accounting has not been enabled when the operating system
117kernel was compiled.
118The kernel configuration parameter controlling this feature is
682edefb 119.BR CONFIG_BSD_PROCESS_ACCT .
fea681da
MK
120.TP
121.B ENOTDIR
c13182ef
MK
122A component used as a directory in
123.I filename
fea681da
MK
124is not in fact a directory.
125.TP
126.B EPERM
127The calling process has insufficient privilege to enable process accounting.
329ad271 128On Linux, the
fea681da
MK
129.B CAP_SYS_PACCT
130capability is required.
131.TP
132.B EROFS
c13182ef 133.I filename
9ee4a2b6 134refers to a file on a read-only filesystem.
fea681da
MK
135.TP
136.B EUSERS
137There are no more free file structures or we ran out of memory.
47297adb 138.SH CONFORMING TO
c13182ef
MK
139SVr4, 4.3BSD (but not POSIX).
140.\" SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS.
97c1eac8
MK
141.\" Also AIX and HP-UX document EBUSY (attempt is made
142.\" to enable accounting when it is already enabled), as does Solaris
143.\" (attempt is made to enable accounting using the same file that is
144.\" currently being used).
fea681da 145.SH NOTES
3cde6db5 146No accounting is produced for programs running when a system crash occurs.
24b74457 147In particular, nonterminating processes are never accounted for.
399d0bad 148.PP
3cde6db5
MK
149The structure of the records written to the accounting file is described in
150.BR acct (5).
47297adb 151.SH SEE ALSO
cbc2a267 152.BR acct (5)