From owner-freebsd-hackers Tue Jan 19 10:05:20 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA17660 for freebsd-hackers-outgoing; Tue, 19 Jan 1999 10:05:20 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp03.primenet.com (smtp03.primenet.com [206.165.6.133]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA17646 for ; Tue, 19 Jan 1999 10:05:18 -0800 (PST) (envelope-from tlambert@usr04.primenet.com) Received: (from daemon@localhost) by smtp03.primenet.com (8.8.8/8.8.8) id LAA24865; Tue, 19 Jan 1999 11:05:12 -0700 (MST) Received: from usr04.primenet.com(206.165.6.204) via SMTP by smtp03.primenet.com, id smtpd024715; Tue Jan 19 11:05:04 1999 Received: (from tlambert@localhost) by usr04.primenet.com (8.8.5/8.8.5) id LAA17691; Tue, 19 Jan 1999 11:04:53 -0700 (MST) From: Terry Lambert Message-Id: <199901191804.LAA17691@usr04.primenet.com> Subject: Re: Loading KLD from the kernel To: dfr@nlsystems.com (Doug Rabson) Date: Tue, 19 Jan 1999 18:04:52 +0000 (GMT) Cc: archie@whistle.com, freebsd-hackers@FreeBSD.ORG, julian@whistle.com In-Reply-To: from "Doug Rabson" at Jan 19, 99 09:21:18 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > I tried simply incrementing lf->userrefs after loading the module > > from the kernel, but somehow it went back to zero (?) > > This field is a count of how many times a user has loaded the file using > kldload(2). It is there to prevent a user from unloading a file which was > loaded explicitly by the kernel (e.g. as a dependancy). Incrementing > userrefs should have worked though - can you watch what happens in the > debugger and find out why it is being reset? Shouldn't a kernel load as a dependency also cause a reference count increment? I think the problem is that dependency vs. explicit loads are not seperate in the idea of loading from kernel space. Archie: look closely at the kldload to see what it does differently, since what you are doing is an explicit load from kernel space, which differs from a dependency based load. I think you need to add dependency references, as well, to account for hooks between particular nodes (i.e., the thing need to be a real reference count, not a load count). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message