1acct(2)                       System Calls Manual                      acct(2)
2
3
4

NAME

6       acct - switch process accounting on or off
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

34       On  success,  zero is returned.  On error, -1 is returned, and errno is
35       set to indicate the error.
36

ERRORS

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

STANDARDS

77       None.
78

HISTORY

80       SVr4, 4.3BSD.
81

NOTES

83       No accounting is produced for programs running when a system crash  oc‐
84       curs.  In particular, nonterminating processes are never accounted for.
85
86       The  structure  of  the  records  written to the accounting file is de‐
87       scribed in acct(5).
88

SEE ALSO

90       acct(5)
91
92
93
94Linux man-pages 6.05              2023-03-30                           acct(2)
Impressum