This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Finding the path of the current binary?
- From: Mike Hearn <mike at theoretic dot com>
- To: Roland McGrath <roland at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: 07 Mar 2003 21:48:01 +0000
- Subject: Re: Finding the path of the current binary?
- Organization:
- References: <200303072018.h27KIYB02958@magilla.sf.frob.com>
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?