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

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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: enabling caching for dl_iterate_phdr()


On Wed, Jan 21, 2004 at 04:35:49PM -0800, David Mosberger wrote:
> --- elf/link.h	16 Sep 2003 05:48:04 -0000	1.76
> +++ elf/link.h	22 Jan 2004 00:26:54 -0000
> @@ -100,6 +100,12 @@
>      const char *dlpi_name;
>      const ElfW(Phdr) *dlpi_phdr;
>      ElfW(Half) dlpi_phnum;
> +
> +    /* Note: older versions of libc do not provide the following
> +       members.  Check the SIZE argument pass to the dl_iterate_phdr()
> +       callback to determine whether or not they areprovided.  */
> +    unsigned int dlpi_adds; /* incremented when phdrs may have been added */
> +    unsigned int dlpi_subs; /* incremented when phdrs may have been removed */

I'd make the counters unsigned long long instead to avoid wrap around.

Also, could you write a testcase for it? dl_iterate_phdr, then dlopen some
shlib in elf, then dl_iterate_phdr again, check the counters, dlclose
etc.

	Jakub


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