fanotify_mark.2: ERRORS: add missing EBADF error for invalid 'dirfd'
[man-pages.git] / man2 / acct.2
blob87353354da6c2c6051f3720b0c90698b1c44421d
1 .\" Copyright (c) 1993 Michael Haardt
2 .\" (michael@moria.de),
3 .\" Fri Apr  2 11:32:09 MET DST 1993
4 .\"
5 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
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
22 .\" License along with this manual; if not, see
23 .\" <http://www.gnu.org/licenses/>.
24 .\" %%%LICENSE_END
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 .\"
31 .TH ACCT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
32 .SH NAME
33 acct \- switch process accounting on or off
34 .SH SYNOPSIS
35 .ad l
36 .nf
37 .B #include <unistd.h>
38 .PP
39 .BI "int acct(const char *" filename );
40 .fi
41 .ad b
42 .PP
43 .RS -4
44 Feature Test Macro Requirements for glibc (see
45 .BR feature_test_macros (7)):
46 .RE
47 .PP
48 .BR acct ():
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
58 .SH DESCRIPTION
59 The
60 .BR acct ()
61 system call enables or disables process accounting.
62 If called with the name of an existing file as its argument,
63 accounting is turned on,
64 and records for each terminating process are appended to
65 .I filename
66 as it terminates.
67 An argument of NULL causes accounting to be turned off.
68 .SH RETURN VALUE
69 On success, zero is returned.
70 On error, \-1 is returned, and
71 .I errno
72 is set to indicate the error.
73 .SH ERRORS
74 .TP
75 .B EACCES
76 Write permission is denied for the specified file,
77 or search permission is denied for one of the directories
78 in the path prefix of
79 .I filename
80 (see also
81 .BR path_resolution (7)),
83 .I filename
84 is not a regular file.
85 .TP
86 .B EFAULT
87 .I filename
88 points outside your accessible address space.
89 .TP
90 .B EIO
91 Error writing to the file
92 .IR filename .
93 .TP
94 .B EISDIR
95 .I filename
96 is a directory.
97 .TP
98 .B ELOOP
99 Too many symbolic links were encountered in resolving
100 .IR filename .
102 .B ENAMETOOLONG
103 .I filename
104 was too long.
106 .B ENFILE
107 The system-wide limit on the total number of open files has been reached.
109 .B ENOENT
110 The specified file does not exist.
112 .B ENOMEM
113 Out of memory.
115 .B ENOSYS
116 BSD process accounting has not been enabled when the operating system
117 kernel was compiled.
118 The kernel configuration parameter controlling this feature is
119 .BR CONFIG_BSD_PROCESS_ACCT .
121 .B ENOTDIR
122 A component used as a directory in
123 .I filename
124 is not in fact a directory.
126 .B EPERM
127 The calling process has insufficient privilege to enable process accounting.
128 On Linux, the
129 .B CAP_SYS_PACCT
130 capability is required.
132 .B EROFS
133 .I filename
134 refers to a file on a read-only filesystem.
136 .B EUSERS
137 There are no more free file structures or we ran out of memory.
138 .SH CONFORMING TO
139 SVr4, 4.3BSD (but not POSIX).
140 .\" SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS.
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).
145 .SH NOTES
146 No accounting is produced for programs running when a system crash occurs.
147 In particular, nonterminating processes are never accounted for.
149 The structure of the records written to the accounting file is described in
150 .BR acct (5).
151 .SH SEE ALSO
152 .BR acct (5)