Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 May 2007 18:58:22 +0300
From:      Diomidis Spinellis <dds@aueb.gr>
To:        arch@FreeBSD.org
Cc:        re@FreeBSD.org, Poul-Henning Kamp <phk@phk.freebsd.dk>, Robert Watson <rwatson@FreeBSD.org>
Subject:   Re: Accounting changes
Message-ID:  <463B581E.6070804@aueb.gr>
In-Reply-To: <4627E311.6080500@aueb.gr>
References:  <461958CC.4040804@aueb.gr>	<20070414170218.M76326@fledge.watson.org>	<4621E826.6050306@aueb.gr>	<20070415105157.J84174@fledge.watson.org>	<46231C64.9010707@aueb.gr> <20070419101815.Y2913@fledge.watson.org>	<4627A6C3.2070409@aueb.gr> <20070419212253.L2913@fledge.watson.org> <4627E311.6080500@aueb.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
I've put a proposed new version of acct.h at 
http://www.spinellis.gr/FreeBSD/acct.h

Following earlier discussion and comments, here is its design rationale. 
  [In square brackets is the identifier of people whose comments are 
addressed by each design decision.]


On modern processors the various time values were 0, because many 
commands took less than 1/64s to execute [bde].  Now time values are 
stored with microsecond precision as float numbers.(I've written code 
that allows the kernel to write them without any floating point 
operations.)

Users often keep accounting data for many years back; we should offer 
backwards compatibility [rwatson, sam]. Binary compatibility of legacy 
accounting data will be documented (in acct.h and acct(5)) and 
maintained.  I will modify sa(8) and lastcomm(1) to read both acctv1 and 
acctv2 accounting records.  Backwards compatibility of the 
sa(8)-generated compacted accounting files can be maintained by 
continuing to store in them time in AHZV1 units.

Third-party programs reading accounting data may get confused by the new 
format  [dds].  I intentionally broke source-code compatibility by 
renaming "struct acct" to "struct acctv1", so that other programs 
reading accounting records will not accidentally try to read new records 
into the old structure.

Files containing records of acctv1 and/or acctv2 structures should be 
readable backwards and forwards.  (lastcomm(1) requires this capability 
  [dds].)  A length field exists at both ends.  At the heading-end a 
zero byte indicates a post v1 version.  At the trailing-end an ANVER 
flag indicates the same.

Alignment differences might have ac_flag to be in different relative 
locations from the end of the file in the two versions [rwatson].  To 
guarantee that the location of ac_flag at the end of the acctv2 record 
remains in the same location from the end as on the legacy acctv1 
record, I used a union to force the same alignment.  Although an 
anonymous union would result in clearer code, I did not use it, because 
this is a gcc extension.

The field ac_tty is nowadays useless and should be replaced with a 
credential identifier  [phk].  A credential identifier has not been 
added, because this could be inferred from a (suitably updated) wtmp. 
The current structure provides a clean upgrade path, if we wish to add 
such a feature in the future.

Diomidis - dds@



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?463B581E.6070804>