• Tim Schmielau's avatar
    [PATCH] BSD accounting format rework · f38928f4
    Tim Schmielau authored
    BSD accounting format rework:
    
    Use all explicit and implicit padding in struct acct to
    
     - correctly report 32 bit uid/gid,
     - correctly report jobs (e.g., daemons) running longer than 497 days,
     - increase the precision of ac_etime from 2^-13 to 2^-20
       (i.e., from ~6 hours to ~1 min. after a year)
     - store the current AHZ value.
     - allow cross-platform processing of the accounting file
       (limited for m68k which has a different size struct acct).
     - introduce versioning for smooth transition to incompatible formats in
       the future. Currently the following version numbers are defined:
         0: old format (until 2.6.7) with 16 bit uid/gid
         1: extended variant (binary compatible to v0 on M68K)
         2: extended variant (binary compatible to v0 on everything except M68K)
         3: a new binary incompatible format (64 bytes)
         4: new binary incompatible format (128 bytes).
            layout of its first 64 bytes is the same as for v3.
         5: marks second half of new binary incompatible format (128 bytes)
            (layout is not yet defined)
    
    All this is accomplished without breaking binary compatibility.  32 bit
    uid/gid support is compatible with the patch previously floating around and
    used e.g.  by Red Hat.
    
    This patch also introduces a config option for a new, binary incompatible
    "version 3" format that
    
     - is uniform across and properly aligned on all platforms
     - stores pid and ppid
     - uses AHZ==100 on all platforms (allows to report longer times)
    
    Much of the compatibility glue goes away when v1/v2 support is removed from
    the kernel.  Such a patch is at
    
      http://www.physik3.uni-rostock.de/tim/kernel/2.7/acct-cleanup-04.patch
    
    and might be applied in the 2.7 timeframe.
    
    The new v3 format is source compatible with current GNU acct tools (6.3.5).
    However, current GNU acct tools can be compiled for only one format.  As there
    is no way to pass the kernel configuration to userspace, with my patch it will
    still only support the old v2 format.  Only if v1/v2 support is removed from
    the kernel, recompiling GNU acct tools will yield v3 support.
    
    A preliminary take at the corresponding work on cross-platform userspace tools
    (GNU acct package) is at
    
      http://www.physik3.uni-rostock.de/tim/kernel/utils/acct/
    
    This version of the package is able to read any of the v0/v2/v3 formats,
    regardless of byte-order (untested), even within the same file.
    Cross-platform compatibility with m68k (v1 format) is not yet implemented, but
    native use on m68k should work (untested).  pid and ppid are currently only
    shown by the dump-acct utility.
    
    Thanks to Arthur Corliss, Albert Cahalan and Ragnar Kjørstad for their
    comments, and to Albert Cahalan for the u64->IEEE float conversion code.
    Signed-off-by: default avatarTim Schmielau <tim@physik3.uni-rostock.de>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    f38928f4
acct.c 13.4 KB