xref: /freebsd/share/man/man5/acct.5 (revision fdbe5babe4c36438757554fd0b61ff7ba19b0dc2)
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
337f3dea24SPeter Wemm.\" $FreeBSD$
34afe61c15SRodney W. Grimes.\"
35fdbe5babSDiomidis Spinellis.Dd May 15, 2007
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
4232eef9aeSRuslan Ermilov.In sys/types.h
4332eef9aeSRuslan Ermilov.In 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
481111b49cSSheldon Hearnprocesses.
491111b49cSSheldon HearnIf a process terminates, and accounting is enabled,
50afe61c15SRodney W. Grimesthe kernel calls the
51afe61c15SRodney W. Grimes.Xr acct 2
52afe61c15SRodney W. Grimesfunction call to prepare and append the record
53afe61c15SRodney W. Grimesto the accounting file.
54afe61c15SRodney W. Grimes.Bd -literal
559136a887SMike Pritchard#define AC_COMM_LEN 16
56fdbe5babSDiomidis Spinellis
57fdbe5babSDiomidis Spinellis/*
58fdbe5babSDiomidis Spinellis * Accounting structure version 2 (current).
59fdbe5babSDiomidis Spinellis * The first byte is always zero.
60fdbe5babSDiomidis Spinellis * Time units are microseconds.
61fdbe5babSDiomidis Spinellis */
62fdbe5babSDiomidis Spinellis
63fdbe5babSDiomidis Spinellisstruct acctv2 {
64fdbe5babSDiomidis Spinellis	uint8_t  ac_zero;		/* zero identifies new version */
65fdbe5babSDiomidis Spinellis	uint8_t  ac_version;		/* record version number */
66fdbe5babSDiomidis Spinellis	uint16_t ac_len;		/* record length */
67fdbe5babSDiomidis Spinellis
689136a887SMike Pritchard	char	  ac_comm[AC_COMM_LEN];	/* command name */
69fdbe5babSDiomidis Spinellis	float	  ac_utime;		/* user time */
70fdbe5babSDiomidis Spinellis	float	  ac_stime;		/* system time */
71fdbe5babSDiomidis Spinellis	float	  ac_etime;		/* elapsed time */
72afe61c15SRodney W. Grimes	time_t	  ac_btime;		/* starting time */
73afe61c15SRodney W. Grimes	uid_t	  ac_uid;		/* user id */
74afe61c15SRodney W. Grimes	gid_t	  ac_gid;		/* group id */
75fdbe5babSDiomidis Spinellis	float	  ac_mem;		/* average memory usage */
76fdbe5babSDiomidis Spinellis	float	  ac_io;		/* count of IO blocks */
77fdbe5babSDiomidis Spinellis	__dev_t   ac_tty;		/* controlling tty */
78fdbe5babSDiomidis Spinellis
79fdbe5babSDiomidis Spinellis	uint16_t ac_len2;		/* record length */
80fdbe5babSDiomidis Spinellis	union {
81fdbe5babSDiomidis Spinellis		__dev_t	  ac_align;	/* force v1 compatible alignment */
82fdbe5babSDiomidis Spinellis
834043c58eSTim Vanderhoek#define	AFORK	0x01			/* forked but not exec'ed */
84fdbe5babSDiomidis Spinellis/* ASU is no longer supported */
85afe61c15SRodney W. Grimes#define	ASU	0x02			/* used super-user permissions */
86afe61c15SRodney W. Grimes#define	ACOMPAT	0x04			/* used compatibility mode */
87afe61c15SRodney W. Grimes#define	ACORE	0x08			/* dumped core */
88afe61c15SRodney W. Grimes#define	AXSIG	0x10			/* killed by a signal */
89fdbe5babSDiomidis Spinellis#define ANVER	0x20			/* new record version */
90afe61c15SRodney W. Grimes
91fdbe5babSDiomidis Spinellis		uint8_t  ac_flag;	/* accounting flags */
92fdbe5babSDiomidis Spinellis	} ac_trailer;
93fdbe5babSDiomidis Spinellis
94fdbe5babSDiomidis Spinellis#define ac_flagx ac_trailer.ac_flag
95fdbe5babSDiomidis Spinellis};
96afe61c15SRodney W. Grimes.Ed
97afe61c15SRodney W. Grimes.Pp
98afe61c15SRodney W. GrimesIf a terminated process was created by an
99afe61c15SRodney W. Grimes.Xr execve 2 ,
100afe61c15SRodney W. Grimesthe name of the executed file (at most ten characters of it)
101afe61c15SRodney W. Grimesis saved in the field
102afe61c15SRodney W. Grimes.Fa ac_comm
103afe61c15SRodney W. Grimesand its status is saved by setting one of more of the following flags in
104afe61c15SRodney W. Grimes.Fa ac_flag :
105afe61c15SRodney W. Grimes.Dv AFORK ,
106afe61c15SRodney W. Grimes.Dv ACOMPAT ,
107afe61c15SRodney W. Grimes.Dv ACORE
108afe61c15SRodney W. Grimesand
109afe61c15SRodney W. Grimes.Dv ASIG .
110a454b0d3SRobert Watson.Dv ASU
111a454b0d3SRobert Watsonis no longer supported.
112fdbe5babSDiomidis Spinellis.Dv ANVER
113fdbe5babSDiomidis Spinellisis always set in the above structure.
114afe61c15SRodney W. Grimes.Sh SEE ALSO
115fdbe5babSDiomidis Spinellis.Xr lastcomm 1 ,
116afe61c15SRodney W. Grimes.Xr acct 2 ,
117afe61c15SRodney W. Grimes.Xr execve 2 ,
118afe61c15SRodney W. Grimes.Xr sa 8
119afe61c15SRodney W. Grimes.Sh HISTORY
120afe61c15SRodney W. GrimesA
121afe61c15SRodney W. Grimes.Nm
122afe61c15SRodney W. Grimesfile format appeared in
123afe61c15SRodney W. Grimes.At v7 .
124fdbe5babSDiomidis SpinellisThe current record format was introduced on May 2007.
125fdbe5babSDiomidis SpinellisIt is backwards compatible with the previous format,
126fdbe5babSDiomidis Spinelliswhich is still documented in
127fdbe5babSDiomidis Spinellis.In sys/acct.h
128fdbe5babSDiomidis Spinellisand supported by
129fdbe5babSDiomidis Spinellis.Xr lastcomm 1
130fdbe5babSDiomidis Spinellisand
131fdbe5babSDiomidis Spinellis.Xr sa 8 .
132