From owner-freebsd-arch Tue Feb 4 12:45: 4 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 692AC37B405; Tue, 4 Feb 2003 12:45:02 -0800 (PST) Received: from mail.nsu.ru (mx.nsu.ru [193.124.215.71]) by mx1.FreeBSD.org (Postfix) with ESMTP id E254443F75; Tue, 4 Feb 2003 12:44:58 -0800 (PST) (envelope-from fjoe@iclub.nsu.ru) Received: from drweb by mail.nsu.ru with drweb-scanned (Exim 3.20 #1) id 18g9vz-0003e2-00; Wed, 05 Feb 2003 02:44:47 +0600 Received: from iclub.nsu.ru ([193.124.215.97] ident=root) by mail.nsu.ru with esmtp (Exim 3.20 #1) id 18g9vy-0003dt-00; Wed, 05 Feb 2003 02:44:46 +0600 Received: from iclub.nsu.ru (fjoe@localhost [127.0.0.1]) by iclub.nsu.ru (8.12.6/8.12.6) with ESMTP id h14KidRV064666; Wed, 5 Feb 2003 02:44:39 +0600 (NS) (envelope-from fjoe@iclub.nsu.ru) Received: (from fjoe@localhost) by iclub.nsu.ru (8.12.6/8.12.6/Submit) id h14KiYDS064665; Wed, 5 Feb 2003 02:44:34 +0600 (NS) Date: Wed, 5 Feb 2003 02:44:34 +0600 From: Max Khon To: Mikhail Teterin Cc: arch@freebsd.org, Alfred Perlstein , Wes Peters , Mario Sergio Fujikawa Ferreira Subject: Re: dlclose() vs. atexit() Message-ID: <20030205024434.A64330@iclub.nsu.ru> References: <200302030506.h1356Nha011918@repoman.freebsd.org> <200302041046.13767.mi+mx@aldan.algebra.com> <20030205014229.A62172@iclub.nsu.ru> <200302041505.53352.mi+mx@aldan.algebra.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200302041505.53352.mi+mx@aldan.algebra.com>; from mi+mx@aldan.algebra.com on Tue, Feb 04, 2003 at 03:05:53PM -0500 X-Spam-Status: No, hits=-3.0 required=5.0 tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01, USER_AGENT,USER_AGENT_MUTT version=2.43 X-Envelope-To: mi+mx@aldan.algebra.com, arch@freebsd.org, bright@mu.org, wes@softweyr.com, lioux@freebsd.org Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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