[ntp:questions] Size of ntpd program

Piotr Grudzinski piotr at powersmiths.com
Fri Oct 9 18:45:51 UTC 2009


> On Tue, Sep 29, 2009 at 9:38 PM, Piotr Grudzinski wrote:
>> I have noticed that the size of ntpd program between ntp-dev-4.2.5p219 
>> and ntp-dev-4.2.5p224 increased from 340KB to 430KB.
>>
>> Is there a real justification for this size increase of 90KB?
>
> Looking at the ChangeLog, the prime suspect would be the updated
> libisc.  Previously, ntpd used a fork of libisc dating back over 5
> years (with a few bits here and there updated with more current code).
> With 4.2.5p222 current lib/isc from BIND 9 was imported with an
> effort to minimize changes to our copy.  Previously, libisc was
> simpler and smaller and more of it was stubbed out for ntpd's use.  My
> hunch is most of the 90k you're pulling in is unused routines that
> happen to live in the same source file as a routine or global which is
> used.
>
> I care about ntpd on embedded systems where every kilobyte counts.  I
> also care about minimizing our NTP-specific patches to libisc.  If you
> spend some time investigating pre-p222 and post you might find some
> minimally-invasive ways to carve off unneeded libisc code from ntpd.
>
> Cheers,
> Dave Hart

Using ntp-dev-4.2.5p230-RC
In the lib/isc/include/isc/mem.h I defined all of the below to be 0

ISC_MEM_DEBUG
ISC_MEM_TRACKLINES
ISC_MEM_CHECKOVERRUN
ISC_MEM_FILL
ISC_MEMPOOL_NAMES
ISC_MEM_USE_INTERNAL_MALLOC

Also, in lib/isc/mem.c I changed:
    LIBISC_EXTERNAL_DATA unsigned int isc_mem_debugging = ISC_MEM_DEBUGGING;
to be:
    #define isc_mem_debugging  ISC_MEM_DEBUGGING

My compiler fails with:
    lib/isc/mem.c:1286: error: structure has no member named `name'

which is easily fixable by conditionally removing all the while(fprintf 
...).

With the above changes the size of ntpd shrinks (in my case) from 432.7KB to 
422.5KB (about 10KB).

Q1. Is there possibly more of silently introduced debug defines after 
ntp-dev-4.2.5p219?
Q2. If the only required functionality of ntpd is ntp client, where should I 
start looking to remove the unnecessary code?

Best Regards,
Piotr 




More information about the questions mailing list