From owner-freebsd-hackers Sun Jul 20 20:08:04 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id UAA17794 for hackers-outgoing; Sun, 20 Jul 1997 20:08:04 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id UAA17740 for ; Sun, 20 Jul 1997 20:07:59 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id MAA20639; Mon, 21 Jul 1997 12:37:43 +0930 (CST) From: Michael Smith Message-Id: <199707210307.MAA20639@genesis.atrad.adelaide.edu.au> Subject: Re: utmp/wtmp interface In-Reply-To: <199707170828.SAA04602@labs.usn.blaze.net.au> from David Nugent at "Jul 17, 97 06:28:00 pm" To: davidn@labs.usn.blaze.net.au (David Nugent) Date: Mon, 21 Jul 1997 12:37:42 +0930 (CST) Cc: freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk David Nugent stands accused of saying: > For anyone who may be interested, my interim work on a lastlog/utmp/wtmp > api has been posted on freefall and is available via the web. It is not > as thoroughly tested as I would like, and the proposed 'new' wtmp format > has not been tested at all (it isn't the default, and won't be initially > activated anyway, when committed, for backwards compatibility with ports). > > Comments, patches, flames and insults - any feedback welcome. :-) Hmm. "More documentation" 8) Seriously; I think that perhaps going in a similar direction to the /etc/passwd approach might be good; write the 'old-format' files when generating the records, but use an improved binary format under a new (but related) filename when accessing it from the library. In particular, a self-describing format for something like utmp/wtmp would be very sexy. I think your changed interface for lastlog is better, although there are a few problems in lastlog.c : modes = xl->ll_time ? (O_RDWR|O_CREAT) : O_RDONLY; if (xl == NULL) errno = EINVAL; This fragment is pretty bad. static char sbuf[sizeof(pl) * 2]; /* time */ xl->ll_time = pl.ll_time; /* line */ xl->ll_line = strncpy(sbuf + l, pl.ll_line, sizeof(pl.ll_line)); sbuf[l + sizeof(pl.ll_line)] = '\0'; if (!*xl->ll_line) xl->ll_line = NULL; else l += strlen(xl->ll_line) + 1; /* host */ xl->ll_host = strncpy(sbuf + l, pl.ll_host, sizeof(pl.ll_host)); sbuf[l + sizeof(pl.ll_host)] = '\0'; if (!*xl->ll_host) xl->ll_host = NULL; Using a static buffer here isn't so great either. It's going to give the threaded version cooties by default. 8) -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[