Correct BSD License clause numbering from 1-2-4 to 1-2-3.
[dragonfly.git] / share / man / man5 / acct.5
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: src/share/man/man5/acct.5,v 1.7.2.2 2001/12/17 11:30:13 ru Exp $
30 .\" $DragonFly: src/share/man/man5/acct.5,v 1.3 2007/11/23 23:03:57 swildner Exp $
31 .\"
32 .Dd June 5, 1993
33 .Dt ACCT 5
34 .Os
35 .Sh NAME
36 .Nm acct
37 .Nd execution accounting file
38 .Sh SYNOPSIS
39 .In sys/types.h
40 .In sys/acct.h
41 .Sh DESCRIPTION
42 The kernel maintains the following
43 .Fa acct
44 information structure for all
45 processes.
46 If a process terminates, and accounting is enabled,
47 the kernel calls the
48 .Xr acct 2
49 function call to prepare and append the record
50 to the accounting file.
51 .Bd -literal
52 /*
53  * Accounting structures; these use a comp_t type which is a 3 bits base 8
54  * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
55  * seconds.
56  */
57 typedef u_short comp_t;
58
59 #define AC_COMM_LEN 16
60 struct acct {
61         char    ac_comm[AC_COMM_LEN];  /* command name */
62         comp_t  ac_utime;       /* user time */
63         comp_t  ac_stime;       /* system time */
64         comp_t  ac_etime;       /* elapsed time */
65         time_t  ac_btime;       /* starting time */
66         uid_t   ac_uid;         /* user id */
67         gid_t   ac_gid;         /* group id */
68         short   ac_mem;         /* average memory usage */
69         comp_t  ac_io;          /* count of IO blocks */
70         dev_t   ac_tty;         /* controlling tty */
71 #define AFORK   0x01            /* forked but not exec'ed */
72 #define ASU     0x02            /* used super-user permissions */
73 #define ACOMPAT 0x04            /* used compatibility mode */
74 #define ACORE   0x08            /* dumped core */
75 #define AXSIG   0x10            /* killed by a signal */
76         char    ac_flag;        /* accounting flags */
77 };
78
79 /*
80  * 1/AHZ is the granularity of the data encoded in the comp_t fields.
81  * This is not necessarily equal to hz.
82  */
83 #define AHZ     64
84 .Ed
85 .Pp
86 If a terminated process was created by an
87 .Xr execve 2 ,
88 the name of the executed file (at most ten characters of it)
89 is saved in the field
90 .Fa ac_comm
91 and its status is saved by setting one of more of the following flags in
92 .Fa ac_flag :
93 .Dv AFORK ,
94 .Dv ASU ,
95 .Dv ACOMPAT ,
96 .Dv ACORE
97 and
98 .Dv AXSIG .
99 .Sh SEE ALSO
100 .Xr acct 2 ,
101 .Xr execve 2 ,
102 .Xr sa 8
103 .Sh HISTORY
104 A
105 .Nm
106 file format appeared in
107 .At v7 .