procd is the OpenWrt process management daemon written in C. It keeps track of processes started from init scripts (via ubus calls), and can suppress redundant service start/restart requests when the config/environment has not changed.
procd has replaced … , e.g.
hotplug2, a dynamic device management subsystem for embedded systems. Hotplug2 is a trivial replacement of some of the UDev functionality in a tiny pack, intended for Linux early userspace: Init RAM FS and InitRD.
procd is intended to stay compatible with the existing format of
/etc/config/; exceptions …
see use case hardware.button
Before the real procd runs, a small init process is started. This process has the job of early system init. It will do the following things in the listed order
Once preinit is complete the init process is done and will do an exec on the real procd. This will replace init as pid1 with an instance of procd running as the new pid 1. The watchdog file descriptor is not closed. Instead it is handed over to the new procd process. The debug_level will also be handed over to the new procd instance if it was set via command line or during preinit.
Procd will first do some basic process init such as setting itself to be owner of its own process group and setting up signals. We are now ready to bring up the userland in the following order
The basic system bringup is now complete, procd is up and running and can start handling daemons and services
Procd supports four commands inside inittab
Once all items inside /etc/inittab are processed, procd enter its normal run mode and will handle messages coming in via ubus. It will stay in this state until a reboot/shutdown is triggered.
Hotplug scripts are located inside /etc/hotplug.d and are based on json_script. This is a json based if then else syntax. Procd hotplug service offers the following actions:
Whereas desktop distributions use glib+dbus+udev(part of systemd), OpenWrt uses libubox+ubus+hotplug2. This provides some pretty awesome functionality without requiring huge libraries with huge dependencies (*cough* glib).
|Typical main memory size||128 MiB to 16 GiB (or more)||32 MiB to 512 MiB1)|| min 92 MiB for Android 2.1 |
min 340 MiB for Android 4.0
|Supported instruction sets||almost anything||almost anything||x86, 86-64, ARM, MIPS32|
|non-volatile storage space||100 MiB||8 MiB2)|| 150MiB for Android 2.1|
512MiB for Android 4.0
|FOSS and binary drivers||FOSS drivers: e.g. 802.11; Iaccess||Android binary drivers|
|C standard library||glibc||uClibc, musl||bionic||glibc + libhybris||eglibc 2.15|
| ||busybox-initd|| ||Android init-fork||
|rsyslog / syslog-ng||busybox-klogd, busybox-syslogd|
|network configuration||NetworkManager + GUI|| || ConnectivityManager|
(not ConnMan = ConnectionManager!)
| GLib |
(GObject, Glib, GModule, GThread, GIO)
|Package management system|| dpkg/APT|
dbus is bloated, its C API is very annoying to use and requires writing large amounts of boilerplate code. In fact, the pure C API is so annoying that its own API documentation states: “If you use this low-level API directly, you're signing up for some pain.”
ubus is tiny and has the advantage of being easy to use from regular C code, as well as automatically making all exported API functionality also available to shell scripts with no extra effort.
“Of course, NetworkManager should be renamed to
“unetwork”, dbus to
“ubus”, PulseAudio to
“usound”, and X.Org-Server/Wayland-Compositor to
“udisplay”; and then indescribable happiness would come down to all people of this world.” – Lennart Poettering
Package history is available at: