diff options
Diffstat (limited to 'share/man/man4')
-rw-r--r-- | share/man/man4/Makefile | 4 | ||||
-rw-r--r-- | share/man/man4/hotplug.4 | 104 |
2 files changed, 106 insertions, 2 deletions
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index a7c6a1b6d26..c25b83916ef 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.264 2004/05/23 18:44:08 grange Exp $ +# $OpenBSD: Makefile,v 1.265 2004/05/30 08:35:19 grange Exp $ MAN= aac.4 ac97.4 acphy.4 addcom.4 adv.4 aha.4 ahb.4 ahc.4 \ aic.4 amdpm.4 ami.4 amphy.4 an.4 aria.4 ast.4 atalk.4 \ @@ -11,7 +11,7 @@ MAN= aac.4 ac97.4 acphy.4 addcom.4 adv.4 aha.4 ahb.4 ahc.4 \ emu.4 enc.4 ep.4 esa.4 esis.4 eso.4 ess.4 exphy.4 \ faith.4 fd.4 fdc.4 fms.4 fpa.4 fxp.4 gdt.4 gem.4 gif.4 \ gpr.4 gre.4 gscsio.4 gtp.4 hifn.4 hil.4 hilid.4 hilkbd.4 hilms.4 \ - hme.4 hsq.4 icmp.4 icmp6.4 icsphy.4 idp.4 ifmedia.4 \ + hme.4 hotplug.4 hsq.4 icmp.4 icmp6.4 icsphy.4 idp.4 ifmedia.4 \ iha.4 iic.4 inet.4 inet6.4 inphy.4 iop.4 iophy.4 ioprbs.4 \ iopsp.4 ip.4 ip6.4 ipcomp.4 ipsec.4 isa.4 isapnp.4 \ ises.4 iso.4 isp.4 it.4 ksyms.4 kue.4 lc.4 lge.4 lkm.4 \ diff --git a/share/man/man4/hotplug.4 b/share/man/man4/hotplug.4 new file mode 100644 index 00000000000..abf8b82c877 --- /dev/null +++ b/share/man/man4/hotplug.4 @@ -0,0 +1,104 @@ +.\" $OpenBSD: hotplug.4,v 1.1 2004/05/30 08:35:19 grange Exp $ +.\" +.\" Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd March 30, 2004 +.Dt HOTPLUG 4 +.Os +.Sh NAME +.Nm hotplug +.Nd devices hot plugging +.Sh SYNOPSIS +.Cd "pseudo-device hotplug 1" +.Pp +.Fd #include <sys/types.h> +.Fd #include <sys/device.h> +.Fd #include <sys/hotplug.h> +.Sh DESCRIPTION +The +.Nm +pseudo-device passes device attachment and detachment events to +userland. +When a device attaches or detaches, the corresponding event is queued. +The events can then be obtained from the queue through the +.Xr read 2 +call on the +.Pa /dev/hotplug +device file. +Once an event has been read, it's deleted from the queue. +The event queue has a limited size and if it's full all new events will be +dropped. +Each event is described with the following structure declared in the +.Aq Pa sys/hotplug.h +header file: +.Bd -literal -offset indent +struct hotplug_event { + int he_type; /* event type */ + enum devclass he_devclass; /* device class */ + char he_devname[16]; /* device name */ +}; + +.Ed +The +.Va he_type +field describes the event type and can be either +.Dv HOTPLUG_DEVAT +for device attachment or +.Dv HOTPLUG_DEVDT +for detachment. +The +.Va he_devclass +field describes the device class. +All device classes can be found in the +.Aq Pa sys/device.h +header file: +.Bd -literal -offset indent +enum devclass { + DV_DULL, /* generic, no special info */ + DV_CPU, /* CPU (carries resource utilization) */ + DV_DISK, /* disk drive (label, etc) */ + DV_IFNET, /* network interface */ + DV_TAPE, /* tape device */ + DV_TTY /* serial line interface */ +}; + +.Ed +The +.Va he_devname +is a device name including unit number, e.g.\& +.Pa sd1 . +.Pp +Only one structure can be read per call. +If there are no events in the queue, the +.Xr read 2 +call will block until an event appears. +.Sh DIAGNOSTICS +.Bl -diag +.It "hotplug: event lost, queue full" +New events will be dropped until pending events aren't read. +.El +.Sh SEE ALSO +.Xr read 2 , +.Xr hotplugd 8 +.Sh HISTORY +The +.Nm +device first appeared in +.Ox 3.6 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Alexander Yurchenko Aq grange@openbsd.org . |