Finding the path of the current binary?
Mike Hearn
mike@theoretic.com
Fri Mar 7 21:46:00 GMT 2003
On Fri, 2003-03-07 at 20:18, Roland McGrath wrote:
> You can use the DT_DEBUG slot or just the _r_debug symbol, to find the the
> `r_map' member giving the head of the struct link_map list (see <link.h>).
> Then l_name in each struct link_map gives you the file name that was opened.
Doesn't that require the library knows its own soname? I'd really like
to have some reusable piece of code that I can just drop in, rather than
having to specify my own soname in the code.
> That said, it might indeed be nice to have a library interface for
> substituting $ORIGIN and similar magic bits.
That would be idea really. Any idea how complex such a patch would be?
More information about the Libc-alpha
mailing list