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