1.\" 2.\" Copyright (c) 2002 M. Warner Losh. 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" 26.\" $FreeBSD$ 27.\" 28.Dd November 24, 2005 29.Dt DEVD 8 30.Os 31.Sh NAME 32.Nm devd 33.Nd "device state change daemon" 34.Sh SYNOPSIS 35.Nm 36.Op Fl Ddn 37.Op Fl f Ar file 38.Sh DESCRIPTION 39The 40.Nm 41daemon provides a way to have userland programs run when certain 42kernel events happen. 43.Pp 44The following options are accepted. 45.Bl -tag -width ".Fl f Ar file" 46.It Fl D 47Enable debugging messages. 48.It Fl d 49Run in the foreground instead of becoming a daemon. 50.It Fl f Ar file 51Use configuration file 52.Ar file 53instead of the default 54.Pa /etc/devd.conf . 55If option 56.Fl f 57is specified more than once, the last file specified is used. 58.It Fl n 59Do not process all pending events before becoming a daemon. 60Instead, call daemon right away. 61.El 62.Sh IMPLEMENTATION NOTES 63The 64.Nm 65utility 66is a system daemon that runs in the background all the time. 67Whenever a device is added to or removed from the device tree, 68.Nm 69will execute actions specified in 70.Xr devd.conf 5 . 71For example, 72.Nm 73might execute 74.Xr dhclient 8 75when an Ethernet adapter is added to the system, and kill the 76.Xr dhclient 8 77instance when the same adapter is removed. 78Another example would be for 79.Nm 80to use a table to locate and load via 81.Xr kldload 8 82the proper driver for an unrecognized device that is added to the system. 83.Pp 84The 85.Nm 86utility 87hooks into the 88.Xr devctl 4 89device driver. 90This device driver has hooks into the device configuration system. 91When nodes are added or deleted from the tree, this device will 92deliver information about the event to 93.Nm . 94Once 95.Nm 96has parsed the message, it will search its action list for that kind 97of event and perform the action with the highest matching value. 98For most mundane uses, the default handlers are adequate. 99However, for more advanced users, the power is present to tweak every 100aspect of what happens. 101.Pp 102The 103.Nm 104utility 105reads 106.Pa /etc/devd.conf 107or the alternate configuration file specified with a 108.Fl f 109option and uses that file to drive the rest of the process. 110While the format of this file is described in 111.Xr devd.conf 5 , 112some basics are covered here. 113In the 114.Ic options 115section, one can define multiple directories to search 116for config files. 117All files in these directories whose names match the pattern 118.Pa *.conf 119are parsed. 120These files are intended to be installed by third party vendors that 121wish to hook into the 122.Nm 123system without modifying the user's other 124config files. 125.Pp 126All messages that 127.Nm 128receives are forwarded to the 129.Ux 130domain socket at 131.Pa /var/run/devd.pipe . 132.Sh FILES 133.Bl -tag -width ".Pa /var/run/devd.pipe" -compact 134.It Pa /etc/devd.conf 135The default 136.Nm 137configuration file. 138.It Pa /var/run/devd.pipe 139The socket used by 140.Nm 141to communicate with its clients. 142.El 143.Sh SEE ALSO 144.Xr devctl 4 , 145.Xr devd.conf 5 146.Sh AUTHORS 147.An M. Warner Losh 148