Jim Meyering wrote:
> diff --git a/NEWS b/NEWS
> index d7695e4..754f9e2 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -28,6 +28,8 @@ GNU coreutils NEWS -*-
> outline -*-
> sort accepts a new option, --human-numeric-sort (-h): sort numbers
> while honoring human readable suffixes like KiB and MB etc.
>
> + tail uses inotify when possible.
> +
>
That's a little terse. How about:
tail --follow uses inotify when possible to be more responsive
to file changes and also be more scalable when many files are monitored.
> diff --git a/src/tail.c b/src/tail.c
> index 9d416e1..059ee82 100644
> --- a/src/tail.c
> +++ b/src/tail.c
> @@ -1691,7 +1933,24 @@ main (int argc, char **argv)
> ok &= tail_file (&F[i], n_units);
>
> if (forever)
> - tail_forever (F, n_files, sleep_interval);
> + {
> +#if HAVE_INOTIFY
> + if (pid == 0)
> + {
> + int wd = inotify_init ();
> + if (wd < 0)
> + error (0, errno, _("inotify cannot be used, reverting to
> polling"));
Do we need to warn here since the fallback is functionally equivalent?
It's OK if the error is rare, but I'm worried that errors might be issued
from /sys or /proc or if the user boots an old kernel, or whatever.
Well not that worried TBH, just mentioning it :)
cheers,
Pádraig.
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils