From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 25 22:45:01 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5BB5A16A4CE for ; Thu, 25 Mar 2004 22:45:01 -0800 (PST) Received: from tv.soth.at (door.soth.at [80.110.102.19]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A9A143D46 for ; Thu, 25 Mar 2004 22:45:00 -0800 (PST) (envelope-from toni@tv.soth.at) Received: from tv.soth.at (tv.soth.at [127.0.0.1]) by tv.soth.at (8.12.10/8.12.10) with ESMTP id i2Q6iwFo004022; Fri, 26 Mar 2004 07:44:58 +0100 Received: (from toni@localhost) by tv.soth.at (8.12.10/8.12.10/Submit) id i2Q6iwhZ004020; Fri, 26 Mar 2004 07:44:58 +0100 Date: Fri, 26 Mar 2004 07:44:58 +0100 From: Toni Andjelkovic To: Sam Lawrance Message-ID: <20040326064458.GK1227@tv.soth.at> References: <1080252926.1138.18.camel@dirk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1080252926.1138.18.camel@dirk> User-Agent: Mutt/1.4.1i cc: freebsd-hackers@freebsd.org Subject: Re: kldstat and module ref count X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Mar 2004 06:45:01 -0000 On Fri, Mar 26 2004 (09:15:26 +1100), Sam Lawrance wrote: > I've tried to find the answer to this but am stuck. How can I prevent a > kld module being unloaded if it is still in use? > > Filesystem modules give "device busy" if you try to kldunload them while > still in use. Any sort of quick pointer in the right direction would be > much appreciated. You may veto the unload by returning an error > 0 from the module event handler. See md_modevent() in sys/dev/md/md.c or vfs_modevent() in sys/kern/vfs_init.c for examples. Cheers, Toni