Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: atexit(), dlclose() and more atexit()



On Mon, Jun 29, 2020 at 12:34:31AM +0200, Kamil Rytarowski wrote:
> On 28.06.2020 23:57, Joerg Sonnenberger wrote:
> > On Sun, Jun 28, 2020 at 11:48:15PM +0200, Kamil Rytarowski wrote:
> >> On 28.06.2020 23:29, Joerg Sonnenberger wrote:
> >>> It is fundamentally wrong to use a handler in a library that can be
> >>> unloaded. Some systems hack around that problem by looping over all
> >>> atexit handlers on dlclose, but that's exactly that, a costly hack. The
> >>> most common way this triggers is a segfault, actually.
> >>
> >> The world disagrees and NetBSD is different for no good reason.
> > 
> > You sound like a broken record. Have you *thought* about the reasons at
> > all? Like for example the very definition of atexit: "Run a handler at
> > process exit". The Linux variant does not do that. Heck, they only
> > document it as a side note.
> > 
> 
> atexit is implemented today as 'The atexit() function registers the
> function pointed to by func to be called without arguments on normal
> termination of the program or when the object defining the function is
> unloaded.' for around 20 years now.
> 
> NetBSD is a leftover with a broken implementation.

Funny, neither POSIX nor ISO C agree with you, but I guess neither is
the relevant standard. But I'll stop here. It isn't productive.

Joerg


Home | Main Index | Thread Index | Old Index