Giuseppe Scrivano wrote: > have you considered this patch for inclusion? I don't see a clearer way > to avoid polling without inotify fd support.
>> This patch changes `tail' to handle stdin separately from inotify >> events, similar to what we are already doing when a --pid is specified. Hi Giuseppe, Considering the amount of complexity it adds to already-dense code (in spite of the fact that some is just due to indentation changes), for so little gain (who will use tail -f on stdin and care whether tail is sleep-based or inotify-based?), I'm reluctant to use it at all. Is there a good reason to want to avoid the sleep-based code in this corner case? > Subject: [PATCH] tail: handle "-" properly > > * src/tail.c (tail_forever_inotify): Handle stdin (i.e., "-", but not > /dev/stdin) separately from inotify. > * tests/tail-2/wait: Ensure that when a stdin is watched, tail does not > raise errors. BTW, that log message is out of date. tail -f handles "-" now, via the sleep-based implementation. Summarizing what this patch does: it changes e.g., tail -f - F1 F2 F3 not to revert to the sleep-based implementation solely due to the presence of an unnamed (stdin) file, "-". Instead, the files F1, F2, F3 would still be tracked efficiently via inotify, and stdin would be tracked via a select-based wait.