Debian Codegraph @

upstream/debian-unstable/man2/acct.2

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