1ACCT(2)                    Linux Programmer's Manual                   ACCT(2)
2
3
4

NAME

6       acct - switch process accounting on or off
7

SYNOPSIS

9       #include <unistd.h>
10
11       int acct(const char *filename);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       acct():
16           Since glibc 2.21:
17               _DEFAULT_SOURCE
18           In glibc 2.19 and 2.20:
19               _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
20           Up to and including glibc 2.19:
21               _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
22

DESCRIPTION

24       The  acct()  system  call  enables  or disables process accounting.  If
25       called with the name of an existing file as its argument, accounting is
26       turned  on,  and  records  for each terminating process are appended to
27       filename as it terminates.  An argument of NULL causes accounting to be
28       turned off.
29

RETURN VALUE

31       On  success,  zero is returned.  On error, -1 is returned, and errno is
32       set to indicate the error.
33

ERRORS

35       EACCES Write permission is denied for the  specified  file,  or  search
36              permission is denied for one of the directories in the path pre‐
37              fix of filename (see also path_resolution(7)),  or  filename  is
38              not a regular file.
39
40       EFAULT filename points outside your accessible address space.
41
42       EIO    Error writing to the file filename.
43
44       EISDIR filename is a directory.
45
46       ELOOP  Too many symbolic links were encountered in resolving filename.
47
48       ENAMETOOLONG
49              filename was too long.
50
51       ENFILE The system-wide limit on the total number of open files has been
52              reached.
53
54       ENOENT The specified file does not exist.
55
56       ENOMEM Out of memory.
57
58       ENOSYS BSD process accounting has not been enabled when  the  operating
59              system  kernel was compiled.  The kernel configuration parameter
60              controlling this feature is CONFIG_BSD_PROCESS_ACCT.
61
62       ENOTDIR
63              A component used as a directory in filename is not in fact a di‐
64              rectory.
65
66       EPERM  The calling process has insufficient privilege to enable process
67              accounting.  On Linux, the CAP_SYS_PACCT capability is required.
68
69       EROFS  filename refers to a file on a read-only filesystem.
70
71       EUSERS There are no more free file structures or we ran out of memory.
72

CONFORMING TO

74       SVr4, 4.3BSD (but not POSIX).
75

NOTES

77       No accounting is produced for programs running when a system crash  oc‐
78       curs.  In particular, nonterminating processes are never accounted for.
79
80       The  structure  of  the  records  written to the accounting file is de‐
81       scribed in acct(5).
82

SEE ALSO

84       acct(5)
85

COLOPHON

87       This page is part of release 5.13 of the Linux  man-pages  project.   A
88       description  of  the project, information about reporting bugs, and the
89       latest    version    of    this    page,    can     be     found     at
90       https://www.kernel.org/doc/man-pages/.
91
92
93
94Linux                             2021-03-22                           ACCT(2)
Impressum