2 .\" Copyright (c) 1996 David E. O'Brien, Joerg Wunsch
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 .\" $FreeBSD: src/share/man/man4/intro.4,v 1.13.2.6 2002/01/09 15:36:51 ru Exp $
33 .Nd introduction to devices and device drivers
35 This section contains information related to devices, device drivers
36 and miscellaneous hardware.
37 .Ss The device abstraction
38 Device is a term used mostly for hardware-related stuff that belongs
39 to the system, like disks, printers, or a graphics display with its
40 keyboard. There are also so-called
42 where a device driver emulates the behaviour of a device in software
43 without any particular underlying hardware. A typical example for
46 a loophole where the physical memory can be accessed using the regular
47 file access semantics.
49 The device abstraction generally provides a common set of system calls
50 layered on top of them, which are dispatched to the corresponding
51 device driver by the upper layers of the kernel. The set of system
52 calls available for devices is chosen from
61 Not all drivers implement all system calls, for example, calling
63 on terminal devices is likely to be not useful at all.
65 Most of the devices in a unix-like operating system are accessed
70 They are usually located under the directory
72 in the file system hierarchy
76 Each device node must be created statically and
77 independently of the existence of the associated device driver,
81 Note that this could lead to an inconsistent state, where either there
82 are device nodes that do not have a configured driver associated with
83 them, or there may be drivers that have successfully probed for their
84 devices, but cannot be accessed since the corresponding device node is
85 still missing. In the first case, any attempt to reference the device
86 through the device node will result in an error, returned by the upper
87 layers of the kernel, usually
89 In the second case, the device node needs to be created before the
90 driver and its device will be usable.
92 Some devices come in two flavors:
96 devices, or to use better terms, buffered and unbuffered
98 devices. The traditional names are reflected by the letters
102 as the file type identification in the output of
104 Buffered devices are being accessed through the buffer cache of the
105 operating system, and they are solely intended to layer a file system
106 on top of them. They are normally implemented for disks and disk-like
107 devices only and, for historical reasons, for tape devices.
109 Raw devices are available for all drivers, including those that also
110 implement a buffered device. For the latter group of devices, the
111 differentiation is conventionally done by prepending the letter
113 to the path name of the device node, for example
115 denotes the raw device for the first SCSI disk, while
117 is the corresponding device node for the buffered device.
119 Unbuffered devices should be used for all actions that are not related
120 to file system operations, even if the device in question is a disk
121 device. This includes making backups of entire disk partitions, or
125 (i.e. those used like tapes).
127 Access restrictions to device nodes are usually subject to the regular
128 file permissions of the device node entry, instead of being enforced
129 directly by the drivers in the kernel.
130 .Ss Drivers without device nodes
131 Drivers for network devices do not use device nodes in order to be
132 accessed. Their selection is based on other decisions inside the
133 kernel, and instead of calling
135 use of a network device is generally introduced by using the system
138 .Ss Configuring a driver into the kernel
139 For each kernel, there is a configuration file that is used as a base
140 to select the facilities and drivers for that kernel, and to tune
143 for a detailed description of the files involved. The individual
144 manual pages in this section provide a sample line for the
145 configuration file in their synopsis portion. See also the sample
147 .Pa /sys/i386/conf/LINT
165 This man page has been written by
167 with initial input by
168 .An David E. O'Brien .