Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Feb 2004 18:05:42 +0900
From:      takawata@jp.freebsd.org
To:        hackers@freebsd.org
Subject:   Re: more info about KLD
Message-ID:  <200402170905.SAA27653@axe-inc.co.jp>
In-Reply-To: Your message of "Mon, 16 Feb 2004 19:36:57 PST." <20040217033657.GG85686@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20040217033657.GG85686@funkthat.com>, John-Mark Gurney wrote:
>> I have two questions:
>> (1) Is there any more detailed information regarding KLD in
>> addition to the KDL facility programming in DaemonNews
>> and in Architecture Book?
>
>have you checked the kernel developers handbook..
>
>> (2) Can I turn an arbitrary piece of codes in kernel into a KLD?
>> Say, the entire TCP/IP stack?
>
>Yes, for the most part you can.  Though you may limited on when you
>can load/unload the code.  The tcp/ip stack may be a bit difficult as
>it has interdependancies on other parts, like ipv6...

It may have some problem when the code is initialized early or 
using #ifdef.
Kernel modules are loaded by loader(8) or kldload(2).
When kernel module should be initialized early, the module have to 
be loaded by loader(8). The loaded module is linked in kernel boot 
sequence after VM initialzied. 
Another thing, #ifdef is interpreted on compiling. If there are some
code like this, the FUGAFUGA option cannot turn into module.
INET option is this example.


	switch(foo){
		case BAR:
		     hehehe();
		     break;
#ifdef FUGAFUGA
		case BAZ:
		     function_in_fugafuga();
		     break;
#endif
		default:
	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402170905.SAA27653>