summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2018-01-14 17:54:42 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2018-01-14 17:54:42 +0000
commit4984158b95c5a0c3922cd34940c393652d080f99 (patch)
treebd110462519e041679dc0332088b43132214fe45 /doc
parentc5e7afbd8d62f3217687f21c0691a02797dc0df5 (diff)
downloadmdevd-4984158b95c5a0c3922cd34940c393652d080f99.tar.xz
New mdevd model, prepare for 0.1.0.0
- mdevd-netlink removed - mdevd listens to the netlink itself - mdevd-coldplug writes nothing to stdout, but triggers the kernel to create uevents
Diffstat (limited to 'doc')
-rw-r--r--doc/index.html5
-rw-r--r--doc/mdevd-coldplug.html25
-rw-r--r--doc/mdevd-netlink.html124
-rw-r--r--doc/mdevd.html44
-rw-r--r--doc/upgrade.html11
5 files changed, 42 insertions, 167 deletions
diff --git a/doc/index.html b/doc/index.html
index c11b508..19a43a4 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -53,7 +53,7 @@ entirely compatible with advanced mdev usage such as
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.6.0.2 or later. It's a build-time requirement. It's also a run-time
+2.6.3.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>
</ul>
@@ -69,7 +69,7 @@ library. </li>
<ul>
<li> The current released version of mdevd is
-<a href="mdevd-0.0.1.0.tar.gz">0.0.1.0</a>. </li>
+<a href="mdevd-0.1.0.0.tar.gz">0.1.0.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>:
@@ -100,7 +100,6 @@ the previous versions of mdevd and the current one. </li>
<ul>
<li><a href="mdevd.html">The <tt>mdevd</tt> program</a></li>
-<li><a href="mdevd-netlink.html">The <tt>mdevd-netlink</tt> program</a></li>
<li><a href="mdevd-coldplug.html">The <tt>mdevd-coldplug</tt> program</a></li>
</ul>
diff --git a/doc/mdevd-coldplug.html b/doc/mdevd-coldplug.html
index fbbb5aa..027c849 100644
--- a/doc/mdevd-coldplug.html
+++ b/doc/mdevd-coldplug.html
@@ -21,8 +21,8 @@
<p>
<tt>mdevd-coldplug</tt> performs a <em>coldplug</em>: it scans
<tt>/sys</tt> for all registered devices a uevent manager would
-want to perform actions on, and generates uevents for all these
-devices.
+want to perform actions on, and tells the kernel to generate uevents
+for all these devices.
</p>
<h2> Interface </h2>
@@ -33,17 +33,13 @@ devices.
<ul>
<li> mdevd-coldplug scans <tt>/sys</tt> for devices. </li>
- <li> For every suitable device it finds, it generates a
-uevent and writes it to its stdout, using the same format
-as <a href="mdevd-netlink.html">mdevd-netlink</a>. </li>
- <li> It exits when it has finished scanning. </li>
+ <li> For every suitable device it finds, it tells the kernel
+to generate an event. If a device manager such as
+as <a href="mdevd.html">mdevd</a> is listening to the netlink
+at this point, it will pick up the series of events. </li>
+ <li> mdevd-coldplug exits when it has finished scanning. </li>
</ul>
-<p>
- This implies that the <tt>mdevd-coldplug | mdevd</tt> command line
-will function as a coldplug manager, just like <tt>mdev -s</tt>.
-</p>
-
<h2> Options </h2>
<ul>
@@ -62,12 +58,7 @@ pseudo-filesystem is mounted on <em>slashsys</em>. Default is <tt>/sys</tt>. </l
<ul>
<li> mdevd-coldplug is a short-lived program, just like
-<tt>mdev -s</tt>. </li>
- <li> Unlike <tt>mdev -s</tt>, however, mdevd-coldplug does
-not act on the uevents it generates. It simply prints them.
-This allows for easy debugging. </li>
- <li> To act on the uevents, simply pipe the output of
-<tt>mdevd-coldplug</tt> into <a href="mdevd.html">mdevd</a>. </li>
+<tt>mdev -s</tt> or <tt>udevadm trigger</tt>. </li>
</ul>
</body>
diff --git a/doc/mdevd-netlink.html b/doc/mdevd-netlink.html
deleted file mode 100644
index d0aa054..0000000
--- a/doc/mdevd-netlink.html
+++ /dev/null
@@ -1,124 +0,0 @@
-<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: the mdevd-netlink program</title>
- <meta name="Description" content="mdevd: the mdevd-netlink program" />
- <meta name="Keywords" content="mdevd linux administration root utilities devd mdev udev s6-uevent-listener uevent netlink" />
- <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
- </head>
-<body>
-
-<p>
-<a href="index.html">mdevd</a><br />
-<a href="//skarnet.org/software/">Software</a><br />
-<a href="//skarnet.org/">skarnet.org</a>
-</p>
-
-<h1> The <tt>mdevd-netlink</tt> program </h1>
-
-<p>
-<tt>mdevd-netlink</tt> listens to the netlink interface for uevents
-(also called "hotplug" or "udev" events), and writes those uevents to
-its standard output, using a simple format.
-</p>
-
-<p>
-<a href="mdevd.html">mdevd</a> expects uevents in the same
-format mdevd-netlink writes them. So the
-<tt>mdevd-netlink | mdevd</tt> command line will function as
-a daemon reading uevents from the netlink and handling them.
-</p>
-
-<h2> Interface </h2>
-
-<pre>
- mdevd-netlink [ -d notif ] [ -v <em>verbosity</em> ] [ -b kbufsz ]
-</pre>
-
-<ul>
- <li> mdevd-netlink binds to the netlink interface and listens for
-hotplug events, as the <em>udevd</em> program does. </li>
- <li> It writes event information to its stdout. The output contains
-null characters, so a terminal will not display them correctly. To
-properly use mdevd-netlink, it should be piped into a handler
-program such as <a href="mdevd.html">mdevd</a>. </li>
- <li> mdevd-netlink is a long-lived program.
-When it receives a SIGTERM, it stops listening to hotplug events;
-it will exit as soon as it has flushed its event queue to stdout. </li>
-</ul>
-
-<h2> Options </h2>
-
-<ul>
- <li> <tt>-d</tt>&nbsp;<em>notif</em>&nbsp;: when ready (actually
-listening to the netlink), write a newline to file descriptor <em>notif</em>
-then close it. This allows mdevd-netlink to use the
-<a href="//skarnet.org/software/s6/notifywhenup.html">s6 mechanism to
-notify readiness</a>. <em>notif</em> cannot be lesser than 3. If this
-option is not given, no readiness notification is sent. </li>
- <li> <tt>-v</tt>&nbsp;<em>verbosity</em>&nbsp;: be more or less verbose.
-Default verbosity is 1. 0 will only print fatal error messages, 3 will
-print warnings every time the netlink interface sends something
-unexpected. </li>
- <li> <tt>-b</tt>&nbsp;<em>kbufsz</em>&nbsp;: try and reserve a kernel buffer of
-<em>kbufsz</em> bytes for the netlink queue. Too large a buffer wastes kernel memory;
-too small a buffer risks losing events. The default is 65536 (which is on
-the large side). </li>
-</ul>
-
-<h2> Protocol </h2>
-
-<ul>
- <li> An event is a series of null-terminated strings as they are sent by
-the kernel to the netlink; mdevd-netlink adds a final empty string
-(i.e. an additional null character) to mark the end of the series. </li>
- <li> The first string is a short description of the event; it normally
-contains the string "@/". Other strings after the first are of the form
-"VARIABLE=value", and describe the environment which a hotplug helper
-for the event (registered in <tt>/proc/sys/kernel/hotplug</tt>) would be
-spawned with. </li>
- <li> Example (newlines added for clarity): <pre>
-add@/class/input/input9/mouse2\0
-ACTION=add\0
-DEVPATH=/class/input/input9/mouse2\0
-SUBSYSTEM=input\0
-SEQNUM=106\0
-PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb2/2­2/2­2:1.0
-PHYSDEVBUS=usb\0
-PHYSDEVDRIVER=usbhid\0
-MAJOR=13\0
-MINOR=34\0
-\0 </pre> </li>
-</ul>
-
-<h2> Notes </h2>
-
-<ul>
- <li> mdevd-netlink is a daemon; it should be run under a proper supervision system such
-as <a href="//skarnet.org/software/s6/">s6</a>. </li>
-<li> If you are running mdevd-netlink, the program you pipe its
-output into should be the only program handling uevents; that means
-that <tt>/proc/sys/kernel/hotplug</tt> should be empty. </li>
-<li> The <tt>mdevd-netlink | mdevd</tt> command line is a quick
-way of running a uevent manager, but there are ways to improve it:
- <ul>
- <li> Using the
-<a href="//skarnet.org/software/execline/">execline</a> scripting
-language, the <tt>pipeline { mdevd-netlink } mdevd</tt> command
-line will avoid leaving a shell around. </li>
- <li> The best way to use mdevd-netlink and mdevd is with a
-supervision system:
-under <a href="//skarnet.org/software/s6/">s6</a> or
-<a href="//skarnet.org/software/s6-rc/">s6-rc</a>, write a service
-pipeline where <tt>mdevd-netlink</tt> is a producer and
-<tt>mdevd</tt> is a consumer. This setup has the advantage, among
-others, that you can restart the netlink listener and the event handler
-separately. The <tt>examples/</tt> subdirectory of the mdevd
-package contains example configurations for such a setup. </li>
- </ul> </li>
-</ul>
-
-</body>
-</html>
diff --git a/doc/mdevd.html b/doc/mdevd.html
index 14d2867..0ea61bb 100644
--- a/doc/mdevd.html
+++ b/doc/mdevd.html
@@ -19,8 +19,8 @@
<h1> The <tt>mdevd</tt> program </h1>
<p>
-<tt>mdevd</tt> is a uevent manager. It reads a series of
-uevents on its stdin; for every uevent it reads, it performs
+<tt>mdevd</tt> is a uevent manager. It connects to the netlink and reads
+a series of uevents; for every uevent it reads, it performs
actions according to its configuration file. Actions can
be inserting a kernel module, creating or modifying device
entries in <tt>/dev</tt>, etc.
@@ -36,35 +36,29 @@ The differences between mdevd and mdev are:
<ul>
<li> mdev needs to be registered as a hotplug manager and the
kernel spawns an instance of mdev per uevent; for every uevent,
-mdev has to parse its configuration file. By contrast, there
-is only one instance of mdevd, reading a series of uevents and
+mdev has to parse its configuration file. By contrast, mdevd is
+a daemon: it's long-lived, and there is only one instance,
+reading a series of uevents and
performing actions without forking; the configuration file is
read and parsed only once. </li>
- <li> mdevd reads uevents on its stdin. It is not suitable as
-a hotplug manager, and it does not connect to the netlink itself
-either. It is meant to be used in conjunction with
-<a href="mdevd-netlink.html">mdevd-netlink</a>, which reads
-uevents from the netlink, or with
-<a href="mdevd-coldplug.html">mdevd-coldplug</a>, which generates
-coldplug uevents. </li>
</ul>
<h2> Interface </h2>
<pre>
- mdevd [ -v <em>verbosity</em> ] [ -f <em>conffile</em> ] [ -n ] [ -s <em>slashsys</em> ] [ -d <em>slashdev</em> ] [ -F <em>fwbase</em> ]
+ mdevd [ -v <em>verbosity</em> ] [ -D <em>notif</em> ] [ -b <em>kbufsz</em> ] [ -f <em>conffile</em> ] [ -n ] [ -s <em>slashsys</em> ] [ -d <em>slashdev</em> ] [ -F <em>fwbase</em> ]
</pre>
<ul>
<li> mdevd reads and parses its configuration file <tt>/etc/mdev.conf</tt>. </li>
- <li> It then reads its stdin, waiting for uevents.
- <li> It exits when the stream of uevents ends. (EOF on stdin.) </li>
+ <li> It then connects to the netlink and reads from it, waiting for uevents.
+ <li> It exits 0 on a SIGTERM. </li>
</ul>
<h2> Exit codes </h2>
<ul>
- <li> 0: EOF read on standard input </li>
+ <li> 0: SIGTERM received, clean exit </li>
<li> 1: received an invalid event </li>
<li> 2: syntax error in the configuration file </li>
<li> 100: wrong usage </li>
@@ -79,6 +73,7 @@ coldplug uevents. </li>
<ul>
<li> SIGHUP: re-read the configuration file </li>
+ <li> SIGTERM: exit as soon as possible </li>
</ul>
<h2> Options </h2>
@@ -87,6 +82,17 @@ coldplug uevents. </li>
<li> <tt>-v</tt>&nbsp;<em>verbosity</em>&nbsp;: be more or less verbose.
Default verbosity is 1. 0 will only print fatal error messages, 3 or more
is seriously verbose debugging. </li>
+ <li> <tt>-D</tt>&nbsp;<em>notif</em>&nbsp;: when ready
+(actually listening to the netlink),
+write a newline to file descriptor <em>notif</em> then close it.
+This allows mdevd to use the
+<a href="//skarnet.org/software/s6/notifywhenup.html">s6 mechanism to notify
+readiness</a>. <em>notif</em> cannot be lesser than 3.
+If this option is not given, no readiness notification is sent. </li>
+ <li> <tt>-b</tt>&nbsp;<em>kbufsz</em>&nbsp;: try and reserve a kernel buffer of
+<em>kbufsz</em> bytes for the netlink queue. Too large a buffer wastes kernel memory;
+too small a buffer risks losing events. The default is 65536 (which is reasonable
+for average systems). </li>
<li> <tt>-n</tt>&nbsp;: dry run. mdevd will not create or delete
device nodes, and it will not spawn commands. Instead, it will print to stdout
the actions it would have performed. </li>
@@ -121,14 +127,6 @@ nothing else.
<h2> Notes </h2>
<ul>
- <li> Strictly speaking, mdevd is a short-lived program: it has
-a normal exit condition, which is when it receives EOF on its stdin.
-That allows it to work as a coldplug manager when paired with
-<a href="mdevd-coldplug.html">mdevd-coldplug</a>. </li>
- <li> However, when paired with <a href="mdevd-netlink.html">mdevd-netlink</a>,
-it acts as a daemon, because mdev-netlink normally never exits until
-the end of the machine lifetime and never closes its stdout, so
-mdevd's stdin never receives EOF. </li>
<li> The <tt>examples/</tt> subdirectory of the mdevd package contains
examples on how to run mdevd under various init systems / supervisors. </li>
</ul>
diff --git a/doc/upgrade.html b/doc/upgrade.html
index 06c1654..fbbcc00 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -18,6 +18,17 @@
<h1> What has changed in mdevd </h1>
+<h2> in 0.1.0.0 </h2>
+
+<ul>
+ <li> <a href="//skarnet.org/software/skalibs/">skalibs</a>
+dependency bumped to 2.6.3.0. </li>
+ <li> The <tt>mdevd-netlink</tt> program doesn't exist anymore. </li>
+ <li> <a href="mdevd.html">mdevd</a> now listens to the netlink itself. </li>
+ <li> <a href="mdevd-coldplug.html">mdevd-coldplug</a> does not print events
+to stdout anymore. Instead, it makes the kernel trigger events. </li>
+</ul>
+
<h2> in 0.0.1.0 </h2>
<ul>