[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inotify back end for tail -f on linux
From: |
Pádraig Brady |
Subject: |
Re: inotify back end for tail -f on linux |
Date: |
Thu, 25 Jun 2009 12:08:31 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
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.
- Re: inotify back end for tail -f on linux, (continued)
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/06
- Re: inotify back end for tail -f on linux, Giuseppe Scrivano, 2009/06/07
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/07
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/07
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/11
- Re: inotify back end for tail -f on linux, Giuseppe Scrivano, 2009/06/11
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/11
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/13
- Re: inotify back end for tail -f on linux, Giuseppe Scrivano, 2009/06/14
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/15
- Re: inotify back end for tail -f on linux,
Pádraig Brady <=
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/25
- Re: inotify back end for tail -f on linux, Pádraig Brady, 2009/06/25
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/25
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/06
- Re: inotify back end for tail -f on linux, Giuseppe Scrivano, 2009/06/06
- Re: inotify back end for tail -f on linux, Jim Meyering, 2009/06/07