1 /* Copyright (C) 1996-1999, 2007, 2012 Free Software Foundation, Inc. 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 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. 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 12 Lesser General Public License for more details. 13 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 <http://www.gnu.org/licenses/>. */ 17 18 #ifndef _SYS_ACCT_H 19 #define _SYS_ACCT_H 1 20 21 #include <features.h> 22 23 #include <endian.h> 24 #define __need_time_t 25 #include <time.h> 26 #include <sys/types.h> 27 28 __BEGIN_DECLS 29 30 #define ACCT_COMM 16 31 32 /* 33 comp_t is a 16-bit "floating" point number with a 3-bit base 8 34 exponent and a 13-bit fraction. See linux/kernel/acct.c for the 35 specific encoding system used. 36 */ 37 38 typedef u_int16_t comp_t; 39 40 struct acct 41 { 42 char ac_flag; /* Flags. */ 43 u_int16_t ac_uid; /* Real user ID. */ 44 u_int16_t ac_gid; /* Real group ID. */ 45 u_int16_t ac_tty; /* Controlling terminal. */ 46 u_int32_t ac_btime; /* Beginning time. */ 47 comp_t ac_utime; /* User time. */ 48 comp_t ac_stime; /* System time. */ 49 comp_t ac_etime; /* Elapsed time. */ 50 comp_t ac_mem; /* Average memory usage. */ 51 comp_t ac_io; /* Chars transferred. */ 52 comp_t ac_rw; /* Blocks read or written. */ 53 comp_t ac_minflt; /* Minor pagefaults. */ 54 comp_t ac_majflt; /* Major pagefaults. */ 55 comp_t ac_swaps; /* Number of swaps. */ 56 u_int32_t ac_exitcode; /* Process exitcode. */ 57 char ac_comm[ACCT_COMM+1]; /* Command name. */ 58 char ac_pad[10]; /* Padding bytes. */ 59 }; 60 61 62 struct acct_v3 63 { 64 char ac_flag; /* Flags */ 65 char ac_version; /* Always set to ACCT_VERSION */ 66 u_int16_t ac_tty; /* Control Terminal */ 67 u_int32_t ac_exitcode; /* Exitcode */ 68 u_int32_t ac_uid; /* Real User ID */ 69 u_int32_t ac_gid; /* Real Group ID */ 70 u_int32_t ac_pid; /* Process ID */ 71 u_int32_t ac_ppid; /* Parent Process ID */ 72 u_int32_t ac_btime; /* Process Creation Time */ 73 float ac_etime; /* Elapsed Time */ 74 comp_t ac_utime; /* User Time */ 75 comp_t ac_stime; /* System Time */ 76 comp_t ac_mem; /* Average Memory Usage */ 77 comp_t ac_io; /* Chars Transferred */ 78 comp_t ac_rw; /* Blocks Read or Written */ 79 comp_t ac_minflt; /* Minor Pagefaults */ 80 comp_t ac_majflt; /* Major Pagefaults */ 81 comp_t ac_swaps; /* Number of Swaps */ 82 char ac_comm[ACCT_COMM]; /* Command Name */ 83 }; 84 85 86 enum 87 { 88 AFORK = 0x01, /* Has executed fork, but no exec. */ 89 ASU = 0x02, /* Used super-user privileges. */ 90 ACORE = 0x08, /* Dumped core. */ 91 AXSIG = 0x10 /* Killed by a signal. */ 92 }; 93 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 99 100 #define AHZ 100 101 102 103 /* Switch process accounting on and off. */ 104 extern int acct (const char *__filename) __THROW; 105 106 __END_DECLS 107 108 #endif /* sys/acct.h */ 109