This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Finding the path of the current binary?


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]