HEADS UP: /bin and /sbin are now dynamically linked

Peter Wemm peter at wemm.org
Mon Nov 17 12:59:49 PST 2003


walt wrote:
> Terry Lambert wrote:
> > "Robert M.Zigweid" wrote:
> > 
> >>I'll admit to being mostly a lurker here, but isn't the point of /sbin
> >>to be statically linked.  That's what the 's' stands for?
> >>
> >>Second question.  This seems to imply that /sbin and /bin both have to
> >>have the same behavior?  I have no problem with /bin being dynamically
> >>linked, but what if I want /bin to be dynamic and /sbin static?
> > 
> > 
> > Since sbin on System V predated shared libraries on System V,
> > I think maybe this is a reverse assignment of a meaning to the
> > 's'.
> 
> I was taught by an older fart than Terry that the 's' stands for
> (S)ingle-user, which is reflected even today in the 'boot -s' switch.
> 
> Since the single-user is usually the Sysadmin, the association with
> 'system' is inevitable.  The association with 'static' is also
> inevitable when I think of Sysadmins-I-Have-Known  ;0)

It is 'system' binaries.  The distinction between bin and sbin (and /usr/
bin and /usr/sbin) is that the binaries in */sbin are only really supposed
to be useful for administrators or other priviliged users.

eg:  ps, netstat, ls, id, etc are in */bin because they dont require privs
and are generally useful.

meanwhile, fsck, dhclient, fdisk, cron, rmuser, usbdevs etc do require
priviliges or are not of general use.

Why seperate them?  Consider your shell and searching $PATH at execve time.
It was more efficient to keep the amount of work that each step in processing
$PATH to a minimum.  Doubling the size of the directories means double the work
searching directories looking for the "foo" binary.  Remember that we dont
have hashed directory lookups, its a linear search.  For all your shell
scripts etc, this search happens over and over and over again.  So, having
/bin:/usr/bin:/usr/local/bin as your $PATH as a normal user is a win.

Of course, the nami cache which does negative caching does skew things a bit,
but it still helps.

Cheers,
-Peter
--
Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5



More information about the freebsd-current mailing list