From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 31 12:29:11 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E00E616A4CE for ; Wed, 31 Mar 2004 12:29:11 -0800 (PST) Received: from arginine.spc.org (arginine.spc.org [195.206.69.236]) by mx1.FreeBSD.org (Postfix) with ESMTP id A8E8C43D1D for ; Wed, 31 Mar 2004 12:29:11 -0800 (PST) (envelope-from bms@spc.org) Received: from localhost (localhost [127.0.0.1]) by arginine.spc.org (Postfix) with ESMTP id 70BB16542A; Wed, 31 Mar 2004 21:29:10 +0100 (BST) Received: from arginine.spc.org ([127.0.0.1]) by localhost (arginine.spc.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 53843-01-5; Wed, 31 Mar 2004 21:29:10 +0100 (BST) Received: from empiric.dek.spc.org (82-147-17-88.dsl.uk.rapidplay.com [82.147.17.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by arginine.spc.org (Postfix) with ESMTP id 5272A65419; Wed, 31 Mar 2004 21:29:09 +0100 (BST) Received: by empiric.dek.spc.org (Postfix, from userid 1001) id 9AE2B612C; Wed, 31 Mar 2004 21:29:08 +0100 (BST) Date: Wed, 31 Mar 2004 21:29:08 +0100 From: Bruce M Simpson To: Mike Heffner Message-ID: <20040331202908.GB32757@empiric.dek.spc.org> Mail-Followup-To: Mike Heffner , freebsd-hackers@freebsd.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: cc: freebsd-hackers@freebsd.org Subject: Re: Determining a program's shared libraries at runtime X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2004 20:29:12 -0000 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//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