[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6900: mktemp: want option to make a fifo

From: John Reiser
Subject: bug#6900: mktemp: want option to make a fifo
Date: Mon, 23 Aug 2010 15:49:45 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4

On 08/23/2010 02:22 PM, Paul Eggert wrote:
> On 08/23/2010 01:40 PM, John Reiser wrote:
>> Two independent user requests [one of which
>> includes code!] within a few months show a definite need.
> The two requests would have been more convincing if they demonstrated
> a definite need.  Neither did: they both just said the equivalent
> of "we need a new option".

Consider a pipeline with three logical stages:   A | B1 | C
where B1 is a shell script.  At some point B1 notices that one
parallel process B2 becomes desirable, such that B2 also pipes
into the same C as B1, and output from a *subset* of the multiple
sequential subprocesses of B1 pipes into the same B2 [view in
constant-width font]:
A |  B1   | C
       \  /
where both slashes also indicate fifos.

The fifo from B2 to C can be the same fifo as from B1 to C,
just by forking B1 and inheriting stdout.  However the fifo
from B1 to B2 cannot be an anonymous pipe, but must be named
because some of the subprocesses of B1 continue to pipe their
output directly into C.  It's the switching back and forth
between "stdout goes directly to C" and "stdout goes to B2
first, and then to C" that requires a named fifo.

Some subprocesses of B1 will direct their output into B2 by
shell redirection "> $fifo_B1_B2".  And yes, I know that B1
must hold open the write end of the fifo; I use:
   sleep 999000  > $fifo_B1_B2 &

Finally, the $fifo_B1_B2 should be as invisible as possible
when viewed from outside the A|B1|C pipeline.  All together,
that's why I want "mktemp --fifo".

[Process C is 'cpio'.  Process A is 'find'.  Process B1 is
a filter which is mostly pass-through but sometimes uncovers
embedded filenames that must come along for the ride.
Process B2 has large setup cost, but is 100% parallelizable
with B1.  Filenames are written singly, and are small
enough to receive atomic passage through the pipes.]


reply via email to

[Prev in Thread] Current Thread [Next in Thread]