]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/sys/acct.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / sys / acct.h
CommitLineData
bfff8b1b 1/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
7e3be507
UD
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
7e3be507
UD
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12 Lesser General Public License for more details.
7e3be507 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
0e3426bb
RM
17
18#ifndef _SYS_ACCT_H
0e3426bb 19#define _SYS_ACCT_H 1
d762684b 20
11160cb7
ZW
21#include <sys/types.h>
22#include <stdint.h>
15c4b5a4 23#include <endian.h>
05b68e14 24#include <bits/types/time_t.h>
0e3426bb
RM
25
26__BEGIN_DECLS
27
df4ef2ab
UD
28#define ACCT_COMM 16
29
8325d82c
UD
30/*
31 comp_t is a 16-bit "floating" point number with a 3-bit base 8
32 exponent and a 13-bit fraction. See linux/kernel/acct.c for the
33 specific encoding system used.
34*/
35
11160cb7 36typedef uint16_t comp_t;
8325d82c 37
df4ef2ab 38struct acct
15c4b5a4
UD
39{
40 char ac_flag; /* Flags. */
11160cb7
ZW
41 uint16_t ac_uid; /* Real user ID. */
42 uint16_t ac_gid; /* Real group ID. */
43 uint16_t ac_tty; /* Controlling terminal. */
44 uint32_t ac_btime; /* Beginning time. */
15c4b5a4
UD
45 comp_t ac_utime; /* User time. */
46 comp_t ac_stime; /* System time. */
47 comp_t ac_etime; /* Elapsed time. */
48 comp_t ac_mem; /* Average memory usage. */
49 comp_t ac_io; /* Chars transferred. */
50 comp_t ac_rw; /* Blocks read or written. */
51 comp_t ac_minflt; /* Minor pagefaults. */
52 comp_t ac_majflt; /* Major pagefaults. */
53 comp_t ac_swaps; /* Number of swaps. */
11160cb7 54 uint32_t ac_exitcode; /* Process exitcode. */
15c4b5a4
UD
55 char ac_comm[ACCT_COMM+1]; /* Command name. */
56 char ac_pad[10]; /* Padding bytes. */
57};
58
59
60struct acct_v3
61{
62 char ac_flag; /* Flags */
63 char ac_version; /* Always set to ACCT_VERSION */
11160cb7
ZW
64 uint16_t ac_tty; /* Control Terminal */
65 uint32_t ac_exitcode; /* Exitcode */
66 uint32_t ac_uid; /* Real User ID */
67 uint32_t ac_gid; /* Real Group ID */
68 uint32_t ac_pid; /* Process ID */
69 uint32_t ac_ppid; /* Parent Process ID */
70 uint32_t ac_btime; /* Process Creation Time */
15c4b5a4
UD
71 float ac_etime; /* Elapsed Time */
72 comp_t ac_utime; /* User Time */
73 comp_t ac_stime; /* System Time */
74 comp_t ac_mem; /* Average Memory Usage */
75 comp_t ac_io; /* Chars Transferred */
76 comp_t ac_rw; /* Blocks Read or Written */
77 comp_t ac_minflt; /* Minor Pagefaults */
78 comp_t ac_majflt; /* Major Pagefaults */
79 comp_t ac_swaps; /* Number of Swaps */
80 char ac_comm[ACCT_COMM]; /* Command Name */
81};
82
df4ef2ab
UD
83
84enum
85 {
8325d82c
UD
86 AFORK = 0x01, /* Has executed fork, but no exec. */
87 ASU = 0x02, /* Used super-user privileges. */
88 ACORE = 0x08, /* Dumped core. */
89 AXSIG = 0x10 /* Killed by a signal. */
df4ef2ab
UD
90 };
91
15c4b5a4
UD
92#if __BYTE_ORDER == __BIG_ENDIAN
93# define ACCT_BYTEORDER 0x80 /* Accounting file is big endian. */
94#else
95# define ACCT_BYTEORDER 0x00 /* Accounting file is little endian. */
96#endif
97
df4ef2ab
UD
98#define AHZ 100
99
100
0e3426bb 101/* Switch process accounting on and off. */
a784e502 102extern int acct (const char *__filename) __THROW;
0e3426bb
RM
103
104__END_DECLS
105
106#endif /* sys/acct.h */