Add nsswitch.conf.5 to man page build
[dragonfly.git] / share / man / man4 / intro.4
1 .\"
2 .\" Copyright (c) 1996 David E. O'Brien, Joerg Wunsch
3 .\"
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
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.
14 .\"
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.
25 .\"
26 .\" $FreeBSD: src/share/man/man4/intro.4,v 1.13.2.6 2002/01/09 15:36:51 ru Exp $
27 .\" $DragonFly: src/share/man/man4/intro.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
28 .\"
29 .Dd January 20, 1996
30 .Dt INTRO 4
31 .Os
32 .Sh NAME
33 .Nm intro
34 .Nd introduction to devices and device drivers
35 .Sh DESCRIPTION
36 This section contains information related to devices, device drivers
37 and miscellaneous hardware.
38 .Ss The device abstraction
39 Device is a term used mostly for hardware-related stuff that belongs
40 to the system, like disks, printers, or a graphics display with its
41 keyboard.  There are also so-called
42 .Em pseudo-devices
43 where a device driver emulates the behaviour of a device in software
44 without any particular underlying hardware.  A typical example for
45 the latter class is
46 .Pa /dev/mem ,
47 a loophole where the physical memory can be accessed using the regular
48 file access semantics.
49 .Pp
50 The device abstraction generally provides a common set of system calls
51 layered on top of them, which are dispatched to the corresponding
52 device driver by the upper layers of the kernel.  The set of system
53 calls available for devices is chosen from
54 .Xr open 2 ,
55 .Xr close 2 ,
56 .Xr read 2 ,
57 .Xr write 2 ,
58 .Xr ioctl 2 ,
59 .Xr select 2 ,
60 and
61 .Xr mmap 2 .
62 Not all drivers implement all system calls, for example, calling
63 .Xr mmap 2
64 on terminal devices is likely to be not useful at all.
65 .Ss Accessing Devices
66 Most of the devices in a unix-like operating system are accessed
67 through so-called
68 .Em device nodes ,
69 sometimes also called
70 .Em special files .
71 They are usually located under the directory
72 .Pa /dev
73 in the file system hierarchy
74 (see also
75 .Xr hier 7 ) .
76 .Pp
77 Each device node must be created statically and
78 independently of the existence of the associated device driver,
79 usually by running
80 .Xr MAKEDEV 8 .
81 .Pp
82 Note that this could lead to an inconsistent state, where either there
83 are device nodes that do not have a configured driver associated with
84 them, or there may be drivers that have successfully probed for their
85 devices, but cannot be accessed since the corresponding device node is
86 still missing.  In the first case, any attempt to reference the device
87 through the device node will result in an error, returned by the upper
88 layers of the kernel, usually
89 .Er ENXIO .
90 In the second case, the device node needs to be created before the
91 driver and its device will be usable.
92 .Pp
93 Some devices come in two flavors:
94 .Em block
95 and
96 .Em character
97 devices, or to use better terms, buffered and unbuffered
98 (raw)
99 devices.  The traditional names are reflected by the letters
100 .Ql b
101 and
102 .Ql c
103 as the file type identification in the output of
104 .Ql ls -l .
105 Buffered devices are being accessed through the buffer cache of the
106 operating system, and they are solely intended to layer a file system
107 on top of them.  They are normally implemented for disks and disk-like
108 devices only and, for historical reasons, for tape devices.
109 .Pp
110 Raw devices are available for all drivers, including those that also
111 implement a buffered device.  For the latter group of devices, the
112 differentiation is conventionally done by prepending the letter
113 .Ql r
114 to the path name of the device node, for example
115 .Pa /dev/rda0
116 denotes the raw device for the first SCSI disk, while
117 .Pa /dev/da0
118 is the corresponding device node for the buffered device.
119 .Pp
120 Unbuffered devices should be used for all actions that are not related
121 to file system operations, even if the device in question is a disk
122 device.  This includes making backups of entire disk partitions, or
123 to
124 .Em raw
125 floppy disks
126 (i.e. those used like tapes).
127 .Pp
128 Access restrictions to device nodes are usually subject to the regular
129 file permissions of the device node entry, instead of being enforced
130 directly by the drivers in the kernel.
131 .Ss Drivers without device nodes
132 Drivers for network devices do not use device nodes in order to be
133 accessed.  Their selection is based on other decisions inside the
134 kernel, and instead of calling
135 .Xr open 2 ,
136 use of a network device is generally introduced by using the system
137 call
138 .Xr socket 2 .
139 .Ss Configuring a driver into the kernel
140 For each kernel, there is a configuration file that is used as a base
141 to select the facilities and drivers for that kernel, and to tune
142 several options.  See
143 .Xr config 8
144 for a detailed description of the files involved.  The individual
145 manual pages in this section provide a sample line for the
146 configuration file in their synopsis portion.  See also the sample
147 config file
148 .Pa /sys/i386/conf/LINT
149 (for the
150 .Em i386
151 architecture).
152 .Sh SEE ALSO
153 .Xr close 2 ,
154 .Xr ioctl 2 ,
155 .Xr mmap 2 ,
156 .Xr open 2 ,
157 .Xr read 2 ,
158 .Xr select 2 ,
159 .Xr socket 2 ,
160 .Xr write 2 ,
161 .Xr hier 7 ,
162 .Xr config 8 ,
163 .Xr MAKEDEV 8
164 .Sh AUTHORS
165 .An -nosplit
166 This man page has been written by
167 .An J\(:org Wunsch
168 with initial input by
169 .An David E. O'Brien .
170 .Sh HISTORY
171 .Nm Intro
172 appeared in
173 .Fx 2.1 .