This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [V2 patch] Enhance comments in nsswitch.h
- From: DJ Delorie <dj at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: codonell at redhat dot com, libc-alpha at sourceware dot org
- Date: Wed, 15 May 2019 02:07:02 -0400
- Subject: Re: [V2 patch] Enhance comments in nsswitch.h
Florian Weimer <fweimer@redhat.com> writes:
>> + We define several types of pointers to try help identify the data:
>> + - ptr-to-malloc'd: Pointer to data which needs freeing.
>> + - ptr-to-persistent: Pointer to persistent object.
>> + - ptr-to-unloadable: Pointer to unloadlable object. */
>
> What is a pointer to an unloadable object? A DSO handle? Or is it a
> heap pointer that is never freed?
The intention is, if/when we allow for nsswitch.conf to be reloaded, we
need to understand which internal data *is* reloaded, and which *isn't*.
So ptr-to-unloadable means those malloc'd objects that can be free'd
when we reload nsswitch.conf.
> Is ptr-to-persistent to a static object?
Just to something that doesn't change once created. The problem is, if
we load a DSO and some thread is using it via nss, and we reload
nsswitch.conf, we can't unload the DSO, because it might be in use. So
ptr-to-persistent means it points to something that, once created, won't
go away. Since the DSO doesn't change, any data mapping names to DSO
functions also won't need to change, etc.