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