Add LIBMAGIC.
[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. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)acct.5      8.1 (Berkeley) 6/5/93
33 .\" $FreeBSD: src/share/man/man5/acct.5,v 1.7.2.2 2001/12/17 11:30:13 ru Exp $
34 .\" $DragonFly: src/share/man/man5/acct.5,v 1.2 2003/06/17 04:37:00 dillon Exp $
35 .\"
36 .Dd June 5, 1993
37 .Dt ACCT 5
38 .Os
39 .Sh NAME
40 .Nm acct
41 .Nd execution accounting file
42 .Sh SYNOPSIS
43 .In sys/types.h
44 .In sys/acct.h
45 .Sh DESCRIPTION
46 The kernel maintains the following
47 .Fa acct
48 information structure for all
49 processes.
50 If a process terminates, and accounting is enabled,
51 the kernel calls the
52 .Xr acct 2
53 function call to prepare and append the record
54 to the accounting file.
55 .Bd -literal
56 /*
57  * Accounting structures; these use a comp_t type which is a 3 bits base 8
58  * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
59  * seconds.
60  */
61 typedef u_short comp_t;
62
63 #define AC_COMM_LEN 16
64 struct acct {
65         char    ac_comm[AC_COMM_LEN];  /* command name */
66         comp_t  ac_utime;       /* user time */
67         comp_t  ac_stime;       /* system time */
68         comp_t  ac_etime;       /* elapsed time */
69         time_t  ac_btime;       /* starting time */
70         uid_t   ac_uid;         /* user id */
71         gid_t   ac_gid;         /* group id */
72         short   ac_mem;         /* average memory usage */
73         comp_t  ac_io;          /* count of IO blocks */
74         dev_t   ac_tty;         /* controlling tty */
75 #define AFORK   0x01            /* forked but not exec'ed */
76 #define ASU     0x02            /* used super-user permissions */
77 #define ACOMPAT 0x04            /* used compatibility mode */
78 #define ACORE   0x08            /* dumped core */
79 #define AXSIG   0x10            /* killed by a signal */
80         char    ac_flag;        /* accounting flags */
81 };
82
83 /*
84  * 1/AHZ is the granularity of the data encoded in the comp_t fields.
85  * This is not necessarily equal to hz.
86  */
87 #define AHZ     64
88 .Ed
89 .Pp
90 If a terminated process was created by an
91 .Xr execve 2 ,
92 the name of the executed file (at most ten characters of it)
93 is saved in the field
94 .Fa ac_comm
95 and its status is saved by setting one of more of the following flags in
96 .Fa ac_flag :
97 .Dv AFORK ,
98 .Dv ASU ,
99 .Dv ACOMPAT ,
100 .Dv ACORE
101 and
102 .Dv ASIG .
103 .Sh SEE ALSO
104 .Xr acct 2 ,
105 .Xr execve 2 ,
106 .Xr sa 8
107 .Sh HISTORY
108 A
109 .Nm
110 file format appeared in
111 .At v7 .