Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Oct 2002 17:07:23 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Doug Rabson <dfr@nlsystems.com>
Cc:        Peter Wemm <peter@wemm.org>, Terry Lambert <tlambert2@mindspring.com>, Nate Lawson <nate@root.org>, current@FreeBSD.ORG
Subject:   Re: libc size
Message-ID:  <20021030230723.GE42580@dan.emsphone.com>
In-Reply-To: <20021030221417.J22480-100000@herring.nlsystems.com>
References:  <20021030214158.CB6EA2A88D@canning.wemm.org> <20021030221417.J22480-100000@herring.nlsystems.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Oct 30), Doug Rabson said:
> On Wed, 30 Oct 2002, Peter Wemm wrote:
> > We've been over this before.  To make this work right, we need to
> > make /bin and /sbin dynamically linked.  NetBSD's /rescue/*
> > approach would solve the "oops!" and other foot shooting problems.
> 
> Yes please. Our root filesystem space requirements are too high,
> IMHO.

Note that dynamically-linked executables take significantly longer to
exec than statically-linked ones.  Running the following simple script
with getfacl and grep linked dynamically runs a little over twice as
slow as with them both static:

#! /bin/sh
for i in /bin/* /sbin/* /usr/bin/* /usr/sbin/* ; do
 if ! getfacl "$i" | grep -q owner:0 ; then
   echo "owner of $i is not root"
 fi
done

Static: 3.20r 0.16u 3.59s   Dynamic: 6.88r 1.60u 7.03s
        3.62r 0.18u 3.50s            6.82r 2.08u 6.56s
        3.26r 0.22u 3.52s            6.92r 1.35u 7.26s
        3.23r 0.16u 3.62s            7.59r 1.25u 7.48s
        3.26r 0.19u 3.65s            7.74r 1.66u 7.42s
        3.63r 0.16u 3.76s            7.17r 1.67u 7.15s

6 runs, alternatic static and dynamic scripts for each run.

I actually link quite a few binaries in /usr/bin and /usr/sbin static
(awk, basename, dirname, find, head, install, sed, tr, uniq, wc).  Try
this: enable process accounting, run "make fetch-recursive-list" in
ports/www/mozilla, then run lastcomm and see how many times tr, sed,
basename, sh, and grep got called.  Linking these static makes a big
difference.

As a compromise, how about converting the major space wasters in /bin
and /sbin to dynamic but leaving the rest?  Except for /bin/sh, none of
them are run often enough to matter.

-r-xr-xr-x  1 root  wheel      475108 Sep  7 17:50 /sbin/routed*
-r-xr-xr-x  1 root  wheel      495943 Sep  7 17:50 /sbin/fore_dnld*
-r-xr-xr-x  1 root  wheel      521654 Oct 22 12:14 /sbin/tunefs*
-r-xr-xr-x  1 root  wheel      528572 Sep  7 17:46 /bin/pax*
-r-xr-xr-x  1 root  wheel      532428 Sep  7 17:46 /bin/ls*
-r-xr-xr-x  1 root  wheel      605588 Sep  7 17:50 /sbin/ipfstat*
-r-xr-xr-x  1 root  wheel      616277 Sep  7 17:50 /sbin/ilmid*
-r-xr-xr-x  1 root  wheel      670188 Sep  7 17:50 /sbin/fsdb*
-r-xr-xr-x  1 root  wheel      695512 Sep  7 17:50 /sbin/vinum*
-r-xr-xr-x  1 root  wheel      713372 Oct  8 00:44 /bin/sh*
-r-xr-xr-x  1 root  wheel      752168 Sep  7 17:58 /sbin/dhclient*
-r-xr-xr-x  2 root  wheel      844512 Sep  7 17:46 /bin/tcsh*
-r-xr-xr-x  1 root  wheel     3214381 Oct 25 10:29 /sbin/ipfw*
-r-xr-xr-x  2 root  wheel     3420946 Oct 25 16:02 /sbin/rdump*
-r-xr-xr-x  3 root  wheel     3464372 Oct 22 12:07 /sbin/fsck_ufs*

-- 
	Dan Nelson
	dnelson@allantgroup.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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