| 1 |
.\" Copyright (c) 1993 Michael Haardt |
| 2 |
.\" ([email protected]), |
| 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 <[email protected]> |
| 8 |
.\" Modified 1993-08-10 by Alan Cox <[email protected]> |
| 9 |
.\" Modified 1998-11-04 by Tigran Aivazian <[email protected]> |
| 10 |
.\" Modified 2004-05-27, 2004-06-17, 2004-06-23 by Michael Kerrisk |
| 11 |
.\" |
| 12 |
.TH acct 2 2024-05-02 "Linux man-pages 6.9.1" |
| 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 |
.P |
| 22 |
.BI "int acct(const char *_Nullable " filename ); |
| 23 |
.fi |
| 24 |
.P |
| 25 |
.RS -4 |
| 26 |
Feature Test Macro Requirements for glibc (see |
| 27 |
.BR feature_test_macros (7)): |
| 28 |
.RE |
| 29 |
.P |
| 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)), |
| 64 |
or |
| 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 . |
| 102 |
.TP |
| 103 |
.B ENOTDIR |
| 104 |
A component used as a directory in |
| 105 |
.I filename |
| 106 |
is not in fact a directory. |
| 107 |
.TP |
| 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. |
| 113 |
.TP |
| 114 |
.B EROFS |
| 115 |
.I filename |
| 116 |
refers to a file on a read-only filesystem. |
| 117 |
.TP |
| 118 |
.B EUSERS |
| 119 |
There are no more free file structures or we ran out of memory. |
| 120 |
.SH STANDARDS |
| 121 |
None. |
| 122 |
.SH HISTORY |
| 123 |
SVr4, 4.3BSD. |
| 124 |
.\" SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS. |
| 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). |
| 129 |
.SH NOTES |
| 130 |
No accounting is produced for programs running when a system crash occurs. |
| 131 |
In particular, nonterminating processes are never accounted for. |
| 132 |
.P |
| 133 |
The structure of the records written to the accounting file is described in |
| 134 |
.BR acct (5). |
| 135 |
.SH SEE ALSO |
| 136 |
.BR acct (5) |