acct(5) File Formats Manual acct(5) acct - #include (CONFIG_BSD_PROCESS_ACCT), acct(2) : acct("/var/log/pacct"); , . : #define ACCT_COMM 16 typedef u_int16_t comp_t; struct acct { char ac_flag; /* Accounting flags */ u_int16_t ac_uid; /* Accounting user ID */ u_int16_t ac_gid; /* Accounting group ID */ u_int16_t ac_tty; /* Controlling terminal */ u_int32_t ac_btime; /* Process creation time (seconds since the Epoch) */ comp_t ac_utime; /* User CPU time */ comp_t ac_stime; /* System CPU time */ comp_t ac_etime; /* Elapsed time */ comp_t ac_mem; /* Average memory usage (kB) */ comp_t ac_io; /* Characters transferred (unused) */ comp_t ac_rw; /* Blocks read or written (unused) */ comp_t ac_minflt; /* Minor page faults */ comp_t ac_majflt; /* Major page faults */ comp_t ac_swaps; /* Number of swaps (unused) */ u_int32_t ac_exitcode; /* Process termination status (see wait(2)) */ char ac_comm[ACCT_COMM+1]; /* Command name (basename of last executed command; null-terminated) */ char ac_pad[X]; /* padding bytes */ }; enum { /* Bits that may be set in ac_flag field */ AFORK = 0x01, /* Has executed fork, but no exec */ ASU = 0x02, /* Used superuser privileges */ ACORE = 0x08, /* Dumped core */ AXSIG = 0x10 /* Killed by a signal */ }; comp_t -- , 3- 8 13- . c (long) : v = (c & 0x1fff) << (((c >> 13) & 0x7) * 3); ac_utime, ac_stime ac_etime " "; sysconf(_SC_CLK_TCK). 3 Since Linux 2.6.8, an optional alternative version of the accounting file can be produced if the CONFIG_BSD_PROCESS_ACCT_V3 option is set when building the kernel. With this option is set, the records written to the accounting file contain additional fields, and the width of c_uid and ac_gid fields is widened from 16 to 32 bits (in line with the increased size of UID and GIDs in Linux 2.4 and later). The records are defined as follows: struct acct_v3 { char ac_flag; /* */ char ac_version; /* ACCT_VERSION (3) */ u_int16_t ac_tty; /* */ u_int32_t ac_exitcode; /* u_int32_t ac_uid; /* ID */ u_int32_t ac_gid; /* ID */ u_int32_t ac_pid; /* ID */ u_int32_t ac_ppid; /* ID */ u_int32_t ac_btime; /* float ac_etime; /* */ comp_t ac_utime; /* */ comp_t ac_stime; /* */ comp_t ac_mem; /* () */ comp_t ac_io; /* ( ) */ comp_t ac_rw; /* ( ) */ comp_t ac_minflt; /* */ comp_t ac_majflt; /* */ comp_t ac_swaps; /* ( ) */ char ac_comm[ACCT_COMM]; /* */ }; Although it is present on most systems, it is not standardized, and the details vary somewhat between systems. None. glibc 2.6. Process accounting originated on BSD. . Up to and including Linux 2.6.9, a separate accounting record is written for each thread created using the NPTL threading library; since Linux 2.6.10, a single accounting record is written for the entire process on termination of the last thread in the process. /proc/sys/kernel/acct, proc(5), , . lastcomm(1), acct(2), accton(8), sa(8) () Dmitry Bolkhovskikh Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.9.1 2 2024 . acct(5)