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