Date: Wed, 5 Feb 2003 02:44:34 +0600 From: Max Khon <fjoe@iclub.nsu.ru> To: Mikhail Teterin <mi+mx@aldan.algebra.com> Cc: arch@freebsd.org, Alfred Perlstein <bright@mu.org>, Wes Peters <wes@softweyr.com>, Mario Sergio Fujikawa Ferreira <lioux@freebsd.org> Subject: Re: dlclose() vs. atexit() Message-ID: <20030205024434.A64330@iclub.nsu.ru> In-Reply-To: <200302041505.53352.mi%2Bmx@aldan.algebra.com>; from mi%2Bmx@aldan.algebra.com on Tue, Feb 04, 2003 at 03:05:53PM -0500 References: <200302030506.h1356Nha011918@repoman.freebsd.org> <200302041046.13767.mi%2Bmx@aldan.algebra.com> <20030205014229.A62172@iclub.nsu.ru> <200302041505.53352.mi%2Bmx@aldan.algebra.com>
next in thread | previous in thread | raw e-mail | index | archive | help
hi, there! On Tue, Feb 04, 2003 at 03:05:53PM -0500, Mikhail Teterin wrote: > = > Yet another plan would be to have the atexit() call simply increase the > = > ref-count of the library a handler is from, so it will not actually be > = > unloaded by dlclose(). But that will be yet another implementation... > = > = this will break applications which want to reload some > = of the dlopen'ed modules > > I guess, I'm especially slow today. How will it break them? That is > what Solaris appears to be doing, BTW -- calling the exit-handler at > dlclose(), but leaving the library in memory: > > SunOS [...] 5.8 Generic_108528-13 sun4u sparc SUNW,Sun-Fire-280R > Loading the libraries > ./l0.so loaded as ff3a1458 > ./l1.so loaded as ff3a17b8 > Library 0 calling atexit(ff260380) > Library 1 calling atexit(ff350380) > Unloading the libraries > Exit handler ff350380 of library 0 is invoked > ff3a1458 unloaded > Exit handler ff260380 of library 1 is invoked > ff3a17b8 unloaded > Libraries unloaded. Returning > > See, the exit handler for library 1 is called and does not crash, even > though it is defined in the already dlclosed library 0... ah. if refcount will be decremented and checked for 0 (with possible dlclose call) after each call to exit function then there is no problems. /fjoe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030205024434.A64330>