aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/yaf/files/patch-src_yafstat.c
blob: 22b0530bb0406eb00289fcafa240f39071ceb092 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- src/yafstat.c.orig	2023-02-08 18:37:15 UTC
+++ src/yafstat.c
@@ -75,7 +75,7 @@
 #include "yafdag.h"
 #endif
 
-static uint32_t     yaf_do_stat = 0;
+static volatile sig_atomic_t yaf_do_stat = 0;
 static GTimer      *yaf_fft = NULL;
 static yfContext_t *statctx = NULL;
 
@@ -84,7 +84,7 @@ yfSigUsr1(
     int   s)
 {
     (void)s;
-    ++yaf_do_stat;
+    yaf_do_stat = 1;
 }
 
 
@@ -101,6 +101,11 @@ yfStatInit(
     if (sigaction(SIGUSR1, &sa, &osa)) {
         g_error("sigaction(SIGUSR1) failed: %s", strerror(errno));
     }
+#ifdef SIGINFO
+    if (sigaction(SIGINFO,&sa,&osa)) {
+        g_error("sigaction(SIGINFO) failed: %s", strerror(errno));
+    }
+#endif /* SIGINFO */
 
     /* stash statistics context */
     statctx = ctx;
@@ -147,7 +152,7 @@ yfStatDumpLoop(
     void)
 {
     if (yaf_do_stat) {
-        --yaf_do_stat;
+        yaf_do_stat = 0;
         yfStatDump();
     }
 }