OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / original / man2 / acct.2
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 .\"
32 .TH ACCT 2 2008-06-16 "Linux" "Linux Programmer's Manual"
33 .SH NAME
34 acct \- 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
43 .sp
44 .in -4n
45 Feature 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)
51 .SH DESCRIPTION
52 The
53 .BR acct ()
54 system call enables or disables process accounting.
55 If called with the name of an existing file as its argument,
56 accounting is turned on,
57 and records for each terminating process are appended to
58 \fIfilename\fP 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 file system.
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)