Merge commit '008b34be09d7b9c3e7a18d3ce9ef8b5c4f4ff8b8'
[unleashed.git] / share / man / man3head / acct.h.3head
blob375b95d7611abe1ba5a78114888b60ed16a72fac
1 '\" te
2 .\" Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH ACCT.H 3HEAD "May 19, 1994"
8 .SH NAME
9 acct.h, acct \- per-process accounting file format
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <sys/types.h>
14 #include <sys/acct.h>
15 .fi
17 .SH DESCRIPTION
18 .sp
19 .LP
20 Files produced as a result of calling \fBacct\fR(2) have records in the form
21 defined by <\fBsys/acct.h\fR>, whose contents are:
22 .sp
23 .in +2
24 .nf
25 typedef ushort_t  comp_t;   /* pseudo "floating point"
26                                representation */
27                             /* 3 bit base-8 exponent in the high */
28                             /* order bits, and a 13-bit fraction */
29                             /* in the low order bits. */
31 struct  acct
33     char   ac_flag;    /* Accounting flag */
34     char   ac_stat;    /* Exit status */
35     uid_t  ac_uid;     /* Accounting user ID */
36     gid_t  ac_gid;     /* Accounting group ID */
37     dev_t  ac_tty;     /* control tty */
38     time_t ac_btime;   /* Beginning time */
39     comp_t ac_utime;   /* accounting user time in clock ticks */
40     comp_t ac_stime;   /* accounting system time in clock ticks */
41     comp_t ac_etime;   /* accounting total elapsed time in clock
42                           ticks */
43     comp_t ac_mem;     /* memory usage in clicks (pages) */
44     comp_t ac_io;      /* chars transferred by read/write */
45     comp_t ac_rw;      /* number of block reads/writes */
46     char   ac_comm[8]; /* command name */
50  * Accounting Flags
51  */
53 #define AFORK   01    /* has executed fork, but no exec */
54 #define ASU     02    /* used super-user privileges */
55 #define ACCTF   0300  /* record type */
56 #define AEXPND  040   /* Expanded Record Type \(mi default */
57 .fi
58 .in -2
60 .sp
61 .LP
62 In \fBac_flag\fR, the \fBAFORK\fR flag is turned on by each \fBfork\fR and
63 turned off by an \fBexec\fR. The \fBac_comm\fR field is inherited from the
64 parent process and is reset by any \fBexec\fR. Each time the system charges the
65 process with a clock tick, it also adds to \fBac_mem\fR the current process
66 size, computed as follows:
67 .sp
68 .LP
69 \fI(data size) + (text size) / (number of in-core processes using text)\fR
70 .sp
71 .LP
72 The value of \fBac_mem\|/\|(ac_stime\|+\|ac_utime)\fR can be viewed as an
73 approximation to the mean process size, as modified by text sharing.
74 .sp
75 .LP
76 The structure \fBtacct\fR, (which resides with the source files of the
77 accounting commands), represents a summary of accounting statistics for the
78 user id \fBta_uid\fR. This structure is used by the accounting commands to
79 report  statistics based on user id.
80 .sp
81 .in +2
82 .nf
84  *  total accounting (for acct period), also for day
85  */
86 struct tacct {
87    uid_t           ta_uid;       /* user id */
88    char            ta_name[8];   /* login name */
89    float           ta_cpu[2];    /* cum. cpu time in minutes, */
90                                  /* p/np (prime/non-prime time) */
91    float           ta_kcore[2];  /* cum. kcore-minutes, p/np */
92    float           ta_con[2];    /* cum. connect time in minutes,
93                                      p/np */
94    float           ta_du;        /* cum. disk usage (blocks)*/
95    long            ta_pc;        /* count of processes */
96    unsigned short  ta_sc;        /* count of login sessions */
97    unsigned short  ta_dc;        /* count of disk samples */
98    unsigned short  ta_fee;       /* fee for special services */
101 .in -2
105 The \fBta_cpu\fR, \fBta_kcore\fR, and \fBta_con\fR members contain usage
106 information pertaining to prime time and non-prime time hours.  The first
107 element in each array represents the time the  resource was used during prime
108 time hours.  The second element in  each array represents the time the resource
109 was used during non-prime time hours.  Prime time and non-prime time hours may
110 be set in the  \fBholidays\fR file (see \fBholidays\fR(4)).
113 The \fBta_kcore\fR member is a cumulative measure of the amount of memory used
114 over the accounting period by processes owned by the user with uid
115 \fBta_uid\fR. The amount shown represents kilobyte segments of memory used, per
116 minute.
119 The \fBta_con\fR member represents the amount of time the user was logged in to
120 the system.
121 .SH FILES
123 .ne 2
125 \fB\fB/etc/acct/holidays\fR\fR
127 .RS 22n
128 prime/non-prime time table
131 .SH SEE ALSO
134 \fBacctcom\fR(1), \fBacct\fR(8), \fBacctcon\fR(8), \fBacctmerg\fR(8),
135 \fBacctprc\fR(8), \fBacctsh\fR(8), \fBprtacct\fR(8), \fBrunacct\fR(8),
136 \fBshutacct\fR(8), \fBacct\fR(2), \fBexec\fR(2), \fBfork\fR(2)
137 .SH NOTES
140 The \fBac_mem\fR value for a short-lived command gives little information about
141 the actual size of the command, because \fBac_mem\fR may be incremented while a
142 different command (for example, the shell) is being executed by the process.