Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jan 1998 17:12:38 -0600 (CST)
From:      Damon Anton Permezel <dap@damon.com>
To:        hasty@rah.star-gate.com (Amancio Hasty)
Cc:        tlambert@primenet.com, dap@damon.com, nate@mt.sri.com, freebsd-hackers@FreeBSD.ORG
Subject:   dladdr hax
Message-ID:  <199801082312.RAA20001@damon.com>
In-Reply-To: <199801081837.KAA02418@rah.star-gate.com> from Amancio Hasty at "Jan 8, 98 10:37:09 am"

next in thread | previous in thread | raw e-mail | index | archive | help
"Amancio Hasty sez: "
> 
> Hi,
> 
> I know what dladdr is its just that we don't have an implementation for it.
> 
> So who is the right person to ask to make sure that dladdr gets implemented?
> 
> 	Cheers,
> 	Amancio
> 

I'd do it, but I have no access, *and* I have concerns about having to
hack on the kernel to support java.  I'd prefer if the JDK worked on
"all recent versions", but certain enhancements can be accomodated dynamically.

My understanding of it is that it requires the full path be kept by execve().
It can either be stored in the u area, or can be copied into the new address
space somewhere, ala argv/envp.  This makes it easier for ld.so to know where
it is, and then the dladdr hack follows quite easily.
If it is kept in the u area, then some mechanism needs to be dreamed up to
let ld.so get at it, which I like less.

There are probably precedents which should be looked at and possible followed,
but that is the hard part.

Anyway, I have kluged it by having all the shell script wrappers put it in the
environment.  The kluge is not guaranteed to work, but my understanding
(which I admit might be wrong) was that this was so that "apps" could be
written which come with their own big-mess-of-java-gorp, and if one follows
some conventions when putting it all together, then the default library
path gets set appropriately.  Since I have not seen anything which relied on
this, and haven't attempted to construct such a beast, perhaps i'm just off
in the weeds...

Here's the kluge i use: (the first 3 lines are standard java wrapper setup)

PRG=`whence $0` >/dev/null 2>&1
J_HOME=`dirname $PRG`/..
progname=`basename $0`

export __cmd_path_kluge=$PRG


Then I use the __cmd_path_kluge, if set:;

    if (default_classpath == NULL) {
	char *ep;

	/*
	 * there doesn't appear to be a way to get the exec path, so
	 * we add this kluge to the java wrappers.
	 */
	if ((ep = getenv("__cmd_path_kluge")) != 0) {
	    jio_snprintf(buf, PATH_MAX, "%s", ep);

	    *(strrchr(buf, '/')) = '\0';
	    default_classpath = malloc(strlen(buf) * 5 + 100);
	    sprintf(default_classpath, 
		    "%s/../../../classes:"
		    "%s/../../classes.zip:"
		    "%s/../../classes.jar:"
		    "%s/../../rt.jar:"
		    "%s/../../i18n.jar",
		    buf, buf, buf, buf, buf);



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