1.\" $NetBSD: acct.2,v 1.6 1995/02/27 12:31:47 cgd Exp $ 2.\" 3.\" Copyright (c) 1980, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by the University of 17.\" California, Berkeley and its contributors. 18.\" 4. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)acct.2 8.1 (Berkeley) 6/4/93 35.\" 36.Dd June 4, 1993 37.Dt ACCT 2 38.Os BSD 4 39.Sh NAME 40.Nm acct 41.Nd enable or disable process accounting 42.Sh SYNOPSIS 43.Fd #include <unistd.h> 44.Ft int 45.Fn acct "const char *file" 46.Sh DESCRIPTION 47The 48.Fn acct 49call enables or disables the collection of system accounting 50records. 51If the argument 52.Fa file 53is a nil pointer, accounting is disabled. 54If 55.Fa file 56is an 57.Em existing 58pathname (null-terminated), record collection is enabled and for 59every process initiated which terminates under normal 60conditions an accounting record is appended to 61.Fa file . 62Abnormal conditions of termination are reboots 63or other fatal system problems. 64Records for processes which never terminate can not be 65produced by 66.Fn acct . 67.Pp 68For more information on the record structure used by 69.Fn acct , 70see 71.Pa /usr/include/sys/acct.h 72and 73.Xr acct 5 . 74.Pp 75This call is permitted only to the super-user. 76.Sh NOTES 77Accounting is automatically disabled when the file system the 78accounting file resides on runs out of space; it is enabled when 79space once again becomes available. 80.Sh RETURN VALUES 81On error -1 is returned. 82The file must exist and the call may be exercised only by the super-user. 83.Sh ERRORS 84.Fn Acct 85will fail if one of the following is true: 86.Bl -tag -width Er 87.It Bq Er EPERM 88The caller is not the super-user. 89.It Bq Er ENOTDIR 90A component of the path prefix is not a directory. 91.It Bq Er ENAMETOOLONG 92A component of a pathname exceeded 93.Dv {NAME_MAX} 94characters, or an entire path name exceeded 95.Dv {PATH_MAX} 96characters. 97.It Bq Er ENOENT 98The named file does not exist. 99.It Bq Er EACCES 100Search permission is denied for a component of the path prefix, 101or the path name is not a regular file. 102.It Bq Er ELOOP 103Too many symbolic links were encountered in translating the pathname. 104.It Bq Er EROFS 105The named file resides on a read-only file system. 106.It Bq Er EFAULT 107.Fa File 108points outside the process's allocated address space. 109.It Bq Er EIO 110An I/O error occurred while reading from or writing to the file system. 111.El 112.Sh SEE ALSO 113.Xr acct 5 , 114.Xr sa 8 115.Sh HISTORY 116An 117.Fn acct 118function call appeared in 119.At v7 . 120