diff options
Diffstat (limited to 'doc/mdevd-netlink.html')
-rw-r--r-- | doc/mdevd-netlink.html | 124 |
1 files changed, 0 insertions, 124 deletions
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> <em>notif</em> : 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> <em>verbosity</em> : 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> <em>kbufsz</em> : 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/22/22: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> |