This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: RFE: dl_iterate_phdr, r_debug.r_brk usability for introspection
- From: Rich Felker <dalias at libc dot org>
- To: John Reiser <jreiser at bitwagon dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 23 Sep 2015 15:04:38 -0400
- Subject: Re: RFE: dl_iterate_phdr, r_debug.r_brk usability for introspection
- Authentication-results: sourceware.org; auth=none
- References: <55F5A822 dot 1050609 at bitwagon dot com>
On Sun, Sep 13, 2015 at 09:45:22AM -0700, John Reiser wrote:
> Counting and reporting the number of calls to dlopen and dlclose
> would enhance the usability of dl_iterate_phdr. A related change
> to r_debug.r_brk would make life easier for live introspection.
>
> For dl_iterate_phdr: count the number of calls to dlopen and dlclose.
> Report the counts to the callback function as new members of
> struct dl_phdr_info. Also tell the number of iterations remaining:
> unsigned dlpi_n_dlopen; /* # calls in this process */
> unsigned dlpi_n_dlclose; /* # calls in this process */
> unsigned dlpi_n_more; /* # remaining link_map along .r_map */
I just remembered: there's already an equivalent API from one or more
of the BSDs (I'd have to look back to see which) that was adopted in
musl. See:
http://git.musl-libc.org/cgit/musl/tree/include/link.h#n27
Rather than inventing something new and gratuitously incompatible it
would be nice if glibc could adopt the same member names (and layout).
We also have the TLS module id (for use with __tls_get_addr) and image
pointer available there.
Rich