From owner-freebsd-questions@FreeBSD.ORG Mon Sep 22 05:58:33 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6814816A4B3 for ; Mon, 22 Sep 2003 05:58:33 -0700 (PDT) Received: from sccimhc02.asp.att.net (sccimhc02.asp.att.net [63.240.76.164]) by mx1.FreeBSD.org (Postfix) with ESMTP id 290D143FEC for ; Mon, 22 Sep 2003 05:58:32 -0700 (PDT) (envelope-from david.fleck@mchsi.com) Received: from grond (12-216-14-105.client.mchsi.com[12.216.14.105]) by sccimhc02.asp.att.net (sccimhc02) with SMTP id <20030922125831im20042pnve>; Mon, 22 Sep 2003 12:58:31 +0000 Date: Mon, 22 Sep 2003 07:58:27 -0500 (CDT) From: David Fleck Sender: dcf@grond.sourballs.org To: Sergey DoubleF Zaharchenko In-Reply-To: <20030921190832.51ab0169.doublef@tele-kom.ru> Message-ID: <20030922074442.J430@grond.sourballs.org> References: <20030921083559.U1534@grond.sourballs.org> <20030921190832.51ab0169.doublef@tele-kom.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: FreeBSD Questions Subject: Re: What determines if kernel modules are auto-loaded? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Sep 2003 12:58:33 -0000 On Sun, 21 Sep 2003, Sergey DoubleF Zaharchenko wrote: > On Sun, 21 Sep 2003 18:53:31 +0000 Sergey "DoubleF" Zaharchenko probably wrote: > > Mostly the program which uses the device. For instance, vnconfig and > > mount will load the necessary modules because they are supposed to be > > run as root and expect to have the necessary priveleges. Why would a > > programmer make a mp3 player that would auto-load the sound module? An > > mp3 player should be portable and should not depend on such things as a > > kernel module. Moreover, the player is not supposed to run as > > root, which is required to load kernel modules. > > You should read kldload(2), etc. if you want to load modules in your program. Thanks for the response - it helps shed some more light on things. But I don't want to load modules for 'my' program - I'm far less interested in this from a development point of view than from a system admin. point of view. Why, for instance, does my (4.6.2-RELEASE-p20) system have a nfs.ko kernel module, and a line in /boot/defaults/loader.conf to enable this module, but (apparently) no way to *use* the module? If I compile a kernel with 'options NFS' uncommented in the kernel config file, the nfs module gets built into the kernel, and loading the module is pointless - however, if I comment out 'options NFS', the kernel can't compile because of missing symbols. So I have a chunk of code that gets built by the makefile as a module, but can't be used as a module? I find this all very unintuitive. What seems to be happening during the kernel compile process is that a certain number of modules are always compiled, regardless of config file settings - the settings only determine if a given chunk of code makes it into the kernel itself. If the module is compiled into a .ko file, and if the code isn't present in the kernel, then it can be loaded by kldload. Is this correct? -- David Fleck david.fleck@mchsi.com