1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux << 2 /* 1 /* 3 * BSD Process Accounting for Linux - Definit 2 * BSD Process Accounting for Linux - Definitions 4 * 3 * 5 * Author: Marco van Wieringen (mvw@planets.e 4 * Author: Marco van Wieringen (mvw@planets.elm.net) 6 * 5 * 7 * This header file contains the definitions 6 * This header file contains the definitions needed to implement 8 * BSD-style process accounting. The kernel a 7 * BSD-style process accounting. The kernel accounting code and all 9 * user-level programs that try to do somethi 8 * user-level programs that try to do something useful with the 10 * process accounting log must include this f 9 * process accounting log must include this file. 11 * 10 * 12 * Copyright (C) 1995 - 1997 Marco van Wierin 11 * Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V. 13 * 12 * 14 */ 13 */ 15 14 16 #ifndef _UAPI_LINUX_ACCT_H 15 #ifndef _UAPI_LINUX_ACCT_H 17 #define _UAPI_LINUX_ACCT_H 16 #define _UAPI_LINUX_ACCT_H 18 17 19 #include <linux/types.h> 18 #include <linux/types.h> 20 19 21 #include <asm/param.h> 20 #include <asm/param.h> 22 #include <asm/byteorder.h> 21 #include <asm/byteorder.h> 23 22 24 /* 23 /* 25 * comp_t is a 16-bit "floating" point number 24 * comp_t is a 16-bit "floating" point number with a 3-bit base 8 26 * exponent and a 13-bit fraction. 25 * exponent and a 13-bit fraction. 27 * comp2_t is 24-bit with 5-bit base 2 expone 26 * comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction 28 * (leading 1 not stored). 27 * (leading 1 not stored). 29 * See linux/kernel/acct.c for the specific e 28 * See linux/kernel/acct.c for the specific encoding systems used. 30 */ 29 */ 31 30 32 typedef __u16 comp_t; 31 typedef __u16 comp_t; 33 typedef __u32 comp2_t; 32 typedef __u32 comp2_t; 34 33 35 /* 34 /* 36 * accounting file record 35 * accounting file record 37 * 36 * 38 * This structure contains all of the inform 37 * This structure contains all of the information written out to the 39 * process accounting file whenever a proces 38 * process accounting file whenever a process exits. 40 */ 39 */ 41 40 42 #define ACCT_COMM 16 41 #define ACCT_COMM 16 43 42 44 struct acct 43 struct acct 45 { 44 { 46 char ac_flag; 45 char ac_flag; /* Flags */ 47 char ac_version; 46 char ac_version; /* Always set to ACCT_VERSION */ 48 /* for binary compatibility back until 47 /* for binary compatibility back until 2.0 */ 49 __u16 ac_uid16; 48 __u16 ac_uid16; /* LSB of Real User ID */ 50 __u16 ac_gid16; 49 __u16 ac_gid16; /* LSB of Real Group ID */ 51 __u16 ac_tty; 50 __u16 ac_tty; /* Control Terminal */ 52 /* __u32 range means times from 1970 t << 53 __u32 ac_btime; 51 __u32 ac_btime; /* Process Creation Time */ 54 comp_t ac_utime; 52 comp_t ac_utime; /* User Time */ 55 comp_t ac_stime; 53 comp_t ac_stime; /* System Time */ 56 comp_t ac_etime; 54 comp_t ac_etime; /* Elapsed Time */ 57 comp_t ac_mem; 55 comp_t ac_mem; /* Average Memory Usage */ 58 comp_t ac_io; 56 comp_t ac_io; /* Chars Transferred */ 59 comp_t ac_rw; 57 comp_t ac_rw; /* Blocks Read or Written */ 60 comp_t ac_minflt; 58 comp_t ac_minflt; /* Minor Pagefaults */ 61 comp_t ac_majflt; 59 comp_t ac_majflt; /* Major Pagefaults */ 62 comp_t ac_swaps; 60 comp_t ac_swaps; /* Number of Swaps */ 63 /* m68k had no padding here. */ 61 /* m68k had no padding here. */ 64 #if !defined(CONFIG_M68K) || !defined(__KERNEL 62 #if !defined(CONFIG_M68K) || !defined(__KERNEL__) 65 __u16 ac_ahz; 63 __u16 ac_ahz; /* AHZ */ 66 #endif 64 #endif 67 __u32 ac_exitcode; 65 __u32 ac_exitcode; /* Exitcode */ 68 char ac_comm[ACCT_COMM + 1] 66 char ac_comm[ACCT_COMM + 1]; /* Command Name */ 69 __u8 ac_etime_hi; 67 __u8 ac_etime_hi; /* Elapsed Time MSB */ 70 __u16 ac_etime_lo; 68 __u16 ac_etime_lo; /* Elapsed Time LSB */ 71 __u32 ac_uid; 69 __u32 ac_uid; /* Real User ID */ 72 __u32 ac_gid; 70 __u32 ac_gid; /* Real Group ID */ 73 }; 71 }; 74 72 75 struct acct_v3 73 struct acct_v3 76 { 74 { 77 char ac_flag; 75 char ac_flag; /* Flags */ 78 char ac_version; 76 char ac_version; /* Always set to ACCT_VERSION */ 79 __u16 ac_tty; 77 __u16 ac_tty; /* Control Terminal */ 80 __u32 ac_exitcode; 78 __u32 ac_exitcode; /* Exitcode */ 81 __u32 ac_uid; 79 __u32 ac_uid; /* Real User ID */ 82 __u32 ac_gid; 80 __u32 ac_gid; /* Real Group ID */ 83 __u32 ac_pid; 81 __u32 ac_pid; /* Process ID */ 84 __u32 ac_ppid; 82 __u32 ac_ppid; /* Parent Process ID */ 85 /* __u32 range means times from 1970 t << 86 __u32 ac_btime; 83 __u32 ac_btime; /* Process Creation Time */ 87 #ifdef __KERNEL__ 84 #ifdef __KERNEL__ 88 __u32 ac_etime; 85 __u32 ac_etime; /* Elapsed Time */ 89 #else 86 #else 90 float ac_etime; 87 float ac_etime; /* Elapsed Time */ 91 #endif 88 #endif 92 comp_t ac_utime; 89 comp_t ac_utime; /* User Time */ 93 comp_t ac_stime; 90 comp_t ac_stime; /* System Time */ 94 comp_t ac_mem; 91 comp_t ac_mem; /* Average Memory Usage */ 95 comp_t ac_io; 92 comp_t ac_io; /* Chars Transferred */ 96 comp_t ac_rw; 93 comp_t ac_rw; /* Blocks Read or Written */ 97 comp_t ac_minflt; 94 comp_t ac_minflt; /* Minor Pagefaults */ 98 comp_t ac_majflt; 95 comp_t ac_majflt; /* Major Pagefaults */ 99 comp_t ac_swaps; 96 comp_t ac_swaps; /* Number of Swaps */ 100 char ac_comm[ACCT_COMM]; 97 char ac_comm[ACCT_COMM]; /* Command Name */ 101 }; 98 }; 102 99 103 /* 100 /* 104 * accounting flags 101 * accounting flags 105 */ 102 */ 106 /* bit set whe !! 103 /* bit set when the process ... */ 107 #define AFORK 0x01 /* ... execute 104 #define AFORK 0x01 /* ... executed fork, but did not exec */ 108 #define ASU 0x02 /* ... used su 105 #define ASU 0x02 /* ... used super-user privileges */ 109 #define ACOMPAT 0x04 /* ... used co 106 #define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */ 110 #define ACORE 0x08 /* ... dumped 107 #define ACORE 0x08 /* ... dumped core */ 111 #define AXSIG 0x10 /* ... was kil 108 #define AXSIG 0x10 /* ... was killed by a signal */ 112 #define AGROUP 0x20 /* ... was the << 113 109 114 #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __ 110 #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) 115 #define ACCT_BYTEORDER 0x80 /* accounting 111 #define ACCT_BYTEORDER 0x80 /* accounting file is big endian */ 116 #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == 112 #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) 117 #define ACCT_BYTEORDER 0x00 /* accounting 113 #define ACCT_BYTEORDER 0x00 /* accounting file is little endian */ 118 #else 114 #else 119 #error unspecified endianness 115 #error unspecified endianness 120 #endif 116 #endif 121 117 122 #ifndef __KERNEL__ 118 #ifndef __KERNEL__ 123 #define ACCT_VERSION 2 119 #define ACCT_VERSION 2 124 #define AHZ (HZ) 120 #define AHZ (HZ) 125 #endif /* __KERNEL */ 121 #endif /* __KERNEL */ 126 122 127 123 128 #endif /* _UAPI_LINUX_ACCT_H */ 124 #endif /* _UAPI_LINUX_ACCT_H */ 129 125
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.