This is the mail archive of the libc-alpha@sourceware.org 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: RFE: dl_iterate_phdr, r_debug.r_brk usability for introspection


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.

Can you offer some intended usage cases? I'm not seeing how this
"enhances the usability".

> 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 */
> 
> By remembering .dlpi_n_dlopen and .dlpi_n_dlclose from the previous
> invocation of dl_iterate_phdr, then the app can tell which kind of
> changes, or determine quickly that there have been no changes.
> The data member .dlpi_n_more enables effective planning for
> resources which depend on the number of link_map instances.

The type unsigned is way too small for this and subject to overflow.
Counters like this need to be at least 64-bit.

Rich


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