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