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