Subject: Re: devd-alike for NetBSD
To: Jachym Holecek <freza@liberouter.org>
From: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
List: tech-kern
Date: 02/08/2005 09:15:40
Hello,

On Sat, 05 Feb 2005 12:36:20 +0100, Jachym Holecek wrote:

> mostly as an exercise, I finished a first shot at ${subj}. It's implemented
> as a straightforward extension of drvctl(4) (added read method) and
> autoconf(9) (emit events to drvctl queue). Currently, only attach/detach
> events will be announced. This works for any device, with pci/usb/pcmcia
> telling more detailed PNP information [1]. Supporting more buses/events
> would be very simple.
> 
> Source is located at: http://www.liberouter.org/~freza/devmon.tar.gz
> The file devmon/README gives installation instructions, devmon/devmon.conf
> describes config file format (which is remarkably simple ;-).
> 
> I've been inspired by FreeBSD's devd/newbus, but since I only needed a small
> subset thereof, I chose to go from scratch.
> 
> Feedback is welcome, I'm willing to do more work on this.
> 
> 	Regards,
> 		-- Jachym Holecek
> 
> [1] This is what events look like. Note that this is right after boot and
>     after plugging+unplugging USB flash disk and PCMCIA network card:
> 
> $ cat /dev/drvctl
> attach cpu0 at mainbus0 
> attach acpi0 at mainbus0 
> attach acpiec0 at acpi0 
> attach acpibut0 at acpi0 

So, /dev/drvctl presents events in a text form? Is this a good idea? In
Linux procfs, most of the nodes are human-readable text and it seems to do
much more harm than good. E.g. "trivial" whitespace changes breaking
userspace programs. I always preferred the way how sysctl in BGSD presents
structured binary information.

BTW what does FreeBSD newbus do?

Also, OpenBSD has /dev/hotplug which presents the events as simple
structures:

http://www.openbsd.org/cgi-bin/man.cgi?query=hotplug&sektion=4&apropos=0&manpath=OpenBSD+Current&arch=

Bye	Pavel