9fans archive / 1995 / 03 / 45 / prev next
From: Amos Shapir amos@CS....
Subject: An rc challenge
Date: Thu, 30 Mar 1995 02:07:30 -0500
Here's a (very weird) reply to the problem of doing named pipes in rc:
mount /fd/1 /mnt | @{out_cmd |[9=1] exportfs -s}&
in_cmd /mnt/fd/9
unmount /mnt
The principle is that each of the commands on the first lines has a
different view in its namespace, of which fd goes where; I'll try to
explain as best as I can (which may be a bit wrong, since I didn't
invent it):
The "mount" command binds its /fd/1 on /mnt (which may be any
available directory); the first pipe connects it to fd/0 of the
commands within the {}. The second pipe connects the stdout of
"out_cmd" as its /fd/9, to the input side of /fd/1 of "exportfs". The
result is that anything written by "out_cmd" can be read on /fd/9 of
"exportfs", which exports its namespace to the outside world. There,
the internal /fd directory is bound to /mnt; this enables "in_cmd" to
read "out_cmd"'s output from /mnt/fd/9. Phew!
There must be a better way to make pizza!
--
Amos Shapir Net: amos@cs....
Paper: The Hebrew Univ. of Jerusalem, Dept. of Comp. Science.
Givat-Ram, Jerusalem 91904, Israel
Tel: +972 2 585706,586950 GEO: 35 11 46 E / 31 46 21 N