1.\" Copyright (c) 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. Neither the name of the University nor the names of its contributors 13.\" may be used to endorse or promote products derived from this software 14.\" without specific prior written permission. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" @(#)acct.5 8.1 (Berkeley) 6/5/93 29.\" $FreeBSD$ 30.\" 31.Dd February 13, 2017 32.Dt ACCT 5 33.Os 34.Sh NAME 35.Nm acct 36.Nd execution accounting file 37.Sh SYNOPSIS 38.In sys/types.h 39.In sys/acct.h 40.Sh DESCRIPTION 41The kernel maintains the following 42.Fa acct 43information structure for all 44processes. 45If a process terminates, and accounting is enabled, 46the kernel calls the 47.Xr acct 2 48function call to prepare and append the record 49to the accounting file. 50.Bd -literal 51#define AC_COMM_LEN 16 52 53/* 54 * Accounting structure version 3 (current). 55 * The first byte is always zero. 56 * Time units are microseconds. 57 */ 58 59struct acctv3 { 60 uint8_t ac_zero; /* zero identifies new version */ 61 uint8_t ac_version; /* record version number */ 62 uint16_t ac_len; /* record length */ 63 64 char ac_comm[AC_COMM_LEN]; /* command name */ 65 float ac_utime; /* user time */ 66 float ac_stime; /* system time */ 67 float ac_etime; /* elapsed time */ 68 time_t ac_btime; /* starting time */ 69 uid_t ac_uid; /* user id */ 70 gid_t ac_gid; /* group id */ 71 float ac_mem; /* average memory usage */ 72 float ac_io; /* count of IO blocks */ 73 __dev_t ac_tty; /* controlling tty */ 74 75 uint16_t ac_len2; /* record length */ 76 union { 77 uint32_t ac_align; /* force v1 compatible alignment */ 78 79#define AFORK 0x01 /* forked but not exec'ed */ 80/* ASU is no longer supported */ 81#define ASU 0x02 /* used super-user permissions */ 82#define ACOMPAT 0x04 /* used compatibility mode */ 83#define ACORE 0x08 /* dumped core */ 84#define AXSIG 0x10 /* killed by a signal */ 85#define ANVER 0x20 /* new record version */ 86 87 uint8_t ac_flag; /* accounting flags */ 88 } ac_trailer; 89 90#define ac_flagx ac_trailer.ac_flag 91}; 92.Ed 93.Pp 94If a terminated process was created by an 95.Xr execve 2 , 96the name of the executed file (at most ten characters of it) 97is saved in the field 98.Fa ac_comm 99and its status is saved by setting one of more of the following flags in 100.Fa ac_flag : 101.Dv AFORK , 102.Dv ACOMPAT , 103.Dv ACORE 104and 105.Dv ASIG . 106.Dv ASU 107is no longer supported. 108.Dv ANVER 109is always set in the above structure. 110.Sh SEE ALSO 111.Xr lastcomm 1 , 112.Xr acct 2 , 113.Xr execve 2 , 114.Xr sa 8 115.Sh HISTORY 116A 117.Nm 118file format appeared in 119.At v7 . 120The current record format was introduced on May 2007. 121It is backwards compatible with the previous format, 122which is still documented in 123.In sys/acct.h 124and supported by 125.Xr lastcomm 1 126and 127.Xr sa 8 . 128