From owner-freebsd-hackers Mon Dec 31 1: 2:13 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from straylight.ringlet.net (discworld.nanolink.com [217.75.135.248]) by hub.freebsd.org (Postfix) with SMTP id 1C0EE37B41D for ; Mon, 31 Dec 2001 01:01:30 -0800 (PST) Received: (qmail 11126 invoked by uid 1000); 31 Dec 2001 08:59:40 -0000 Date: Mon, 31 Dec 2001 10:59:40 +0200 From: Peter Pentchev To: Mike Barcroft Cc: Mike Smith , hackers@freebsd.org Subject: Re: loadable aio Message-ID: <20011231105940.B3512@straylight.oblivion.bg> Mail-Followup-To: Mike Barcroft , Mike Smith , hackers@freebsd.org References: <20011230215630.B45114@espresso.q9media.com> <200112310508.fBV58MI03596@mass.dis.org> <20011231034807.D45114@espresso.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011231034807.D45114@espresso.q9media.com>; from mike@freebsd.org on Mon, Dec 31, 2001 at 03:48:07AM -0500 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Dec 31, 2001 at 03:48:07AM -0500, Mike Barcroft wrote: > Mike Smith writes: > > > Terry Lambert writes: > > > > There is so much "goo" around the module loading these days; there > > > > are incursions into "mount" and all sorts of other programs that > > > > should not know about module loading. > > > > > > The kldload(2) interface alone is enough to make me cringe. The way > > > in which it locates a module to load appears to be black magic. > > > > What part of searching a path for a matching file is "black magic"? > > > > Shells have been doing this for decades... > > %%% > /* > * Load /boot/kernel/procfs.ko > * XXX: why does this work? > */ > chdir("/"); > kldload("procfs"); > > /* > * Load /boot/kernel/procfs.ko > * XXX: why does this work? > */ > chdir("/"); > kldload("procfs.ko"); > > /* > * Load /boot/kernel/procfs.ko > */ > kldload("/boot/kernel/procfs.ko"); /* Proper interface */ > > /* > * Move procfs.ko from /boot/kernel to /tmp, then load the copy in /tmp. > */ > system("/bin/mv /boot/kernel/procfs.ko /tmp"); > chdir("/tmp"); > kldload("procfs.ko"); /* XXX: this doesn't work. */ > %%% > > If that's not black magic, I'd like to know what is. I'd like to > refer you to the kldload(2) manual, but unfortunately it doesn't > document how kldload(2) works. :( Okay, so it's not documented in the manual, but one look at the source should suffice :) As Mike said, there is a search path. However, the current directory is tried first. If a file by that name is not found in the current directory, the search path is, well, searched ;) The search path is available in the kern.module_path sysctl or in the output of 'kldconfig -r'. This is similar to what shells have been doing for decades, with the added feature of an implicit '.' at the start of the search path. G'luck, Peter -- Do you think anybody has ever had *precisely this thought* before? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message