]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man/man2/acct.2
man/, share/mk/: Move man*/ to man/
[thirdparty/man-pages.git] / man / 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.\"
e4a74ca8 5.\" SPDX-License-Identifier: GPL-2.0-or-later
fea681da
MK
6.\"
7.\" Modified 1993-07-22 by Rik Faith <faith@cs.unc.edu>
8.\" Modified 1993-08-10 by Alan Cox <iiitac@pyramid.swansea.ac.uk>
9.\" Modified 1998-11-04 by Tigran Aivazian <tigran@sco.com>
10.\" Modified 2004-05-27, 2004-06-17, 2004-06-23 by Michael Kerrisk
11.\"
4c1c5274 12.TH acct 2 (date) "Linux man-pages (unreleased)"
fea681da
MK
13.SH NAME
14acct \- switch process accounting on or off
76b1f262
AC
15.SH LIBRARY
16Standard C library
8fc3b2cf 17.RI ( libc ", " \-lc )
fea681da 18.SH SYNOPSIS
fea681da
MK
19.nf
20.B #include <unistd.h>
c6d039a3 21.P
302e02c5 22.BI "int acct(const char *_Nullable " filename );
fea681da 23.fi
c6d039a3 24.P
d39ad78f 25.RS -4
cc4615cc
MK
26Feature Test Macro Requirements for glibc (see
27.BR feature_test_macros (7)):
d39ad78f 28.RE
c6d039a3 29.P
cc4615cc 30.BR acct ():
d0544534
MK
31.nf
32 Since glibc 2.21:
33.\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8
34 _DEFAULT_SOURCE
35 In glibc 2.19 and 2.20:
5c10d2c5 36 _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
d0544534 37 Up to and including glibc 2.19:
5c10d2c5 38 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
d0544534 39.fi
fea681da 40.SH DESCRIPTION
3cde6db5 41The
61792fc6 42.BR acct ()
3cde6db5
MK
43system call enables or disables process accounting.
44If called with the name of an existing file as its argument,
45accounting is turned on,
46and records for each terminating process are appended to
c6fa0841
MK
47.I filename
48as it terminates.
c13182ef 49An argument of NULL causes accounting to be turned off.
47297adb 50.SH RETURN VALUE
c13182ef
MK
51On success, zero is returned.
52On error, \-1 is returned, and
fea681da 53.I errno
f6a4078b 54is set to indicate the error.
fea681da
MK
55.SH ERRORS
56.TP
57.B EACCES
58Write permission is denied for the specified file,
59or search permission is denied for one of the directories
60in the path prefix of
61.I filename
62(see also
ad7cc990 63.BR path_resolution (7)),
fea681da
MK
64or
65.I filename
66is not a regular file.
67.TP
68.B EFAULT
69.I filename
70points outside your accessible address space.
71.TP
72.B EIO
73Error writing to the file
74.IR filename .
75.TP
76.B EISDIR
c13182ef 77.I filename
fea681da
MK
78is a directory.
79.TP
80.B ELOOP
c13182ef 81Too many symbolic links were encountered in resolving
fea681da
MK
82.IR filename .
83.TP
84.B ENAMETOOLONG
85.I filename
86was too long.
87.TP
88.B ENFILE
e258766b 89The system-wide limit on the total number of open files has been reached.
fea681da
MK
90.TP
91.B ENOENT
e82c4748 92The specified file does not exist.
fea681da
MK
93.TP
94.B ENOMEM
95Out of memory.
96.TP
97.B ENOSYS
98BSD process accounting has not been enabled when the operating system
99kernel was compiled.
100The kernel configuration parameter controlling this feature is
682edefb 101.BR CONFIG_BSD_PROCESS_ACCT .
fea681da
MK
102.TP
103.B ENOTDIR
c13182ef
MK
104A component used as a directory in
105.I filename
fea681da
MK
106is not in fact a directory.
107.TP
108.B EPERM
109The calling process has insufficient privilege to enable process accounting.
329ad271 110On Linux, the
fea681da
MK
111.B CAP_SYS_PACCT
112capability is required.
113.TP
114.B EROFS
c13182ef 115.I filename
9ee4a2b6 116refers to a file on a read-only filesystem.
fea681da
MK
117.TP
118.B EUSERS
119There are no more free file structures or we ran out of memory.
3113c7f3 120.SH STANDARDS
4131356c
AC
121None.
122.SH HISTORY
123SVr4, 4.3BSD.
c13182ef 124.\" SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS.
97c1eac8
MK
125.\" Also AIX and HP-UX document EBUSY (attempt is made
126.\" to enable accounting when it is already enabled), as does Solaris
127.\" (attempt is made to enable accounting using the same file that is
128.\" currently being used).
fea681da 129.SH NOTES
3cde6db5 130No accounting is produced for programs running when a system crash occurs.
24b74457 131In particular, nonterminating processes are never accounted for.
c6d039a3 132.P
3cde6db5
MK
133The structure of the records written to the accounting file is described in
134.BR acct (5).
47297adb 135.SH SEE ALSO
cbc2a267 136.BR acct (5)