Subject: Re: Making file-based getXent quicker
To: Luke Mewburn <>
From: Darren Reed <>
List: tech-userlevel
Date: 03/20/2006 07:59:22
On Mon, Mar 20, 2006 at 10:42:35AM +1100, Luke Mewburn wrote:
> On Sun, Mar 19, 2006 at 08:41:14PM +0000, Darren Reed wrote:
>   | 
>   | In a discussion about how NetBSD opens and closes nls files way too
>   | often, it was brought up that there are similar problems with the
>   | name-number files like /etc/services and /etc/protocols.
>   | 
>   | So the problem is, what to do about it?  How can they be made quicker?
> Have you profiled that these are a problem?

No, this is word of mouth from someone else.

> For /etc/passwd, getpwent(3) (et al) already use a db(3) database.
> There's no reason we can't consider /etc/services.db (etc)
> and implement an nsswitch "db" database lookup for these.
> We have db(1) to easily create db(3) files.

For /etc/passwd, we have vipw.  For the other files, we do not,
however, there's no reason we couldn't take the interaction with
db (calling pwd_mkdb) out of vipw.

However, I'm not certain that a db(3) file will make the enumeration
methods any quicker, vs just lookup a single entry by name/number.

I think I'd like to try the shared memory idea just to see if we can
find a way to use this feature within the standard install base of
NetBSD.  I just worry about the security concerns.

Using another db file seems easy still has disk access
latency (if we're really concerned about making things quick.)