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