Subject: Re: libkvm programs with different behaviour
To: None <port-arm32@netbsd.org>
From: Stefan Voss <voss@yoda.in-berlin.de>
List: port-arm32
Date: 12/06/1998 19:02:25
Stefan Voss wrote:
>
> In message <199812051359.NAA13992@sun52.NIS.cambridge>,
>      Richard Earnshaw wrote:
> 
> > > 
> > > [snip]
> > > 
> > > 
> > > I compared the code of 'ps' and 'netstat'. Both use kvm_openfiles()
> > > with the same parameters. 'ps' works ok but 'netstat' does not.
> > > 
> > > Can somebody give me a hint why these two programs behave differently
> > > despite using the same code?
> > 
> > netstat is dynamically linked, whereas ps is statically linked.  Are you
> > installing the new libkvm.so? 
> 
> Yes, I think I do. I do 'make' and 'make install' in /usr/src/lib. I'll try
> and see if linking statically and linking dynamically makes a difference.
> 

Surprisingly for me it makes a difference. I added 'LDSTATIC=-static'
to /etc/mk.conf, ftp'ed current libkvm, netstat and ps. Then I did
'make' and 'make install' in /usr/src/lib. It ran fine and also
installed libkvm.so (/usr/lib/libkvm.so.5.0 to be exact). Then I did
the same for netstat and ps. Now I have a working netstat again. The
dynamically linked netstat used to fail on kvm_openfiles().

I don't have a clue why the dynamically linked binary fails. Any thoughts?

Regards,
   Stefan

-- 
Stefan Voss
(voss@yoda.in-berlin.de)