Re: PicoBSD's kernel, /dev/kmem, and the kernfs

[ Available lists | Index of freebsd-small | Month of Apr 2001 | Week of 24 Apr 2001 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Andrzej Bialecki <abial@webgiro.com>
Date
24 Apr 2001 09:07:06
Subject
Re: PicoBSD's kernel, /dev/kmem, and the kernfs
Message-ID
Pine.BSF.4.20.0104241756210.81364-100000@mx.webgiro.com

In reply to
Referenced by

[ Hide this part ]
On Tue, 24 Apr 2001, Gunther Schadow wrote:

> Hi,
>
> trying to use the ipfilter suite with PicoBSD poses problems. Ipfstat
> uses /kernel and /dev/kmem to read the filter statistics and this seems
> not available on PicoBSD. Sure this is because the PicoBSD kernel is
> without any symbols and is gzipped, and is not even in the root file
> system. There are all good reasons why this is so (even if PicoBSD is
> used from a flash ROM instead of a floppy.) But could one not make
> kernel and kmem available anyway using the kernfs virtual file system?
> I could imagine that we need not absolutely strip the kernel from its
> symbol table. We could still gzip the kernel. Given that the kernel
> is loaded into physical memory, could it not be accessible from there
> to the kernfs virtual file system? Or mapped into the mfs root file
> system? How hard would it be?
>
> There are a number of system tools that use kernel and kmem, moving
*********
"a rapidly decreasing number"...

> all of them to something like sps and vm etc. would be a lot of
> repetitive work, there should be a more fundamental solution...
>
> Any thoughts?
> -Gunther

Well, the general trend in FreeBSD kernel development is to phase out all
/dev/kmem access, even when wrapped with libkvm calls, using sysctl(9)
instead. Groping through kernel memory is Bad. Sysctl(9) presents
consistent, safe, and well-defined interface.

The utilities like vm, ns, and others are in fact now much closer to the
standard utilities, because recently most (if not all) kvm_* calls in the
latter have been replaced with sysctl calls.

So, the fundamental solution is to move everything that needs to access
from user-space any internal kernel data structures either to a device or
a sysctl.

Consequently, my POV on this is: if ipfilter uses /dev/kmem, then it
should be fixed.

Andrzej

// ----------------------------------------------------------------
// Andrzej Bialecki <abial@webgiro.com>, Chief System Architect
// WebGiro AB, Sweden (http://www.webgiro.com)
// ----------------------------------------------------------------
// <abial@freebsd.org> FreeBSD developer (http://www.freebsd.org)


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-small" in the body of the message



Elapsed time: 0.112 seconds