Add SCM_SECURITY, SCM_PIDFD to bits/socket.h
[glibc.git] / sysdeps / unix / sysv / linux / sys / acct.h
blob4e66f3bd063c2e522630cc720cbf77d196a7e66b
1 /* Copyright (C) 1996-2023 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
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.
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
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
18 #ifndef _SYS_ACCT_H
19 #define _SYS_ACCT_H 1
21 #include <sys/types.h>
22 #include <stdint.h>
23 #include <bits/endian.h>
24 #include <bits/types/time_t.h>
26 __BEGIN_DECLS
28 #define ACCT_COMM 16
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.
36 typedef uint16_t comp_t;
38 struct acct
40 char ac_flag; /* Flags. */
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. */
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. */
54 uint32_t ac_exitcode; /* Process exitcode. */
55 char ac_comm[ACCT_COMM+1]; /* Command name. */
56 char ac_pad[10]; /* Padding bytes. */
60 struct acct_v3
62 char ac_flag; /* Flags */
63 char ac_version; /* Always set to ACCT_VERSION */
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 */
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 */
84 enum
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. */
90 AGROUP = 0x20 /* Was the last task of the process
91 (task group). */
94 #if __BYTE_ORDER == __BIG_ENDIAN
95 # define ACCT_BYTEORDER 0x80 /* Accounting file is big endian. */
96 #else
97 # define ACCT_BYTEORDER 0x00 /* Accounting file is little endian. */
98 #endif
100 #define AHZ 100
103 /* Switch process accounting on and off. */
104 extern int acct (const char *__filename) __THROW;
106 __END_DECLS
108 #endif /* sys/acct.h */