xref: /freebsd/share/man/man5/acct.5 (revision 51a9219f5780e61e1437d25220bf8750d9df7f8b)
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.\" $FreeBSD$
34.\"
35.Dd June 5, 1993
36.Dt ACCT 5
37.Os
38.Sh NAME
39.Nm acct
40.Nd execution accounting file
41.Sh SYNOPSIS
42.In sys/types.h
43.In sys/acct.h
44.Sh DESCRIPTION
45The kernel maintains the following
46.Fa acct
47information structure for all
48processes.
49If a process terminates, and accounting is enabled,
50the kernel calls the
51.Xr acct 2
52function call to prepare and append the record
53to the accounting file.
54.Bd -literal
55/*
56 * Accounting structures; these use a comp_t type which is a 3 bits base 8
57 * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
58 * seconds.
59 */
60typedef u_short comp_t;
61
62#define AC_COMM_LEN 16
63struct acct {
64	char	ac_comm[AC_COMM_LEN];  /* command name */
65	comp_t	ac_utime;	/* user time */
66	comp_t	ac_stime;	/* system time */
67	comp_t	ac_etime;	/* elapsed time */
68	time_t	ac_btime;	/* starting time */
69	uid_t	ac_uid;		/* user id */
70	gid_t	ac_gid;		/* group id */
71	short	ac_mem;		/* average memory usage */
72	comp_t	ac_io;		/* count of IO blocks */
73	dev_t	ac_tty;		/* controlling tty */
74#define	AFORK	0x01		/* forked but not exec'ed */
75#define	ASU	0x02		/* used super-user permissions */
76#define	ACOMPAT	0x04		/* used compatibility mode */
77#define	ACORE	0x08		/* dumped core */
78#define	AXSIG	0x10		/* killed by a signal */
79	char	ac_flag;	/* accounting flags */
80};
81
82/*
83 * 1/AHZ is the granularity of the data encoded in the comp_t fields.
84 * This is not necessarily equal to hz.
85 */
86#define	AHZ	64
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 ACOMPAT ,
98.Dv ACORE
99and
100.Dv ASIG .
101.Dv ASU
102is no longer supported.
103.Sh SEE ALSO
104.Xr acct 2 ,
105.Xr execve 2 ,
106.Xr sa 8
107.Sh HISTORY
108A
109.Nm
110file format appeared in
111.At v7 .
112