tzfile.5, tzselect.8: sync from tzdb upstream
[man-pages.git] / man2 / acct.2
blobf9fc1cd5c86f0645fc1bd152bba4962f34691cb4
1 .\" Copyright (c) 1993 Michael Haardt
2 .\" (michael@moria.de),
3 .\" Fri Apr  2 11:32:09 MET DST 1993
4 .\"
5 .\" SPDX-License-Identifier: GPL-2.0-or-later
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 .\"
12 .TH acct 2 (date) "Linux man-pages (unreleased)"
13 .SH NAME
14 acct \- switch process accounting on or off
15 .SH LIBRARY
16 Standard C library
17 .RI ( libc ", " \-lc )
18 .SH SYNOPSIS
19 .nf
20 .B #include <unistd.h>
21 .PP
22 .BI "int acct(const char *_Nullable " filename );
23 .fi
24 .PP
25 .RS -4
26 Feature Test Macro Requirements for glibc (see
27 .BR feature_test_macros (7)):
28 .RE
29 .PP
30 .BR acct ():
31 .nf
32     Since glibc 2.21:
33 .\"             commit 266865c0e7b79d4196e2cc393693463f03c90bd8
34         _DEFAULT_SOURCE
35     In glibc 2.19 and 2.20:
36         _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
37     Up to and including glibc 2.19:
38         _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
39 .fi
40 .SH DESCRIPTION
41 The
42 .BR acct ()
43 system call enables or disables process accounting.
44 If called with the name of an existing file as its argument,
45 accounting is turned on,
46 and records for each terminating process are appended to
47 .I filename
48 as it terminates.
49 An argument of NULL causes accounting to be turned off.
50 .SH RETURN VALUE
51 On success, zero is returned.
52 On error, \-1 is returned, and
53 .I errno
54 is set to indicate the error.
55 .SH ERRORS
56 .TP
57 .B EACCES
58 Write permission is denied for the specified file,
59 or search permission is denied for one of the directories
60 in the path prefix of
61 .I filename
62 (see also
63 .BR path_resolution (7)),
65 .I filename
66 is not a regular file.
67 .TP
68 .B EFAULT
69 .I filename
70 points outside your accessible address space.
71 .TP
72 .B EIO
73 Error writing to the file
74 .IR filename .
75 .TP
76 .B EISDIR
77 .I filename
78 is a directory.
79 .TP
80 .B ELOOP
81 Too many symbolic links were encountered in resolving
82 .IR filename .
83 .TP
84 .B ENAMETOOLONG
85 .I filename
86 was too long.
87 .TP
88 .B ENFILE
89 The system-wide limit on the total number of open files has been reached.
90 .TP
91 .B ENOENT
92 The specified file does not exist.
93 .TP
94 .B ENOMEM
95 Out of memory.
96 .TP
97 .B ENOSYS
98 BSD process accounting has not been enabled when the operating system
99 kernel was compiled.
100 The kernel configuration parameter controlling this feature is
101 .BR CONFIG_BSD_PROCESS_ACCT .
103 .B ENOTDIR
104 A component used as a directory in
105 .I filename
106 is not in fact a directory.
108 .B EPERM
109 The calling process has insufficient privilege to enable process accounting.
110 On Linux, the
111 .B CAP_SYS_PACCT
112 capability is required.
114 .B EROFS
115 .I filename
116 refers to a file on a read-only filesystem.
118 .B EUSERS
119 There are no more free file structures or we ran out of memory.
120 .SH STANDARDS
121 SVr4, 4.3BSD (but not POSIX).
122 .\" SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS.
123 .\" Also AIX and HP-UX document EBUSY (attempt is made
124 .\" to enable accounting when it is already enabled), as does Solaris
125 .\" (attempt is made to enable accounting using the same file that is
126 .\" currently being used).
127 .SH NOTES
128 No accounting is produced for programs running when a system crash occurs.
129 In particular, nonterminating processes are never accounted for.
131 The structure of the records written to the accounting file is described in
132 .BR acct (5).
133 .SH SEE ALSO
134 .BR acct (5)