[TUHS] Device special files

Steffen Nurpmeso steffen at sdaoden.eu
Thu Feb 8 04:36:07 AEST 2018


Dave Horsfall <dave at horsfall.org> wrote:
 |On Tue, 6 Feb 2018, Bakul Shah wrote:
 |>> Wasn't that "devfs" (which Penguin/OS calls "udev")?  I've never 
 |>> grokked that concept.
  ...
 |>    mknod <name> <b or c> <major> <minor>
  ...
 |Umm, I've known that since Edition 5; I'm not exactly new to Unix, you 
 |know...
  ...
 |> So the point of devfs is to avoid having to do mknod manually and yet 
 |> provide access to all found devices from the userland. As a side effect 
  ...
 |That makes sense; bit of a pain when a USB device suddenly disappears just 
 |I unplugged it, though...

That was indeed one of my a-ha! moments with FreeBSD, coming from
Linux!  All those files in /dev and i did not know anything about
anything -- which of all those many hundreds of files is actually
for real?  And then FreeBSD came over with the devfs and there
even was a really enlightening paper, which is still shipped with
FreeBSD (share/doc/papers/devfs/paper.me).  From Linux which back
then had the GNU LibC info file and something almost exclusively
for kernel hackers in the kernel documentation directory and
otherwise almost nil, to FreeBSD and a document which starts

  An outstanding novelty in UNIX at its introduction was the notion
  of ``a file is a file is a file and even a device is a file.''
  Going from ``hardware only changes when the DEC Field engineer is here''
  to ``my toaster has USB'' has put serious strain on the rather crude
  implementation of the ``devices as files'' concept, an implementation which
  has survived practically unchanged for 30 years in most UNIX variants.
  Starting from a high-level view of devices and the semantics that
  have grown around them over the years, this paper takes the audience on a
  grand tour of the redesigned FreeBSD device-I/O system, 
  to convey an overview of how it all fits together, and to explain why
  things ended up as they did, how to use the new features and 
  in particular how not to.

That was fantastic, that was enlightening, and that actually
seemed as such a brave move of entire FreeBSD (and it was, right)!
It is still a good read.  And so: suddenly i had so few files in
/dev, so few that i even could start looking around a bit!

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


More information about the TUHS mailing list