xref: /openbsd/share/man/man5/acct.5 (revision df930be7)
1.\"	$NetBSD: acct.5,v 1.3 1994/11/30 19:31:10 jtc Exp $
2.\"
3.\" Copyright (c) 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"     @(#)acct.5	8.1 (Berkeley) 6/5/93
35.\"
36.Dd June 5, 1993
37.Dt ACCT 5
38.Os
39.Sh NAME
40.Nm acct
41.Nd execution accounting file
42.Sh SYNOPSIS
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
61struct acct {
62	char	ac_comm[10];	/* name of command */
63	comp_t	ac_utime;	/* user time */
64	comp_t	ac_stime;	/* system time */
65	comp_t	ac_etime;	/* elapsed time */
66	time_t	ac_btime;	/* starting time */
67	uid_t	ac_uid;		/* user id */
68	gid_t	ac_gid;		/* group id */
69	short	ac_mem;		/* memory usage average */
70	comp_t	ac_io;		/* count of IO blocks */
71	dev_t	ac_tty;		/* controlling tty */
72#define	AFORK	0x01		/* forked but not execed */
73#define	ASU	0x02		/* used super-user permissions */
74#define	ACOMPAT	0x04		/* used compatibility mode */
75#define	ACORE	0x08		/* dumped core */
76#define	AXSIG	0x10		/* killed by a signal */
77	char	ac_flag;	/* accounting flags */
78};
79
80/*
81 * 1/AHZ is the granularity of the data encoded in the comp_t fields.
82 * This is not necessarily equal to hz.
83 */
84#define	AHZ	64
85
86#ifdef KERNEL
87struct vnode	*acctp;
88#endif
89.Ed
90.Pp
91If a terminated process was created by an
92.Xr execve 2 ,
93the name of the executed file (at most ten characters of it)
94is saved in the field
95.Fa ac_comm
96and its status is saved by setting one of more of the following flags in
97.Fa ac_flag:
98.Dv AFORK ,
99.Dv ASU ,
100.Dv ACOMPAT ,
101.Dv ACORE
102and
103.Dv ASIG .
104.Sh SEE ALSO
105.Xr acct 2 ,
106.Xr execve 2 ,
107.Xr sa 8
108.Sh HISTORY
109A
110.Nm
111file format appeared in
112.At v7 .
113