and `run0` invocations is turned off. Note that this environment variable has
no effect if the background color is explicitly selected via the relevant
`--background=` switch of the tool.
+
+`systemd-hostnamed`, `systemd-importd`, `systemd-localed`, `systemd-machined`,
+`systemd-portabled`, `systemd-timedated`:
+
+* `SYSTEMD_EXIT_ON_IDLE` – Takes a boolean. When false, the exit-on-idle logic
+ of these services is disabled, making it easier to debug them.
#include "chase.h"
#include "daemon-util.h"
#include "data-fd-util.h"
+#include "env-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "memstream-util.h"
return 0;
}
+static bool idle_allowed(void) {
+ static int allowed = -1;
+
+ if (allowed >= 0)
+ return allowed;
+
+ allowed = secure_getenv_bool("SYSTEMD_EXIT_ON_IDLE");
+ if (allowed < 0 && allowed != -ENXIO)
+ log_debug_errno(allowed, "Failed to parse $SYSTEMD_EXIT_ON_IDLE, ignoring: %m");
+
+ return allowed != 0;
+}
+
int bus_event_loop_with_idle(
sd_event *e,
sd_bus *bus,
if (r == SD_EVENT_FINISHED)
break;
- if (sd_bus_pending_method_calls(bus) > 0)
+ if (!idle_allowed() || sd_bus_pending_method_calls(bus) > 0)
idle = false;
else if (check_idle)
idle = check_idle(userdata);