[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tail: reinstate inotify use with FIFOs
From: |
Pádraig Brady |
Subject: |
[PATCH] tail: reinstate inotify use with FIFOs |
Date: |
Mon, 21 Aug 2017 21:07:09 -0700 |
commit v8.27-44-g18f6b22 was too aggressive in
only allowing inotify use with regular files. This will
support responsive processing of `tail -f fifo | ...`
* src/tail.c (any_non_regular): Adjust to allow FIFOs
since inotify supports these well.
* tests/tail-2/inotify-only-regular.sh: Adjust comment.
---
src/tail.c | 8 ++++----
tests/tail-2/inotify-only-regular.sh | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/tail.c b/src/tail.c
index ce34886..316e72e 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -1332,15 +1332,15 @@ any_symlinks (const struct File_spec *f, size_t n_files)
}
/* Return true if any of the N_FILES files in F is not
- a regular file. This is used to avoid adding inotify
+ a regular file or fifo. This is used to avoid adding inotify
watches on a device file for example, which inotify
will accept, but not give any events for. */
static bool
-any_non_regular (const struct File_spec *f, size_t n_files)
+any_non_regular_fifo (const struct File_spec *f, size_t n_files)
{
for (size_t i = 0; i < n_files; i++)
- if (0 <= f[i].fd && ! S_ISREG (f[i].mode))
+ if (0 <= f[i].fd && ! S_ISREG (f[i].mode) && ! S_ISFIFO (f[i].mode))
return true;
return false;
}
@@ -2460,7 +2460,7 @@ main (int argc, char **argv)
|| any_remote_file (F, n_files)
|| ! any_non_remote_file (F, n_files)
|| any_symlinks (F, n_files)
- || any_non_regular (F, n_files)
+ || any_non_regular_fifo (F, n_files)
|| (!ok && follow_mode == Follow_descriptor)))
disable_inotify = true;
diff --git a/tests/tail-2/inotify-only-regular.sh
b/tests/tail-2/inotify-only-regular.sh
index 4d106fb..9f8da94 100755
--- a/tests/tail-2/inotify-only-regular.sh
+++ b/tests/tail-2/inotify-only-regular.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# ensure that tail -f only uses inotify for regular files
+# ensure that tail -f only uses inotify for regular files or fifos
# Copyright (C) 2017 Free Software Foundation, Inc.
--
2.9.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tail: reinstate inotify use with FIFOs,
Pádraig Brady <=