Subject: Re: RFC: migration to a fully dynamically linked system
To: None <tech-userlevel@netbsd.org>
From: None <cgd@broadcom.com>
List: tech-userlevel
Date: 12/21/2001 10:59:41
At Fri, 21 Dec 2001 17:43:15 +0000 (UTC), "Jason R Thorpe" wrote:
> On Fri, Dec 21, 2001 at 08:36:44AM -0800, Greywolf wrote:
>  > Why does nsswitch need to be part of a dynamic library?  Why can we not
>  > just do the lookup in the nsswitch.conf and behave accordingly?
> 
> Because then for every possible auth type you want to provide, you
> have to have it included in libc.

It's actually worse than that.  it gets included in libc... and
because of the inherent nature of the nsswitch code, the generic
e.g. passwd routines have to reference _all_ of the back-end passwd
routines.  Thinking about it, since those need to do nsswitch parsing
etc., probably all of the _other_ stuff understood by nsswitch has to
get pulled in as well.


It's a fairly huge amount of code.  For a good time, compare the size
of fsck_ffs compiled with and without -DSMALL.

text    data    bss     dec     hex     filename
278495  3416    19772   301683  49a73   fsck_ffs.LARGE
112113  1536    7324    120973  1d88d   fsck_ffs.SMALL

If you look at the code #ifdef'd by SMALL, you'll note that it's
_only_:

#ifndef SMALL   
        if ((pw = getpwuid((int)iswap32(dp->di_uid))) != 0)
                printf("%s ", pw->pw_name);
        else
#endif

That 'getpwuid()' call more than doubles the size of fsck (which isn't
a tiny/trivial program to begin with).


chris