Determining a program's shared libraries at runtime

Bruce M Simpson bms at spc.org
Wed Mar 31 12:29:12 PST 2004


On Wed, Mar 31, 2004 at 02:55:47PM -0500, Mike Heffner wrote:
> Is there a method in FreeBSD for a program to retrieve the current list of
> dynamic shared libraries it is linked against or has dlopen()'d?

/proc/<pid>/map should give you what you need, but it needs to be read
atomically, i.e. you can't use more than one read() call to retrieve the
information so you probably want to cp it to a temporary file and read it.

This also requires that /proc be mounted, which is not the default behaviour
under -CURRENT any more.

BMS


More information about the freebsd-hackers mailing list