From owner-freebsd-hackers Mon Jan 18 02:44:09 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA24076 for freebsd-hackers-outgoing; Mon, 18 Jan 1999 02:44:09 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA24071 for ; Mon, 18 Jan 1999 02:44:06 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from localhost (dfr@localhost) by nlsystems.com (8.9.1/8.8.5) with SMTP id KAA42491; Mon, 18 Jan 1999 10:44:20 GMT Date: Mon, 18 Jan 1999 10:44:19 +0000 (GMT) From: Doug Rabson To: Archie Cobbs cc: freebsd-hackers@FreeBSD.ORG, Julian Elischer Subject: Re: Loading KLD from the kernel In-Reply-To: <199901180549.VAA04615@bubba.whistle.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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