OSDN Git Service

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