2 .\" Copyright (c) 2002 M. Warner Losh
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. The name of the author may not be used to endorse or promote products
11 .\" derived from this software without specific prior written permission.
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
27 .\" The section on comments was taken from named.conf.5, which has the
28 .\" following copyright:
29 .\" Copyright (c) 1999-2000 by Internet Software Consortium
31 .\" Permission to use, copy, modify, and distribute this software for any
32 .\" purpose with or without fee is hereby granted, provided that the above
33 .\" copyright notice and this permission notice appear in all copies.
35 .\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
36 .\" ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
37 .\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
38 .\" CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
39 .\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
40 .\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
41 .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
49 .Nd configuration file for
55 configuration consists of two general features, statements
57 All statements end with a semicolon.
58 Many statements can contain substatements, which are also
59 terminated with a semicolon.
61 The following statements are supported:
62 .Bl -tag -width ".Ic options"
64 Specifies various matching criteria and actions to perform when
65 a newly attached device matches said criteria.
67 Specifies various matching criteria and actions to perform when
68 a newly detached device matches said criteria.
70 Specifies various matching criteria and actions to perform when
71 no device driver currently loaded in the kernel claims a (new)
74 Specifies various matching criteria and actions to perform when the kernel
75 sends an event notification to userland.
77 Specifies various options and parameters for the operation of
81 Statements may occur in any order in the configuration file, and may be
82 repeated as often as required.
83 Further details on the syntax and meaning of each statement and their
84 substatements are explained below.
86 Each statement, except
88 has a priority (an arbitrary number) associated with it, where
90 is defined as the lowest priority.
91 If two statements match the same event, only the action of the statement with
92 highest priority will be executed.
93 In this way generic statements can be overridden for devices or
94 notifications that require special attention.
96 The general syntax of a statement is:
97 .Bd -literal -offset indent
101 substatement "value";
105 The following sub-statements are supported within the
108 .Bl -tag -width ".Ic directory"
109 .It Ic directory Qq Ar /some/path ;
110 Adds the given directory to the list of directories from which
112 will read all files named "*.conf" as further
116 statements can be used.
117 .It Ic pid-file Qq Pa /var/run/devd.pid ;
119 .It Ic set Ar regexp-name Qq Ar (some|regexp) ;
120 Creates a regular expression and assigns it to the variable
122 The variable is available throughout the rest of
123 the configuration file.
124 If the string begins with
126 it matches if the regular expression formed by the rest of the string
128 All regular expressions have an implicit
133 The following sub-statements are supported within the
138 .Bl -tag -width ".Ic directory"
139 .It Ic action Qq Ar command ;
140 Command to execute upon a successful match.
142 .Dq Li "/etc/pccard_ether $device-name start" .
143 .It Ic class Qq Ar string ;
144 This is shorthand for
145 .Dq Ic match Qo Li class Qc Qq Ar string .
146 .It Ic device-name Qq string ;
147 This is shorthand for
148 .Dq Ic match Qo Li device-name Qc Qq Ar string .
149 This matches a device named
151 which is allowed to be a regular expression or a variable previously created
152 containing a regular expression.
156 is available for later use with the
159 .It Ic match Qo Ar variable Qc Qq Ar value ;
160 Matches the content of
166 may be a regular expression.
173 statement takes care of all device matching.
174 For a partial list of variables, see below.
175 .It Ic media-type Qq Ar string ;
178 will match devices that have the given media type.
179 Valid media types are:
186 .It Ic subdevice Qq Ar string ;
187 This is shorthand for
188 .Dq Ic match Qo Li subdevice Qc Qq Ar string .
191 The following sub-statements are supported within the
194 .Bl -tag -width ".Ic directory"
195 .It Ic action Qq Ar command ;
197 .It Ic match Qo Ar variable Qc Qq Ar value ;
198 Matches the content of
204 may be a regular expression.
205 For a partial list of variables, see below.
208 The following sub-statements are supported within the
213 variable is available inside this statement and contains, a value, depending
214 on which system and subsystem that delivered the event.
215 .Bl -tag -width ".Ic directory"
216 .It Ic action Qq Ar command ;
217 Command to execute upon a successful match.
219 .Dq Li "/etc/rc.d/power_profile $notify" .
220 .It Ic match Qo Ar system | subsystem | type | notify Qc Qq Ar value ;
223 statements can exist within a
227 can be either a fixed string or a regular expression.
228 Below is a list of available systems, subsystems, and types.
229 .It Ic media-type Qq Ar string ;
232 .Ss Variables that can be used with the match statement
233 A partial list of variables and their possible values that can be used together
237 The variables are published by the bus based on characteristics of the device
238 that generated the event (for device events).
239 Variables for other classes of events are dependent on those events.
241 .Bl -tag -width ".Li manufacturer" -compact
245 The entire message from the current event.
247 The entire message from the current event, after the initial type character.
249 The time this event was processed, in seconds since 1970 dot fraction.
251 Device name of parent bus.
253 Device node path if one is created by the
259 Executable name (kernel).
261 Path to core file (kernel).
267 Device Sub-class (USB).
269 Name of attached/detached device.
271 Endpoint count (USB).
277 Interface Class (USB).
279 Interface Protocol (USB).
281 Interface Sub-class (USB).
283 Jail name for the process triggering the rule (RCTL).
285 Peripheral mode (USB).
287 Match the value of the
293 PID of the process triggering the rule (RCTL).
295 Hub port number (USB).
299 Hardware revision (USB).
301 Real UID of the process triggering the rule (RCTL).
313 Matches a subsystem of a system, see below.
315 Matches a system type, see below.
317 Type of notification, see below.
322 A partial list of systems, subsystems, and types used within the
326 .\" Please keep these tables sorted. Also, please use the same parameters
327 .\" for each of the tables so that things line up in columns nicely.
328 .\" Please do not omit the type column for notifiers that omit it.
330 .Bl -column "System" "Subsystem" "1234567" -compact
331 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
333 Events related to the ACPI Subsystem.
334 .It Li ACPI Ta Li ACAD Ta Ta
335 AC line state ($notify=0x00 is offline, 0x01 is online).
336 .It Li ACPI Ta Li Button Ta Ta
337 Button state ($notify=0x00 is power, 0x01 is sleep).
338 .It Li ACPI Ta Li CMBAT Ta Ta
340 .It Li ACPI Ta Li Dock Ta Ta
341 Dock state ($notify=0x00 is undocked, 0x01 is docked).
342 .It Li ACPI Ta Li Lid Ta Ta
343 Lid state ($notify=0x00 is closed, 0x01 is open).
344 .It Li ACPI Ta Li PROCESSOR Ta Ta
345 Processor state/configuration ($notify=0x81 is a change in available Cx states).
346 .It Li ACPI Ta Li Resume Ta Ta
348 .It Li ACPI Ta Li Suspend Ta Ta
349 Suspend notification.
350 .It Li ACPI Ta Li Thermal Ta Ta
354 .Bl -column "System" "Subsystem" "1234567" -compact
355 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
356 .It Li AEON Ta Li power Ta Li press Ta
357 The power button on an Amiga has been pressed.
360 .Bl -column "System" "Subsystem" "1234567" -compact
361 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
363 Events related to the
366 .It Li CAM Ta Li periph Ta Ta
367 Events related to peripheral devices.
368 .It Li CAM Ta Li periph Ta Li error Ta
370 .It Li CAM Ta Li periph Ta Li timeout Ta
374 .Bl -column "System" "Subsystem" "1234567" -compact
375 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
377 Events related to the
380 .It CARP Ta Ar vhid@inet Ta Ta
383 contains the actual CARP vhid and the name of the network interface
384 on which the event took place.
385 .It CARP Ta Ar vhid@inet Ta MASTER Ta
386 Node become the master for a virtual host.
387 .It CARP Ta Ar vhid@inet Ta BACKUP Ta
388 Node become the backup for a virtual host.
391 .Bl -column "System" "Subsystem" "1234567" -compact
392 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
393 .It Li coretemp Ta Ta Ta
394 Events related to the
397 .It Li coretemp Ta Li Thermal Ta Ta
398 Notification that the CPU core has reached critical temperature.
399 .It Li coretemp Ta Li Thermal Ta Li temperature Ta
400 String containing the temperature of the core that has become too hot.
403 .Bl -column "System" "Subsystem" "1234567" -compact
404 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
406 .It Li IFNET Ta Ar inet Ta Ta
409 is the actual name of the network interface on which the event
411 .It Li IFNET Ta Ar inet Ta Li LINK_UP Ta
412 Carrier status changed to UP.
413 .It Li IFNET Ta Ar inet Ta Li LINK_DOWN Ta
414 Carrier status changed to DOWN.
415 .It Li IFNET Ta Ar inet Ta Li ATTACH Ta
416 The network interface is attached to the system.
417 .It Li IFNET Ta Ar inet Ta Li DETACH Ta
418 The network interface is detached from the system.
421 .Bl -column "System" "Subsystem" "1234567" -compact
422 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
424 .It Li DEVFS Ta Li CDEV Ta Li CREATE Ta
428 .It Li DEVFS Ta Li CDEV Ta Li DESTROY Ta
434 .Bl -column "System" "Subsystem" "1234567" -compact
435 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
436 .It Li ETHERNET Ta Ar inet Ta IFATTACH Ta
437 Notification when the default VNET instance of the
439 interface is attached.
442 .Bl -column "System" "Subsystem" "1234567" -compact
443 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
445 Events related to the
448 The difference compared to
452 only includes disk-like devices.
453 .It Li GEOM Ta Li DEV Ta Li CREATE Ta
456 device node is created.
457 .It Li GEOM Ta Li DEV Ta Li DESTROY Ta
460 device node is destroyed.
461 .It Li GEOM Ta Li DEV Ta Li GEOM::physpath Ta
462 The physical path of a device has changed.
463 .It Li GEOM Ta Li DEV Ta Li GEOM::rotation_rate Ta
464 The rotation rate of the disk has changed.
465 .It Li GEOM Ta Li DEV Ta Li MEDIACHANGE Ta
466 Physical media has changed.
467 .It Li GEOM Ta Li DEV Ta Li SIZECHANGE Ta
470 provider size has changed.
473 .Bl -column "System" "Subsystem" "1234567" -compact
474 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
475 .It Li kern Ta Li power Ta Li resume Ta
476 Notification that the system has woken from the suspended state.
477 Note: this notification is deprecated and will be removed in
482 .Bl -column "System" "Subsystem" "1234567" -compact
483 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
484 .It Li kernel Ta Li signal Ta Li coredump Ta
485 Notification that a process has crashed and dumped core.
486 .It Li kernel Ta Li power Ta Li resume Ta
487 Notification that the system has woken from the suspended state.
490 .Bl -column "System" "Subsystem" "1234567" -compact
491 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
493 Notification of events from various types of Power Management Units.
494 .It Li PMU Ta Li "AC" Ta Ta
495 Notifications of AC power related events.
496 .It Li PMU Ta Li "AC" Ta Li overvoltage Ta
497 An over-voltage condition was detected on the AC power line.
498 .It Li PMU Ta Li "AC" Ta Li plugged Ta
499 Power has been applied to the AC power line.
500 .It Li PMU Ta Li "AC" Ta Li unplugged Ta
501 Power has been removed from the AC power line.
502 .It Li PMU Ta Li Battery Ta Ta
503 .It Li PMU Ta Li Battery Ta absent Ta
504 Battery is no longer absent.
505 .It Li PMU Ta Li Battery Ta charged Ta
506 The battery has become charged.
507 .It Li PMU Ta Li Battery Ta charging Ta
508 The battery has started charging.
509 .It Li PMU Ta Li Battery Ta disconnected Ta
510 The battery has been disconnected.
511 .It Li PMU Ta Li Battery Ta high-temp Ta
512 The battery reported a temperature over the limit.
513 .It Li PMU Ta Li Battery Ta low-temp Ta
514 The battery reported a temperature under the limit.
515 .It Li PMU Ta Li Battery Ta plugged Ta
516 The battery has become plugged (eg connected).
517 .It Li PMU Ta Li Battery Ta shutdown-threshold Ta
518 The power in the battery has fallen below the shutdown threshold.
519 .It Li PMU Ta Li Battery Ta warning-threshold Ta
520 The power in the battery has fallen below the warn the user threshold.
521 .It Li PMU Ta Li Button Ta pressed Ta
527 .It Li PMU Ta Li keys Ta Ta
528 One of the keys on the
530 keyboard has been pressed.
531 .It Li PMU Ta Li keys Ta brightness Ta
532 A brightness level change has been requested.
533 Direction is in the $notify variable.
534 .It Li PMU Ta Li keys Ta mute Ta
536 .It Li PMU Ta Li keys Ta volume Ta
537 A volume level change has been requested.
538 Direction is in the $notify variable.
539 .It Li PMU Ta Li keys Ta eject Ta
540 An ejection has been requested.
541 .It Li PMU Ta Li lid Ta close Ta
544 device has detected the lid closing.
545 .It Li PMU Ta Li lid Ta open Ta
548 device has detected the lid openinging.
549 .It Li PMU Ta Li POWER Ta ACLINE Ta
552 device has deteted an AC line state ($notify=0x00 is offline, 0x01 is online).
553 .It Li PMU Ta Li USB Ta overvoltage Ta
554 An over-voltage condition on the power lines for the USB power pins.
555 .It Li PMU Ta Li USB Ta plugged Ta
556 A device has been plugged into a USB device.
557 .It Li PMU Ta Li USB Ta undervoltage Ta
558 An under-voltage condition on the power lines for the USB power pins.
559 .It Li PMU Ta Li USB Ta unplugged Ta
560 A device has been unplugged into a USB device.
563 .Bl -column "System" "Subsystem" "1234567" -compact
564 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
566 Events related to the
569 .It Li RCTL Ta Li rule Ta Li matched Ta
570 A rule with action specified as "devctl" was triggered.
573 .Bl -column "System" "Subsystem" "1234567" -compact
574 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
576 Events related to the USB subsystem.
577 .It Li USB Ta Li DEVICE Ta Li ATTACH Ta
578 USB device is attached to the system.
579 .It Li USB Ta Li DEVICE Ta Li DETACH Ta
580 USB device is detached to the system.
581 .It Li USB Ta Li INTERFACE Ta Li ATTACH Ta
582 USB interface is attached to a device.
583 .It Li USB Ta Li INTERFACE Ta Li DETACH Ta
584 USB interface is detached from a device.
590 A link state change to UP on the interface
592 would result in the following notify event:
593 .Bd -literal -offset indent
594 system=IFNET subsystem=fxp0 type=LINK_UP
597 An AC line state change to
599 would result in the following event:
600 .Bd -literal -offset indent
601 system=ACPI subsystem=ACAD notify=0x00
604 Comments may appear anywhere that whitespace may appear in a
606 To appeal to programmers of all kinds, they can
607 be written in C, C++, or shell/Perl constructs.
609 C-style comments start with the two characters
611 (slash, star) and end with
614 Because they are completely delimited with these characters,
615 they can be used to comment only a portion of a line or to span
618 C-style comments cannot be nested.
619 For example, the following is
620 not valid because the entire comment ends with the first
622 .Bd -literal -offset indent
623 /* This is the start of a comment.
624 This is still part of the comment.
625 /* This is an incorrect attempt at nesting a comment. */
626 This is no longer in any comment. */
629 C++-style comments start with the two characters
631 (slash, slash) and continue to the end of the physical line.
632 They cannot be continued across multiple physical lines; to have
633 one logical comment span multiple lines, each line must use the
637 .Bd -literal -offset indent
638 // This is the start of a comment. The next line
639 // is a new comment, even though it is logically
640 // part of the previous comment.
643 .Bl -tag -width ".Pa /etc/devd.conf" -compact
644 .It Pa /etc/devd.conf
652 # This will catch link down events on the interfaces fxp0 and ath0
655 match "system" "IFNET";
656 match "subsystem" "(fxp0|ath0)";
657 match "type" "LINK_DOWN";
658 action "logger $subsystem is DOWN";
662 # Match lid open/close events
663 # These can be combined to a single event, by passing the
664 # value of $notify to the external script.
667 match "system" "ACPI";
668 match "subsystem" "Lid";
669 match "notify" "0x00";
670 action "logger Lid closed, we can sleep now!";
674 match "system" "ACPI";
675 match "subsystem" "Lid";
676 match "notify" "0x01";
677 action "logger Lid opened, the sleeper must awaken!";
681 # Match a USB device type
684 match "system" "USB";
685 match "subsystem" "INTERFACE";
686 match "type" "ATTACH";
687 match "intclass" "0x0e";
688 action "logger USB video device attached";
692 # Try to configure ath and iwn devices with pccard_ether
693 # as they are attached.
696 device-name "(ath|iwn)[0-9]+";
697 action "/etc/pccard_ether $device-name start";
701 # Stop ath and iwn devices as they are detached from
705 device-name "(ath|iwn)[0-9]+";
706 action "/etc/pccard_ether $device-name stop";
712 has many additional examples.