1acct(2) System Calls acct(2)
2
3
4
6 acct - enable or disable process accounting
7
9 #include <unistd.h>
10
11 int acct(const char *path);
12
13
15 The acct() function enables or disables the system process accounting
16 routine. If the routine is enabled, an accounting record will be writ‐
17 ten in an accounting file for each process that terminates. The termi‐
18 nation of a process can be caused by either an exit(2) call or a sig‐
19 nal(3C)). The effective user ID of the process calling acct() must have
20 the appropriate privileges.
21
22
23 The path argument points to the pathname of the accounting file, whose
24 file format is described on the acct.h(3HEAD) manual page.
25
26
27 The accounting routine is enabled if path is non-zero and no errors
28 occur during the function. It is disabled if path is (char *)NULL and
29 no errors occur during the function.
30
32 Upon successful completion, 0 is returned. Otherwise, −1 is returned
33 and errno is set to indicate the error.
34
36 The acct() function will fail if:
37
38 EACCES The file named by path is not an ordinary file.
39
40
41 EBUSY An attempt is being made to enable accounting using the
42 same file that is currently being used.
43
44
45 EFAULT The path argument points to an illegal address.
46
47
48 ELOOP Too many symbolic links were encountered in translating
49 path.
50
51
52 ENAMETOOLONG The length of the path argument exceeds {PATH_MAX}, or
53 the length of a path argument exceeds {NAME_MAX} while
54 _POSIX_NO_TRUNC is in effect.
55
56
57 ENOENT One or more components of the accounting file pathname
58 do not exist.
59
60
61 ENOTDIR A component of the path prefix is not a directory.
62
63
64 EPERM The {PRIV_SYS_ACCT} privilege is not asserted in the
65 effective set of the calling process.
66
67
68 EROFS The named file resides on a read-only file system.
69
70
72 exit(2), acct.h(3HEAD), signal(3C), privileges(5)
73
74
75
76SunOS 5.11 20 Jan 2003 acct(2)