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. The name of the author may not be used to endorse or promote products 10.\" derived from this software without specific prior written permission. 11.\" 12.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 13.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 16.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 18.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 19.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 20.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 22.\" SUCH DAMAGE. 23.\" 24.\" $FreeBSD$ 25.\" 26.\" The section on comments was taken from named.conf.5, which has the 27.\" following copyright: 28.\" Copyright (c) 1999-2000 by Internet Software Consortium 29.\" 30.\" Permission to use, copy, modify, and distribute this software for any 31.\" purpose with or without fee is hereby granted, provided that the above 32.\" copyright notice and this permission notice appear in all copies. 33.\" 34.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS 35.\" ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 36.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE 37.\" CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 38.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 39.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 40.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 41.\" SOFTWARE. 42.\" 43.Dd June 23, 2021 44.Dt DEVD.CONF 5 45.Os 46.Sh NAME 47.Nm devd.conf 48.Nd configuration file for 49.Xr devd 8 50.Sh DESCRIPTION 51.Ss General Syntax 52A 53.Xr devd 8 54configuration consists of two general features, statements 55and comments. 56All statements end with a semicolon. 57Many statements can contain substatements, which are also 58terminated with a semicolon. 59.Pp 60The following statements are supported: 61.Bl -tag -width ".Ic options" 62.It Ic attach 63Specifies various matching criteria and actions to perform when 64a newly attached device matches said criteria. 65.It Ic detach 66Specifies various matching criteria and actions to perform when 67a newly detached device matches said criteria. 68.It Ic nomatch 69Specifies various matching criteria and actions to perform when 70no device driver currently loaded in the kernel claims a (new) 71device. 72.It Ic notify 73Specifies various matching criteria and actions to perform when the kernel 74sends an event notification to userland. 75.It Ic options 76Specifies various options and parameters for the operation of 77.Xr devd 8 . 78.El 79.Pp 80Statements may occur in any order in the configuration file, and may be 81repeated as often as required. 82Further details on the syntax and meaning of each statement and their 83substatements are explained below. 84.Pp 85Each statement, except 86.Ic options 87has a priority (an arbitrary number) associated with it, where 88.Ql 0 89is defined as the lowest priority. 90If two statements match the same event, only the action of the statement with 91highest priority will be executed. 92In this way generic statements can be overridden for devices or 93notifications that require special attention. 94.Pp 95The general syntax of a statement is: 96.Bd -literal -offset indent 97statement priority { 98 substatement "value"; 99 ... 100 substatement "value"; 101}; 102.Ed 103.Ss Sub-statements 104The following sub-statements are supported within the 105.Ic options 106statement. 107.Bl -tag -width ".Ic directory" 108.It Ic directory Qq Ar /some/path ; 109Adds the given directory to the list of directories from which 110.Xr devd 8 111will read all files named "*.conf" as further 112configuration files. 113Any number of 114.Ic directory 115statements can be used. 116.It Ic pid-file Qq Pa /var/run/devd.pid ; 117Specifies PID file. 118.It Ic set Ar regexp-name Qq Ar (some|regexp) ; 119Creates a regular expression and assigns it to the variable 120.Ar regexp-name . 121The variable is available throughout the rest of 122the configuration file. 123If the string begins with 124.Ql \&! , 125it matches if the regular expression formed by the rest of the string 126does not match. 127All regular expressions have an implicit 128.Ql ^$ 129around them. 130.El 131.Pp 132The following sub-statements are supported within the 133.Ic attach 134and 135.Ic detach 136statements. 137.Bl -tag -width ".Ic directory" 138.It Ic action Qq Ar command ; 139Command to execute upon a successful match. 140Example 141.Dq Li "/etc/pccard_ether $device-name start" . 142.It Ic class Qq Ar string ; 143This is shorthand for 144.Dq Ic match Qo Li class Qc Qq Ar string . 145.It Ic device-name Qq string ; 146This is shorthand for 147.Dq Ic match Qo Li device-name Qc Qq Ar string . 148This matches a device named 149.Ar string , 150which is allowed to be a regular expression or a variable previously created 151containing a regular expression. 152The 153.Dq Li device-name 154variable 155is available for later use with the 156.Ic action 157statement. 158.It Ic match Qo Ar variable Qc Qq Ar value ; 159Matches the content of 160.Ar value 161against 162.Ar variable ; 163the content of 164.Ar value 165may be a regular expression. 166Not required during 167.Ic attach 168nor 169.Ic detach 170events since the 171.Ic device-name 172statement takes care of all device matching. 173For a partial list of variables, see below. 174.It Ic media-type Qq Ar string ; 175For network devices, 176.Ic media-type 177will match devices that have the given media type. 178Valid media types are: 179.Dq Li Ethernet , 180.Dq Li Tokenring , 181.Dq Li FDDI , 182.Dq Li 802.11 , 183and 184.Dq Li ATM . 185.It Ic subdevice Qq Ar string ; 186This is shorthand for 187.Dq Ic match Qo Li subdevice Qc Qq Ar string . 188.El 189.Pp 190The following sub-statements are supported within the 191.Ic nomatch 192statement. 193.Bl -tag -width ".Ic directory" 194.It Ic action Qq Ar command ; 195Same as above. 196.It Ic match Qo Ar variable Qc Qq Ar value ; 197Matches the content of 198.Ar value 199against 200.Ar variable ; 201the content of 202.Ar value 203may be a regular expression. 204For a partial list of variables, see below. 205.El 206.Pp 207The following sub-statements are supported within the 208.Ic notify 209statement. 210The 211.Dq Li notify 212variable is available inside this statement and contains, a value, depending 213on which system and subsystem that delivered the event. 214.Bl -tag -width ".Ic directory" 215.It Ic action Qq Ar command ; 216Command to execute upon a successful match. 217Example 218.Dq Li "/etc/rc.d/power_profile $notify" . 219.It Ic match Qo Ar system | subsystem | type | notify Qc Qq Ar value ; 220Any number of 221.Ic match 222statements can exist within a 223.Ic notify 224statement; 225.Ar value 226can be either a fixed string or a regular expression. 227Below is a list of available systems, subsystems, and types. 228.It Ic media-type Qq Ar string ; 229See above. 230.El 231.Ss Variables that can be used with the match statement 232A partial list of variables and their possible values that can be used together 233with the 234.Ic match 235statement. 236The variables are published by the bus based on characteristics of the device 237that generated the event (for device events). 238Variables for other classes of events are dependent on those events. 239.Pp 240.Bl -tag -width ".Li manufacturer" -compact 241.It Ic Variable 242.Ic Description 243.It Li * 244The entire message from the current event. 245.It Li _ 246The entire message from the current event, after the initial type character. 247.It Li timestamp 248The time this event was processed, in seconds since 1970 dot fraction. 249.It Li bus 250Device name of parent bus. 251.It Li cdev 252Device node path if one is created by the 253.Xr devfs 5 254filesystem. 255.It Li class 256Device class. 257.It Li comm 258Executable name (kernel). 259.It Li core 260Path to core file (kernel). 261.It Li device 262Device ID. 263.It Li devclass 264Device Class (USB). 265.It Li devsubclass 266Device Sub-class (USB). 267.It Li device-name 268Name of attached/detached device. 269.It Li endpoints 270Endpoint count (USB). 271.It Li function 272Card functions. 273.It Li interface 274Interface ID (USB). 275.It Li intclass 276Interface Class (USB). 277.It Li intprotocol 278Interface Protocol (USB). 279.It Li intsubclass 280Interface Sub-class (USB). 281.It Li jail 282Jail name for the process triggering the rule (RCTL). 283.It Li mode 284Peripheral mode (USB). 285.It Li notify 286Match the value of the 287.Dq Li notify 288variable. 289.It Li parent 290Parent device. 291.It Li pid 292PID of the process triggering the rule (RCTL). 293.It Li port 294Hub port number (USB). 295.It Li product 296Product ID (USB). 297.It Li release 298Hardware revision (USB). 299.It Li ruid 300Real UID of the process triggering the rule (RCTL). 301.It Li rule 302Rule (RCTL). 303.It Li sernum 304Serial Number (USB). 305.It Li slot 306Card slot. 307.It Li subvendor 308Sub-vendor ID (PCI). 309.It Li subdevice 310Sub-device ID (PCI). 311.It Li subsystem 312Matches a subsystem of a system, see below. 313.It Li system 314Matches a system type, see below. 315.It Li type 316Type of notification, see below. 317.It Li vendor 318Vendor ID. 319.El 320.Ss Notify matching 321A partial list of systems, subsystems, and types used within the 322.Ic notify 323mechanism. 324.\" 325.\" Please keep these tables sorted. Also, please use the same parameters 326.\" for each of the tables so that things line up in columns nicely. 327.\" Please do not omit the type column for notifiers that omit it. 328.Pp 329.Bl -column "System" "Subsystem" "1234567" -compact 330.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 331.It Li ACPI Ta Ta Ta 332Events related to the ACPI Subsystem. 333.It Li ACPI Ta Li ACAD Ta Ta 334AC line state ($notify=0x00 is offline, 0x01 is online). 335.It Li ACPI Ta Li Button Ta Ta 336Button state ($notify=0x00 is power, 0x01 is sleep). 337.It Li ACPI Ta Li CMBAT Ta Ta 338Battery events. 339.It Li ACPI Ta Li Dock Ta Ta 340Dock state ($notify=0x00 is undocked, 0x01 is docked). 341.It Li ACPI Ta Li Lid Ta Ta 342Lid state ($notify=0x00 is closed, 0x01 is open). 343.It Li ACPI Ta Li PROCESSOR Ta Ta 344Processor state/configuration ($notify=0x81 is a change in available Cx states). 345.It Li ACPI Ta Li Resume Ta Ta 346Resume notification. 347.It Li ACPI Ta Li Suspend Ta Ta 348Suspend notification. 349.It Li ACPI Ta Li Thermal Ta Ta 350Thermal zone events. 351.El 352.Pp 353.Bl -column "System" "Subsystem" "1234567" -compact 354.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 355.It Li AEON Ta Li power Ta Li press Ta 356The power button on an Amiga has been pressed. 357.El 358.Pp 359.Bl -column "System" "Subsystem" "1234567" -compact 360.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 361.It Li CAM Ta Ta Ta 362Events related to the 363.Xr cam 4 364system. 365.It Li CAM Ta Li periph Ta Ta 366Events related to peripheral devices. 367.It Li CAM Ta Li periph Ta Li error Ta 368Generic errors. 369.It Li CAM Ta Li periph Ta Li timeout Ta 370Command timeouts. 371.El 372.Pp 373.Bl -column "System" "Subsystem" "1234567" -compact 374.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 375.It Li CARP Ta Ta Ta 376Events related to the 377.Xr carp 4 378protocol. 379.It CARP Ta Ar vhid@inet Ta Ta 380The 381.Dq subsystem 382contains the actual CARP vhid and the name of the network interface 383on which the event took place. 384.It CARP Ta Ar vhid@inet Ta MASTER Ta 385Node become the master for a virtual host. 386.It CARP Ta Ar vhid@inet Ta BACKUP Ta 387Node become the backup for a virtual host. 388.El 389.Pp 390.Bl -column "System" "Subsystem" "1234567" -compact 391.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 392.It Li coretemp Ta Ta Ta 393Events related to the 394.Xr coretemp 4 395device. 396.It Li coretemp Ta Li Thermal Ta Ta 397Notification that the CPU core has reached critical temperature. 398.It Li coretemp Ta Li Thermal Ta Li temperature Ta 399String containing the temperature of the core that has become too hot. 400.El 401.Pp 402.Bl -column "System" "Subsystem" "1234567" -compact 403.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 404.It Li DEVFS 405.It Li DEVFS Ta Li CDEV Ta Li CREATE Ta 406The 407.Xr devfs 5 408node is created. 409.It Li DEVFS Ta Li CDEV Ta Li DESTROY Ta 410The 411.Xr devfs 5 412node is destroyed. 413.El 414.Pp 415.Bl -column "System" "Subsystem" "1234567" -compact 416.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 417.It Li ETHERNET Ta Ar inet Ta IFATTACH Ta 418Notification when the default VNET instance of the 419.Em inet 420interface is attached. 421.El 422.Pp 423.Bl -column "System" "Subsystem" "1234567" -compact 424.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 425.It Li GEOM Ta Ta Ta 426Events related to the 427.Xr geom 4 428framework. 429The difference compared to 430.Li DEVFS 431is that 432.Li GEOM 433only includes disk-like devices. 434.It Li GEOM Ta Li DEV Ta Li CREATE Ta 435A 436.Xr geom 4 437provider is created. 438.It Li GEOM Ta Li DEV Ta Li DESTROY Ta 439A 440.Xr geom 4 441provider is destroyed. 442.It Li GEOM Ta Li DEV Ta Li GEOM::physpath Ta 443The physical path of a device has changed. 444.It Li GEOM Ta Li DEV Ta Li GEOM::rotation_rate Ta 445The rotation rate of the disk has changed. 446.It Li GEOM Ta Li DEV Ta Li MEDIACHANGE Ta 447Physical media has changed. 448.It Li GEOM Ta Li DEV Ta Li SIZECHANGE Ta 449A 450.Xr geom 4 451provider size has changed. 452.El 453.Pp 454.Bl -column "System" "Subsystem" "1234567" -compact 455.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 456.It Li IFNET 457.It Li IFNET Ta Em inet Ta Ta 458The 459.Dq subsystem 460is the actual name of the network interface on which the event 461took place. 462.It Li IFNET Ta Em inet Ta Li LINK_UP Ta 463Carrier status changed to UP. 464.It Li IFNET Ta Em inet Ta Li LINK_DOWN Ta 465Carrier status changed to DOWN. 466.It Li IFNET Ta Em inet Ta Li ATTACH Ta 467The network interface is attached to the system. 468.It Li IFNET Ta Em inet Ta Li DETACH Ta 469The network interface is detached from the system. 470.It Li IFNET Ta Em inet Ta Li RENAME Ta 471The network interface is renamed. 472.It Li IFNET Ta Em inet Ta Li ADDR_ADD Ta 473The network interface address added. 474.It Li IFNET Ta Em inet Ta Li ADDR_DEL Ta 475The network interface address removed. 476.El 477.Pp 478.Bl -column "System" "Subsystem" "1234567" -compact 479.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 480.It Li kern Ta Li power Ta Li resume Ta 481Notification that the system has woken from the suspended state. 482Note: this notification is deprecated and will be removed in 483.Fx 14.0 . 484.El 485.Pp 486.Bl -column "System" "Subsystem" "1234567" -compact 487.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 488.It Li kernel Ta Li signal Ta Li coredump Ta 489Notification that a process has crashed and dumped core. 490.It Li kernel Ta Li power Ta Li resume Ta 491Notification that the system has woken from the suspended state. 492.El 493.Pp 494.Bl -column "System" "Subsystem" "1234567" -compact 495.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 496.It Li PMU Ta Ta Ta 497Notification of events from various types of Power Management Units. 498.It Li PMU Ta Li "AC" Ta Ta 499Notifications of AC power related events. 500.It Li PMU Ta Li "AC" Ta Li overvoltage Ta 501An over-voltage condition was detected on the AC power line. 502.It Li PMU Ta Li "AC" Ta Li plugged Ta 503Power has been applied to the AC power line. 504.It Li PMU Ta Li "AC" Ta Li unplugged Ta 505Power has been removed from the AC power line. 506.It Li PMU Ta Li Battery Ta Ta 507.It Li PMU Ta Li Battery Ta absent Ta 508Battery is no longer absent. 509.It Li PMU Ta Li Battery Ta charged Ta 510The battery has become charged. 511.It Li PMU Ta Li Battery Ta charging Ta 512The battery has started charging. 513.It Li PMU Ta Li Battery Ta disconnected Ta 514The battery has been disconnected. 515.It Li PMU Ta Li Battery Ta high-temp Ta 516The battery reported a temperature over the limit. 517.It Li PMU Ta Li Battery Ta low-temp Ta 518The battery reported a temperature under the limit. 519.It Li PMU Ta Li Battery Ta plugged Ta 520The battery has become plugged (eg connected). 521.It Li PMU Ta Li Battery Ta shutdown-threshold Ta 522The power in the battery has fallen below the shutdown threshold. 523.It Li PMU Ta Li Battery Ta warning-threshold Ta 524The power in the battery has fallen below the warn the user threshold. 525.It Li PMU Ta Li Button Ta pressed Ta 526A button on a 527.Xr adb 4 528or 529.Xr pmu 4 530has been pressed. 531.It Li PMU Ta Li keys Ta Ta 532One of the keys on the 533.Xr adb 4 534keyboard has been pressed. 535.It Li PMU Ta Li keys Ta brightness Ta 536A brightness level change has been requested. 537Direction is in the $notify variable. 538.It Li PMU Ta Li keys Ta mute Ta 539The mute key 540.It Li PMU Ta Li keys Ta volume Ta 541A volume level change has been requested. 542Direction is in the $notify variable. 543.It Li PMU Ta Li keys Ta eject Ta 544An ejection has been requested. 545.It Li PMU Ta Li lid Ta close Ta 546The 547.Xr pmc 4 548device has detected the lid closing. 549.It Li PMU Ta Li lid Ta open Ta 550The 551.Xr pmc 4 552device has detected the lid openinging. 553.It Li PMU Ta Li POWER Ta ACLINE Ta 554The 555.Xr pmc 4 556device has deteted an AC line state ($notify=0x00 is offline, 0x01 is online). 557.It Li PMU Ta Li USB Ta overvoltage Ta 558An over-voltage condition on the power lines for the USB power pins. 559.It Li PMU Ta Li USB Ta plugged Ta 560A device has been plugged into a USB device. 561.It Li PMU Ta Li USB Ta undervoltage Ta 562An under-voltage condition on the power lines for the USB power pins. 563.It Li PMU Ta Li USB Ta unplugged Ta 564A device has been unplugged into a USB device. 565.El 566.Pp 567.Bl -column "System" "Subsystem" "1234567" -compact 568.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 569.It Li RCTL Ta Ta Ta 570Events related to the 571.Xr rctl 8 572framework. 573.It Li RCTL Ta Li rule Ta Li matched Ta 574A rule with action specified as "devctl" was triggered. 575.El 576.Pp 577.Bl -column "System" "Subsystem" "1234567" -compact 578.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 579.It Li USB Ta Ta Ta 580Events related to the USB subsystem. 581.It Li USB Ta Li DEVICE Ta Li ATTACH Ta 582USB device is attached to the system. 583.It Li USB Ta Li DEVICE Ta Li DETACH Ta 584USB device is detached to the system. 585.It Li USB Ta Li INTERFACE Ta Li ATTACH Ta 586USB interface is attached to a device. 587.It Li USB Ta Li INTERFACE Ta Li DETACH Ta 588USB interface is detached from a device. 589.El 590.Pp 591.Bl -column "System" "Subsystem" "1234567" -compact 592.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 593.It Li VFS Ta Ta Ta 594Events from the vfs system. 595.It Li VFS Ta Li FS Ta Ta 596Events that change what is mounted to the system. 597.It Li VFS Ta Li FS Ta Li MOUNT Ta 598Notification of a filesystem is mounted for the first time. 599.It Li VFS Ta Li FS Ta Li REMOUNT Ta 600Notification of a filesystem is remounted (whether or not the options actually change). 601.It Li VFS Ta Li FS Ta Li UNMOUNT Ta 602Notification of a filesystem being unmounted. 603.El 604.Pp 605.Bl -column "System" "Subsystem" "1234567" -compact 606.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description" 607.It Li ZFS Ta ZFS Ta Ta 608Events about the ZFS subsystem. 609See 610.Xr zfsd 8 611and 612.Pa /etc/devd/zfs.conf 613for details. 614.El 615.Pp 616.\" 617.\" End of tables 618.\" 619A link state change to UP on the interface 620.Dq Li fxp0 621would result in the following notify event: 622.Bd -literal -offset indent 623system=IFNET subsystem=fxp0 type=LINK_UP 624.Ed 625.Pp 626An AC line state change to 627.Dq offline 628would result in the following event: 629.Bd -literal -offset indent 630system=ACPI subsystem=ACAD notify=0x00 631.Ed 632.Ss Comments 633Comments may appear anywhere that whitespace may appear in a 634configuration file. 635To appeal to programmers of all kinds, they can 636be written in C, C++, or shell/Perl constructs. 637.Pp 638C-style comments start with the two characters 639.Ql /* 640(slash, star) and end with 641.Ql */ 642(star, slash). 643Because they are completely delimited with these characters, 644they can be used to comment only a portion of a line or to span 645multiple lines. 646.Pp 647C-style comments cannot be nested. 648For example, the following is 649not valid because the entire comment ends with the first 650.Ql */ : 651.Bd -literal -offset indent 652/* This is the start of a comment. 653 This is still part of the comment. 654/* This is an incorrect attempt at nesting a comment. */ 655 This is no longer in any comment. */ 656.Ed 657.Pp 658C++-style comments start with the two characters 659.Ql // 660(slash, slash) and continue to the end of the physical line. 661They cannot be continued across multiple physical lines; to have 662one logical comment span multiple lines, each line must use the 663.Ql // 664pair. 665For example: 666.Bd -literal -offset indent 667// This is the start of a comment. The next line 668// is a new comment, even though it is logically 669// part of the previous comment. 670.Ed 671.Ss Notes on Variable Expansion 672To prevent issues with special shell characters, the following happens for each 673variable 674.Ic $foo . 675.Bl -enum 676.It 677The characters 678.Dq $' 679are inserted. 680.It 681The string 682.Dq $foo 683is removed. 684.It 685The value of the 686.Ic foo 687variable is inserted into the buffer with all single quote characters 688prefixed by a backslash. 689.El 690.Pp 691See 692.Xr sh 1 693for what this construct means. 694It is safe in all context, except one: inside single quotes. 695If foo=meta and bar=var, then a rule like the following: 696.Bd -literal -offset indent -compact 697action "echo '$foo $bar'"; 698.Ed 699will be presented to the shell via 700.Xr system 3 701as 702.Bd -literal -offset indent -compact 703echo '$'meta' $'var'' 704.Ed 705which produces the following output: 706.Bd -literal -offset indent -compact 707$meta $var 708.Ed 709as its output. 710This is an unanticipated result. 711A future version of this software will change this behavior. 712Users are discouraged from using single quotes inside 713.Ic action 714value without due care. 715.Pp 716The above should be written as 717.Bd -literal -offset indent -compact 718action "echo $foo' '$bar" 719.Ed 720to produce a single argument to echo. 721Given the above expansion, juxtaposing bare variables with 722single quote expressions will produce the right output, 723regardless of the value of the variable. 724.Sh FILES 725.Bl -tag -width ".Pa /etc/devd.conf" -compact 726.It Pa /etc/devd.conf 727The 728.Xr devd 8 729configuration file. 730.El 731.Sh EXAMPLES 732.Bd -literal 733# 734# This will catch link down events on the interfaces fxp0 and ath0 735# 736notify 0 { 737 match "system" "IFNET"; 738 match "subsystem" "(fxp0|ath0)"; 739 match "type" "LINK_DOWN"; 740 action "logger $subsystem is DOWN"; 741}; 742 743# 744# Match lid open/close events 745# These can be combined to a single event, by passing the 746# value of $notify to the external script. 747# 748notify 0 { 749 match "system" "ACPI"; 750 match "subsystem" "Lid"; 751 match "notify" "0x00"; 752 action "logger Lid closed, we can sleep now!"; 753}; 754 755notify 0 { 756 match "system" "ACPI"; 757 match "subsystem" "Lid"; 758 match "notify" "0x01"; 759 action "logger Lid opened, the sleeper must awaken!"; 760}; 761 762# 763# Match a USB device type 764# 765notify 0 { 766 match "system" "USB"; 767 match "subsystem" "INTERFACE"; 768 match "type" "ATTACH"; 769 match "intclass" "0x0e"; 770 action "logger USB video device attached"; 771}; 772 773# 774# Try to configure ath and iwn devices with pccard_ether 775# as they are attached. 776# 777attach 0 { 778 device-name "(ath|iwn)[0-9]+"; 779 action "/etc/pccard_ether $device-name start"; 780}; 781 782# 783# Stop ath and iwn devices as they are detached from 784# the system. 785# 786detach 0 { 787 device-name "(ath|iwn)[0-9]+"; 788 action "/etc/pccard_ether $device-name stop"; 789}; 790.Ed 791.Pp 792The installed 793.Pa /etc/devd.conf 794has many additional examples. 795.Sh SEE ALSO 796.Xr cam 4 , 797.Xr coretemp 4 , 798.Xr devfs 5 , 799.Xr re_format 7 , 800.Xr devd 8 801.Sh BUGS 802The variable expansion's interaction with single quotes is 803suboptimal and surprising. 804