9fans archive / 2000 / 08 / 46 /    prev next

From: Skip Tavakkolian <skipt@rea...>
Subject: Re: [9fans] pipefile
Date: Tue, 01 Aug 2000 20:40:34 -0700

Could one stack pipefiles?

Also, this may be a totally stupid question, but I am wondering why
there never was a notation for bidirectional pipes in the shell
(say '><') that sets this pipelining?

So, your example would look like:

rc >< readwrite </dev/cons > /dev/cons

It does look to be of limited use.

At 09:14 PM 7/30/00 -0400, rob pike wrote:
>> If you don't mind, could you also say a word as to what made the
>> /dev/cons case special?  Who was writing to /dev/cons all of the 
>> keyboard input so that it worked? (rio?)
>
>/dev/cons is connected to standard in and standard out, that's all.
>I stupidly had file descriptors 0 and 1 wired into the code.
>Nobody was writing any keyboard input of any kind to /dev/cons.
>
>What pipefile does is place filters between the file and
>any subsequent program that opens it for i/o, by binding a pipe
>onto the file and then connecting the filters to the pipe.  The other
>end of the pipe is connected to the underlying file.
>
>Normally you have, in effect,
>
>	</dev/cons  rc   >/dev/cons
>
>but after
>
>	pipefile -r 'readcmd' -w 'writecmd' /dev/cons
>	rc < /dev/cons >/dev/cons
>
>you have, almost literally,
>
>	</dev/cons readcmd | rc | writecmd >/dev/cons
>
>(The only difference is that it uses one full duplex pipe instead
>of two half duplex ones.)
>
>What was special about /dev/cons was that I had this
>example in mind when I wrote the program, so what
>it actually did was closer to
>
>	</fd/0 readcmd | rc | writecmd >/fd/1
>
>The fix was to open the file explicitly.
>
>Hope that helps.
>
>-rob
>
>