Kernel to userspace

by havoc

Reading this thread on a
kernelspace keyring
, which I don’t pretend to know a lot about (I
was just curious from seeing the name of the patch in LWN, and found
the thread via google).

However, the thread shows how differently some kernel developers and
userspace developers are still thinking about problems. Linus
says
: “I’m just looking at how _well_ /sbin/hotplug has worked
out. I believe that it would have been a disaster done with a binary
messaging setup.” What??? We didn’t get any decent UI for hardware
working until we had a binary messaging setup! Of course I
realize that a script callout can send the binary message, and so
that’s fine, but we really do need the real messaging.

Looks like this thread also has the good old “let’s have some horrible
/proc thing instead of typesafe ABI-stable interfaces with
well-defined error handling.” Anyhow, don’t know how that patch
ended up when it was included, so maybe it all turned out well.

Someday I need to write down why I feel grumpy and hostile toward
text-based “API”, whether we’re talking about initscripts, tcl, or
/proc. It has to do with things such as 1) reporting errors, 2)
ability to write event-driven code, 3) ability to tell when your ABI
changes, 4) performance, 5) ability to have multiple threads/processes
involved sanely, 6) ability to extend an interface while keeping back
compat, 7) ability to keep UI code completely separate from “engine”
code, whether “UI” means tty or X, 8) keeping data and configuration
strongly separated from code, and 9) probably some other
things. Deserves some kind of long essay.

Don’t get me wrong, hooks that call out to scripts can be handy. But
it’s nice if the hooks are invoked by a larger system that’s a bit
more deterministic and well-defined than scripts usually are.

(This post was originally found at http://log.ometer.com/2004-10.html#23)

My Twitter account is @havocp.
Interested in becoming a better software developer? Sign up for my email list and I'll let you know when I write something new.