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: Pádraig Brady
Subject: Re: [PATCH] tee: Add --pipe-check to allow instantly detecting closed outputs
Date: Sun, 27 Nov 2022 13:07:31 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.0

On 27/11/2022 11:32, Arsen Arsenović wrote:

Arsen Arsenović <arsen@aarsen.me> writes:

Looking at ``check_output_alive'', this logic should be fairly easy to
reuse.  Worst case, I'd need to refactor some of the code to handle the
non-pipe-check case more elegantly so that it doesn't become too
unreadable when also adding the logic to pick between poll and select.

Got some free time again.  The more I think about how to do this, the
more it feels like the solution involves a portable poll or poll-like
function that gets translated to select() if need be on a given
platform, which sounds an awful lot like Gnulib ;).  The
``check_output_alive'' code checks for Gnulib poll and declares it
incompatible, but I can't quite tell what incompatibility this is.  I
wonder if that can be fixed?

I vaguely remember on macos that POLLRDBAND needed to be set on read fds for 
select,
though didn't check all combinations since we didn't actually need
the poll() replacement.  Also select() (emulation of poll) doesn't work on
Solaris or AIX, so we needed to explicitly disable emulation there.

Perhaps we could adjust poll() emulation to be compat everywhere,
but I'm not confident.

If not, I can make factor out the check_alive logic and have it also
check for file descriptors with input data.  Sadly, I don't have many
non-GNU and non-Linux systems to test for poll behavior on; just some
(modern) Solaris and BSD VMs.

We can help test on esoteric systems,
especially if appropriate tests are in place.
Note https://www.nongnu.org/pretest/ which may be useful.

cheers,
Pádraig



reply via email to

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