devd(8): Sync with FreeBSD and turn it on by default.
[dragonfly.git] / sbin / devd / devd.8
CommitLineData
71fc104f
HT
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.\"
e348c2ad 26.\" $FreeBSD: head/sbin/devd/devd.8 262914 2014-03-07 23:30:48Z asomers $
71fc104f 27.\"
e348c2ad 28.Dd January 30, 2013
71fc104f
HT
29.Dt DEVD 8
30.Os
31.Sh NAME
32.Nm devd
33.Nd "device state change daemon"
34.Sh SYNOPSIS
35.Nm
e348c2ad 36.Op Fl dnq
71fc104f 37.Op Fl f Ar file
e348c2ad 38.Op Fl l Ar num
71fc104f
HT
39.Sh DESCRIPTION
40The
41.Nm
42daemon provides a way to have userland programs run when certain
43kernel events happen.
44.Pp
45The following options are accepted.
46.Bl -tag -width ".Fl f Ar file"
71fc104f 47.It Fl d
e348c2ad 48Run in the foreground instead of becoming a daemon and log additional information for debugging.
71fc104f
HT
49.It Fl f Ar file
50Use configuration file
51.Ar file
52instead of the default
53.Pa /etc/devd.conf .
54If option
55.Fl f
56is specified more than once, the last file specified is used.
e348c2ad
SW
57.It Fl l Ar num
58Limit concurrent
59.Pa /var/run/devd.pipe
60connections to
61.Ar num .
62The default connection limit is 10.
71fc104f
HT
63.It Fl n
64Do not process all pending events before becoming a daemon.
65Instead, call daemon right away.
e348c2ad
SW
66.It Fl q
67Quiet mode. Only log messages at priority LOG_WARNING or above.
71fc104f
HT
68.El
69.Sh IMPLEMENTATION NOTES
70The
71.Nm
72utility
73is a system daemon that runs in the background all the time.
74Whenever a device is added to or removed from the device tree,
75.Nm
76will execute actions specified in
77.Xr devd.conf 5 .
78For example,
79.Nm
80might execute
81.Xr dhclient 8
82when an Ethernet adapter is added to the system, and kill the
83.Xr dhclient 8
84instance when the same adapter is removed.
85Another example would be for
86.Nm
87to use a table to locate and load via
88.Xr kldload 8
89the proper driver for an unrecognized device that is added to the system.
90.Pp
91The
92.Nm
93utility
94hooks into the
95.Xr devctl 4
96device driver.
97This device driver has hooks into the device configuration system.
98When nodes are added or deleted from the tree, this device will
99deliver information about the event to
100.Nm .
101Once
102.Nm
103has parsed the message, it will search its action list for that kind
104of event and perform the action with the highest matching value.
105For most mundane uses, the default handlers are adequate.
106However, for more advanced users, the power is present to tweak every
107aspect of what happens.
108.Pp
109The
110.Nm
111utility
112reads
113.Pa /etc/devd.conf
114or the alternate configuration file specified with a
115.Fl f
116option and uses that file to drive the rest of the process.
117While the format of this file is described in
118.Xr devd.conf 5 ,
119some basics are covered here.
120In the
121.Ic options
122section, one can define multiple directories to search
123for config files.
124All files in these directories whose names match the pattern
125.Pa *.conf
126are parsed.
127These files are intended to be installed by third party vendors that
128wish to hook into the
129.Nm
130system without modifying the user's other
131config files.
132.Pp
133All messages that
134.Nm
135receives are forwarded to the
136.Ux
137domain socket at
138.Pa /var/run/devd.pipe .
139.Sh FILES
140.Bl -tag -width ".Pa /var/run/devd.pipe" -compact
141.It Pa /etc/devd.conf
142The default
143.Nm
144configuration file.
145.It Pa /var/run/devd.pipe
146The socket used by
147.Nm
148to communicate with its clients.
149.El
150.Sh SEE ALSO
151.Xr devctl 4 ,
152.Xr devd.conf 5
153.Sh AUTHORS
154.An M. Warner Losh