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