xref: /freebsd/share/man/man5/acct.5 (revision afe61c15161c324a7af299a9b8457aba5afc92db)
1.\" Copyright (c) 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     @(#)acct.5	8.1 (Berkeley) 6/5/93
33.\"
34.Dd June 5, 1993
35.Dt ACCT 5
36.Os
37.Sh NAME
38.Nm acct
39.Nd execution accounting file
40.Sh SYNOPSIS
41.Fd #include <sys/acct.h>
42.Sh DESCRIPTION
43The kernel maintains the following
44.Fa acct
45information structure for all
46processes. If a process terminates, and accounting is enabled,
47the kernel calls the
48.Xr acct 2
49function call to prepare and append the record
50to the accounting file.
51.Bd -literal
52/*
53 * Accounting structures; these use a comp_t type which is a 3 bits base 8
54 * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
55 * seconds.
56 */
57typedef u_short comp_t;
58
59struct acct {
60	char	ac_comm[10];	/* name of command */
61	comp_t	ac_utime;	/* user time */
62	comp_t	ac_stime;	/* system time */
63	comp_t	ac_etime;	/* elapsed time */
64	time_t	ac_btime;	/* starting time */
65	uid_t	ac_uid;		/* user id */
66	gid_t	ac_gid;		/* group id */
67	short	ac_mem;		/* memory usage average */
68	comp_t	ac_io;		/* count of IO blocks */
69	dev_t	ac_tty;		/* controlling tty */
70#define	AFORK	0x01		/* forked but not execed */
71#define	ASU	0x02		/* used super-user permissions */
72#define	ACOMPAT	0x04		/* used compatibility mode */
73#define	ACORE	0x08		/* dumped core */
74#define	AXSIG	0x10		/* killed by a signal */
75	char	ac_flag;	/* accounting flags */
76};
77
78/*
79 * 1/AHZ is the granularity of the data encoded in the comp_t fields.
80 * This is not necessarily equal to hz.
81 */
82#define	AHZ	64
83
84#ifdef KERNEL
85struct vnode	*acctp;
86#endif
87.Ed
88.Pp
89If a terminated process was created by an
90.Xr execve 2 ,
91the name of the executed file (at most ten characters of it)
92is saved in the field
93.Fa ac_comm
94and its status is saved by setting one of more of the following flags in
95.Fa ac_flag:
96.Dv AFORK ,
97.Dv ASU ,
98.Dv ACOMPAT ,
99.Dv ACORE
100and
101.Dv ASIG .
102.Sh SEE ALSO
103.Xr acct 2 ,
104.Xr execve 2 ,
105.Xr sa 8
106.Sh HISTORY
107A
108.Nm
109file format appeared in
110.At v7 .
111