9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* An rc challenge
@ 1995-03-30  7:40 philw
  0 siblings, 0 replies; 3+ messages in thread
From: philw @ 1995-03-30  7:40 UTC (permalink / raw)


pipes are already named.

	bind '#|' /mnt/pipe

look at the result.






^ permalink raw reply	[flat|nested] 3+ messages in thread

* An rc challenge
@ 1995-03-30  7:07 Amos
  0 siblings, 0 replies; 3+ messages in thread
From: Amos @ 1995-03-30  7:07 UTC (permalink / raw)


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.huji.ac.il
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






^ permalink raw reply	[flat|nested] 3+ messages in thread

* An rc challenge
@ 1995-03-27 13:39 Amos
  0 siblings, 0 replies; 3+ messages in thread
From: Amos @ 1995-03-27 13:39 UTC (permalink / raw)



How to do spliced pipes:
	cmd_a > file; cmd_b <{ cmd_c < file} <{ cmd_d < file }
can also be done as:
	cmd_b <{ cmd_a | cmd_c} <{ cmd_a | cmd_d }

But if "cmd_a" is heavy, how can this be done without running it
twice, or using a temporary file?

Alternatively, is there an easy way to do named pipes in rc?

Thanks,

	Amos Shapir		Net: amos@cs.huji.ac.il
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






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-03-30  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-03-30  7:40 An rc challenge philw
  -- strict thread matches above, loose matches on Subject: below --
1995-03-30  7:07 Amos
1995-03-27 13:39 Amos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).