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.\" 30.Dd February 13, 2017 31.Dt ACCT 5 32.Os 33.Sh NAME 34.Nm acct 35.Nd execution accounting file 36.Sh SYNOPSIS 37.In sys/types.h 38.In sys/acct.h 39.Sh DESCRIPTION 40The kernel maintains the following 41.Fa acct 42information structure for all 43processes. 44If 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#define AC_COMM_LEN 16 51 52/* 53 * Accounting structure version 3 (current). 54 * The first byte is always zero. 55 * Time units are microseconds. 56 */ 57 58struct acctv3 { 59 uint8_t ac_zero; /* zero identifies new version */ 60 uint8_t ac_version; /* record version number */ 61 uint16_t ac_len; /* record length */ 62 63 char ac_comm[AC_COMM_LEN]; /* command name */ 64 float ac_utime; /* user time */ 65 float ac_stime; /* system time */ 66 float 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 float ac_mem; /* average memory usage */ 71 float ac_io; /* count of IO blocks */ 72 __dev_t ac_tty; /* controlling tty */ 73 74 uint16_t ac_len2; /* record length */ 75 union { 76 uint32_t ac_align; /* force v1 compatible alignment */ 77 78#define AFORK 0x01 /* forked but not exec'ed */ 79/* ASU is no longer supported */ 80#define ASU 0x02 /* used super-user permissions */ 81#define ACOMPAT 0x04 /* used compatibility mode */ 82#define ACORE 0x08 /* dumped core */ 83#define AXSIG 0x10 /* killed by a signal */ 84#define ANVER 0x20 /* new record version */ 85 86 uint8_t ac_flag; /* accounting flags */ 87 } ac_trailer; 88 89#define ac_flagx ac_trailer.ac_flag 90}; 91.Ed 92.Pp 93If a terminated process was created by an 94.Xr execve 2 , 95the name of the executed file (at most ten characters of it) 96is saved in the field 97.Fa ac_comm 98and its status is saved by setting one of more of the following flags in 99.Fa ac_flag : 100.Dv AFORK , 101.Dv ACOMPAT , 102.Dv ACORE 103and 104.Dv ASIG . 105.Dv ASU 106is no longer supported. 107.Dv ANVER 108is always set in the above structure. 109.Sh SEE ALSO 110.Xr lastcomm 1 , 111.Xr acct 2 , 112.Xr execve 2 , 113.Xr sa 8 114.Sh HISTORY 115A 116.Nm 117file format appeared in 118.At v7 . 119The current record format was introduced on May 2007. 120It is backwards compatible with the previous format, 121which is still documented in 122.In sys/acct.h 123and supported by 124.Xr lastcomm 1 125and 126.Xr sa 8 . 127