Lions - A Commentary On The Unix Operating System 197705
Lions - A Commentary On The Unix Operating System 197705
COMMENTARY
ON THE
UNIX
OPERATING
SYSTEM
JOHN LIONS
4. An Overview
1. Introduction
Variable Allocation 4-1
The UNIX Operating System 1-1 Global Variables 4-1
Utilities 1-1 The 'c' Preprocessor 4-1
Other Documentation 1-1 Section One 4-2
UNIX Programmer's Manual 1-2 The First Group of '.h' Files 4-2
UNIX Documents 1-2 Assembly Language Files 4-2
UNIX Operating System Source Code 1-2 Other Files in Section One 4-2
Source Code Sections 1-3 Section Two 4-3
Source Code Files 1-3 Section Three 4-3
Use of these notes 1-3 Section Four 4-3
A Note on Programming Standards 1-3 Section Five 4-4
It is the UNIX Time-sharing System, There seem to be three main approaches In our opinion, it is highly beneficial
which runs on the larger models of to teaching Operating Systems. for students to have the opportunity to
Digital Equipment Corporation's PDPII study a working operating system in all
computer system, and was developed by its aspects.
Ken Thompson and Dennis Ritchie at Bell First there is the "general principles"
Laboratories. It was first announced to approach, wherein fundamental princi
the world in the July, 1974 issue of pIes are expounded, and illustrated by Moreover it is undoubtedly good for
the "Communications of the ACM". references to various existing systems, students majoring in Computer Science,
(most of which happen to be outside the to be confronted at least once in their
students' immediate experience). This careers, with the task of reading and
Very soon in our experience with UNIX, is the approach advocated by the COSINE understanding a program of major dimen-
it suggested itself as an interesting Committee, but in our view, many stu- sions.
candidate for formal study by students, dents are not mature or experienced
for the following reasons: enough to profit from it.
Section III contains "subroutines" The tutorials on "C" and the edi- a number of comments consisting of
which are- library routines which tor, and the reference manuals for a line of underscore characters
may be called from a user program. "C" and the assembler are highly have been introduced, particularly
To the ordinary programmer, the useful unless you are completely at the end of procedures;
distinctions between Sections II expert;
and III often appear somewhat the size of each file has been
arbitrary. Most of Section III IS The UNIX I/O System provides a -"
adjusted to an exact multiple Ui.
irrelevant to the operating sys- good--o\Tervlew of many features of 5~ lines by padding with blank
tem; the operating system; lines;
adc Add the contents of the C bit to clc Clear C; rtt Return from interrupt or trap.
the destination; Reload both pc and ps from the
clr Clear destination to zero; stack;
add Add the source to the destination;
Compare the source and destination sbc Subtract the carry bit from the
ash Shift the contents of the defined to set the condition codes. N is destination;
register left the number of times set if the source value is less
specified by the shift count. (A than the destination value; sob Subtract one from the designated
negative value implies a right register. If the result is not
shift. ) ; dec Subtract one from the contents of zero, branch back "offset" words;
the destination;
ashc Similar to "ash" except that two sub Subtract the source from the des-
registers are involved; div The 32 bit two's complement tination;
integer stored in rn and r(n+l)
asl Shift all bits one place to the (where n is even) is divided by swab Exchange the high and low order
left. Bit 0 becomes 0 and bit 15 the source operand. The quotient bytes in the destination;
is loaded into C; is left in rn, and the remainder
in r (n+l) ; tst Set the condition codes, Nand Z,
asr Shift all bits one place to the according to the contents of the
right. Bit 15 is replicated and inc Add one to the contents of the destination;
bit 0 is loaded into C; destination;
wait Idle the processor and release the
beq Branch if equal, i.e. if Z = 1; ~ Jump to the destination; Unibus until a hardware interrupt
occurs.
Branch if greater than or equal Jump to subroutine. Register
to, i.e. if N = V; values are shuffled as follows:
The page description register defines: SR0 contains abort error flags and 0760000 to 0777777
other essential information for
(a) the size of the lower part of the operating system. In particu-
the page. (The number stored is lar memory management is enabled
actually the number of 32 word when bit 0 of SR0 is on; Special Device Registers
blocks less one);
SR2 is loaded with the 16 bit vir- The high page of physical memory is
(b) a bit which is set when the tual address at the beginning of reserved for various special registers
upper part is the valid part. each instruction fetch. associated with the processor and the
(Also known as the "expansion peripheral devices. By sacrificing one
direction" bit); page of memory space in this way, the
PDPll designers have been able to make
(c) access mode bits defining "no "i" and "~" Spaces the various device registers accessible
access" or "read only access" or without the need to provide special
"read/write access". In the PDPll/45 and 11/70 systems, instruction types.
there are additional sets of segmenta-
tion registers. Addresses created using
Note that if the valid part is null, the pc register (r7) are said to belong The method of assignment of addresses
this fact must be shown by setting the to "i" space, and are translated by a to registers in this page is a black
access bits to "no access". different set of segmentation registers art: the values are hallowed by tradi-
from those used for the remaining tion and are not to be questioned.
addresses which are said to belong to
"d" space.
-000-
Memory Allocation The advantage of this arrangement is
that both Hi" and lid" spaces may occupy
The hardware does not dictate the way up to 32K words, thus allowing the max-
areas in physical memory which imum space which can be allocated to a
correspond to the valid parts of pages program to be increased to twice the
semicolons; Example 1
n=n and "==";
"{n and "}"; The next example is a little less
"++n and " __ "; trivial:
declarations;
register variables; 6566 nodev ()
"if" and "for" statements; {
etc. u.u error ENODEV;
fp 1= NULL There are a number of similarities invokes the procedure "setrun" passing
between this example and the previous the value of "pH as a parameter. (All
is true, and as a term in an arithmetic one. We have a new concept however, an parameters are passed by value.)
expression, is accorded the value one. array of structures. To be just a
This value is greater than zero, and little confusing, in this example it
hence the statement turns out that both the array and the The relation
structure are called "procH (yes, "C"
return (fp); allows this). They are declared on
When a character is loaded into a six- There are two additional features you
teen bit register, sign extension may may need to know about: This is an example of a very useful
occur. By "and"ing the word with 0377 construction in UNIX, which can save
any extraneous high order bits are the programmer much labour. If "I" is
eliminated. Thus the result returned "&&" is the logical conjunction ("and") any binary operator, then
is simply a character. for relational expressions. (Cf. "II"
introduced earlier.) x = x I a;
Note that any integer which begins with where "a" is an expression, can be
a zero (e.g. 0377) is interpreted as an The last statement contains the expres- rewritten more succinctly as
octal integer. sion
x =1 a; .
&runout
The second example is: A programmer using this construction
which is syntactically an address vari- has to be careful about the placement
1771 nseg(n) able but semantically just a unique bit of blank characters. Since
( pattern.
return «n+127) »7) ; x =+ 1;
case 9:
Example 14 case 3:
Example 13
8870 Ipwrite ()
3949 signal (tp, sig) {
{ register int c:
register struct proc *p: while «c=cpass (» >= 0)
for (p=proc:p<&proc[NPROC]:p++) Ipcanon(c) :
if (p->p ttyp == tp) Note the array declaration for the two
psignaI (p,sig): word array Un", and the use of "getf"
(which appeared in Example 4).
This is an example of the "while"
statement, which should be compared
In this example of the "for" statement, with the "do .•. while "construc- The "switch" statement makes a multi-
the pointer variable "p" is stepped tion encountered earlier. (Cf. the way branch depending on the value of
through each element of the array "while" and "repeat" statements of Pas- the expression in parentheses. The
"proc" in turn. cal. ) individual parts have "case labels":
variable Allocation
The 'f' Preprocessor
The PDPII architecture allows efficient
access to variables whose absolute If global declarations must be repeated
address is known, or whose address in full in each file (as is required by
relative to the stack pointer can be Fortran, for instance) then the bulk of
determined exactly at compile time. the program is increased, and modifying
a declaration is at best a nuisance,
and at worst, highly error-prone.
There is no hardware support for multi-
CHAPTER FOUR ple lexical levels for variable
declarations such as are available in These difficulties are avoided in UNIX
An Overview block structured languages such as by use of the preprocessor facility of
Algol or Pascal. Thus "C" as imple- the "C" compiler. This allows declara-
mented on the PDPll supports only two tions for most global variables to be
lexical levels: global and local. recorded once only in one of the few
".h" files.
The purpose of this chapter is to sur-
vey the source code as a whole i.e. to Global variables are allocated stati-
present the "wood" before the "trees". cally; local variables are allocated Whenever the declaration for a particu-
dynamically within the current stack lar global variable is required the
area or in the general registers (r2, appropriate ".h" file can then be
Examination of the source code will r3 and r4 are used in this way). "included" in the file being compiled.
reveal that it consists of some 44 dis-
tinct files, of which:
UNIX also uses the ".h" files as vehi-
two are in assembly language, and Global Variables cles for lists of standard definitions
have names ending in ".s"; for many symbolic names which represent
In UNIX with very few exceptions, the constants and adjustable parameters,
28 are in the "C" language and declarations for global variables have and for declaration of some structure
have names ending in ".e" ; been all gathered into the set of ".h" types.
files. The exceptions are:
14 are in the "C" language, but
are not intended for independent (a) the static variable "p" (2l8~) For example, if the file "bottle.c"
compilation, and have names ending declared in "swtch" which is contains a procedure "glug" which
in ".h". stored globally, but is accessi- references a global variable called
ble only from within the pro- "gin" which is declared in the file
cedure "swtch". (Actually "pH is "box.h", then a statement:
The files and their contents were a very popular name for local
arranged by the programmers presumably variables in UNIX.); jlinclude "box.h"
to suit their convenience and not for
CHAPTER FIVE
The declarations of "coremap· and
Two Files "swapmap" are on lines e293, 1!21!4.
Here the "map" structure is completely
ignored a regrettable programming
short-cut which is possible because it
is not detected by the loader. Thus the
This chapter is intended to provide a actual numbers of list elements in
gentle introduction to the source code "coremap" and "swapmap" are "CMAPSIZ/2"
by looking at two files in Section One and "SMAPSIZ/2" respectively.
which can be isolated reasonably well
from the rest.
an area of size 15 beginning at malloc (2528) 2542: The "while" continuation condi-
location 47 and ending at location tion does not test the equality
61; The body of this procedure consists of of " (bp-l)->m size" and
a "for" loop to search the "map" array "bp->m_size"! -
an area of size 13 spanning until either:
addresses 27 to 39 inclusive; The value tested is the value
(a) the end of the list of available .. assign-ed to "(bp-l) ->m. sbe"
an area of size 7 beginning at resources is encountered; or . co.piedfrom "bp->m_size". -
location 65.
(b) an area large enough to honour (You are forgiven for: not
the current request is found; recognising this at .once.);
Then the "map" would contain:
2534: The "for" statement initialises 2543: Return the address of the area.
Entry Size Address "bp" to point to the first ele- This represents the end of the
27 ment of the resource map. At procedure and hence very defin-
"
1
2
13
15
7
47
65
each succeeding iteration "bp" is
incremented to point to the next
itely the end of the "for" loop.
3 ?? "map" structure. Note that a value of zero
4 "
?? ??
Note that the continuation condi-
returned means "no luck". This is
based on the assumption that no
tion "bp->m size" is an expres- valid area can ever begin at
If a request for a space of size 7 were sion, which becomes zero with the location zero.
received, the area would be allocated sentinel is referenced. This
starting at location 27, and the "map" expression could have been writ-
would become: ten equivalently but more tran-
sparently as "bp->m_size>"".
Included Files
CHAPTER SEVEN At this level the processes themselves (e) a process may acquire and pos-
are considered to be the active enti- sess resources of various kinds.
Processes ties in the system, while the identi-
ties of the true active elements, the
processor and the peripheral devices,
are submerged: the processes are born, ~ Process Image
live and die~ they exist in varying
The previous chapter traced the numbers; they may acquire and release Ritchie and Thompson in their paper
developments which occur after the resources; they may interact, define a "process" as the execution of
operating system has been "rebooted", cooperate, conflict, share resources; an "image", where the "image" is the
and in so doing introduced a number of etc. current state of a pseudo-computer,
significant features of the process i.e. an abstract data structure, which
concept. One of the aims of this may be represented in either main
chapter is to go back and re-explore At the lower level, "processes" are memory or on disk.
some of the same ground more inactive entities which are acted on by
thoroughly. active entities such as the processor.
By allowing the processor to switch The process image involves two or three
frequently from the execution of one physically distinct areas of memory:
There are a number of serious difficul- process image to another, the impres-
ties in providing a generally accept- sion can be created that each of the (1) the "procH structure, which is
able definition of "process". These are process images is developing continu- contained within the core
akin to the difficulties faced by the ously and this leads to the upper level resident "procH array and is
philosopher who would answer "what is interpretation. accessible at all times;
life?" We will be in good company if we
brush the more subtle points lightly (2) the data segment, which con-
aside. sists----ot the "per process data
CHAPTER EIGHT A process which has called "sleep" and "sched" is executed by process #I!,
suspended itself may be returned to the which after completing its initial
Process Management "ready to run" state by another pro- tasks, spends its time in a double
cess. This often occurs during the role: openly as the "scheduler" i.e. a
handling of interrupts when the process normal kernel process; and surrepti-
handling the interrupt calls "setrun" tiously as the intermediate process of
(2134) either directly or indirectly "swtch" (discussed in Chapter Seven).
Process management is concerned with via a calIon "wakeup" (2113). Since the procedure "sched" never ter-
the sharing of the processor and the minates, kernel process #I! never com-
main memory amongst the various pletes its task, and so the question of
processes, which can be seen as com- a user process #I! does not arise.
petitors for these resources. Interrupts
It should be noted that a hardware
Decisions to reallocate resources are interrupt (see Chapter Nine) does not Jobs
made from time to time, either on the directly cause a calIon "swtch" or its
initiative of the process which holds equivalent. A hardware interrupt will There is no concept of "job" in UNIX,
the resource, of for some other reason. cause a user process to revert to a at least in the sense in which this
kernel process, which as just noted, term is understood in more conven-
may call "swtch" as an alternative to tional, batch processing oriented sys-
reverting to user mode after the inter- tems.
Process Switching rupt handling is complete.
Any process may "fork" a new copy of
An active process may suspend itself itself at any time, essentially without
i.e relinquish the processor, by cal- If a kernel process is interrupted, delay, and hence create the equivalent
ling "swtch" (2178) which calls " retu" then after the interrupt has been han- of a new job. Hence job scheduling,
(1!7U) • dled, the kernel process resumes where job classes, etc. are non-events here.
(a) "main" (1564) calls "fuibyte" 0846: The argument is moved to rl;
repeatedly until a negative
value is returned. This will 0848: "gword" is called;
occur after a "bus timeout
error" has been encountered with 0852: The current PS is stored on the
a subsequent trap to vector stack;
location 4 (line 0512);
0853: The priority level is raised to 7
(b) The clock has been set running (to disable interrupts);
and will generate an interrupt
every clock tick i.e. 16.7 or 20 0854: The contents of the location
milliseconds; "nofault" (1466) are saved in the
stack;
(c) Process *1 is about to execute a
"trap" instruction as part of 0855: "nofault" is loaded with the
the system calIon "exec". address of the routine "err";
"main" uses both "fuibyte" and "fui- 0857: The value is transferred from the
word". Since the former is more compli- stack to r0;
cated in a non-essential way, we leave
it to the reader, and concentrate on 0876: The previous values of "nofault"
the latter. and PS are restored;
Note that with "fuiword", there is an 0512: The new PC will have the value of
This code is found between lines 0750 ambiguity which does not occur with "trap". The new PS will indicate:
and 0805, and has two entry points, "fuibyte", namely a returned value of
"trap" (0755) and "call" (0766). There -1 may not necessarily be an error present mode kernel mode
are several different and relevant indication but the actual value in the previous mode kernel mode
paths through this code and we shall user space. Convince yourself that for priority 7;
trace some examples of these. the way it is used in "main", this does
not matter. 0756: The next instruction executed is
the first instruction of "trap".
This saves the processor status
Sources of Traps and Interrupts Also the code does not distinguish word two words beyond the current
between a "bus timeout error" and a "top of stack". (This is not
The discussion in Section One intro- "segmentation error". relevant here.);
duced three places where the occurrence
Both clock vector locations, 100 and If the previous mode is kernel If "runrun > 0", then another, higher
104, have the same information. PC is mode the branch 1S taken (0784). priority, process 1S waiting. The pro-
set to the address of the location PS is changed to show the previous cessor priority is reset to 0, allowing
labelled "kwlp" (0568) and PS is set to mode as user mode (0798); any pending interrupt to be taken. A
show: call is then made to "swtch" (2178), to
0799: The specialised interrupt han- allow the higher priority process to
present mode kernel mode dling routine pointed to by r0 is proceed. When the process returns from
previous mode kernel or user mode entered. (In this case it is the "swtch", the program loops back to
priority 6 routine "clock", which is dis- repeat the test.
cussed in detail in the next
chapter.)
Note. The PS will contain the true pre- The above discussion obviously extends
vious mode, regardless of the value 0800: When the "clock" routine (or some to all interrupts. The only part which
picked up from the vector location. other interrupt handler) returns, relates specifically to the clock
the top two words of the stack interrupt is the calIon the special-
0570: The vector location contains a are deleted. These are the ised routine "clock".
new PC value which is the address masked copy of the PS and the
of the statement labelled "kwlp". copy of the stack pointer;
This instruction is a subroutine
calIon "call" via r0. 0802: rl is restored from the stack; User Program Traps
After the execution of this 0803: Delete the copy of PS from the The "system call" mechanism which
instruction, r0 is left with the stack; enables user mode programs to calIon
address of the code word after the operating system for assistance,
the instruction which contains 0804: Restore the value of r0 from the involves the execution by the user mode
" clock", i.e. r0 contains the stack; program of one of 256 versions of the
address of the address of the "trap" instruction. (The nversionn is
"clock" routine in the file 0805: Finally the "rtt" instruction the value of the low order byte of the
"clock.c" (3725). returns to the "kernel" mode instruction word.)
enced (2161, 3814), the top eight if the number of such processes ever (1962, 2009) to determine which
bits are masked off after the becomes large. processes to swap in or out.
value has been transferred to a
special register; 3820: If the scheduler is waiting to
In this situation, a mechanism similar rearrange things, wake it up.
3797: Increment "lbolt" and if it to the "callout" array (see 3767) would Thus the normal rate for schedul-
exceeds "HZ", i.e. a second or need to be provided. (In fact, how dif- ing decisions is once per second;
more has elapsed .•. ficult would it be to merge the two
mechanisms? What would be the disadvan- 3824: If the previous mode before the
3798: Then provided the processor was tages ??); interrupt was "user mode", store
not previously running at a non- the address of "r0" in a standard
zero priority, do a whole lot of 3806: When the last two bits of place, and if a "signal" has been
housekeeping; "time[l]" are zero i.e. every received for the process, call
four seconds, reset the schedul- "psig" (4043) for the appropriate
3800: Decrement "lbolt" by "HZ"; ing flag "runrun" and wake up action.
everything waiting for a "light-
3801: Increment the time of day accumu- ning bolt". ("lbolt" represents a
lator; general event which is caused
every four seconds, to initiate timeout (3845)
3803: The events which follow may take miscellaneous housekeeping. It is
some time, but they may reason- used by "pcopen" (8648).); This procedure makes new entries in the
ably be interrupted to service "callout" array. In this system it is
other peripherals. So the proces- 3810: For all currently defined only called from the routine "ttstart"
sor priority is dropped below all processes: (8505), passing the procedure "ttrstrt"
the device priority levels i.e. (8486). Note that "ttrstrt" calls
below four. increment "p time" up to a maximum "ttstart", which may call "timeout",
of 127 (it- is only a character for a thoroughly incestuous relation-
However there is now a possibil- variable) ; ship!
ity of another clock interrupt
before this activation of the decrement "p_cpu" by "SCHMAG" Note also that most of "timeout" runs
"clock" procedure is completed. (3707) but do not allow it to go at priority level seven, to avoid clock
By setting the processor priority negative. Note that as discussed interrupts.
to one rather than to zero, a earlier (line 3795) "p_cpu" is
The "trap" procedure can operate as At this point we can observe that UNIX
though it had been called by another divides traps into three classes,
"CO procedure in the normal way with depending on the prior processor mode
seven parameters and the source of the trap:
dev, sp, rl, nps, r0, pc, ps. (A) kernel mode;
2733: Apart from the one special case 2822: "psig" performs the appropriate The "C" compiler does not give special
noted, the treatment of illegal actions. (Both "issig" and "psig" recognition to system calls, but treats
instructions is the same at this are discussed in detail in the them in the same way as other pro-
level as for bus errors; next chapter.); cedures. When the loader comes to
resolve undetermined references, it
2739: 2823: Recalculate the priority for the satisfies these with library routines
2743: current process. which contain the actual "trap"
2747: instructions.
2796: Cf. the comment for line 2721.
2752: The error indicators are reset;
System Calls
Note that cases "4+USER" (power fail) 2754: The user mode instruction which
and "7+USER" (programmed interrupt) are User mode programs use "trap" instruc- caused the trap is retrieved and
handled by the "default" case (line tiQns as part of the "system call" all but the least significant six
2715) . mechanism to call upon the operating bits are masked off. The result
system for assistance. is used to select an entry from
the array of structures,
"ssig" (3614) implements system call Q. Tracing 3639: Consider each entry in the "proc"
#48 ("signal") to set the value in one table in turn and reject it if:
element of the array "u.u_signal". "ptrace" (4164) implements the "ptrace" it is the current process (3640);
system call lt26. it is not the designated process
(3642) ;
no particular process was desig-
B. Causation "stop" (4016) is called by "issig" nated ("a" == 0) but it does not
(3999) for a process which is being have the same controlling termi-
"kill" (3630) implements system call traced to allow the supervising parent nal, or it is one of the two ini-
#~ ("kill") to cause a specified to have a "look-see". tial processes (3644);
interrupt to a process defined by its the user is not the "super user"
process identifying number. and the user identities do not
"procxmt" (4204) is a procedure called match (3646);
from "stop" (4028) whereby the child
"signal" (3949) causes a specified carries out certain operations related 3649: For any process that survives the
interrupt to be caused for all to tracing, at the behest of the above tests, call "psignal" to
processes controlled and/or initiated parent. change "p_sig".
from a specified terminal.
(4) the parent then goes to "sleep" 4023: Otherwise look through "procH for Note that this code handles the on~y
while the child "wakes up"~ your parent ••• wake him up explicit action the child process lS
declare yourself ~stopped" and asked to take with respect to tracing.
(5) the child reads the message in call "swtch" (Note do NOT There is no real reason why even this
"ipc" and acts upon it (e.g. call "sleep". Why?)~ action should be taken by the child
copying one of its own values process and not by the parent process.
4187: reset the "SWTED" flag, and ••• In the second case, where the parent
has ignored the child, "procxmt"_ will _
4188: return the child to a "ready to never in fact be called.
run" state;
4189: Sleep until "ipc.ip req" is non- By executing the statement "return
positive (4212); (0);" on line 4210, "procxmt" forces
"stop" to loop back to line 4020. In
4191: Extract a value that is to be the case where the parent has already
returned to the parent process, died, the test on line 4022 will then
check for errors, unlock "ipc" fail, and a calion "exit" (4032) will
and "wake up" any processes wait- resul t.
ing for "ipc".
4211: Store the value of "ipc.ip req"
before resetting the latter,
Note that the "sleeps" on lines 4182, "wake up" the parent, and select
4190 are for essentially different rea- the next action as indicated.
sons, and could be differentiated to
good effect by replacing "&ipc" by
"&ipc.ip_req" on lines 4190 and 4213. The various actions are adequately
explained in Section "PTRACE (II)" of
the UPM, with the one qualification
that cases 1, 2 and 4, 5 are documented
procxmt (4204) the wrong way around (i.e. "I" and "0"
spaces respectively, not "0" and "I"!).
This procedure is executed by the child
process under the influence of data
left by the parent in the "ipc" struc-
ture. -000-
Software Interrupts
UNIX Operating System 13-6
Most of the decisions regarding "swap-
ping out", and all the decisions
regarding "swapping in", are made by
the procedure "sched". "swapping in" is
handled by a direct call (2034) on the
procedure "swap" (5196), whereas "swap-
ping out" is handled by a call (2024)
on "xswap" (4368).
Section Three is concerned with basic
input/output operations between the For those archaeologists who like to
main memory and disk storage. ponder the "bones" of earlier versions
of operating systems, it seems that
originally "sched" called "swap"
These operations are fundamental to the directly to "swap out" processes,
activities of program swapping and the rather than via "xswap". The extra pro-
creation and referencing of disk files. cedure (one of several to be found in
the file "text.c") has been necessi-
tated by the implementation of the
This section also introduces procedures sharable "text segments".
for the use and manipulation of the
large (512 byte) buffers.
It is instructive to estimate how much
extra code has been necessitated by the
text segment feature: in "text.c" are
four procedures "xswap", "xalloc",
"xfree" and "xccdec", which manipulate
an array of structures called "text",
which is declared in the file "text.h".
Additional code has also been added to
"sysl.c" and "slp.c".
CHAPTER FOURTEEN
Program Swapping
Text Segments
Text segments are segments which con-
tain only "pure" code and data i.e.
UNIX, like all time-sharing systems, code and data which remain unaltered
and some multiprogramming systems uses throughout the program execution, so
"program swapping" (also called "roll- that they may be shared amongst several
in/roll-out") to share the limited processes executing the same program.
resource of the main physical memory
among several processes.
The resulting economies in space can be
quite substantial when many users of
Processes which are suspended may be the system are executing the same pro-
selectively "swapped out" by writing gram simultaneously e.g. the editor or
their data segments (including the "per the "shell".
process data") into a "swap area" on
disk
Information about text segments must be
stored in a central location, and hence
The main memory area which was occupied the existence of the "text" array. Each
can then be reassigned to other program which shares a text segment
processes, which quite probably will be keeps a pointer to the corresponding
"swapped in" from the "swap area". text array element in "u.u_textp".
closef (6643)
read (f; b; n) i /*user program*/
"closef" is called by "close" (5854) Deletion of Files
and by "exit" (3230). (The latter is {trap occurs}
more common since most files do not get New files are automatically entered
closed explicitly but only implicitly into the file directory as permanent 2693 trap
when the user program terminates.) files as soon as they are "opened".
Subsequent "closing" of a file does not {system call :ft3}
automatically cause its deletion. As
was seen at line 7352, deletion will 5711 read ( );
6649: If the file is a pipe, reset the occur when the field "i nlink" of the 5713 rdwr (FREAD);
mode of the pipe and "wakeup" any core "inode" entry is ziro. This field
process which is waiting for the is set to one initially by "maknode"
pipe, either for information or (7464) when the file is first created. Execution of the system call by the
for space; It may be incremented by the system user process results in the activation
call "link" (5941) and decremented by of "trap" running in kernel mode.
6655: If this is the last process to the system call "unlink" (3529). "trap" recognises system call #3, and
reference the file, call "closei" calls (via "trapl") the routine "read",
(6672) to handle any special end which calls "rdwr".
of file processing for special
files and then call "iput"; 5731 rdwr
Programs which create temporary "work
6657: Decrement the "file" entry refer- files" should remove these files before 5736 fp = getf (u.u_ar0[R0]);
ence count. If this now zero, the terminating, by executing an "unlink" 5743 u.u base = u.u arg[0];
entry is no longer allocated. system call. Note that the "unlink" 5744 u.u-count = u.u arg[l];
call does not of itself remove the 5745 u.u-segflg = 0;-
file. This can only happen when the 5751 u.u-offset[l] = fp->f offset[l];
reference count ("i count") is about to 5752 u.u-offset[0] = fp->f-offset[0];
be decremented to ziro (7350, 7362). 5754 readi(fp->f inode); -
5756 dpadd(fp->f-offset,
"closei", as its last action calls u.u=arg[l]-u.u_count) ;
"iput". This routine is in fact called To minimise the problems associated
from many places, whenever a connection with "temporary" files which survive
to a core "inode" is to be severed and program or system crashes, programmers "rdwr" includes much code which is com-
the reference count decremented. should observe the conventions that: mon to both "read" and "write" opera-
tions. It converts, via "getf" (6619),
(a) temporary files should be the file identification supplied by the
"unlinked" immediately after user process into the address of an
7350: If the reference count is one at they are opened; entry in the "file" array.
this point, the "inode" is to be
released. While this is happen- (b) temporary files should always be
ing, it should be locked. placed in the "tmp" directory. Note that the first parameter of the
Unique file names can be gen- system call is passed in a different
7352: If the number of "links" to the erated by incorporating the way from the remaining two parameters.
file is zero (or less) the file process's identifying number
is to be deallocated (s~e below); into the file name (See "getpid"
(3480») • "u.u segflg" is set to zero to indicate
7357: "iupdat" (7374) updates the that- the operation destination is in
accessed and update times as the user address space. After "readi"
storage device: a device which can The 'Super Block' (5561) sumount (6144) is a system call
store information (especially disk whIch deletes entries from the
pack or DECtape, etc.); The "super block" is always recorded as table.
block #1 on the storage device. (Block
access device: a mechanism for #0 is always ignored and is available
transferring information to or for miscellaneous uses not necessarily
from a storage device; concerned with UNIX.)
7789: A process waiting for input will Unlock the "inode" and "wake" any wait-
A "pipe" is created as the result of a raise the "IREAD" flag. Since a ing processes. This procedure is called
system calion the "pipe" procedure. pipe cannot be full and empty by several others (especially "iput"),
simultaneously, no more than one in addition to "readp" and "writep".
7728: Allocate an "inode" for the root of the flags "IWRITE" or "IREAD"
device; should be set at one time; -000-
Section Five is the final section: last The standard UNIX device handlers for
but not least. It is concerned with character devices make use of the pro-
input/output for the slower, character cedures "putc" and "getc" which store
oriented peripheral devices. and retrieve characters into and from a
standard buffer pool. This will be
described in more detail in Chapter
Such devices share a common buffer Twenty-Three.
pool, which is manipulated by a set of
standard procedures.
The "PDPII Peripherals Handbook" should
be consulted for more complete informa-
The set of character oriented peri- tion on the device controller hardware
pheral devices are exemplified by the and the devices themselves.
following:
(b) the current line is not empty; or 8954: Provided the current character (2). This routine pays a little more
count does not exceed the maximum attention to error conditions than the
(c) some lines have been completed line length, output blank charac- line printer driver, but the treatment
since the last "form feed" char- ters to bring the maximum charac- is still not exhaustive;
acter. then '" ter count to the current charac-
ter count. (Perhaps these two
3925: reset "lpll.mcc" to zero; variables would be more accu- (3). "passc" (8695) knows how many
rately called the "actual charac- characters are required and returns a
8926: Increment the completed line ter count" and the "logical char- negative value when "enough" is
count; acter count".); reached;
8927: Convert a "new line" character to 8959: Output the actual character.
a "form feed" if sufficient lines (4). "pcclose" is careful to flush out
have been completed on the any remaining characters in the input
current page, and the printer has queue if and only if it believes the
a "form feed" capability; For idle readers: A suggestion device was opened for input.
8929: Output the character, and i f i t It will be observed that backspaces for -000-
was a "form feed", reset the overprinting or underscoring characters
number of completed lines to introduce separate print cycles, and
zero; where these features are in heavy use,
the effective output rate of the
printer may be drastically reduced. If
Examination of this code will show this is considered a serious problem,
that: "lpcanon" could be rewritten to ensure
that no more than two print cycles are
Figure 23·1
The answer (if you have not already
guessed) involves looking at the value
$ $' $ of the pointer address modulo 8. Since
g m division by eight is easily performed
CHAPTER TWENTY-THREE h ' n' on a binary computer, the reason for
i 0 the choice of six charac~ers per
Character Handling 13 j, P "cblock" should now also be apparent.
head k q
tail f ,1 r
The addition of a character to the list
is illustrated in the change between
Buffering for character special devices Figure 23.~ Figure 23.3 and Figure 23.4.
is provided via a set of four word
blocks, each of which provides storage $ :$ $1
for six characters. The prototype g m' s
storage block is "cblock" (81413) which Initially the list is assumed to con- h n
incorporates a word pointer (to a simi- tain the fourteen characters i 0
lar structure) along with the six char- "efghijklmnopqr". Note that the head 13 j 'p
acters. and tail pointers point to characters. !head $ k q
If the first character, "e", is removed tail $i 1 r
by "getc", the situation portrayed in
Structures of type "clist" (79138) which Figure 23.1 changes to that of Figure
contain a character counter plus a head 23.2. The character count has been Figure Q.!,
and tail pointer are used as "headers" decremented and the head pointer has
for lists of blocks of type "cblock". been advanced by one character posi-
tion.
Since thi last "cblock" in Figure 23.3
"cblock"s which are not in current use was' full, a new one has been obtained
are linked via their head pointers into If a further character, "f", is removed from "cfreelist" and linked into the
a list whose head is the pointer from the head of the list, the list of "cblock"s. The character count
};
The other non-null characters in "map-
tab" are involved in the translation of
input characters from "upper case only"
devices and do not occur in their Each element of "par tab" is an eight
"natural" locations but in the location bit character, which, with the use of
of their equivalent character, e.g. "I" appropriate bitmasks (0200 and 0177) ,
occurs in the natural location for "en, can be interpreted as a two part struc-
since "\(n will be interpreted as "I", ture:
etc.
bit 7 parity bit;
bits 3-6 not used. Always zero;
Note the situation regarding alphabetic bits 0-2 code number.
characters. This is only explicable
when it is remembered that the alpha-
betic characters are all translated to The parity bit is appended to the seven
lower case before any backslash is bit ASCII code when a character is
recognised. transmitted by the computer, to form an
eight bit code with even parity.
The items in Group B of Table 24.1 may klsgtty (8090) RAW 5 input characters are to be
be changed by a "stty" system call. sent to the program exactly as
The current values may be interrogated This is an example of a "d sgtty" rou- received, without "erase" or
by a "gtty" system call. tine. It calls "ttystty" passing a "kill" processing, or adjust-
pointer to the appropriate "tty" struc- ment for backslash characters.
ture as a parameter.
A description of these is contained in
the sections, "STTY(II)" and "GTTY(II)"
of the UPM. These calls are invoked by In addition, the following bits are
the "stty" shell command which is ttystty (8577) interrogated by "ttyoutput" (8373) in
described in the section "STTY(I)". choosing the delay which should ensue
A call originating from "stty" will after the character indicated is sent,
have a second parameter of zero. before sending the next character:
Since the "stty" and "gtty" system
calls require a file descriptor as a 8589: Empty all the queues associated 8,9 line feed;
parameter, they can only be applied to with the terminal forthwith. They 10,11 horizontal tab;
an "open" character special file. quite likely contain nonsense; 12,13 carriage return;
14 vertical tab or form feed.
8591: Reset the speed information (use-
The two system calls share a good deal ful in the case of a DHII inter-
of common code. We will trace the pro- face, but of little interest for
gress of an execution of "stty" below the present selection of code);
and leave the tracing of a similar exe- The DLll/KLll Terminal Device Handler
cution of "gtty" to the reader. 8592: Reset the "erase" character and
the "kill" character. ("kill" The file "kl.c" constitutes the device
here denotes "throwaway the handler for terminals connected to the
current input line".) Note that system via DLll/KLll interfaces. This
if these characters are changed group always has at least one member -
away from their normal values of the operator's console terminal. Hence
This procedure implements the "stty" -.- and "@" respectively, no this device handler will always be
system call. It copies three words of corresponding changes are made to present.
user parameter information into "maptab". Nor should they!);
8039: Calculate the address of the Note that the "open" routine does not
appropriate set of device regis- distinguish between the cases where the
ters for the terminal and store file is opened for reading only, or 8083: Read the input character from the
in "t_addr"; writing only, or for both reading and Receiver Data Buffer register;
writing.
8045: If the terminal is not already 8084: Enable the receiver for the next
"open", do some initialisation of character;
the "tty· structure
klclose (8055) 8085: The comment says "hardware
8046: "t state" is set to show the file botch". Better believe it;
is-"open", so that the next three 8057: Find the address of the appropri-
lines will not be executed if the ate "tty" structure in the array 8086: Pass the character to "ttyinput"
file is opened a second time, of such structures, "kIll" to insert it into the appropriate
possibly undoing the effect of a (8015) • (This operation may be "raw" input queue.
"stty" system call; observed in all the procedures in
"t state" is also set to show the second column of Sheet 80,
"CARR ON" ("carrier on"). This is and its relevance should be
a software flag which shows that noted.) ; -000-
the terminal is logically
enabled, regardless of the true 8058: "wflushtty" (8217) allows the
hardware status of the terminal. output queue for the terminal to
If ·CARR ON fi is reset for a ter- "drain" and then flushes the
minal, the system should ignore input queue;
all input from the terminal.
8265: the "delimiter count" is properly 8543: If there are characters in the
set to zero. "cooked" input queue or a calion
CHAPTER TWENTY-FIVE "canon" (8274) is successful ••.
The File ~tty.c" "flush tty" is called by "wflushtty" 8544: transfer characters from the
(see below) and "ttyinput" (8346,835"') "cooked" input queue until either
when either: it is empty or enough characters
have been transferred to suit the
(a) the terminal is not operating in user's requirements.
In this, the last chapter, the intrica- "raw" mode and a "quit" or
cies of interactive terminal handlers "delete" character is received
are finally unveiled, including: from the terminal; or
(a) the handlihg of the "erase" and (b) the "raw" input queue has grown
"kill" characters; unreasonably large (presumably This procedure is called by "ttread"
because no process is reading (8543) to transfer characters from the
(b) the conversion of characters input from the terminal); "raw input queue to the "cooked" input
during input and output for queue (after processing "erase" and
upper case only terminals; "kill" characters and, in the case of
upper case only terminals, processing
(c) the insertion of delays after wflushtty (8217) "escaped" characters, i.e. characters
various special characters such preceded by the character ','). "canon"
as "carriage return". This procedure waits until the queue of returns a non-zero value if the
characters for a terminal is empty "cooked" input queue is no longer
(because they"ve all been sent!) and empty.
The routines "gtty" (8165), "stty" then calls "flushtty" to clean up the
(8183), "sgtty" (82"'1) and "ttystty" input queues. 8284: If the number of delimiters in
(8577) were dealt within the previous the "raw" input queue is zero
chapter. then •••
Previous character was not a backslash 8344: If the terminal is not operating
line completed in "raw" mode and the character
8299: If the character is an "erase" is a "quit" or "delete" (7958)
and .•• 8319: At this point, an input line has then call "signal" (3949) to send
been assembled in the array a software interrupt to every
8300: if there is at least one charac- "canonb"; process which has the terminal as
ter to erase, backup the pointer its controlling terminal, flush
"bp"; 8322: Shift the contents of "canonb" all the queues associated with
into the "cooked" input queue, the terminal, and return;
8302: Start on the next cycle of the and return a "successful" result.
loop beginning at line 8292; 8349: If the "raw" input queue has
grown excessively large, flush
8304: If the character is a "kill", Notes all the queues for the terminal
throwaway all the characters and return. (This may seem a
accumulated for the current line, (A) The reason why "bp" starts (8291) trifle harsh at first sight but
by going back to line 8290; at the third character of "canonb" can it will usually be what is
be found on line 8310. required.);
8306: If the character is an "eot"
(004) (usually generated at the 8353: If the terminal has a limited
terminal as "control-O"), ignore (B) A number of subtleties in the han- character set, and the character
it (and do not put it into dling of backslashes (which the reader is an upper case alphabetic,
"canonb") and start on the next will no doubt have encountered in his translate it into lower case;
-000-
THE END
..
3.3 If the system crashes and must be 4.6 Devise modifications to "pipe.c"
Wribooted" the contents of the buffers which will make pipes more efficient
which were not written out at the time according to the following scheme:
Line Page Line Page Line Page Line Page Line Page
9512 19-1 fuiword 0844 1I~-1 1615 6-3 sched 1940 14-2 2189 8-2
0518 10-3 0846 10-1 1627 6-4 1958 6-4 2193 6-4
0570 10-2 0848 19-1 1627 6-5 1958 14-2 2193 8-2
0852 10-1 1628 6-5 1960 6-4 2195 8-2
start 0612 6-1 0853 10-1 1629 6-5 1966 6-4 2196 8-2
0613 6-1 0854 10-1 1630 6-5 1966 14-2 2201 6-4
• 0615 6-1 0855 19-1 1635 6-5 1968 6-4 2218 6-4
0619 6-1 0856 10-1 1637 6-4 1976 14-2 2224 8-2
0632 6-2 0857 10-1 1982 14-2 2228 6-5
0634 6-2 0876 19-1 estabur 1650 7-4 1990 14-2 2228 8-2
• 0641 6-2 0878 10-1 1654 7-4 21:'03 14-2 2228 8-4
0646 6-2 0880 10-2 1664 7-4 2005 14-2 2229 6-5
0647 6-2 1667 7-4 2013 14-2 2229 8-2
0649 6-2 getc 9930 23-2 1672 7-4 2022 14-2 2230 8-2
0668 6-2 9931 23-2 1677 7-4 2932 14-2 2240 6-5
0669 6-2 9934 23-2 1682 7-4 2042 14-2 2249 8-4
9936 23-2 1703 7-4 2944 14-2 2242 8-4
savu 0725 8-2 0937 23-2 1711 7-4 2247 6-5
9938 23-2 1714 7-4 sleep 2066 6-4 2247 8-2
aretu 0734 8-2 0939 23-2
0940 23-2 sureg 1739 7-4 sleep 2066 8-3 expand 2268 8-3
retu 0749 8-2 0941 23-2 1743 7-5 2079 6-4 2277 8-3
0942 23-2 1744 7-5 2970 8-3 2281 8-3
9756 10-1 0947 23-2 1752 7-5 2071 6-4 2283 8-3
9756 10-3 9949 23-2 1754 7-5 2072 6-4 2284 8-4
9757 10-1 0959 23-2 1762 7-5 2072 8-3 2285 8-4
0757 10-3 9952 23-2 2075 8-3 2286 8-4
0759 10-3 9953 23-2 newproc 1826 7-5 2989 8-3 2287 8-4
0762 19-3 0954 23-2 1841 7-5 2084 8-3
0765 10-2 0957 23-2 1846 7-5 2087 8-3 printf 2340 5-3
0766 19-2 9961 23-2 1860 7-5 2093 6-4 2341 5-4
0767 10-2 0962 23-2 1861 7-5 2346 5-4
0772 10-3 1876 7-5 wakeup 2113 8-3 234.8 5-4
9773 10-3 putc 0967 23-2 1879 7-5 2349 5-4
0774 10-3 1883 7-5 setrun 2134 8-3 2350 5-4
1421 10-3 1889 7-5 2149 8-3 2351 5-4
call 0776 19-2 1422 10-3 1890 7-5 2141 8-3 2353 5-4
0777 10-2 1896 7-5 2143 8-3 2354 5-4
9779 10-2 main 1550 6-2 1992 7-5 2356 5-4
0789 10-2 1903 7-5 setpri 2156 8-2 2361 5-4
0781 10-2 main 1559 6-5 1904 7-5 2161 8-2 2362 5-4
0783 10-2 1559 6-2 1905 7-5 2165 8-3
0788 10-2 1569 6-2 1996 7-5 printn 2369 5-4
• 0799 10-2 1562 6-2 1997 7-5 swtch 2178 6-4 2375 5-4
0800 10-2 1582 6-3 1908 7-5
0802 10-2 1583 6-3 1913 7-5 swtch 2178 8-2 putchar 2386 5-4
0803 10-2 1589 6-3 1917 7-5 2391 5-4
0804 10-2 1599 6-3 1918 7-5 swtch 2178 8-4 2393 5-5
0805 19-2 1697 6-3 2184 6-4 2395 5-5
1613 6-3 sched 1940 6-4 2184 8-2 2397 5-5
fuibyte 9814 10-1 1614 6-3 2189 6-4 2398 5-5
Source Code Line Index Page 2
Line Page Line Page Line Page Line Page Line Page
2399 5-5 2776 12-3 3301 13-5 3801 11-2 4168 13-5
2400 5-5 2793 12-1 3302 13-5 3803 11-2 4172 13-6
2405 5-5 2794 12-2 3303 13-5 3804 11-2 4181 13-6
2406 5-5 2796 12-2 3309 13-5 3806 11-2 4183 13-6
2810 12-2 3313 13-4 3810 11-2 4187 13-6
panic 2419 5-5 2818 12-2 3820 11-2 4188 13-6 •
2420 5-5 2821 12-2 fork 3322 12-4 3824 11-2 4189 13-6
2421 5-5 2822 12-2 3335 12-4 4191 13-6
2422 5-5 2823 12-2 3344 12-4 timeout 3845 11-2
procxmt 4204 13-6
prdev 2433 5-6 exec 3020 12-3 sbreak 3354 12-4 signal 3949 13-3 4209 13-6
3034 12-3 3364 12-4 4211 13-6
deverror 2447 5-6 3037 12-3 3371 12-4 psignal 3963 13-3
3040 12-3 3376 12-4 3966 13-3 xswap 4368 14-3
malloc 2528 5-2 3041 12-3 3386 12-4 3971 13-3 4373 14-3
2534 5-2 3052 12-3 3973 13-3 4375 14-3
2535 5-2 3064 12-3 unlink 3510 19-4 3975 13-3 4378 14-3
2536 5-2 3071 12-3 3515 19-4 4379 14-3
2537 5-2 3090 12-3 3518 19-4 issig 3991 13-3 4382 14-3
2538 5-2 3095 12-3 3519 19-4 3997 13-3 4388 14-3
2539 5-2 3105 12-3 3522 19-4 3998 13-3
2542 5-2 3127 12-3 3528 19-4 4000 13-3 xfree 4398 14-3
2543 5-2 3129 12-4 3529 19-4 4003 13-3 4402 14-3
3130 12-4 4006 13-3 4403 14-3
mfree 2556 5-3 3158 12-4 ssig 3614 13-2 4406 14-3
2564 5-3 3186 12-4 3619 13-2 stop 4016 13-5 4408 14-3
2565 5-3 3194 12-4 3623 13-2 4022 13-5 4411 14-3
2566 5-3 3195 12-4 3624 13-2 4023 13-5
2567 5-3 3196 12-4 3625 13-2 4028 13-5 xal10c 4433 14-3
2568 5-3 4029 13-5 4439 14-3
2569 5-3 rexit 3205 13-4 kill 3630 13-2 4441 14-3
2576 5-3 3637 13-2 psig 4043 13-3 4452 14-3
2579 5-3 exit 3219 13-4 3639 13-2 4054 13-3 4459 14-3
3224 13-4 3649 13-2 4055 13-3 4460 14-3
trap 2693 12-1 3225 13-4 4056 13-3 4461 14-3
2698 12-1 3227 13-4 clock 3725 11-1 4057 13-3 4462 14-3
2700 12-1 3232 13-4 3741il 11-1 41il66 13-3 4463 14-3
2701 12-1 3233 13-4 3743 11-1 4079 13-3 4464 14-3
2702 12-1 3234 13-4 3748 11-1 4080 13-3 4467 14-3
2716 12-1 3237 13-4 3750 11-1 4473 14-3
2719 12-1 3238 13-4 3759 11-1 core 4094 13-3 4475 14-3
2721 12-2 3239 13-4 3766 11-1
2723 12-2 3241 13-4 3767 11-1 grow 4136 13-3 devtab 4551 15-1
2733 12-2 3243 13-4 3773 11-1 4141 13-3
•
2752 12-2 3245 13-4 3787 11-1 4143 13-3 bread 4754 17-3
2754 12-2 3788 11-1 4144 13-3
2755 12-3 wait 3271il 13-4 3792 11-1 4146 13-4 breada 4773 17-3
2760 12-3 3277 13-4 3795 11-2 4148 13-4 4780 17-3
2765 12-3 3280 13-4 3797 11-2 4156 13-4 4781 17-3
2770 12-3 3298 13-4 3798 11-2 4788 17-3
2771 12-3 3300 13-4 3800 11-2 ptrace 4164 13-5 4793 17-3
Source Code Line Index Page 3
Line Page Line Page Line Page Line Page Line Page
4798 17-3 5397 16-2 5917 19-3 6318 18-6 7916 20-5
4803 17-3 5399 16-2 5921 19-3 7919 23-5
5437 16-2 5926 19-3 iomove 6364 18-6 UJ25 23-5
bwrite 4839 17-3 5414 16-2 5927 19-3
4823 17-3 5933 19-3 bmap 6415 18-6 ifree 7134 23-5
4823 17-3 rkaddr 5423 16-2 5935 19-3 6423 18-6
5943 19-3 6427 18-6 getfs 7167 23-3
bdwrite 4836 17-3 rkintr 5451 16-2 5941 19-3 6431 18-6
4844 17-3 5455 16-2 6435 18-6 update 7231 23-3
4847 17-3 5459 16-2 mknod 5952 19-4 6438 18-6 7237 23-3
5463 16-2 6442 18-6 7213 23-3
bawrite 4856 17-3 5461 16-2 smount 6086 23-2 6448 18-6 7211 23-3
5462 16-2 6393 23-2 6456 18-6 7213 23-3
bre1se 4869 17-2 5463 16-2 6396 23-2 7217 23-3
5469 16-2 6103 23-2 c10sef 6643 18-4 7223 23-3
incore 4899 17-1 5472 16-2 6133 23-2 6649 18-4 7229 23-3
6111 23-2 6655 18-4 7233 20-3
getb1k 4921 17-1 file 5537 18-2 6113 23-2 6657 18-4
4943 17-2 6116 23-2 iget 7276 20-2
4953 17-2 inode 5659 18-2 6124 23-2 access 6746 19-4 7285 23-2
4963 17-2 6133 23-2 6753 19-4 7286 20-3
4966 17-2 rdwr 5731 18-5 6763 19-4 7287 23-3
4967 17-2 5736 18-5 sumount 6144 23-4 6769 19-4 7290 20-3
5739 18-5 6154 23-4 6774 19-4 7292 20-3
iodone 5018 16-2 5743 18-5 6161 20-4 7293 20-3
5746 18-5 6168 20-4 iinit 6922 20-2 7302 23-3
c1rbuf 5038 17-1 5755 18-5 6926 23-2 7336 23-3
5756 18-5 readi 6221 18-5 6931 23-2 7339 23-3
binit 5055 17-2 6233 18-5 6933 23-2 7314 23-3
open 5763 18-3 6232 18-5 6936 20-2 7319 23-3
devstart 5396 16-2 6233 18-5 6938 23-2 7326 23-3
creat 5781 18-3 6238 18-5 6939 23-2 7328 23-3
swap 5196 15-2 5786 18-3 6239 18-5
5233 15-2 5787 18-3 6243 18-5 a110c 6956 23-4 iput 7344 18-4
5232 15-2 5788 18-3 6241 18-5 6961 23-4
5236 15-2 5793 18-3 6242 18-5 6962 23-4 iput 7344 23-5
5237 15-2 6243 18-5 6967 20-4 7353 18-4
5238 15-2 open1 5834 18-3 6246 18-5 6968 23-4 7352 18-4
5213 15-2 5812 18-3 6248 18-5 6970 23-4 7357 18-4
5212 15-2 5813 18-3 6253 18-5 6971 20-4 7358 18-4
5213 15-2 5824 18-3 6251 18-5 6972 23-4
5214 15-2 5826 18-3 6252 18-5 6975 23-4 iupdat 7374 23-5
5216 15-2 5827 18-3 6253 18-5 6978 23-4 7383 23-5
5218 15-2 5831 18-3 6255 18-5 6982 23-4 7386 23-5
5219 15-2 5832 18-3 6256 18-5 6983 23-4 7389 23-5
5839 18-3 6258 18-5 7391 23-5
bflush 5229 17-3 6263 18-6 free 7333 23-5 7396 23-3
" close 5846 18-3 6261 18-6 7335 23-5 7396 23-5
physio 5259 17-3 6303 18-6 7336 23-5 7433 23-5
link 5939 19-3 6311 18-6 7013 20-5
rkstrategy 5389 16-2 5914 19-3 6312 18-6 7014 23-5 itrunc 7414 23-4
Source Code Line Index Page 4
Line Page Line Page Line Page Line page Line Page
7421 2t:!-4 7799 21-1 cinit 8234 23-2 8424 25-4 8858 22-2
7423 2t:!-4 8239 23-2 8425 25-4 8859 22-2
7425 2t:!-4 writep 78t:!5 21-1 824t:! 23-2 8426 25-4
7427 2t:!-5 7828 21-1 8241 23-2 8428 25-4 Ipc10se 8863 22-3
7438 20-5 7835 21-1 8242 23-2 8431 25-4
7439 2t:!-5 8244 23-2 8434 25-4 1pwrite 8870 22-3
7443 20-5 plock 7862 21-1 8439 25-4
7445 2t:!-5 flushtty 8252 25-1 8451 25-4 1pcanon 8879 22-3
pre1e 7882 21-1 8258 25-1 8453 25-4 8884 22-3
maknode 7455 19-4 8259 25-1 8458 25-4 8885 22-3
par tab 7947 23-4 826t:! 25-1 8459 25-4 8887 22-3
wdir 7477 19-3 8261 25-1 8462 25-4 8909 22-4
k10pen 8923 24-4 8263 25-1 8467 25-4 8919 22-4
namei 7518 1"9-1 8926 24-4 8264 25-1 8469 25-4 8911 22-4
7531 19-1 893t:! 24-4 8265 25-1 8472 25-4 8915 22-4
7532 19-1 8931 24-4 8475 25-4 8917 22-4
7534 19-2 8t:!33 24-4 canon 8274 25-1 8921 22-4
7535 19-2 8939 24-4 8284 25-1 ttrstrt 8486 25-3 8925 22-4
7537 19-2 8945 24-4 8285 25-2 8926 22-4
7542 19-2 8946 24-4 8286 25-2 ttstart 85t:!5 25-3 8927 22-4
755t:! 19-2 8t:!47 24-4 8291 25-2 8514 25-3 8929 22-4
7563 19-2 8t:!48 24-4 8292 25-2 8518 25-3 8934 22-4
757t:! 19-2 8051 24-4 8293 25-2 852t:! 25-3 8949 22-4
7589 19-2 8t:!52 24-4 8297 25-2 8521 25-3 895t:! 22-4
7592 19-2 8298 25-2 8522 25-3 8954 22-4
7699 19-2 k1close 8955 24-4 8299 25-2 8524 25-3 8959 22-4
7606 19-2 8t:!57 24"':4 8300 25-2
76t:!7 19-2 8058 24-4 8392 25-2 ttr:ead 8535 25-1 1pstart 8967 22-2
7622 19-2 8959 24-4 8394 25-2 8541 25-1
7636 19-2 8396 25-2 8543 25-1 Ipint 8976- 22-2
7645 19-2 klxint 8979 24-4 8399 25-2 8544 25-1 8989 22-3
7647 19-2 83HJ 25-2 8981 22-3
7657 19-2 klrint 8978 24-4 8315 25-2 ttwrite 855t:! 25-3
7662 19-2 8983 24-4 8319 25-2 8556 25-3 Ipoutput 8986 22-2
7664 19-2 8984 24-4 8322 25-2 8558 25-3 8988 22-2
7665 19-2 8985 24-4 856t:! 25-3 899t:! 22-2
8986 24-4 ttyinput 8333 25-2 8561 25-3 8991 22-2
pipe 7723 21-1 8342 25-2 8562 25-3
7728 21-1 klsgtty 8099 24-2 8344 25-2 8563 25-3
7731 21-1 8349 25-2 8566 25-3
7736 21-1 map tab 8117 23-4 8353 2·5-3 8568 25-3
7744 21-1 8355 25-3
7746 21-1 stty 8183 24-2 8356 25-3 ttystty 8577 24-2
8357 25-3 8589 24-2
readp 7758 21-1 sgtty 8201 24-2 8361 25-3 8591 24-2
7763 21-1 8286 24-2 8592 24-2
7768 21-1 8209 24-2 ttyoutput 8373 25-3 8593 24-2 ,.
7776- 21-1 8213 24-2 8488 25-3
7786 21-1 8487 25-3 1popen 885H 22-1
7787 21-1 wflushtty 8217 25-1 8414 25-4 8853 22-2
7789 21-1 8423 25-4 8857 22-2