From owner-freebsd-hackers Sun Jan 18 05:09:53 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA00662 for hackers-outgoing; Sun, 18 Jan 1998 05:09:53 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp04.primenet.com (smtp04.primenet.com [206.165.6.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA00647 for ; Sun, 18 Jan 1998 05:09:43 -0800 (PST) (envelope-from tlambert@usr04.primenet.com) Received: (from daemon@localhost) by smtp04.primenet.com (8.8.8/8.8.8) id XAA29465; Sat, 17 Jan 1998 23:53:11 -0700 (MST) Received: from usr04.primenet.com(206.165.6.204) via SMTP by smtp04.primenet.com, id smtpd029450; Sat Jan 17 23:53:07 1998 Received: (from tlambert@localhost) by usr04.primenet.com (8.8.5/8.8.5) id XAA07823; Sat, 17 Jan 1998 23:53:05 -0700 (MST) From: Terry Lambert Message-Id: <199801180653.XAA07823@usr04.primenet.com> Subject: Re: dladdr hax To: jdp@polstra.com (John Polstra) Date: Sun, 18 Jan 1998 06:53:04 +0000 (GMT) Cc: hasty@rah.star-gate.com, hackers@FreeBSD.ORG In-Reply-To: <199801172050.MAA07904@austin.polstra.com> from "John Polstra" at Jan 17, 98 12:50:21 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk > If you will come up with (or suggest) a solution to finding the > pathname of the main program, then I will add that into my version and > commit it. And puhleeeze, don't suggest the hack of searching each of > the directories in $PATH for argv[0]. To be bug-compatible with Solaris, you should simply return argv[0] *witjout* trying to find it in your PATH. Yes, this is a kludge. My initial reaction was to return the name of the file from the procfs; this fails to satify the java use of the path to determine a location relative to the java binary (java is why dladdr is needed, at least initially. Yes, you can do some neat stuff with it on top of that, but that's not the point). The Solaris java kldge is to assume the binary is run via absolute path from a shell script run by a shell that passes an unmodified argv[ 0] (ie: doesn't rewrite it or truncate to the terminal component). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.