From: Steve Harris <scharris@worldnet.att.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] pipefile
Date: Sun, 30 Jul 2000 17:38:07 -0500 [thread overview]
Message-ID: <20000730173807.A1371@tiger.home.net> (raw)
On Sun, 30 Jul 2000 14:54:30 rob pike wrote:
> The command is called pipefile; it interposes a command
> between you and the named file. ...
I'm trying to understand this, but I can't figure out how the original
file is actually read/written by this code.
I think I'm misunderstanding, but it looks to me like the code produces
a
"closed loop" of two pipes with the filter command in between, with one
side
"data" bound over and replacing the original file (I'm with it so far I
think).
But I don't see how the other side of the pipe, "data1", is connected at
all
with the contents of the original file ( before it had the
bind(TEMP "/data", file, MREPL)
done over it ). In fact I don't see how you can access the original file
contents at all after the bind() call above has been done in the
namespace.
Or do we not care about the original file at all? Does rio make
keyboard
input available for reading through /dev/cons even if we've bound
something
over the original file with MREPL?
What am I missing?
Here's the section I don't understand:
> file = argv[0];
> if(bind("#|", TEMP, MREPL) < 0)
> sysfatal("bind pipe %s: %r", TEMP);
> if(bind(TEMP "/data", file, MREPL) < 0)
> sysfatal("bind %s %s: %r", TEMP "/data", file);
>
> if(bcmd != nil){
> fd0 = open(TEMP "/data1", ORDWR);
> if(fd0 < 0)
> sysfatal("open %s: %r", TEMP "/data1");
> connect(bcmd, fd0, fd0);
> close(fd0);
> }else{
> fd0 = open(TEMP "/data1", OREAD);
> if(fd0 < 0)
> sysfatal("open %s: %r", TEMP "/data1");
> connect(wcmd, fd0, 1);
> fd1 = open(TEMP "/data1", OWRITE);
> if(fd1 < 0)
> sysfatal("open %s: %r", TEMP "/data1");
> connect(rcmd, 0, fd1);
> close(fd0);
> close(fd1);
> }
> unmount(nil, TEMP);
> exits(nil);
> }
>
next reply other threads:[~2000-07-30 22:38 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-30 22:38 Steve Harris [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-08-03 23:46 okamoto
2000-08-03 4:49 rob pike
2000-08-03 4:15 okamoto
2000-08-03 3:44 okamoto
2000-08-03 7:14 ` Matt
2000-08-03 3:19 okamoto
2000-08-03 0:19 okamoto
2000-08-02 21:19 rob pike
[not found] <rob@plan9.bell-labs.com>
2000-08-02 14:48 ` rob pike
2000-08-02 15:49 ` James A. Robinson
2000-08-02 7:55 okamoto
2000-08-03 8:21 ` Boyd Roberts
2000-07-31 9:47 okamoto
2000-07-31 4:55 rob pike
2000-07-31 4:40 okamoto
2000-07-31 1:14 rob pike
2000-08-02 3:40 ` Skip Tavakkolian
2000-08-03 1:21 ` Skip Tavakkolian
2000-07-30 23:46 Steve Harris
2000-07-30 23:17 rob pike
2000-07-30 23:06 rob pike
2000-07-30 19:54 rob pike
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=20000730173807.A1371@tiger.home.net \
--to=scharris@worldnet.att.net \
--cc=9fans@cse.psu.edu \
/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).