9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Amos Shapir amos@CS.HUJI.AC.IL
Subject: An rc challenge
Date: Thu, 30 Mar 1995 02:07:30 -0500	[thread overview]
Message-ID: <19950330070730.Mpb17sBOF8EUbr7XTEfE74jSczGrrBNJjSAVoC4LGTg@z> (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






             reply	other threads:[~1995-03-30  7:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-30  7:07 Amos [this message]
  -- strict thread matches above, loose matches on Subject: below --
1995-03-30  7:40 philw
1995-03-27 13:39 Amos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19950330070730.Mpb17sBOF8EUbr7XTEfE74jSczGrrBNJjSAVoC4LGTg@z \
    --to=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).