[monitoring-plugins] Place _cmd_pids in object not header to avoid ...
Lorenz Kästle
git at monitoring-plugins.org
Sat Sep 23 09:40:11 CEST 2023
Module: monitoring-plugins
Branch: master
Commit: a3029c5a2e71d4aa4955901f282d3f4669acf97d
Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com>
Committer: Lorenz Kästle <lorenz.kaestle at netways.de>
Date: Sun Mar 5 15:47:49 2023 +0100
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=a3029c5
Place _cmd_pids in object not header to avoid unsused variables
---
lib/utils_cmd.c | 10 ++++++++++
lib/utils_cmd.h | 9 ---------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c
index 34fb390..883f1ec 100644
--- a/lib/utils_cmd.c
+++ b/lib/utils_cmd.c
@@ -42,6 +42,16 @@
#include "common.h"
#include "utils.h"
#include "utils_cmd.h"
+/* This variable must be global, since there's no way the caller
+ * can forcibly slay a dead or ungainly running program otherwise.
+ * Multithreading apps and plugins can initialize it (via CMD_INIT)
+ * in an async safe manner PRIOR to calling cmd_run() or cmd_run_array()
+ * for the first time.
+ *
+ * The check for initialized values is atomic and can
+ * occur in any number of threads simultaneously. */
+static pid_t *_cmd_pids = NULL;
+
#include "utils_base.h"
#include <fcntl.h>
diff --git a/lib/utils_cmd.h b/lib/utils_cmd.h
index 6f3aeb8..1fc2968 100644
--- a/lib/utils_cmd.h
+++ b/lib/utils_cmd.h
@@ -32,15 +32,6 @@ void cmd_init (void);
#define CMD_NO_ARRAYS 0x01 /* don't populate arrays at all */
#define CMD_NO_ASSOC 0x02 /* output.line won't point to buf */
-/* This variable must be global, since there's no way the caller
- * can forcibly slay a dead or ungainly running program otherwise.
- * Multithreading apps and plugins can initialize it (via CMD_INIT)
- * in an async safe manner PRIOR to calling cmd_run() or cmd_run_array()
- * for the first time.
- *
- * The check for initialized values is atomic and can
- * occur in any number of threads simultaneously. */
-static pid_t *_cmd_pids = NULL;
RETSIGTYPE timeout_alarm_handler (int);
More information about the Commits
mailing list