summaryrefslogtreecommitdiff
path: root/doc/index.html
blob: b4a21b4c3597e644fb150643e1054b892d239ae4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>mdevd - A mdev-compatible Linux hotplug manager daemon</title>
    <meta name="Description" content="mdevd - a mdev-compatible Linux hotplug manager daemon" />
    <meta name="Keywords" content="mdevd mdev udevd udev Linux kernel hotplug event uevent administration root laurent bercot ska skarnet" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> mdevd </h1>

<h2> What is it&nbsp;? </h2>

<p>
 mdevd is a small daemon managing kernel hotplug events, similarly to udevd.
</p>

<p>
 It uses the same configuration file as
<a href="https://git.busybox.net/busybox/plain/docs/mdev.txt">mdev</a>,
which is a hotplug manager integrated in the
<a href="https://busybox.net/">Busybox</a> suite of tools.
However, mdev needs to be registered in
<tt>/proc/sys/kernel/hotplug</tt>, and the kernel forks
an instance of mdev for every event; by contrast, mdevd is a daemon
and does not fork.
</p>

<p>
 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
<a href="https://github.com/slashbeast/mdev-like-a-boss">mdev-like-a-boss</a>.
</p>

<a name="mdev">
<h2> Comparison with <tt>mdev -d</tt> </h2>
</a>

<p>
 Recent versions of <a href="https://git.busybox.net/busybox/tree/util-linux/mdev.c">mdev</a>
have a <tt>-d</tt> option that allow it to run as a daemon. However,
mdevd still has advantages over <tt>mdev -d</tt>:
</p>

<ul>
 <li> Better log management: <tt>mdev -d</tt> 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. </li>
 <li> Better memory efficiency: <tt>mdev -d</tt> uses its own environment
(via <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/putenv.html">putenv()</a>
and <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/unsetenv.html">unsetenv()</a>)
to store uevent data for each event. This implies repeated allocations of
heap memory. By contrast, mdevd does not use its own environment - it
only uses heap memory to compile its regular expressions, which only happens
at start and when you reload its configuration file. All the rest of the
memory it uses is committed in the stack, and it will never require more.
mdevd cannot fail due to lack of memory while it is processing events. </li>
 <li> Better speed: <tt>mdev -d</tt> parses its config file for every
event it receives, and has to perform expensive operations such as
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwnam.html">getpwnam()</a>
every time it receives an event (which can add up to hundreds of times at boot!).
By contrast, mdevd only parses its config file when it starts - or when
it is told to read it again by a SIGHUP; the event processing is
streamlined, it does not involve any parsing or any kind of expensive
operation - so it is significantly faster. </li>
 <li> Independence from busybox: <tt>mdev</tt> is part of the
<a href="https://busybox.net/">busybox</a> software. It is an advantage
when busybox is also used to provide other functionality, such as
coreutils or util-linux equivalents. However, most distributions find
that functionality lacking in compatibility (for instance, the busybox
implementation of POSIX utilities is often non-conformant), and choose to
use alternatives to busybox instead. In that case, having to use the whole
busybox configuration and build process just for mdev is a drawback, and
the code that gets included in the mdev binary 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. </li>
</ul>

<hr />

<h2> Installation </h2>

<h3> Requirements </h3>

<ul>
 <li> A Linux-based system with a standard C development environment.
The Linux kernel must be 2.6.10 or later. </li>
 <li> GNU make, version 3.81 or later </li>
 <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version
2.11.0.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. </li>
 <li> Optionally: <a href="//skarnet.org/software/execline/">execline</a>
version 2.8.1.0 or later. It's a only a run-time requirement, and only
if your <tt>mdev.conf</tt> file contains <tt>+</tt>, <tt>-</tt> or
<tt>&amp;</tt> command directives. </li>
</ul>

<h3> Licensing </h3>

<p>
 mdevd is free software. It is available under the
<a href="https://opensource.org/licenses/ISC">ISC license</a>.
</p>

<h3> Download </h3>

<ul>
 <li> The current released version of mdevd is
<a href="mdevd-0.1.5.0.tar.gz">0.1.5.0</a>. </li>
 <li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgi-bin/cgit.cgi/mdevd/">mdevd
git repository</a>:
<pre> git clone git://git.skarnet.org/mdevd </pre> </li>
 <li> There's also a
<a href="https://github.com/skarnet/mdevd">GitHub mirror</a>
of the mdevd git repository. </li>
</ul>

<h3> Compilation </h3>

<ul>
 <li> See the enclosed INSTALL file for installation details. </li>
</ul>

<h3> Upgrade notes </h3>

<ul>
 <li> <a href="upgrade.html">This page</a> lists the differences to be aware of between
the previous versions of mdevd and the current one. </li>
</ul>

<hr />

<h2> Reference </h2>

<h3> Commands </h3>

<ul>
<li><a href="mdevd.html">The <tt>mdevd</tt> program</a></li>
<li><a href="mdevd-coldplug.html">The <tt>mdevd-coldplug</tt> program</a></li>
</ul>

<h2> Related resources </h2>

<ul>
 <li> <tt>mdevd</tt> is discussed on the
<a href="//skarnet.org/lists/#skaware">skaware</a> mailing-list. </li>
</ul>

</body>
</html>