This is the mail archive of the
cygwin
mailing list for the Cygwin project.
dlclose() vs fork()
- From: Alexey Sokolov <alexey+cygwin at asokolov dot org>
- To: cygwin at cygwin dot com
- Date: Tue, 21 Mar 2017 09:03:37 +0000
- Subject: dlclose() vs fork()
- Authentication-results: sourceware.org; auth=none
Hello,
If the same DLL is dlopen()ed several times, dlclose() will actually
unload the DLL only after the same number of calls to dlclose().
This works fine in cygwin, until we add fork().
It looks like in the child process the counters of inherited DLLs are
set to 1, so the first dlclose() unloads it, causing segfault for
subsequent access to the unloaded code.
https://github.com/znc/znc/issues/1385#issuecomment-288014319 has a
working minimal example of this behavior.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple