[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: |
Tue, 28 Feb 2023 14:01:43 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Thunderbird/109.0 |
On 27/02/2023 18:26, Pádraig Brady wrote:
Attached are the current patches I have for this functionality.
I'll do a bit more testing and hope to push them early tomorrow.
I'm squashing in the following to handle illumos and macOS.
Also it decouples the code from the pollfd structure layout,
by using C99 designated initializers.
cheers,
Pádraig
diff --git a/src/iopoll.c b/src/iopoll.c
index 916241f89..ceb1b43ad 100644
--- a/src/iopoll.c
+++ b/src/iopoll.c
@@ -49,7 +49,10 @@
extern int
iopoll (int fdin, int fdout)
{
- struct pollfd pfds[2] = {{fdin, POLLIN, 0}, {fdout, 0, 0}};
+ struct pollfd pfds[2] = { /* POLLRDBAND needed for illumos, macOS. */
+ { .fd = fdin, .events = POLLIN | POLLRDBAND, .revents = 0 },
+ { .fd = fdout, .events = POLLRDBAND, .revents = 0 },
+ };
while (poll (pfds, 2, -1) > 0 || errno == EINTR)
{