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: Roland McGrath <roland at redhat dot com>
- To: Mike Hearn <mike at theoretic dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Fri, 7 Mar 2003 12:18:34 -0800
- Subject: Re: Finding the path of the current binary?
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.