coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] tee: Add --pipe-check to allow instantly detecting closed ou


From: Carl Edquist
Subject: Re: [PATCH] tee: Add --pipe-check to allow instantly detecting closed outputs
Date: Sat, 10 Dec 2022 09:48:34 -0600 (CST)

On Fri, 9 Dec 2022, Carl Edquist wrote:

 A quick note, this check only needs to be done a total of once per
 output, it shouldn't be done inside iopoll(), which would result in
 an additional redundant fstat() per read().

 Could this be handled by get_next_out?

Sure, either in that function or immediately after it gets called. But also once for stdout before the while (n_outputs) loop. Alternatively, allocate a file type array and populate it in the for loop that does all the fopen() calls.

Patch attached for this. I ended up going with a bool array to keep track of whether each output is a pipe or not. Potentially a very small amount of extra work up front, but it seemed to make implementing the rest of it simpler.

Carl

Attachment: 0001-tee-only-do-iopoll-for-pipe-outputs.patch
Description: Text Data


reply via email to

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