Software
skarnet.org
mdevd
What is it ?
mdevd is a small daemon managing kernel hotplug events, similarly to udevd.
It uses the same configuration file as
mdev,
which is a hotplug manager integrated in the
Busybox suite of tools.
However, mdev needs to be registered in
/proc/sys/kernel/hotplug, and the kernel forks
an instance of mdev for every event; by contrast, mdevd is a daemon
and does not fork.
The point of mdevd is to provide a drop-in replacement to mdev
that does not fork, so it can handle large influxes of events
at boot time without a performance drop. mdevd is designed to be
entirely compatible with advanced mdev usage such as
mdev-like-a-boss.
Comparison with mdev -d
Recent versions of mdev
have a -d option that allow it to run as a daemon. However,
mdevd still has advantages over mdev -d:
- Better log management: mdev -d logs to a fixed text file, with
all the issues it implies (need for the filesystem to be read-write,
uncontrollable log file growth). By contrast, mdevd logs to stderr and its
messages can be handled by any log infrastructure such as the one provided
by a supervision suite.
- Better memory efficiency: mdev -d uses its own environment
(via putenv()
and unsetenv())
to store uevent data for each event. This implies repeated allocations of
heap memory. By contrast, mdevd does not use its own environment, and
even does not use heap memory at all.
- Better speed: mdev -d parses its config file for every
event it receives, and has to perform expensive operations such as
getpwnam()
every time it receives an event (which can add up to hundreds of time at boot!).
By contrast, mdevd parses its config file only once, when it starts - or when
it is told to read it again by a SIGHUP. So it processes events significantly
faster.
- Independence from busybox: mdev is part of the
busybox software. It is an advantage
when Busybox is also used to provide other functionality, such as
coreutils or util-linux equivalents. However, some distributions find
that functionality lacking in compatibility, and choose to use alternatives
to busybox. In that case, having to use the whole busybox configuration
and build process just for mdev is a drawback, and the code is bigger than
it needs to be. mdevd, on the other hand, is independent software, and
building it is simple and does not pull in any unnecessary code.
Installation
Requirements
- A Linux-based system with a standard C development environment.
The Linux kernel must be 2.6.10 or later.
- GNU make, version 3.81 or later
- skalibs version
2.9.2.0 or later. It's a build-time requirement. It's also a run-time
requirement if you link against the shared version of the skalibs
library.
Licensing
mdevd is free software. It is available under the
ISC license.
Download
Compilation
- See the enclosed INSTALL file for installation details.
Upgrade notes
- This page lists the differences to be aware of between
the previous versions of mdevd and the current one.
Reference
Commands
Related resources
- mdevd is discussed on the
skaware mailing-list.