How skarnet/mdevd works
Project type and purpose
• mdevd is a system‐level daemon (written in C) that listens on the Linux kernel netlink socket for hotplug (uevent) notifications and handles them according to mdev-style rules.
• It replaces BusyBox’s per-event‐forking mdev with a single long‐running process that parses a static configuration file and dispatches actions.
File structure
• Top-level:
• src/mdevd – core C sources: netlink setup, uevent reader, parser, internal headers, coldplug mode
• tools/ – build & release scripts (configure template, dependency generators, test runner)
• examples/ – sample s6-rc service definitions showing integration with runit-like supervisors
• doc/ – HTML documentation and upgrade guide
• package/ – distribution packaging snippets
• configure, Makefile, autoconf scripts – build system
• Key architectural hints:
• Separation between event ingestion (netlink init, uevent read/getvar) and event handling (parser + action executor)
• Two “executables” built: mdevd (main daemon) and mdevd-coldplug (batch‐mode for existing devices at boot)
• No client API or UI; single process with internal modules
README for additional insights
• Confirms that mdevd:
• Listens to the kernel’s netlink interface instead of being invoked per event
• Uses the same config format as mdev (mdev.conf)
• Provides both “coldplug” startup sweep and “hotplug” continuous listener