summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-10-22 17:09:25 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-10-22 17:09:25 +0000
commit32759d402e7327865ea18a203bd1c09f98735bd1 (patch)
tree73c53e1e70df6c23c9c32a73bff0161317f4e9c4 /doc
downloadmdevd-32759d402e7327865ea18a203bd1c09f98735bd1.tar.xz
Initial commit
Diffstat (limited to 'doc')
-rw-r--r--doc/index.html115
-rw-r--r--doc/mdevd-coldplug.html74
-rw-r--r--doc/mdevd-netlink.html123
-rw-r--r--doc/mdevd.html130
-rw-r--r--doc/upgrade.html28
5 files changed, 470 insertions, 0 deletions
diff --git a/doc/index.html b/doc/index.html
new file mode 100644
index 0000000..91c01d3
--- /dev/null
+++ b/doc/index.html
@@ -0,0 +1,115 @@
+<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>
+
+<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.6.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>
+</ul>
+
+<h3> Licensing </h3>
+
+<p>
+ mdevd is free software. It is available under the
+<a href="http://opensource.org/licenses/ISC">ISC license</a>.
+</p>
+
+<h3> Download </h3>
+
+<ul>
+ <li> The current released version of mdevd is
+<a href="mdevd-0.0.1.0.tar.gz">0.0.1.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-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>
+
+<h2> Related resources </h2>
+
+<ul>
+ <li> <tt>mdevd</tt> is discussed on the
+<a href="//skarnet.org/lists.html#skaware">skaware</a> mailing-list. </li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/mdevd-coldplug.html b/doc/mdevd-coldplug.html
new file mode 100644
index 0000000..8355df3
--- /dev/null
+++ b/doc/mdevd-coldplug.html
@@ -0,0 +1,74 @@
+<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-coldplug program</title>
+ <meta name="Description" content="mdevd: the mdevd-coldplug program" />
+ <meta name="Keywords" content="mdevd linux administration root utilities devd mdev-s uevent netlink coldplug boot" />
+ <!-- <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-coldplug</tt> program </h1>
+
+<p>
+<tt>mdevd-coldplug</tt> performs a <em>coldplug</em>: it scans
+<tt>/sys</tt> for all registered devices an uevent manager would
+want to perform actions on, and generates uevents for all these
+devices.
+</p>
+
+<h2> Interface </h2>
+
+<pre>
+ mdevd-coldplug [ -s <em>slashsys</em> ]
+</pre>
+
+<ul>
+ <li> mdevd-coldplug scans <tt>/sys</tt> for devices. </li>
+ <li> For every suitable device it finds, it generates an
+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>
+</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>
+ <li> <tt>-s</tt>&nbsp;<em>slashsys</em>&nbsp;: assume the sysfs
+pseudo-filesystem is mounted on <em>slashsys</em>. Default is <tt>/sys</tt>. </li>
+</ul>
+
+<h2> Exit codes </h2>
+
+<ul>
+ <li> 0: success </li>
+ <li> 111: system call failed </li>
+</ul>
+
+<h2> Notes </h2>
+
+<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>
+</ul>
+
+</body>
+</html>
diff --git a/doc/mdevd-netlink.html b/doc/mdevd-netlink.html
new file mode 100644
index 0000000..9747f13
--- /dev/null
+++ b/doc/mdevd-netlink.html
@@ -0,0 +1,123 @@
+<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. </li>
+ </ul> </li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/mdevd.html b/doc/mdevd.html
new file mode 100644
index 0000000..b5b8a36
--- /dev/null
+++ b/doc/mdevd.html
@@ -0,0 +1,130 @@
+<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 program</title>
+ <meta name="Description" content="mdevd: the mdevd program" />
+ <meta name="Keywords" content="mdevd linux administration root utilities devd mdev uevent netlink hotplug manager" />
+ <!-- <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</tt> program </h1>
+
+<p>
+<tt>mdevd</tt> is an uevent manager. It reads a series of
+uevents on its stdin; 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.
+</p>
+
+<p>
+ <tt>mdevd</tt>'s configuration file uses the exact same
+format as
+<a href="https://git.busybox.net/busybox/plain/docs/mdev.txt">mdev</a>.
+The differences between mdevd and mdev are:
+</p>
+
+<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
+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> ]
+</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 it has finished scanning. </li>
+</ul>
+
+<h2> Exit codes </h2>
+
+<ul>
+ <li> 0: EOF read on mdevd's stdin </li>
+ <li> 1: received an invalid event </li>
+ <li> 100: wrong usage </li>
+ <li> 111: system call failed </li>
+</ul>
+
+<h2> Signals </h2>
+
+<p>
+ mdevd reacts to the following signals:
+</p>
+
+<ul>
+ <li> SIGHUP: re-read the configuration file </li>
+</ul>
+
+<h2> Options </h2>
+
+<ul>
+ <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>-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 commands it would have spawned. </li>
+ <li> <tt>-f</tt>&nbsp;<em>conffile</em>&nbsp;: read the configuration
+file from <em>conffile</em>. Default is <tt>/etc/mdev.conf</tt>. </li>
+ <li> <tt>-s</tt>&nbsp;<em>slashsys</em>&nbsp;: assume the sysfs
+pseudo-filesystem is mounted on <em>slashsys</em>. Default is <tt>/sys</tt>. </li>
+ <li> <tt>-d</tt>&nbsp;<em>slashdev</em>&nbsp;: assume the device nodes
+are to be found in <em>slashdev</em>. Default is <tt>/dev</tt>. </li>
+ <li> <tt>-F</tt>&nbsp;<em>fwbase</em>&nbsp;: assume the firmware files, if any,
+are to be found in <em>fwbase</em>. Default is <tt>/lib/firmware</tt>. </li>
+</ul>
+
+<h2> Configuration file </h2>
+
+<p>
+ mdevd uses mdev's configuration file format.
+A good <tt>mdev.conf</tt> example is available
+<a href="https://github.com/slashbeast/mdev-like-a-boss/blob/master/mdev.conf">here.</a>
+</p>
+
+<p>
+ If mdevd cannot find its configuration file, it will use a simple, basic default
+configuration where it can create device nodes as root or delete them, and does
+nothing else.
+</p>
+
+<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>
+</ul>
+
+</body>
+</html>
diff --git a/doc/upgrade.html b/doc/upgrade.html
new file mode 100644
index 0000000..06c1654
--- /dev/null
+++ b/doc/upgrade.html
@@ -0,0 +1,28 @@
+<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: how to upgrade</title>
+ <meta name="Description" content="mdevd: how to upgrade" />
+ <meta name="Keywords" content="mdevd installation upgrade" />
+ <!-- <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> What has changed in mdevd </h1>
+
+<h2> in 0.0.1.0 </h2>
+
+<ul>
+ <li> Initial release. </li>
+</ul>
+
+</body>
+</html>