1 .\" Copyright (c) 1983, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 Berkeley Software Architecture Manual
34 William Joy, Robert Fabry,
36 Samuel Leffler, M. Kirk McKusick,
40 Computer Systems Research Group
41 Computer Science Division
42 Department of Electrical Engineering and Computer Science
43 University of California, Berkeley
45 .EH 'PSD:5-%''4.4BSD Architecture Manual'
46 .OH '4.4BSD Architecture Manual''PSD:5-%'
49 * UNIX is a trademark of Bell Laboratories.
51 This document summarizes the facilities
52 provided by the 4.4BSD version of the UNIX\|* operating system.
53 It does not attempt to act as a tutorial for use of the system
54 nor does it attempt to explain or justify the design of the
56 It gives neither motivation nor implementation details,
59 The first section describes the basic kernel functions
60 provided to a UNIX process: process naming and protection,
61 memory management, software interrupts,
62 object references (descriptors), time and statistics functions,
63 and resource controls.
64 These facilities, as well as facilities for
65 bootstrap, shutdown and process accounting,
66 are provided solely by the kernel.
68 The second section describes the standard system
70 files and file systems,
73 and process control and debugging.
74 These facilities are implemented by the operating system or by
75 network server processes.
92 .B "0. Notation and types"
96 .B "1. Kernel primitives"
101 \fB1.1. Processes and protection\fP
102 1.1.1. Host and process identifiers
103 1.1.2. Process creation and termination
104 1.1.3. User and group ids
105 1.1.4. Process groups
108 \fB1.2. Memory management\fP
109 1.2.1. Text, data and stack
111 1.2.3. Page protection control
112 1.2.4. Giving and getting advice
113 1.2.5. Protection primitives
120 1.3.3. Signal handlers
121 1.3.4. Sending signals
122 1.3.5. Protecting critical sections
127 \fB1.4. Timing and statistics\fP
133 \fB1.5. Descriptors\fP
134 1.5.1. The reference table
135 1.5.2. Descriptor properties
136 1.5.3. Managing descriptor references
137 1.5.4. Multiplexing requests
138 1.5.5. Descriptor wrapping
142 \fB1.6. Resource controls\fP
143 1.6.1. Process priorities
144 1.6.2. Resource utilization
145 1.6.3. Resource limits
149 \fB1.7. System operation support\fP
150 1.7.1. Bootstrap operations
151 1.7.2. Shutdown operations
158 \fB2. System facilities\fP
162 \fB2.1. Generic operations\fP
163 2.1.1. Read and write
164 2.1.2. Input/output control
165 2.1.3. Non-blocking and asynchronous operations
169 \fB2.2. File system\fP
172 2.2.3. Creation and removal
173 2.2.3.1. Directory creation and removal
174 2.2.3.2. File creation
175 2.2.3.3. Creating references to devices
176 2.2.3.4. Portal creation
177 2.2.3.6. File, device, and portal removal
178 2.2.4. Reading and modifying file attributes
179 2.2.5. Links and renaming
180 2.2.6. Extension and truncation
181 2.2.7. Checking accessibility
187 \fB2.3. Interprocess communication\fP
188 2.3.1. Interprocess communication primitives
189 2.3.1.1.\0 Communication domains
190 2.3.1.2.\0 Socket types and protocols
191 2.3.1.3.\0 Socket creation, naming and service establishment
192 2.3.1.4.\0 Accepting connections
193 2.3.1.5.\0 Making connections
194 2.3.1.6.\0 Sending and receiving data
195 2.3.1.7.\0 Scatter/gather and exchanging access rights
196 2.3.1.8.\0 Using read and write with sockets
197 2.3.1.9.\0 Shutting down halves of full-duplex connections
198 2.3.1.10.\0 Socket and protocol options
200 2.3.2.1. Types of sockets
202 2.3.2.3. Access rights transmission
203 2.3.3. INTERNET domain
204 2.3.3.1. Socket types and protocols
205 2.3.3.2. Socket naming
206 2.3.3.3. Access rights transmission
211 \fB2.4. Terminals and devices\fP
213 2.4.1.1. Terminal input
214 2.4.1.1.1 Input modes
215 2.4.1.1.2 Interrupt characters
216 2.4.1.1.3 Line editing
217 2.4.1.2. Terminal output
218 2.4.1.3. Terminal control operations
219 2.4.1.4. Terminal hardware support
220 2.4.2. Structured devices
221 2.4.3. Unstructured devices
225 \fB2.5. Process control and debugging\fP
229 \fBI. Summary of facilities\fP
242 .if t .ta .6i 2.1i 2.6i
243 .\" 2.94 went to 2.6, 3.64 to 3.30
244 .if n .ta .84i 2.6i 3.30i
247 .if t .ta .5i 1.25i 2.5i 3.5i
248 .\" 3.5i went to 3.8i
249 .if n .ta .7i 1.75i 3.8i 4.8i
252 .sh "Notation and types
254 The notation used to describe system calls is a variant of a
255 C language call, consisting of a prototype call followed by
256 declaration of parameters and results.
257 An additional keyword \fBresult\fP, not part of the normal C language,
258 is used to indicate which of the declared entities receive results.
259 As an example, consider the \fIread\fP call, as described in
262 cc = read(fd, buf, nbytes);
263 result int cc; int fd; result char *buf; int nbytes;
265 The first line shows how the \fIread\fP routine is called, with
267 As shown on the second line \fIcc\fP is an integer and \fIread\fP also
268 returns information in the parameter \fIbuf\fP.
270 Description of all error conditions arising from each system call
271 is not provided here; they appear in the programmer's manual.
272 In particular, when accessed from the C language,
273 many calls return a characteristic \-1 value
274 when an error occurs, returning the error code in the global variable
276 Other languages may present errors in different ways.
278 A number of system standard types are defined in the include file
280 and used in the specifications here and in many C programs.
281 These include \fBcaddr_t\fP giving a memory address (typically as
282 a character pointer),
283 \fBoff_t\fP giving a file offset (typically as a long integer),
284 and a set of unsigned types \fBu_char\fP, \fBu_short\fP, \fBu_int\fP
285 and \fBu_long\fP, shorthand names for \fBunsigned char\fP, \fBunsigned