From a752914da0431422de39c6a296928b4a40389053 Mon Sep 17 00:00:00 2001
From: Maria Matejka <mq@ucw.cz>
Date: Wed, 28 Aug 2024 15:29:07 +0200
Subject: [PATCH] Shutdown marker displaced to runtime

---
 conf/conf.c   | 1 -
 lib/runtime.c | 2 ++
 lib/runtime.h | 4 ++++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/conf/conf.c b/conf/conf.c
index e80e0ac6..49a5446b 100644
--- a/conf/conf.c
+++ b/conf/conf.c
@@ -75,7 +75,6 @@ static void config_done(void);
 static timer *config_timer;		/* Timer for scheduled configuration rollback */
 
 /* These are public just for cmd_show_status(), should not be accessed elsewhere */
-int shutting_down;			/* Shutdown requested, do not accept new config changes */
 int configuring;			/* Reconfiguration is running */
 int undo_available;			/* Undo was not requested from last reconfiguration */
 /* Note that both shutting_down and undo_available are related to requests, not processing */
diff --git a/lib/runtime.c b/lib/runtime.c
index cf40c124..f2507de9 100644
--- a/lib/runtime.c
+++ b/lib/runtime.c
@@ -9,6 +9,8 @@
 
 #include "lib/runtime.h"
 
+int shutting_down = 0;
+
 struct global_runtime global_runtime_initial = {
   .tf_log = {
     .fmt1 = "%F %T.%3f",
diff --git a/lib/runtime.h b/lib/runtime.h
index 455f89a8..450eb26a 100644
--- a/lib/runtime.h
+++ b/lib/runtime.h
@@ -9,6 +9,10 @@
 
 #include "lib/timer.h"
 
+/* Shutdown requested, behave accordingly.
+ * Initially zero, once set to one, never reset. */
+extern int shutting_down;
+
 /* I/O loops log information about task scheduling */
 enum latency_debug_flags {
   DL_PING = 1,