From owner-freebsd-arch@FreeBSD.ORG Fri May 4 15:58:38 2007 Return-Path: X-Original-To: arch@FreeBSD.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5822616A403; Fri, 4 May 2007 15:58:38 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-out-05.forthnet.gr (mx-out.forthnet.gr [193.92.150.103]) by mx1.freebsd.org (Postfix) with ESMTP id B9C8613C46A; Fri, 4 May 2007 15:58:37 +0000 (UTC) (envelope-from dds@aueb.gr) Received: from mx-av-01.forthnet.gr (mx-av.forthnet.gr [193.92.150.27]) by mx-out-05.forthnet.gr (8.13.8/8.13.8) with ESMTP id l44FwYqL022643; Fri, 4 May 2007 18:58:34 +0300 Received: from MX-IN-04.forthnet.gr (mx-in-04.forthnet.gr [193.92.150.163]) by mx-av-01.forthnet.gr (8.14.1/8.14.1) with ESMTP id l44FwYcv017427; Fri, 4 May 2007 18:58:34 +0300 Received: from [192.168.136.22] (ppp124-213.adsl.forthnet.gr [193.92.231.213]) by MX-IN-04.forthnet.gr (8.14.1/8.14.1) with ESMTP id l44FwQv6016853; Fri, 4 May 2007 18:58:26 +0300 Authentication-Results: MX-IN-04.forthnet.gr from=dds@aueb.gr; sender-id=neutral; spf=neutral Message-ID: <463B581E.6070804@aueb.gr> Date: Fri, 04 May 2007 18:58:22 +0300 From: Diomidis Spinellis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070222 SeaMonkey/1.1.1 MIME-Version: 1.0 To: arch@FreeBSD.org 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> In-Reply-To: <4627E311.6080500@aueb.gr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: re@FreeBSD.org, Poul-Henning Kamp , Robert Watson Subject: Re: Accounting changes X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 May 2007 15:58:38 -0000 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@