xref: /freebsd/share/man/man5/acct.5 (revision 380a989b3223d455375b4fae70fd0b9bdd43bafb)
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.\"	$Id: acct.5,v 1.4 1997/03/19 19:48:24 bde Exp $
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.Fd #include <sys/types.h>
43.Fd #include <sys/acct.h>
44.Sh DESCRIPTION
45The kernel maintains the following
46.Fa acct
47information structure for all
48processes. If a process terminates, and accounting is enabled,
49the kernel calls the
50.Xr acct 2
51function call to prepare and append the record
52to the accounting file.
53.Bd -literal
54/*
55 * Accounting structures; these use a comp_t type which is a 3 bits base 8
56 * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
57 * seconds.
58 */
59typedef u_short comp_t;
60
61#define AC_COMM_LEN 16
62struct acct {
63	char	ac_comm[AC_COMM_LEN];  /* command name */
64	comp_t	ac_utime;	/* user time */
65	comp_t	ac_stime;	/* system time */
66	comp_t	ac_etime;	/* elapsed time */
67	time_t	ac_btime;	/* starting time */
68	uid_t	ac_uid;		/* user id */
69	gid_t	ac_gid;		/* group id */
70	short	ac_mem;		/* average memory usage */
71	comp_t	ac_io;		/* count of IO blocks */
72	dev_t	ac_tty;		/* controlling tty */
73#define	AFORK	0x01		/* forked but not exec'ed */
74#define	ASU	0x02		/* used super-user permissions */
75#define	ACOMPAT	0x04		/* used compatibility mode */
76#define	ACORE	0x08		/* dumped core */
77#define	AXSIG	0x10		/* killed by a signal */
78	char	ac_flag;	/* accounting flags */
79};
80
81/*
82 * 1/AHZ is the granularity of the data encoded in the comp_t fields.
83 * This is not necessarily equal to hz.
84 */
85#define	AHZ	64
86.Ed
87.Pp
88If a terminated process was created by an
89.Xr execve 2 ,
90the name of the executed file (at most ten characters of it)
91is saved in the field
92.Fa ac_comm
93and its status is saved by setting one of more of the following flags in
94.Fa ac_flag:
95.Dv AFORK ,
96.Dv ASU ,
97.Dv ACOMPAT ,
98.Dv ACORE
99and
100.Dv ASIG .
101.Sh SEE ALSO
102.Xr acct 2 ,
103.Xr execve 2 ,
104.Xr sa 8
105.Sh HISTORY
106A
107.Nm
108file format appeared in
109.At v7 .
110