2004-11-03 13:51:07 +00:00
|
|
|
.\" Hey Emacs! This file is -*- nroff -*- source.
|
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1993 Michael Haardt
|
|
|
|
.\" (michael@moria.de),
|
|
|
|
.\" Fri Apr 2 11:32:09 MET DST 1993
|
|
|
|
.\"
|
|
|
|
.\" This is free documentation; you can redistribute it and/or
|
|
|
|
.\" modify it under the terms of the GNU General Public License as
|
|
|
|
.\" published by the Free Software Foundation; either version 2 of
|
|
|
|
.\" the License, or (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" The GNU General Public License's references to "object code"
|
|
|
|
.\" and "executables" are to be interpreted as the output of any
|
|
|
|
.\" document formatting or typesetting system, including
|
|
|
|
.\" intermediate and printed output.
|
|
|
|
.\"
|
|
|
|
.\" This manual is distributed in the hope that it will be useful,
|
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
.\" GNU General Public License for more details.
|
|
|
|
.\"
|
|
|
|
.\" You should have received a copy of the GNU General Public
|
|
|
|
.\" License along with this manual; if not, write to the Free
|
|
|
|
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
|
|
|
|
.\" USA.
|
|
|
|
.\"
|
|
|
|
.\" Modified 1993-07-22 by Rik Faith <faith@cs.unc.edu>
|
|
|
|
.\" Modified 1993-08-10 by Alan Cox <iiitac@pyramid.swansea.ac.uk>
|
|
|
|
.\" Modified 1998-11-04 by Tigran Aivazian <tigran@sco.com>
|
|
|
|
.\" Modified 2004-05-27, 2004-06-17, 2004-06-23 by Michael Kerrisk
|
|
|
|
.\"
|
2008-06-11 22:42:23 +00:00
|
|
|
.TH ACCT 2 2008-06-16 "Linux" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
acct \- switch process accounting on or off
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.ad l
|
|
|
|
.nf
|
|
|
|
.B #include <unistd.h>
|
|
|
|
.sp
|
|
|
|
.BI "int acct(const char *" filename );
|
|
|
|
.fi
|
|
|
|
.ad b
|
2007-07-08 12:11:40 +00:00
|
|
|
.sp
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
|
|
|
.BR acct ():
|
|
|
|
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
2008-06-11 22:42:23 +00:00
|
|
|
The
|
2008-09-18 12:30:41 +00:00
|
|
|
.BR acct ()
|
2008-06-11 22:42:23 +00:00
|
|
|
system call enables or disables process accounting.
|
|
|
|
If called with the name of an existing file as its argument,
|
|
|
|
accounting is turned on,
|
|
|
|
and records for each terminating process are appended to
|
2007-04-12 22:42:49 +00:00
|
|
|
\fIfilename\fP as it terminates.
|
|
|
|
An argument of NULL causes accounting to be turned off.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "RETURN VALUE"
|
2007-04-12 22:42:49 +00:00
|
|
|
On success, zero is returned.
|
|
|
|
On error, \-1 is returned, and
|
2004-11-03 13:51:07 +00:00
|
|
|
.I errno
|
|
|
|
is set appropriately.
|
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
|
|
|
.B EACCES
|
|
|
|
Write permission is denied for the specified file,
|
|
|
|
or search permission is denied for one of the directories
|
|
|
|
in the path prefix of
|
|
|
|
.I filename
|
|
|
|
(see also
|
2007-05-26 12:41:39 +00:00
|
|
|
.BR path_resolution (7)),
|
2004-11-03 13:51:07 +00:00
|
|
|
or
|
|
|
|
.I filename
|
|
|
|
is not a regular file.
|
|
|
|
.TP
|
|
|
|
.B EFAULT
|
|
|
|
.I filename
|
|
|
|
points outside your accessible address space.
|
|
|
|
.TP
|
|
|
|
.B EIO
|
|
|
|
Error writing to the file
|
|
|
|
.IR filename .
|
|
|
|
.TP
|
|
|
|
.B EISDIR
|
2007-04-12 22:42:49 +00:00
|
|
|
.I filename
|
2004-11-03 13:51:07 +00:00
|
|
|
is a directory.
|
|
|
|
.TP
|
|
|
|
.B ELOOP
|
2007-04-12 22:42:49 +00:00
|
|
|
Too many symbolic links were encountered in resolving
|
2004-11-03 13:51:07 +00:00
|
|
|
.IR filename .
|
|
|
|
.TP
|
|
|
|
.B ENAMETOOLONG
|
|
|
|
.I filename
|
|
|
|
was too long.
|
|
|
|
.TP
|
|
|
|
.B ENFILE
|
|
|
|
The system limit on the total number of open files has been reached.
|
|
|
|
.TP
|
|
|
|
.B ENOENT
|
|
|
|
The specified filename does not exist.
|
|
|
|
.TP
|
|
|
|
.B ENOMEM
|
|
|
|
Out of memory.
|
|
|
|
.TP
|
|
|
|
.B ENOSYS
|
|
|
|
BSD process accounting has not been enabled when the operating system
|
|
|
|
kernel was compiled.
|
|
|
|
The kernel configuration parameter controlling this feature is
|
2007-06-22 17:16:20 +00:00
|
|
|
.BR CONFIG_BSD_PROCESS_ACCT .
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B ENOTDIR
|
2007-04-12 22:42:49 +00:00
|
|
|
A component used as a directory in
|
|
|
|
.I filename
|
2004-11-03 13:51:07 +00:00
|
|
|
is not in fact a directory.
|
|
|
|
.TP
|
|
|
|
.B EPERM
|
|
|
|
The calling process has insufficient privilege to enable process accounting.
|
|
|
|
On Linux the
|
|
|
|
.B CAP_SYS_PACCT
|
|
|
|
capability is required.
|
|
|
|
.TP
|
|
|
|
.B EROFS
|
2007-04-12 22:42:49 +00:00
|
|
|
.I filename
|
2004-11-03 13:51:07 +00:00
|
|
|
refers to a file on a read-only file system.
|
|
|
|
.TP
|
|
|
|
.B EUSERS
|
|
|
|
There are no more free file structures or we ran out of memory.
|
|
|
|
.SH "CONFORMING TO"
|
2007-04-12 22:42:49 +00:00
|
|
|
SVr4, 4.3BSD (but not POSIX).
|
|
|
|
.\" SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS.
|
2006-08-03 13:57:17 +00:00
|
|
|
.\" Also AIX and HP-UX document EBUSY (attempt is made
|
|
|
|
.\" to enable accounting when it is already enabled), as does Solaris
|
|
|
|
.\" (attempt is made to enable accounting using the same file that is
|
|
|
|
.\" currently being used).
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NOTES
|
2008-06-11 22:42:23 +00:00
|
|
|
No accounting is produced for programs running when a system crash occurs.
|
accept.2, access.2, acct.2, clock_nanosleep.2, mbind.2, mincore.2, remap_file_pages.2, sched_setscheduler.2, set_mempolicy.2, splice.2, stat.2, syslog.2, timer_create.2, timerfd_create.2, truncate.2, fenv.3, ferror.3, fflush.3, fgetwc.3, fgetws.3, flockfile.3, fputwc.3, fputws.3, fread.3, getopt.3, gets.3, getwchar.3, glob.3, iconv.3, longjmp.3, pow.3, printf.3, puts.3, putwchar.3, regex.3, rpc.3, scanf.3, setjmp.3, termios.3, unlocked_stdio.3, wcswidth.3, hd.4, rtc.4, st.4, core.5, dir_colors.5, elf.5, proc.5, arp.7, ascii.7, boot.7, bootparam.7, charsets.7, futex.7, ip.7, iso_8859-11.7, man-pages.7, man.7, mdoc.samples.7, path_resolution.7, pipe.7, posixoptions.7, unicode.7, unix.7, uri.7, utf-8.7, ld.so.8: s/non-/non/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 17:20:12 +00:00
|
|
|
In particular, nonterminating processes are never accounted for.
|
2008-06-11 22:42:23 +00:00
|
|
|
|
|
|
|
The structure of the records written to the accounting file is described in
|
|
|
|
.BR acct (5).
|
2006-05-29 04:37:52 +00:00
|
|
|
.SH "SEE ALSO"
|
2007-05-22 21:37:39 +00:00
|
|
|
.BR acct (5)
|