Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jan 1999 10:44:19 +0000 (GMT)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Archie Cobbs <archie@whistle.com>
Cc:        freebsd-hackers@FreeBSD.ORG, Julian Elischer <julian@whistle.com>
Subject:   Re: Loading KLD from the kernel
Message-ID:  <Pine.BSF.4.01.9901181008100.40696-100000@herring.nlsystems.com>
In-Reply-To: <199901180549.VAA04615@bubba.whistle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 17 Jan 1999, Archie Cobbs wrote:

> 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)
		...;
	... do things with file ...
	linker_unload_file(lf);

Obviously you shouldn't unload the file while you are still using code
from it.  You can lookup symbols in the file using
linker_file_lookup_symbol() if you need to.

To unload a file by name, use linker_find_file_by_name() to get the handle
and then call linker_unload_file().

--
Doug Rabson				Mail:  dfr@nlsystems.com
Nonlinear Systems Ltd.			Phone: +44 181 442 9037



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?Pine.BSF.4.01.9901181008100.40696-100000>