coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tail: allow multiple PIDs


From: Pádraig Brady
Subject: Re: [PATCH] tail: allow multiple PIDs
Date: Tue, 19 Sep 2023 13:13:53 +0100
User-agent: Mozilla Thunderbird

On 18/09/2023 17:09, Stephen Kitt wrote:
tail can watch multiple files, but currently only a single writer. It
can be useful to watch files from multiple writers, or even processes
not directly related to the files (e.g. watch log files written by a
server process, for the duration of a test driven by a separate
client).

This make sense, and the implementation looks good.
I'll push later with the following tweaks.

thanks!
Pádraig

diff --git a/NEWS b/NEWS
index 118995dbc..81899eacf 100644
--- a/NEWS
+++ b/NEWS
@@ -18,0 +19,4 @@ GNU coreutils NEWS                                    -*- 
outline -*-
+** New features
+
+  tail now supports following multiple processes, with repeated --pid options.
+
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index d4f617714..7abfbe3c0 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -3190 +3190 @@ When following by name or by descriptor, you may specify the 
process ID,
-@var{pid}, of one or more (by repeating @code{--pid}) writers of the
+@var{pid}, of one or more (by repeating @option{--pid}) writers of the
diff --git a/src/tail.c b/src/tail.c
index 365f48ed5..0a863c715 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -208 +208 @@ static int nbpids = 0;
-static pid_t * pids = NULL;
+static pid_t * pids = nullptr;
@@ -1302 +1302 @@ tail_forever (struct File_spec *f, size_t n_files, double 
sleep_interval)
-          writers_dead = writers_are_dead();
+          writers_dead = writers_are_dead ();
@@ -1635 +1635 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t 
n_files,
-                  writers_dead = writers_are_dead();
+                  writers_dead = writers_are_dead ();
@@ -2213 +2213 @@ parse_options (int argc, char **argv,
-          pids = xreallocarray(pids, nbpids + 1, sizeof(pid_t));
+          pids = xreallocarray (pids, nbpids + 1, sizeof (pid_t));
@@ -2276 +2276 @@ parse_options (int argc, char **argv,
-      free(pids);
+      free (pids);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]