1ACCT(5) File Formats Manual ACCT(5)
2
3
4
6 acct - execution accounting file
7
9 #include <sys/acct.h>
10
12 The acct(2) system call arranges for entries to be made in an account‐
13 ing file for each process that terminates. The accounting file is a
14 sequence of entries whose layout, as defined by the include file is:
15
16 /* Copyright (C) 1996-1999, 2007, 2012 Free Software Foundation, Inc.
17 This file is part of the GNU C Library.
18
19 The GNU C Library is free software; you can redistribute it and/or
20 modify it under the terms of the GNU Lesser General Public
21 License as published by the Free Software Foundation; either
22 version 2.1 of the License, or (at your option) any later version.
23
24 The GNU C Library is distributed in the hope that it will be useful,
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 Lesser General Public License for more details.
28
29 You should have received a copy of the GNU Lesser General Public
30 License along with the GNU C Library; if not, see
31 <http://www.gnu.org/licenses/>. */
32
33 #ifndef _SYS_ACCT_H
34 #define _SYS_ACCT_H 1
35
36 #include <features.h>
37
38 #include <endian.h>
39 #define __need_time_t
40 #include <time.h>
41 #include <sys/types.h>
42
43 __BEGIN_DECLS
44
45 #define ACCT_COMM 16
46
47 /*
48 comp_t is a 16-bit "floating" point number with a 3-bit base 8
49 exponent and a 13-bit fraction. See linux/kernel/acct.c for the
50 specific encoding system used.
51 */
52
53 typedef u_int16_t comp_t;
54
55 struct acct
56 {
57 char ac_flag; /* Flags. */
58 u_int16_t ac_uid; /* Real user ID. */
59 u_int16_t ac_gid; /* Real group ID. */
60 u_int16_t ac_tty; /* Controlling terminal. */
61 u_int32_t ac_btime; /* Beginning time. */
62 comp_t ac_utime; /* User time. */
63 comp_t ac_stime; /* System time. */
64 comp_t ac_etime; /* Elapsed time. */
65 comp_t ac_mem; /* Average memory usage. */
66 comp_t ac_io; /* Chars transferred. */
67 comp_t ac_rw; /* Blocks read or written. */
68 comp_t ac_minflt; /* Minor pagefaults. */
69 comp_t ac_majflt; /* Major pagefaults. */
70 comp_t ac_swaps; /* Number of swaps. */
71 u_int32_t ac_exitcode; /* Process exitcode. */
72 char ac_comm[ACCT_COMM+1]; /* Command name. */
73 char ac_pad[10]; /* Padding bytes. */
74 };
75
76
77 struct acct_v3
78 {
79 char ac_flag; /* Flags */
80 char ac_version; /* Always set to ACCT_VERSION */
81 u_int16_t ac_tty; /* Control Terminal */
82 u_int32_t ac_exitcode; /* Exitcode */
83 u_int32_t ac_uid; /* Real User ID */
84 u_int32_t ac_gid; /* Real Group ID */
85 u_int32_t ac_pid; /* Process ID */
86 u_int32_t ac_ppid; /* Parent Process ID */
87 u_int32_t ac_btime; /* Process Creation Time */
88 float ac_etime; /* Elapsed Time */
89 comp_t ac_utime; /* User Time */
90 comp_t ac_stime; /* System Time */
91 comp_t ac_mem; /* Average Memory Usage */
92 comp_t ac_io; /* Chars Transferred */
93 comp_t ac_rw; /* Blocks Read or Written */
94 comp_t ac_minflt; /* Minor Pagefaults */
95 comp_t ac_majflt; /* Major Pagefaults */
96 comp_t ac_swaps; /* Number of Swaps */
97 char ac_comm[ACCT_COMM]; /* Command Name */
98 };
99
100
101 enum
102 {
103 AFORK = 0x01, /* Has executed fork, but no exec. */
104 ASU = 0x02, /* Used super-user privileges. */
105 ACORE = 0x08, /* Dumped core. */
106 AXSIG = 0x10 /* Killed by a signal. */
107 };
108
109 #if __BYTE_ORDER == __BIG_ENDIAN
110 # define ACCT_BYTEORDER 0x80 /* Accounting file is big endian. */
111 #else
112 # define ACCT_BYTEORDER 0x00 /* Accounting file is little endian. */
113 #endif
114
115 #define AHZ 100
116
117
118 /* Switch process accounting on and off. */
119 extern int acct (const char *__filename) __THROW;
120
121 __END_DECLS
122
123 #endif /* sys/acct.h */
124
125 If the process was created by an execve(2), the first 10 characters of
126 the filename appear in ac_comm. The accounting flag contains bits
127 indicating whether execve(2) was ever accomplished, and whether the
128 process ever had super-user privileges.
129
131 acct(2), execve(2), sa(8)
132
133
134
1357th Edition May 19, 1986 ACCT(5)