1.\" $OpenBSD: hotplugd.8,v 1.10 2009/03/20 17:53:14 jasper Exp $ 2.\" 3.\" Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd November 14, 2010 18.Dt HOTPLUGD 8 19.Os 20.Sh NAME 21.Nm hotplugd 22.Nd devices hot plugging monitor daemon 23.Sh SYNOPSIS 24.Nm 25.Sh DESCRIPTION 26The 27.Nm 28daemon uses 29.Xr devattr 3 30acting on signaled events by executing the scripts in the 31.Pa /etc/hotplug 32directory. 33.Pp 34Actions can be configured either for device attachment or detachment. 35On device attachment the 36.Pa attach 37script is executed if it exists. 38On device detachment the 39.Pa detach 40script is executed if it exists. 41In both cases two parameters are passed to the scripts: the class and name 42of the attached or detached device. 43The device class corresponds to the classes described in the 44.In sys/device.h 45header file and can be one of the following: 46.Pp 47.Bl -tag -width Ds -offset indent -compact 48.It 0 49generic, no special info 50.It 1 51CPU (carries resource utilization) 52.It 2 53disk drive 54.It 3 55network interface 56.It 4 57tape device 58.It 5 59serial line interface 60.El 61.Pp 62Not all classes are really usable. 63For example, it's unlikely that a CPU will be hotplugged. 64.Pp 65The device name is the usual name, as found in 66.Pa /dev , 67e.g.\& 68.Pa da1 . 69.Sh FILES 70.Bl -tag -width "/dev/hotplug/attach" -compact 71.It /dev/hotplug 72Pseudo-device file. 73.It /etc/hotplug 74Directory where the scripts to execute are located. 75.It /etc/hotplug/attach 76Script to execute on device attachment. 77.It /etc/hotplug/detach 78Script to execute on device detachment. 79.El 80.Sh EXAMPLES 81Sample 82.Pa attach 83script: 84.Bd -literal -offset indent 85#!/bin/sh 86 87DEVCLASS=$1 88DEVNAME=$2 89 90case $DEVCLASS in 912) 92 # disk devices 93 disklabel=`/sbin/disklabel $DEVNAME 2\*(Gt&1 | \e 94 sed -n '/^label: /s/^label: //p'` 95 case $disklabel in 96 Sony*DSC*) 97 # Sony DSC camera 98 mount -o nodev,nosuid /dev/"$DEVNAME"i /mnt/camera 99 ;; 100 esac 101 ;; 1023) 103 # network devices; requires hostname.$DEVNAME 104 sh /etc/netstart $DEVNAME 105 ;; 106esac 107.Ed 108.Sh SEE ALSO 109.Xr devattr 3 110.Sh HISTORY 111The 112.Nm 113program first appeared in 114.Ox 3.6 . 115.Pp 116The 117.Nm 118program was adapted to use 119.Xr devattr 3 120in 121.Dx 2.9 . 122.Sh AUTHORS 123The 124.Nm 125program was written by 126.An Alexander Yurchenko Aq grange@openbsd.org . 127