Date: Mon, 18 Jan 1999 20:51:51 -0800 (PST) From: Archie Cobbs <archie@whistle.com> To: dfr@nlsystems.com (Doug Rabson) Cc: freebsd-hackers@FreeBSD.ORG, julian@whistle.com (Julian Elischer) Subject: Re: Loading KLD from the kernel Message-ID: <199901190451.UAA07575@bubba.whistle.com> In-Reply-To: <Pine.BSF.4.01.9901181008100.40696-100000@herring.nlsystems.com> from Doug Rabson at "Jan 18, 99 10:44:19 am"
next in thread | previous in thread | raw e-mail | index | archive | help
Doug Rabson writes: > > What's the correct way to request loading of a KLD module from within > > the kernel (but not from an interrupt handler). I see the kldload() > > syscall function.. should I just call it directly? > > > > Same question for unloading a KLD module... > > The right thing to do is to call linker_load_file() like this: > > linker_file_t lf; > int error = linker_load_file(filename, &lf); > if (error) > ...; Thanks!! That works great. Now I have another much more minor question.. when kldload() loads a module, it increments "lf->userrefs" .. I assume this field is for the "client" code to use (eg, kld syscalls or other kernel entity). If this field is zero, you can't unload the module from root shell: linkerunload: attempt to unload file which was not loaded by user I'm trying to understand the exact semantics of userrefs, and how we can allow root to unload a KLD from the shell that was loaded from the kernel (after checking that it's safe, of course)? I tried simply incrementing lf->userrefs after loading the module from the kernel, but somehow it went back to zero (?) Thanks, -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901190451.UAA07575>