1846866 Members
3421 Online
110256 Solutions
New Discussion

Re: Shared library

 
Pratheesh
Advisor

Shared library

How can I find out the list of shared library(Including its location) that a process is accessing while its running ? Is there any command for that?

Thanks and regards,

Pratheesh
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: Shared library

Pratheesh,

Though I've never tried it, lsof is supposed to be able to show libraries. You can download lsof from:

for 11.11 (64 bit)
http://the-other.wiretapped.net/security/host-security/lsof/binaries/hpux/B.11.11/

for 11.0 (64 bit)
http://the-other.wiretapped.net/security/host-security/lsof/binaries/hpux/B.11.00/vxfs/64/9000_800/

for 11.0/11.11 (32 bit)
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.67/


Pete


Pete
A. Clay Stephenson
Acclaimed Contributor

Re: Shared library

All you need to do is run the ldd (list dynamic dependencies) command on the executable. The executable does not have to be a running process.

Man ldd for details.

If it ain't broke, I can fix that.
ranganath ramachandra
Esteemed Contributor

Re: Shared library

ldd
or
odump -sllibloadlist
 
--
ranga
hp-ux 11i v3[i work for hpe]

Accept or Kudo

Kevin Wright
Honored Contributor

Re: Shared library

ldd...list dynamic dependancies will show all shared libraries an executable will load.
Erik Heckers
Advisor

Re: Shared library

Hello!

You can also view information about the
binary using chatr

If you binary looks for libraries also at
SHLIB_PATH/LD_LIBRARY_PATH and lsof doesn't
list the required information you have to
know how SHLIB_PATH/LD_LIBRARY_PATH have
been set when the program was started.
I have no idea currently how to get that
info from the running process on HP-UX.

Erik
if power_on; then
hein coulier
Frequent Advisor

Re: Shared library

I wrote a program that will check all running processes and report if they are using the requested lib.

Combined with the privious answers, one can optimize the script (warning : eats cpu).
Mike Stroyan
Honored Contributor

Re: Shared library

The attached procvm program lists all the files mapped into processes. You can give it a list of process ids to limit the report to particular processes. It needs to search the file system to find the names of the files. By default it looks in directories under /usr/lib, $PATH, and $SHLIB_PATH. You can suppress the default directories with -n and add additiona directories with -i.
The shared libraries show up as multiple mappings of the shared library file. There is one mapping for text and one for data. This approach will actually show shared libraries that are mapped by calls to dlopen or shl_load. The static analysis tools like ldd will miss those.