dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0159-WATCHDOG-define-and-use-_MAX_TICKS-as-3.patch

4de095
From 57404a6b7ca0d86ba661e358f3544a32ef4e15bc Mon Sep 17 00:00:00 2001
4de095
From: Jakub Hrozek <jhrozek@redhat.com>
4de095
Date: Mon, 15 Aug 2016 12:54:20 +0200
4de095
Subject: [PATCH 159/160] WATCHDOG: define and use _MAX_TICKS as 3
4de095
MIME-Version: 1.0
4de095
Content-Type: text/plain; charset=UTF-8
4de095
Content-Transfer-Encoding: 8bit
4de095
4de095
Instead of using the number 3 directly, let's introduce and use
4de095
WATCHDOG_MAX_TICKS.
4de095
4de095
Reviewed-by: Petr Čech <pcech@redhat.com>
4de095
(cherry picked from commit d7075a255a1f28e890539072e06d0140ffe0927c)
4de095
---
4de095
 src/util/util_watchdog.c | 6 +++---
4de095
 1 file changed, 3 insertions(+), 3 deletions(-)
4de095
4de095
diff --git a/src/util/util_watchdog.c b/src/util/util_watchdog.c
4de095
index 1c27d73f13b3042ecb549a2184e1368e8339d199..c184fbd759bdbca4a9eae379ff0d87e2d1628470 100644
4de095
--- a/src/util/util_watchdog.c
4de095
+++ b/src/util/util_watchdog.c
4de095
@@ -22,6 +22,7 @@
4de095
 #include "util/util.h"
4de095
 
4de095
 #define WATCHDOG_DEF_INTERVAL 10
4de095
+#define WATCHDOG_MAX_TICKS 3
4de095
 
4de095
 /* this is intentionally a global variable */
4de095
 struct watchdog_ctx {
4de095
@@ -75,9 +76,8 @@ static void watchdog_handler(int sig)
4de095
         return;
4de095
     }
4de095
 
4de095
-    /* if 3 ticks passed by kills itself */
4de095
-
4de095
-    if (__sync_add_and_fetch(&watchdog_ctx.ticks, 1) > 3) {
4de095
+    /* if a pre-defined number of ticks passed by kills itself */
4de095
+    if (__sync_add_and_fetch(&watchdog_ctx.ticks, 1) > WATCHDOG_MAX_TICKS) {
4de095
         DEBUG(SSSDBG_FATAL_FAILURE,
4de095
               "Watchdog timer overflow, killing process!\n");
4de095
         orderly_shutdown(1);
4de095
-- 
4de095
2.9.3
4de095