Initial import from FreeBSD RELENG_4:
[dragonfly.git] / share / doc / psd / 05.sysman / 0.t
1 .\" Copyright (c) 1983, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)0.t 8.1 (Berkeley) 6/8/93
33 .\"
34 .if n .ND
35 .TL
36 Berkeley Software Architecture Manual
37 .br
38 4.4BSD Edition
39 .AU
40 William Joy, Robert Fabry,
41 .AU
42 Samuel Leffler, M. Kirk McKusick,
43 .AU
44 Michael Karels
45 .AI
46 Computer Systems Research Group
47 Computer Science Division
48 Department of Electrical Engineering and Computer Science
49 University of California, Berkeley
50 Berkeley, CA  94720
51 .EH 'PSD:5-%''4.4BSD Architecture Manual'
52 .OH '4.4BSD Architecture Manual''PSD:5-%'
53 .AB
54 .FS
55 * UNIX is a trademark of Bell Laboratories.
56 .FE
57 This document summarizes the facilities
58 provided by the 4.4BSD version of the UNIX\|* operating system.
59 It does not attempt to act as a tutorial for use of the system
60 nor does it attempt to explain or justify the design of the
61 system facilities.
62 It gives neither motivation nor implementation details,
63 in favor of brevity.
64 .PP
65 The first section describes the basic kernel functions
66 provided to a UNIX process: process naming and protection,
67 memory management, software interrupts,
68 object references (descriptors), time and statistics functions,
69 and resource controls.
70 These facilities, as well as facilities for
71 bootstrap, shutdown and process accounting,
72 are provided solely by the kernel.
73 .PP
74 The second section describes the standard system
75 abstractions for
76 files and file systems,
77 communication,
78 terminal handling,
79 and process control and debugging.
80 These facilities are implemented by the operating system or by
81 network server processes.
82 .AE
83 .LP
84 .bp
85 .ft B
86 .br
87 .sv 2
88 .ce
89 TABLE OF CONTENTS
90 .ft R
91 .LP
92 .sp 1
93 .nf
94 .B "Introduction."
95 .LP
96 .if t .sp .5v
97 .nf
98 .B "0. Notation and types"
99 .LP
100 .if t .sp .5v
101 .nf
102 .B "1. Kernel primitives"
103 .LP
104 .if t .sp .5v
105 .nf
106 .nf
107 \fB1.1.  Processes and protection\fP
108 1.1.1.  Host and process identifiers
109 1.1.2.  Process creation and termination
110 1.1.3.  User and group ids
111 1.1.4.  Process groups
112 .LP
113 .nf
114 \fB1.2.  Memory management\fP
115 1.2.1.  Text, data and stack
116 1.2.2.  Mapping pages
117 1.2.3.  Page protection control
118 1.2.4.  Giving and getting advice
119 1.2.5.  Protection primitives
120 .LP
121 .if t .sp .5v
122 .nf
123 \fB1.3.  Signals\fP
124 1.3.1.  Overview
125 1.3.2.  Signal types
126 1.3.3.  Signal handlers
127 1.3.4.  Sending signals
128 1.3.5.  Protecting critical sections
129 1.3.6.  Signal stacks
130 .LP
131 .if t .sp .5v
132 .nf
133 \fB1.4.  Timing and statistics\fP
134 1.4.1.  Real time
135 1.4.2.  Interval time
136 .LP
137 .if t .sp .5v
138 .nf
139 \fB1.5.  Descriptors\fP
140 1.5.1.  The reference table
141 1.5.2.  Descriptor properties
142 1.5.3.  Managing descriptor references
143 1.5.4.  Multiplexing requests
144 1.5.5.  Descriptor wrapping
145 .LP
146 .if t .sp .5v
147 .nf
148 \fB1.6.  Resource controls\fP
149 1.6.1.  Process priorities
150 1.6.2.  Resource utilization
151 1.6.3.  Resource limits
152 .LP
153 .if t .sp .5v
154 .nf
155 \fB1.7.  System operation support\fP
156 1.7.1.   Bootstrap operations
157 1.7.2.   Shutdown operations
158 1.7.3.   Accounting
159 .bp
160 .LP
161 .if t .sp .5v
162 .sp 1
163 .nf
164 \fB2.  System facilities\fP
165 .LP
166 .if t .sp .5v
167 .nf
168 \fB2.1.   Generic operations\fP
169 2.1.1.   Read and write
170 2.1.2.   Input/output control
171 2.1.3.   Non-blocking and asynchronous operations
172 .LP
173 .if t .sp .5v
174 .nf
175 \fB2.2.  File system\fP
176 2.2.1   Overview
177 2.2.2.  Naming
178 2.2.3.  Creation and removal
179 2.2.3.1.  Directory creation and removal
180 2.2.3.2.  File creation
181 2.2.3.3.  Creating references to devices
182 2.2.3.4.  Portal creation
183 2.2.3.6.  File, device, and portal removal
184 2.2.4.  Reading and modifying file attributes
185 2.2.5.  Links and renaming
186 2.2.6.  Extension and truncation
187 2.2.7.  Checking accessibility
188 2.2.8.  Locking
189 2.2.9.  Disc quotas
190 .LP
191 .if t .sp .5v
192 .nf
193 \fB2.3.  Interprocess communication\fP
194 2.3.1.   Interprocess communication primitives
195 2.3.1.1.\0   Communication domains
196 2.3.1.2.\0   Socket types and protocols
197 2.3.1.3.\0   Socket creation, naming and service establishment
198 2.3.1.4.\0   Accepting connections
199 2.3.1.5.\0   Making connections
200 2.3.1.6.\0   Sending and receiving data
201 2.3.1.7.\0   Scatter/gather and exchanging access rights
202 2.3.1.8.\0   Using read and write with sockets
203 2.3.1.9.\0   Shutting down halves of full-duplex connections
204 2.3.1.10.\0  Socket and protocol options
205 2.3.2.   UNIX domain
206 2.3.2.1.    Types of sockets
207 2.3.2.2.    Naming
208 2.3.2.3.    Access rights transmission
209 2.3.3.   INTERNET domain
210 2.3.3.1.    Socket types and protocols
211 2.3.3.2.    Socket naming
212 2.3.3.3.    Access rights transmission
213 2.3.3.4.    Raw access
214 .LP
215 .if t .sp .5v
216 .nf
217 \fB2.4.  Terminals and devices\fP
218 2.4.1.   Terminals
219 2.4.1.1.    Terminal input
220 2.4.1.1.1     Input modes
221 2.4.1.1.2     Interrupt characters
222 2.4.1.1.3     Line editing
223 2.4.1.2.    Terminal output
224 2.4.1.3.    Terminal control operations
225 2.4.1.4.    Terminal hardware support
226 2.4.2.   Structured devices
227 2.4.3.   Unstructured devices
228 .LP
229 .if t .sp .5v
230 .nf
231 \fB2.5.  Process control and debugging\fP
232 .LP
233 .if t .sp .5v
234 .nf
235 \fBI.  Summary of facilities\fP
236 .LP
237 .de sh
238 .ds RH \\$1
239 .bp
240 .NH \\*(ss
241 \s+2\\$1\s0
242 .PP
243 .PP
244 ..
245 .bp
246 .ds ss 1
247 .de _d
248 .if t .ta .6i 2.1i 2.6i
249 .\" 2.94 went to 2.6, 3.64 to 3.30
250 .if n .ta .84i 2.6i 3.30i
251 ..
252 .de _f
253 .if t .ta .5i 1.25i 2.5i 3.5i
254 .\" 3.5i went to 3.8i
255 .if n .ta .7i 1.75i 3.8i 4.8i
256 ..
257 .nr H1 -1
258 .sh "Notation and types
259 .PP
260 The notation used to describe system calls is a variant of a
261 C language call, consisting of a prototype call followed by
262 declaration of parameters and results.
263 An additional keyword \fBresult\fP, not part of the normal C language,
264 is used to indicate which of the declared entities receive results.
265 As an example, consider the \fIread\fP call, as described in
266 section 2.1:
267 .DS
268 cc = read(fd, buf, nbytes);
269 result int cc; int fd; result char *buf; int nbytes;
270 .DE
271 The first line shows how the \fIread\fP routine is called, with
272 three parameters.
273 As shown on the second line \fIcc\fP is an integer and \fIread\fP also
274 returns information in the parameter \fIbuf\fP.
275 .PP
276 Description of all error conditions arising from each system call
277 is not provided here; they appear in the programmer's manual.
278 In particular, when accessed from the C language,
279 many calls return a characteristic \-1 value
280 when an error occurs, returning the error code in the global variable
281 \fIerrno\fP.
282 Other languages may present errors in different ways.
283 .PP
284 A number of system standard types are defined in the include file
285 .I <sys/types.h>
286 and used in the specifications here and in many C programs.
287 These include \fBcaddr_t\fP giving a memory address (typically as
288 a character pointer), 
289 \fBoff_t\fP giving a file offset (typically as a long integer),
290 and a set of unsigned types \fBu_char\fP, \fBu_short\fP, \fBu_int\fP
291 and \fBu_long\fP, shorthand names for \fBunsigned char\fP, \fBunsigned
292 short\fP, etc.