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