Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Jan 2008 10:41:51 -0800
From:      Tim Kientzle <kientzle@freebsd.org>
To:        Alexander Kabaev <kabaev@gmail.com>
Cc:        freebsd-hackers@freebsd.org, Markus Hoenicka <markus.hoenicka@mhoenicka.de>
Subject:   Re: dlopen(), atexit() crash on FreeBSD (testcase included)
Message-ID:  <477A896F.4050509@freebsd.org>
In-Reply-To: <20080101104018.0fe51d67@kan.dnsalias.net>
References:  <18297.6718.750894.937199@yeti.mininet>	<20071231142620.39f2fbd2@kan.dnsalias.net>	<18297.20596.564077.568365@yeti.mininet>	<4779AD03.1060505@freebsd.org> <20080101104018.0fe51d67@kan.dnsalias.net>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>Also, I'm wondering how other OSes handle this. I don't see this
>>>code crash on Linux, contrary to its design as you say.
>>
>>I would be curious to see the results of running your
>>sample program ...  on Linux to see whether it calls the
>>registered exit function at dlclose time or never.
> 
> Linux pulls hidden atexit symbol into every binary that uses it 
> ... Linux calls atexit entries at object unload time.
> 
> Solaris implements a libc callback from ld.so.1 ...
> Solaris calls atexit callback when removing it too.

Interesting.  So the consensus here (at least for Linux
and Solaris, anyone know about Mac OS?) seems to be that
atexit() can be called from a dynamically loaded library
and that functions registered this way will be called
at library unload time.

And <sigh> FreeBSD doesn't implement this behavior.

Tim Kientzle




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?477A896F.4050509>