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.\" 28afe61c15SRodney W. Grimes.\" @(#)acct.5 8.1 (Berkeley) 6/5/93 297f3dea24SPeter Wemm.\" $FreeBSD$ 30afe61c15SRodney W. Grimes.\" 31*69921123SKonstantin Belousov.Dd February 13, 2017 32afe61c15SRodney W. Grimes.Dt ACCT 5 33afe61c15SRodney W. Grimes.Os 34afe61c15SRodney W. Grimes.Sh NAME 35afe61c15SRodney W. Grimes.Nm acct 36afe61c15SRodney W. Grimes.Nd execution accounting file 37afe61c15SRodney W. Grimes.Sh SYNOPSIS 3832eef9aeSRuslan Ermilov.In sys/types.h 3932eef9aeSRuslan Ermilov.In sys/acct.h 40afe61c15SRodney W. Grimes.Sh DESCRIPTION 41afe61c15SRodney W. GrimesThe kernel maintains the following 42afe61c15SRodney W. Grimes.Fa acct 43afe61c15SRodney W. Grimesinformation structure for all 441111b49cSSheldon Hearnprocesses. 451111b49cSSheldon HearnIf a process terminates, and accounting is enabled, 46afe61c15SRodney W. Grimesthe kernel calls the 47afe61c15SRodney W. Grimes.Xr acct 2 48afe61c15SRodney W. Grimesfunction call to prepare and append the record 49afe61c15SRodney W. Grimesto the accounting file. 50afe61c15SRodney W. Grimes.Bd -literal 519136a887SMike Pritchard#define AC_COMM_LEN 16 52fdbe5babSDiomidis Spinellis 53fdbe5babSDiomidis Spinellis/* 54*69921123SKonstantin Belousov * Accounting structure version 3 (current). 55fdbe5babSDiomidis Spinellis * The first byte is always zero. 56fdbe5babSDiomidis Spinellis * Time units are microseconds. 57fdbe5babSDiomidis Spinellis */ 58fdbe5babSDiomidis Spinellis 59*69921123SKonstantin Belousovstruct acctv3 { 60fdbe5babSDiomidis Spinellis uint8_t ac_zero; /* zero identifies new version */ 61fdbe5babSDiomidis Spinellis uint8_t ac_version; /* record version number */ 62fdbe5babSDiomidis Spinellis uint16_t ac_len; /* record length */ 63fdbe5babSDiomidis Spinellis 649136a887SMike Pritchard char ac_comm[AC_COMM_LEN]; /* command name */ 65fdbe5babSDiomidis Spinellis float ac_utime; /* user time */ 66fdbe5babSDiomidis Spinellis float ac_stime; /* system time */ 67fdbe5babSDiomidis Spinellis float ac_etime; /* elapsed time */ 68afe61c15SRodney W. Grimes time_t ac_btime; /* starting time */ 69afe61c15SRodney W. Grimes uid_t ac_uid; /* user id */ 70afe61c15SRodney W. Grimes gid_t ac_gid; /* group id */ 71fdbe5babSDiomidis Spinellis float ac_mem; /* average memory usage */ 72fdbe5babSDiomidis Spinellis float ac_io; /* count of IO blocks */ 73fdbe5babSDiomidis Spinellis __dev_t ac_tty; /* controlling tty */ 74fdbe5babSDiomidis Spinellis 75fdbe5babSDiomidis Spinellis uint16_t ac_len2; /* record length */ 76fdbe5babSDiomidis Spinellis union { 77*69921123SKonstantin Belousov uint32_t ac_align; /* force v1 compatible alignment */ 78fdbe5babSDiomidis Spinellis 794043c58eSTim Vanderhoek#define AFORK 0x01 /* forked but not exec'ed */ 80fdbe5babSDiomidis Spinellis/* ASU is no longer supported */ 81afe61c15SRodney W. Grimes#define ASU 0x02 /* used super-user permissions */ 82afe61c15SRodney W. Grimes#define ACOMPAT 0x04 /* used compatibility mode */ 83afe61c15SRodney W. Grimes#define ACORE 0x08 /* dumped core */ 84afe61c15SRodney W. Grimes#define AXSIG 0x10 /* killed by a signal */ 85fdbe5babSDiomidis Spinellis#define ANVER 0x20 /* new record version */ 86afe61c15SRodney W. Grimes 87fdbe5babSDiomidis Spinellis uint8_t ac_flag; /* accounting flags */ 88fdbe5babSDiomidis Spinellis } ac_trailer; 89fdbe5babSDiomidis Spinellis 90fdbe5babSDiomidis Spinellis#define ac_flagx ac_trailer.ac_flag 91fdbe5babSDiomidis Spinellis}; 92afe61c15SRodney W. Grimes.Ed 93afe61c15SRodney W. Grimes.Pp 94afe61c15SRodney W. GrimesIf a terminated process was created by an 95afe61c15SRodney W. Grimes.Xr execve 2 , 96afe61c15SRodney W. Grimesthe name of the executed file (at most ten characters of it) 97afe61c15SRodney W. Grimesis saved in the field 98afe61c15SRodney W. Grimes.Fa ac_comm 99afe61c15SRodney W. Grimesand its status is saved by setting one of more of the following flags in 100afe61c15SRodney W. Grimes.Fa ac_flag : 101afe61c15SRodney W. Grimes.Dv AFORK , 102afe61c15SRodney W. Grimes.Dv ACOMPAT , 103afe61c15SRodney W. Grimes.Dv ACORE 104afe61c15SRodney W. Grimesand 105afe61c15SRodney W. Grimes.Dv ASIG . 106a454b0d3SRobert Watson.Dv ASU 107a454b0d3SRobert Watsonis no longer supported. 108fdbe5babSDiomidis Spinellis.Dv ANVER 109fdbe5babSDiomidis Spinellisis always set in the above structure. 110afe61c15SRodney W. Grimes.Sh SEE ALSO 111fdbe5babSDiomidis Spinellis.Xr lastcomm 1 , 112afe61c15SRodney W. Grimes.Xr acct 2 , 113afe61c15SRodney W. Grimes.Xr execve 2 , 114afe61c15SRodney W. Grimes.Xr sa 8 115afe61c15SRodney W. Grimes.Sh HISTORY 116afe61c15SRodney W. GrimesA 117afe61c15SRodney W. Grimes.Nm 118afe61c15SRodney W. Grimesfile format appeared in 119afe61c15SRodney W. Grimes.At v7 . 120fdbe5babSDiomidis SpinellisThe current record format was introduced on May 2007. 121fdbe5babSDiomidis SpinellisIt is backwards compatible with the previous format, 122fdbe5babSDiomidis Spinelliswhich is still documented in 123fdbe5babSDiomidis Spinellis.In sys/acct.h 124fdbe5babSDiomidis Spinellisand supported by 125fdbe5babSDiomidis Spinellis.Xr lastcomm 1 126fdbe5babSDiomidis Spinellisand 127fdbe5babSDiomidis Spinellis.Xr sa 8 . 128