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