xref: /original-bsd/share/man/man5/acct.5 (revision c3e32dec)
1.\" Copyright (c) 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"     @(#)acct.5	8.1 (Berkeley) 06/05/93
7.\"
8.Dd
9.Dt ACCT 5
10.Os
11.Sh NAME
12.Nm acct
13.Nd execution accounting file
14.Sh SYNOPSIS
15.Fd #include <sys/acct.h>
16.Sh DESCRIPTION
17The kernel maintains the following
18.Fa acct
19information structure for all
20processes. If a process terminates, and accounting is enabled,
21the kernel calls the
22.Xr acct 2
23function call to prepare and append the record
24to the accounting file.
25.Bd -literal
26/*
27 * Accounting structures; these use a comp_t type which is a 3 bits base 8
28 * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
29 * seconds.
30 */
31typedef u_short comp_t;
32
33struct acct {
34	char	ac_comm[10];	/* name of command */
35	comp_t	ac_utime;	/* user time */
36	comp_t	ac_stime;	/* system time */
37	comp_t	ac_etime;	/* elapsed time */
38	time_t	ac_btime;	/* starting time */
39	uid_t	ac_uid;		/* user id */
40	gid_t	ac_gid;		/* group id */
41	short	ac_mem;		/* memory usage average */
42	comp_t	ac_io;		/* count of IO blocks */
43	dev_t	ac_tty;		/* controlling tty */
44#define	AFORK	0x01		/* forked but not execed */
45#define	ASU	0x02		/* used super-user permissions */
46#define	ACOMPAT	0x04		/* used compatibility mode */
47#define	ACORE	0x08		/* dumped core */
48#define	AXSIG	0x10		/* killed by a signal */
49	char	ac_flag;	/* accounting flags */
50};
51
52/*
53 * 1/AHZ is the granularity of the data encoded in the comp_t fields.
54 * This is not necessarily equal to hz.
55 */
56#define	AHZ	64
57
58#ifdef KERNEL
59struct vnode	*acctp;
60#endif
61.Ed
62.Pp
63If a terminated process was created by an
64.Xr execve 2 ,
65the name of the executed file (at most ten characters of it)
66is saved in the field
67.Fa ac_comm
68and its status is saved by setting one of more of the following flags in
69.Fa ac_flag:
70.Dv AFORK ,
71.Dv ASU ,
72.Dv ACOMPAT ,
73.Dv ACORE
74and
75.Dv ASIG .
76.Sh SEE ALSO
77.Xr acct 2 ,
78.Xr execve 2 ,
79.Xr sa 8
80.Sh HISTORY
81A
82.Nm
83file format appeared in
84.At v7 .
85