enabling caching for dl_iterate_phdr()
Jakub Jelinek
jakub@redhat.com
Sat Jan 17 01:39:00 GMT 2004
On Fri, Jan 16, 2004 at 04:57:26PM -0800, Roland McGrath wrote:
> > In any case, if a callback-based approach is preferred, I can live
> > with that, too.
>
> I don't claim it's the best interface. But that is the approach that
> doesn't have other blocking issues right now.
How about extending struct dl_phdr_info and passing an counter in it
to dl_iterate_phdr's callback?
The structure can be extended at the end, because dl_iterate_phdr
passes its size to the callback as well.
The callback is called with dl_load_lock held, so the counter doesn't
even have to be atomic.
libgcc_s would just see if size includes the additional field in the
first callback, if yes, it would record that counter and on subsequent
dl_iterate_phdr call it would first check whether the counter did not
change and if it is the same, it could use cached info.
Jakub
More information about the Libc-hacker
mailing list