Date: Thu, 21 Sep 2006 21:36:18 -0400 From: John Baldwin <jhb@freebsd.org> To: "Intron is my alias on the Internet" <mag@intron.ac> Cc: freebsd-hackers@freebsd.org Subject: Re: A Bug in linker_reference_module() ? Message-ID: <200609212136.18850.jhb@freebsd.org> In-Reply-To: <courier.4512D623.00003440@intron.ac> References: <courier.4512D623.00003440@intron.ac>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 21 September 2006 14:12, Intron is my alias on the Internet wrote: > Please have a look at the function linker_reference_module() in > /sys/kern/kern_linker.c of 7.0-CURRENT. If the module is loaded on demand, > why not increase its reference counter after loading? In my opinion, > linker_reference_module() behaves differently from linker_load_file(). This is because a new kld loaded via linker_load_module() starts off with a refcount of 1. Thus, if you do: linker_reference_module(...); ... linker_release_module(...); Then with the current code the release_module() call drops the reference count to 0 and the module is unloaded. This is the desired operation for reference_module/release_module. This model is commonly used in the kernel. For example, when creating a credential, one just does 'crget()' and later a 'crfree()' to free it instead of doing 'crget(); crhold()' to create one. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609212136.18850.jhb>