atom feed4 messages in org.freebsd.freebsd-hackersDetermining a program's shared librar...
FromSent OnAttachments
Mike HeffnerMar 31, 2004 11:59 am 
Bruce M SimpsonMar 31, 2004 1:14 pm 
Igor PokrovskyMar 31, 2004 7:16 pm 
Mike HeffnerMar 31, 2004 9:48 pm 
Subject:Determining a program's shared libraries at runtime
From:Bruce M Simpson (bm@spc.org)
Date:Mar 31, 2004 1:14:54 pm
List:org.freebsd.freebsd-hackers

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