man-pages/man2/acct.2.html
2021-03-31 01:06:50 +01:00

219 lines
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of ACCT</TITLE>
</HEAD><BODY>
<H1>ACCT</H1>
Section: Linux Programmer's Manual (2)<BR>Updated: 2016-03-15<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
acct - switch process accounting on or off
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/unistd.h">unistd.h</A>&gt;</B>
<B>int acct(const char *</B><I>filename</I><B>);</B>
</PRE>
<P>
Feature Test Macro Requirements for glibc (see
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
<P>
<B>acct</B>():
<PRE>
Since glibc 2.21:
_DEFAULT_SOURCE
In glibc 2.19 and 2.20:
_DEFAULT_SOURCE || (_XOPEN_SOURCE &amp;&amp; _XOPEN_SOURCE&nbsp;&lt;&nbsp;500)
Up to and including glibc 2.19:
_BSD_SOURCE || (_XOPEN_SOURCE &amp;&amp; _XOPEN_SOURCE&nbsp;&lt;&nbsp;500)
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The
<B>acct</B>()
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
<I>filename</I>
as it terminates.
An argument of NULL causes accounting to be turned off.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
On success, zero is returned.
On error, -1 is returned, and
<I>errno</I>
is set appropriately.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="1"><B>EACCES</B>
<DD>
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</I>
(see also
<B><A HREF="/cgi-bin/man/man2html?7+path_resolution">path_resolution</A></B>(7)),
or
<I>filename</I>
is not a regular file.
<DT id="2"><B>EFAULT</B>
<DD>
<I>filename</I>
points outside your accessible address space.
<DT id="3"><B>EIO</B>
<DD>
Error writing to the file
<I>filename</I>.
<DT id="4"><B>EISDIR</B>
<DD>
<I>filename</I>
is a directory.
<DT id="5"><B>ELOOP</B>
<DD>
Too many symbolic links were encountered in resolving
<I>filename</I>.
<DT id="6"><B>ENAMETOOLONG</B>
<DD>
<I>filename</I>
was too long.
<DT id="7"><B>ENFILE</B>
<DD>
The system-wide limit on the total number of open files has been reached.
<DT id="8"><B>ENOENT</B>
<DD>
The specified file does not exist.
<DT id="9"><B>ENOMEM</B>
<DD>
Out of memory.
<DT id="10"><B>ENOSYS</B>
<DD>
BSD process accounting has not been enabled when the operating system
kernel was compiled.
The kernel configuration parameter controlling this feature is
<B>CONFIG_BSD_PROCESS_ACCT</B>.
<DT id="11"><B>ENOTDIR</B>
<DD>
A component used as a directory in
<I>filename</I>
is not in fact a directory.
<DT id="12"><B>EPERM</B>
<DD>
The calling process has insufficient privilege to enable process accounting.
On Linux, the
<B>CAP_SYS_PACCT</B>
capability is required.
<DT id="13"><B>EROFS</B>
<DD>
<I>filename</I>
refers to a file on a read-only filesystem.
<DT id="14"><B>EUSERS</B>
<DD>
There are no more free file structures or we ran out of memory.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>CONFORMING TO</H2>
SVr4, 4.3BSD (but not POSIX).
<A NAME="lbAH">&nbsp;</A>
<H2>NOTES</H2>
No accounting is produced for programs running when a system crash occurs.
In particular, nonterminating processes are never accounted for.
<P>
The structure of the records written to the accounting file is described in
<B><A HREF="/cgi-bin/man/man2html?5+acct">acct</A></B>(5).
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?5+acct">acct</A></B>(5)
<A NAME="lbAJ">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="15"><A HREF="#lbAB">NAME</A><DD>
<DT id="16"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="17"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="18"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="19"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="20"><A HREF="#lbAG">CONFORMING TO</A><DD>
<DT id="21"><A HREF="#lbAH">NOTES</A><DD>
<DT id="22"><A HREF="#lbAI">SEE ALSO</A><DD>
<DT id="23"><A HREF="#lbAJ">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:32 GMT, March 31, 2021
</BODY>
</HTML>