]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/man/man4/devctl.4
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / man / man4 / devctl.4
1 .\"
2 .\" Copyright (c) 2002 M. Warner Losh
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
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.
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 .\" $FreeBSD$
26 .\"
27 .Dd February 11, 2003
28 .Dt DEVCTL 4
29 .Os
30 .Sh NAME
31 .Nm devctl
32 .Nd "device event reporting and device control interface"
33 .Sh DESCRIPTION
34 The
35 .Nm
36 device is used to report device events from the kernel.
37 Future versions will allow for some device control as well.
38 .Sh IMPLEMENTATION NOTES
39 This design allows only one reader for
40 .Pa /dev/devctl .
41 This is not desirable
42 in the long run, but will get a lot of hair out of this implementation.
43 Maybe we should make this device a clonable device.
44 .Pp
45 Also note: we specifically do not attach a device to the
46 .Vt device_t
47 tree
48 to avoid potential chicken and egg problems.
49 One could argue that all of this belongs to the root node.
50 One could also further argue that the
51 .Xr sysctl 3
52 interface that we have now might more properly be an
53 .Xr ioctl 2
54 interface.
55 .Pp
56 .Dv SIGIO
57 support is included in the driver.
58 However, the author is not sure that the
59 .Dv SIGIO
60 support is done correctly.
61 It was copied from a driver that had
62 .Dv SIGIO
63 support that likely has not been
64 tested since
65 .Fx 3.4
66 or
67 .Fx 2.2.8 !
68 .Pp
69 The read channel for this device is used to report changes to
70 userland in realtime.
71 We return one record at a time.
72 If you try to read this device a character at a time, you will lose
73 the rest of the data.
74 Listening programs are expected to cope.
75 .Pp
76 The sysctl and boot parameter
77 .Va hw.bus.devctl_disable
78 is used to disable
79 .Nm
80 when no
81 .Xr devd 8
82 is running.
83 .Sh PROTOCOL
84 The
85 .Nm
86 device
87 uses an
88 .Tn ASCII
89 protocol.
90 The driver returns one record at a time to its readers.
91 Each record is terminated with a newline.
92 The first character of the record is the event type.
93 .Pp
94 .Bl -column -compact "Type" "Description"
95 .Em "Type       Description"
96 !       A notify event, such as a link state change.
97 +       Device node in tree attached.
98 -       Device node in tree detached.
99 ?       Unknown device detected.
100 .El
101 .Ss Message Formats
102 Except for the first character in the record, attach and detach
103 messages have the same format.
104 .Pp
105 .D1 Ar T Ns Ar dev Li at Ar parent Li on Ar location
106 .Pp
107 .Bl -column -compact "location" "Description"
108 .Em "Part       Description"
109 .It Ar T Ta "+ or -"
110 .It Ar dev Ta "The device name that was attached/detached."
111 .It Ar parent Ta "The device name of the parent bus that attached the device."
112 .It Ar location Ta "Bus specific location information."
113 .El
114 .Pp
115 The nomatch messages can be used to load devices driver.
116 If you load a device driver, then one of two things can happen.
117 If the device driver attaches to something, you will get a device
118 attached message.
119 If it does not, then nothing will happen.
120 .Pp
121 The attach and detach messages arrive after the event.
122 This means one cannot use the attach message to load an alternate
123 driver.
124 The attach message driver has already claimed this device.
125 One cannot use the detach messages to flush data to the device.
126 The device is already gone.
127 .Sh SEE ALSO
128 .Xr devd 8