]> git.saurik.com Git - apple/xnu.git/blob - bsd/man/man2/acct.2
xnu-4903.270.47.tar.gz
[apple/xnu.git] / bsd / man / man2 / acct.2
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
47 The
48 .Fn acct
49 call enables or disables the collection of system accounting
50 records.
51 If the argument
52 .Fa file
53 is a nil pointer, accounting is disabled.
54 If
55 .Fa file
56 is an
57 .Em existing
58 pathname (null-terminated), record collection is enabled and for
59 every process initiated which terminates under normal
60 conditions an accounting record is appended to
61 .Fa file .
62 Abnormal conditions of termination are reboots
63 or other fatal system problems.
64 Records for processes which never terminate can not be
65 produced by
66 .Fn acct .
67 .Pp
68 For more information on the record structure used by
69 .Fn acct ,
70 see
71 .Pa /usr/include/sys/acct.h
72 and
73 .Xr acct 5 .
74 .Pp
75 This call is permitted only to the super-user.
76 .Sh NOTES
77 Accounting is automatically disabled when the file system the
78 accounting file resides on runs out of space; it is enabled when
79 space once again becomes available.
80 .Sh RETURN VALUES
81 .Rv -std acct
82 The file must exist and the call may be exercised only by the super-user.
83 .Sh ERRORS
84 .Fn acct
85 will fail if one of the following is true:
86 .Bl -tag -width Er
87 .It Bq Er EPERM
88 The caller is not the super-user.
89 .It Bq Er ENOTDIR
90 A component of the path prefix is not a directory.
91 .It Bq Er ENAMETOOLONG
92 A component of a pathname exceeded
93 .Dv {NAME_MAX}
94 characters, or an entire path name exceeded
95 .Dv {PATH_MAX}
96 characters.
97 .It Bq Er ENOENT
98 The named file does not exist.
99 .It Bq Er EACCES
100 Search permission is denied for a component of the path prefix,
101 or the path name is not a regular file.
102 .It Bq Er ELOOP
103 Too many symbolic links were encountered in translating the pathname.
104 .It Bq Er EROFS
105 The named file resides on a read-only file system.
106 .It Bq Er EFAULT
107 .Fa File
108 points outside the process's allocated address space.
109 .It Bq Er EIO
110 An 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
116 An
117 .Fn acct
118 function call appeared in
119 .At v7 .