bus-unit-util: define FREEZE_BUS_CALL_TIMEOUT locally
authorMike Yuan <me@yhndnzj.com>
Wed, 6 Mar 2024 18:20:26 +0000 (02:20 +0800)
committerMike Yuan <me@yhndnzj.com>
Thu, 7 Mar 2024 17:09:01 +0000 (01:09 +0800)
Follow-up for f274f8bf256702c5fd0c68d3f7bd6aeba74dfcf0

We define *_SLOW_BUS_CALL_TIMEOUT in each component's
own file too. This one is no different and doesn't need
to be in constants.h IMO.

src/basic/constants.h
src/shared/bus-unit-util.c

index 6bb5f3c28127ea394859b7411e907bc3a1103c94..ef3af88a9dc591fd8bb062f3b5801249e7c297d8 100644 (file)
@@ -42,9 +42,6 @@
 #define DEFAULT_START_LIMIT_INTERVAL (10*USEC_PER_SEC)
 #define DEFAULT_START_LIMIT_BURST 5
 
-/* Wait for 1.5 seconds at maximum for freeze operation */
-#define FREEZE_TIMEOUT (1500 * USEC_PER_MSEC)
-
 /* The default time after which exit-on-idle services exit. This
  * should be kept lower than the watchdog timeout, because otherwise
  * the watchdog pings will keep the loop busy. */
index 2f485f810dbdbb235b38598551a31369c56fdd14..536acc874a142d87b1009d48230feb383bde00dc 100644 (file)
@@ -10,7 +10,6 @@
 #include "cgroup-setup.h"
 #include "cgroup-util.h"
 #include "condition.h"
-#include "constants.h"
 #include "coredump-util.h"
 #include "cpu-set-util.h"
 #include "dissect-image.h"
@@ -2939,6 +2938,9 @@ int bus_service_manager_reload(sd_bus *bus) {
         return 0;
 }
 
+/* Wait for 1.5 seconds at maximum for freeze operation */
+#define FREEZE_BUS_CALL_TIMEOUT (1500 * USEC_PER_MSEC)
+
 int unit_freezer_new(const char *name, UnitFreezer *ret) {
         _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
         _cleanup_free_ char *namedup = NULL;
@@ -2955,7 +2957,7 @@ int unit_freezer_new(const char *name, UnitFreezer *ret) {
         if (r < 0)
                 return log_debug_errno(r, "Failed to open connection to systemd: %m");
 
-        (void) sd_bus_set_method_call_timeout(bus, FREEZE_TIMEOUT);
+        (void) sd_bus_set_method_call_timeout(bus, FREEZE_BUS_CALL_TIMEOUT);
 
         *ret = (UnitFreezer) {
                 .name = TAKE_PTR(namedup),