[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <26a5d195-5b42-dc59-68a2-2e3235ffaba8@chandergovind.org>
Date: Mon, 17 Jul 2023 14:56:04 +0530
From: Chander Govindarajan <mail@...ndergovind.org>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2 v2] misc/ifstat: ignore json_output when run
using "-d"
If ifstat is run with a command like:
ifstat -d 5 -j
subsequenct commands (with or without the "-j" flag) fail with:
Aborted (core dumped)
Unsets json_ouput when using the "-d" flag. Also, since the "-d"
daemon behaviour is not immediately obvious, add a 1 line
description in the man page.
Signed-off-by: Chander Govindarajan <mail@...ndergovind.org>
---
man/man8/ifstat.8 | 3 +++
misc/ifstat.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/man/man8/ifstat.8 b/man/man8/ifstat.8
index 8cd164dd..2deeb3b5 100644
--- a/man/man8/ifstat.8
+++ b/man/man8/ifstat.8
@@ -16,6 +16,9 @@ by default only shows difference between the last and the current call.
Location of the history files defaults to /tmp/.ifstat.u$UID but may be
overridden with the IFSTAT_HISTORY environment variable. Similarly, the default
location for xstat (extended stats) is /tmp/.<xstat name>_ifstat.u$UID.
+
+The \-d flag starts a daemon. Subsequent \fBifstat\fP invocations connect to
+this daemon to fetch statistics.
.SH OPTIONS
.TP
.B \-h, \-\-help
diff --git a/misc/ifstat.c b/misc/ifstat.c
index f6f9ba50..08f0518b 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -888,6 +888,7 @@ int main(int argc, char *argv[])
sprintf(sun.sun_path+1, "ifstat%d", getuid());
if (scan_interval > 0) {
+ json_output = 0;
if (time_constant == 0)
time_constant = 60;
time_constant *= 1000;
--
2.36.1.299.gab336e8f1c
Powered by blists - more mailing lists