Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jul 97 13:52:47 -0400
From:      Garance A Drosehn <gad@mlor.its.rpi.edu>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: utmp/wtmp interface
Message-ID:  <9707221752.AA00801@mlor.its.rpi.edu>
References:  <Pine.BSF.3.91.970722172644.2234A-100000@server.arg.sj.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
Andrew Gordon <arg@arg1.demon.co.uk> wrote:
> On Tue, 22 Jul 1997, Michael Smith wrote:
> > David Nugent stands accused of saying:
> > 
> > > Absolutely it is, and the penalty is paid by the non-threaded
> > > version, and it makes the code more complex then it need be
> > > in any case. The point is whether there is any benefit in
> > > making it thread-safe. :-)
> > 
> > Good question.  Maybe save worrying about that until it needs
> > to be?
> 
> But isn't the time of definition of the API the only chance to
> do it cheaply (ie. by having the caller pass in all required
> buffers, avoiding the need for static buffers in the library)?

First, I have to admit I missed the beginning of this discussion,
because I was ignoring mailing lists for about a week or so.  On
the other hand, I don't intend to keep quiet just because I don't
know the details of what I'm talking about...     :-)

In any case, I agree with Andrew.  If you want this to be an
attractive solution for a utmp/wtmp interface, then it would be
better if the proposed interface at least allows for reentrant
versions to be written.

I don't think there needs to be much of a penalty to allow for
this.  On your subroutines, just require a parameter for a buffer
area.  Include some way that a user-program can find out how large
that area must be (at run-time, not compile-time).  If the user
passes in a NULL for that parameter, have the routines use some
static buffer area.  That way people who don't care about being
thread-safe can still take the easy way out, but at least the
interface allows for reentrant versions to be written.

Disclaimer: I've done almost nothing for FreeBSD development, but
I did spend many years doing systems-programming on a mainframe
operating system.  From that background, I prefer to write things
reentrant, at least as much as possible.  I'm not saying that the
actual implementation needs to be reentrant, as that will probably
run into some practical problems.  I'm just saying that the defined
interface should allow for reentrant implementations, so that anyone
who *needs* to implement a reentrant version (for whatever reason)
can do that without defining a new interface.

I'm also interested in this topic because we (here at RPI) do work
on several unix platforms, and I'd love to see a good interface
for utmp/wtmp that could be implemented on all of them.  I'm not
sure I could help to test that out, because I'm about six months
behind in a number of other projects, but I certainly think a good
API would be a welcome improvement in the land of unix.

---
Garance Alistair Drosehn     =     gad@eclipse.its.rpi.edu
Senior Systems Programmer        (MIME & NeXTmail capable)
Rensselaer Polytechnic Institute;           Troy NY    USA



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