diff options
author | Pádraig Brady <P@draigBrady.com> | 2023-02-28 18:36:02 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2023-03-01 19:27:36 +0000 |
commit | 76b5843ff99977107580cd581213ea2b5b3a81a7 (patch) | |
tree | 6a609b39fd0ada8899892e40dbea7befbb2ffd9e /src/tee.c | |
parent | 5bcc2912e7d7c16d3052a7ed4f0904f72573255e (diff) | |
download | coreutils-76b5843ff99977107580cd581213ea2b5b3a81a7.tar.gz |
maint: refactor tail.c to use iopoll
* src/tail.c (check_output_alive): Reuse iopoll()
rather than directly calling poll() or select().
* src/iopoll.c (iopoll): Refactor to support non blocking operation,
or ignoring descriptors by passing a negative value.
* src/iopoll.h (iopoll): Adjust to support a BLOCK parameter.
* src/tee.c (tee_files): Adjust iopoll() call to explicitly block.
* src/local.mk: Have tail depend on iopoll.c.
Diffstat (limited to 'src/tee.c')
-rw-r--r-- | src/tee.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -290,7 +290,8 @@ tee_files (int nfiles, char **files) if (pipe_check && out_pollable[first_out]) { /* Monitor for input, or errors on first valid output. */ - int err = iopoll (STDIN_FILENO, fileno (descriptors[first_out])); + int err = iopoll (STDIN_FILENO, fileno (descriptors[first_out]), + true); /* Close the output if it became a broken pipe. */ if (err == IOPOLL_BROKEN_OUTPUT) |