]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/acct.2
getent.1, intro.1, time.1, _exit.2, _syscall.2, accept.2, access.2, acct.2, adjtimex...
[thirdparty/man-pages.git] / man2 / acct.2
CommitLineData
fea681da
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\"
3.\" Copyright (c) 1993 Michael Haardt
4.\" (michael@moria.de),
5.\" Fri Apr 2 11:32:09 MET DST 1993
6.\"
7.\" This is free documentation; you can redistribute it and/or
8.\" modify it under the terms of the GNU General Public License as
9.\" published by the Free Software Foundation; either version 2 of
10.\" the License, or (at your option) any later version.
11.\"
12.\" The GNU General Public License's references to "object code"
13.\" and "executables" are to be interpreted as the output of any
14.\" document formatting or typesetting system, including
15.\" intermediate and printed output.
16.\"
17.\" This manual is distributed in the hope that it will be useful,
18.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
19.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.\" GNU General Public License for more details.
21.\"
22.\" You should have received a copy of the GNU General Public
23.\" License along with this manual; if not, write to the Free
24.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
25.\" USA.
26.\"
27.\" Modified 1993-07-22 by Rik Faith <faith@cs.unc.edu>
28.\" Modified 1993-08-10 by Alan Cox <iiitac@pyramid.swansea.ac.uk>
29.\" Modified 1998-11-04 by Tigran Aivazian <tigran@sco.com>
30.\" Modified 2004-05-27, 2004-06-17, 2004-06-23 by Michael Kerrisk
31.\"
3cde6db5 32.TH ACCT 2 2008-06-16 "Linux" "Linux Programmer's Manual"
fea681da
MK
33.SH NAME
34acct \- switch process accounting on or off
35.SH SYNOPSIS
36.ad l
37.nf
38.B #include <unistd.h>
39.sp
40.BI "int acct(const char *" filename );
41.fi
42.ad b
cc4615cc
MK
43.sp
44.in -4n
45Feature Test Macro Requirements for glibc (see
46.BR feature_test_macros (7)):
47.in
48.sp
49.BR acct ():
50_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
fea681da 51.SH DESCRIPTION
3cde6db5 52The
61792fc6 53.BR acct ()
3cde6db5
MK
54system call enables or disables process accounting.
55If called with the name of an existing file as its argument,
56accounting is turned on,
57and records for each terminating process are appended to
c13182ef
MK
58\fIfilename\fP as it terminates.
59An argument of NULL causes accounting to be turned off.
47297adb 60.SH RETURN VALUE
c13182ef
MK
61On success, zero is returned.
62On error, \-1 is returned, and
fea681da
MK
63.I errno
64is set appropriately.
65.SH ERRORS
66.TP
67.B EACCES
68Write permission is denied for the specified file,
69or search permission is denied for one of the directories
70in the path prefix of
71.I filename
72(see also
ad7cc990 73.BR path_resolution (7)),
fea681da
MK
74or
75.I filename
76is not a regular file.
77.TP
78.B EFAULT
79.I filename
80points outside your accessible address space.
81.TP
82.B EIO
83Error writing to the file
84.IR filename .
85.TP
86.B EISDIR
c13182ef 87.I filename
fea681da
MK
88is a directory.
89.TP
90.B ELOOP
c13182ef 91Too many symbolic links were encountered in resolving
fea681da
MK
92.IR filename .
93.TP
94.B ENAMETOOLONG
95.I filename
96was too long.
97.TP
98.B ENFILE
99The system limit on the total number of open files has been reached.
100.TP
101.B ENOENT
102The specified filename does not exist.
103.TP
104.B ENOMEM
105Out of memory.
106.TP
107.B ENOSYS
108BSD process accounting has not been enabled when the operating system
109kernel was compiled.
110The kernel configuration parameter controlling this feature is
682edefb 111.BR CONFIG_BSD_PROCESS_ACCT .
fea681da
MK
112.TP
113.B ENOTDIR
c13182ef
MK
114A component used as a directory in
115.I filename
fea681da
MK
116is not in fact a directory.
117.TP
118.B EPERM
119The calling process has insufficient privilege to enable process accounting.
120On Linux the
121.B CAP_SYS_PACCT
122capability is required.
123.TP
124.B EROFS
c13182ef 125.I filename
fea681da
MK
126refers to a file on a read-only file system.
127.TP
128.B EUSERS
129There are no more free file structures or we ran out of memory.
47297adb 130.SH CONFORMING TO
c13182ef
MK
131SVr4, 4.3BSD (but not POSIX).
132.\" SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS.
97c1eac8
MK
133.\" Also AIX and HP-UX document EBUSY (attempt is made
134.\" to enable accounting when it is already enabled), as does Solaris
135.\" (attempt is made to enable accounting using the same file that is
136.\" currently being used).
fea681da 137.SH NOTES
3cde6db5 138No accounting is produced for programs running when a system crash occurs.
24b74457 139In particular, nonterminating processes are never accounted for.
3cde6db5
MK
140
141The structure of the records written to the accounting file is described in
142.BR acct (5).
47297adb 143.SH SEE ALSO
cbc2a267 144.BR acct (5)