Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Mar 2004 21:29:08 +0100
From:      Bruce M Simpson <bms@spc.org>
To:        Mike Heffner <mheffner@vt.edu>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Determining a program's shared libraries at runtime
Message-ID:  <20040331202908.GB32757@empiric.dek.spc.org>
In-Reply-To: <XFMail.20040331145547.mheffner@vt.edu>
References:  <XFMail.20040331145547.mheffner@vt.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040331202908.GB32757>