Chapter 7
The Pipe File Manager
(PIPEMAN)
The Pipe file manager handles control of processes that use
paths to pipes. Pipes allow concurrently executing processes to
send each other data by using the output of one process (the
writer) as input to a second process (the reader). The reader gets
input from the standard input. The exclamation point (!) opera
tor specifies that the input or output is from or to a pipe. The
Pipe file manager allocates a 256-byte block and a path descrip
tor for data transfer. The Pipe file manager also determines
which process has control of the pipe. The Pipe file manager has
the standard file manager branch table at its entry point:
PipeEnt lbra Create
' lbra PRead
lbra PWrite
lbra PRdLn
lbra PWrLn
lbra Getstat
lbra Putstat
lbra Close
You cannot use MakDir, ChgDir, Delete, and Seek with pipes. If
you try to do so, the system returns E$UNKSVC (unknown ser
vice request). Getstat and Putstat are also no-action service rou
tines. They return without error.
Create and Open perform the same functions. They set up the
256-byte data exchange buffer, and save several addresses in the
The Close request checks to see if any process is reading or writ
ing through the pipe. If not, OS-9 returns the buffer.
PRead, PWrite, PRdLn, and PWrLn read data from the buffer
7-1
OS-9 Technical Reference
The ! operator tells the Shell that processes wish to communicate
through a pipe. For example:
proc1 ! Proc2
ENTER
In this example, shell forks Procl with the standard output path
to a pipe, and forks Proc2 with the Standard input path from a
pipe.
Shell can also handle a series of processes using pipes. Example:
proc1 ! Proc2 ! proc3 ! proc4
ENTER
The following outline shows how to set up pipes between
processes:
Open /Pipe save path in variable x
Dup
path #1 save 5tdout in variable y
Dup x
make path available
Fork proc1 put pipe in stdout.
CDup
uses lowest available)
Close #1 make path available
Dup
y restore stdout
Close y make path available
Dup
path #0 save stdin in Y
Close #0 make path available
Dup x
put pipe in stdin
Fork 2 fork process 2
Close #0 make path available
Dup
y restore 5tdin
Close x no longer needed
Close y no longer needed
7-2
The Pipe File Manager (PIPEMAN) / 7
Example: The following example shows how an application can
initiate another process with the stdin and stdout routed
through a pipe.
Open /pipe1 save path in variable a
Open /pipe2 save path in variable b
Dup 0
save stdin in variable x
Dup 1
save stdout in variable y
Close 0 make path available
Close 1 make path available
Dup
a make pipe1 stdin
Dup
b make pipe2 5tdout
Fork new process
Close 0 make path available
Close 1 make path available
Dup x
restore stdin
Dup
y restore stdout
Return a&b return pipe path numbers to caller
5 FF E
RATJV Bow
p F-
G
c-iw$ aR 1 a8
-7
PA 6.Fs
-o x jjt- 1-71
F-ott A )qF"+L
1: K& f xAAro1,E
rN-r
s
7-3