/dev/io , /dev/mem : only used by Xorg?

Ted Mittelstaedt tedm at toybox.placo.com
Mon Feb 28 09:32:27 GMT 2005

> -----Original Message-----
> From: owner-freebsd-questions at freebsd.org
> [mailto:owner-freebsd-questions at freebsd.org]On Behalf Of Rob
> Sent: Sunday, February 27, 2005 6:26 PM
> To: FreeBSD questions
> Subject: /dev/io , /dev/mem : only used by Xorg?
> Hello,
> This is on 5.3-STABLE.
> On my desktop FreeBSD PC:
>   $ fstat /dev/io /dev/mem
> only shows that Xorg is using these devices.
> Googling on /dev/io and /dev/mem, finds only Xorg
> related discussions and problems.
> I now also have Server PC, that does not run X at all.
> I'm about to remove the devices io and mem
> in the kernel configuration. Is that OK?
> How about the /dev/random device? Could that go too?
> Thanks,
> Rob.

Rob, you are very mistaken about that the devices in /dev are.

These devices, /dev/mem, /dev/io, /dev/random and the like, do
not in fact actually reside in the /dev directory.

Instead, they are part of the kernel itself.

All the /dev files are, /dev/random, /dev/ad0 and so on, are simple
files that take up only a few bytes of space.  They are convenient
"hook points" to use to get to these devices.  That is, when a program
accesses /dev/random, it isn't actually opening that file.  Instead,
the kernel intercepts that call and supplies the program opening
that device with the output of the actual device.

This is why these device files are created with the mknod utility,
rather than just copying a file to /dev/random - since doing that is
accessing the device, not creating the device file.

So, deleting these /dev devices saves you practically no space at
all, and does not in fact delete the devices - it only deletes the
access point to them.  The devices are still there in the kernel.


More information about the freebsd-questions mailing list