iana-etc with STRIP=yes

Gilles Espinasse g.esp at free.fr
Tue Oct 7 17:22:07 PDT 2008

----- Original Message ----- 
From: "Matthew Burgess" <matthew at linuxfromscratch.org>
To: "LFS Developers Mailinglist" <lfs-dev at linuxfromscratch.org>
Sent: Tuesday, October 07, 2008 10:19 PM
Subject: Re: iana-etc with STRIP=yes

> On Tue, 7 Oct 2008 09:51:04 -0700, "Dan Nicholson" <dbn.lists at gmail.com>
> > "barf" is my standard "make this program fail" input. I've yet to come
> > across any conflicts with that assumption. :)#
> echo "barf" works for me :)
> Seriously, though, I would expect any reasonable program to call getent()
once on startup and cache the result.  As such, I'd much prefer to have the
comments in the file than have them stripped.  I can only assume that the
embedded folks are after space savings rather than time savings by stripping
the file.
> Regards,
> Matt.
I am afraid glibc may be not classed as a reasonable program.

Following the URL I have posted, you could read that getservbyname() result
is not cached.
The thread is from 2006 from a RH guy. I admit this is a bit old (work done
for FC6)

I have tested on my Centos-5.2 machine and that look true and unchanged.

Caching could be a job for nscd but only passwd, group, hosts services look
supported by nscd.

Using google with 'glibc cache getservbyname', I have hits from Mac OSX and
BSD, I haven't find something linux related.

On this Cento machine (glibc-2.5), compiling the test app include in the
above URL show
ls -l /etc/{protocols,services}
-rw-r--r-- 1 root root   6108 Oct 11  2006 /etc/protocols
-rw-r--r-- 1 root root 362031 Feb 23  2006 /etc/services

time ./getserverbyname-test foobar

real    0m56.473s
user    0m50.857s
sys     0m5.627s

time ./getserverbyname-test svn

real    0m3.230s
user    0m2.869s
sys     0m0.362s

On the same machine inside a chroot with glibc-2.7 and iana-etc-2.30
ls -l /etc/{protocols,services}
-rw-r--r-- 1 root root   2078 Oct  4 22:59 /etc/protocols
-rw-r--r-- 1 root root 192217 Oct  4 22:59 /etc/services

time ./getserverbyname-test foobar

real    1m12.605s
user    1m9.623s
sys     0m2.996s

time ./getserverbyname-test svn

real    0m40.820s
user    0m39.233s
sys     0m1.595s

So size is not everything ;-)

CentOS services file has 9245 lines, etc-iana-2.30 stripped has 10308 lines.
This explain why it is a bit longer with etc-iana-2.30 and foobar.

svn is at line 533 on CentOS and at line 6633 with etc-iana-2.30
This explain why the answer is more than 10 faster on CentOS.

On CentOS, all new entries have been placed after original ports list.
In etc-iana-2.30, everything is in perfect port number order.

On Centos etc/services file, compressnet is line 580
time ./getserverbyname-test compressnet

real    0m3.502s
user    0m3.098s
sys     0m0.405s

On etc-iana-2.30, compressnet is line 3
 time ./getserverbyname-test compressnet

real    0m0.322s
user    0m0.098s
sys     0m0.224s

so this time etc-iana win by being 10 time faster


More information about the lfs-dev mailing list