From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 17 01:05:44 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3AD0116A4CE for ; Tue, 17 Feb 2004 01:05:44 -0800 (PST) Received: from axe-inc.co.jp (axegw.axe-inc.co.jp [61.199.217.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C9BE43D1D for ; Tue, 17 Feb 2004 01:05:43 -0800 (PST) (envelope-from takawata@axe-inc.co.jp) Received: from localhost (localhost [127.0.0.1]) by axe-inc.co.jp (8.9.3+3.2W/3.7W) with SMTP id SAA27653 for ; Tue, 17 Feb 2004 18:05:42 +0900 (JST) Message-Id: <200402170905.SAA27653@axe-inc.co.jp> X-Authentication-Warning: axegw.axe-inc.co.jp: localhost [127.0.0.1] didn't use HELO protocol To: hackers@freebsd.org From: takawata@jp.freebsd.org In-reply-to: Your message of "Mon, 16 Feb 2004 19:36:57 PST." <20040217033657.GG85686@funkthat.com> Date: Tue, 17 Feb 2004 18:05:42 +0900 Sender: takawata@axe-inc.co.jp Subject: Re: more info about KLD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Feb 2004 09:05:44 -0000 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: }