if (r < 0)
return log_error_errno(r, "Failed to start up daemon: %m");
- notify_stop = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_stop = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
r = sd_event_loop(m->event);
if (r < 0)
if (r < 0)
return r;
- r = sd_notify(false, NOTIFY_READY);
+ r = sd_notify(false, NOTIFY_READY_MESSAGE);
if (r < 0)
log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
if (r < 0)
return r;
- r = sd_notify(false, NOTIFY_READY);
+ r = sd_notify(false, NOTIFY_READY_MESSAGE);
if (r < 0)
log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
if (r < 0)
return r;
- notify_stop = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_stop = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
while (!server.quit) {
struct epoll_event event;
log_debug("%s running as pid "PID_FMT,
program_invocation_short_name, getpid_cached());
- notify_message = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_message = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
while (s.active) {
r = sd_event_get_state(s.event);
notify_message = notify_start("READY=1\n"
"STATUS=Processing input...",
- NOTIFY_STOPPING);
+ NOTIFY_STOPPING_MESSAGE);
for (;;) {
r = sd_event_get_state(u.event);
* there's something to send it will be turned on again. */
if (!s->sent_notify_ready) {
- if (send(s->notify_fd, NOTIFY_READY, strlen(NOTIFY_READY), MSG_DONTWAIT) < 0) {
+ if (send(s->notify_fd, NOTIFY_READY_MESSAGE, strlen(NOTIFY_READY_MESSAGE), MSG_DONTWAIT) < 0) {
if (errno == EAGAIN)
return 0;
if (r < 0)
return r;
- r = sd_notify(false, NOTIFY_READY);
+ r = sd_notify(false, NOTIFY_READY_MESSAGE);
if (r < 0)
log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
else
log_info("Config file reloaded.");
- (void) sd_notify(/* unset= */ false, NOTIFY_READY);
+ (void) sd_notify(/* unset= */ false, NOTIFY_READY_MESSAGE);
return 0;
}
if (r < 0)
return log_error_errno(r, "Failed to fully start up daemon: %m");
- notify_message = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_message = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
return manager_run(m);
}
if (r < 0)
return log_error_errno(r, "Failed to fully start up daemon: %m");
- r = sd_notify(false, NOTIFY_READY);
+ r = sd_notify(false, NOTIFY_READY_MESSAGE);
if (r < 0)
log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
if (r < 0)
return log_error_errno(r, "Failed to start up daemon: %m");
- notify_stop = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_stop = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
r = sd_event_loop(m->event);
if (r < 0)
log_debug("Reloaded.");
r = 0;
finish:
- (void) sd_notify(/* unset_environment= */ false, NOTIFY_READY);
+ (void) sd_notify(/* unset_environment= */ false, NOTIFY_READY_MESSAGE);
return r;
}
if (r < 0)
return log_error_errno(r, "Could not start manager: %m");
- notify_message = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_message = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
r = sd_event_loop(m->event);
if (r < 0)
return log_error_errno(r, "Failed to start up daemon: %m");
_unused_ _cleanup_(notify_on_cleanup) const char *notify_stop = NULL;
- notify_stop = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_stop = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
r = sd_event_loop(m->event);
if (r < 0)
manager_set_defaults(m);
manager_parse_config_file(m);
- (void) sd_notify(/* unset= */ false, NOTIFY_READY);
+ (void) sd_notify(/* unset= */ false, NOTIFY_READY_MESSAGE);
return 0;
}
if (r < 0)
return log_error_errno(r, "Failed to start up daemon: %m");
- notify_msg = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_msg = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
log_debug("systemd-oomd started%s.", arg_dry_run ? " in dry run mode" : "");
if (r < 0)
return log_error_errno(r, "Failed to fully start up daemon: %m");
- r = sd_notify(false, NOTIFY_READY);
+ r = sd_notify(false, NOTIFY_READY_MESSAGE);
if (r < 0)
log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
manager_flush_caches(m, LOG_INFO);
manager_verify_all(m);
- (void) sd_notify(/* unset= */ false, NOTIFY_READY);
+ (void) sd_notify(/* unset= */ false, NOTIFY_READY_MESSAGE);
return 0;
}
if (r < 0)
return log_error_errno(r, "Failed to drop remaining caps: %m");
- notify_stop = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_stop = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
r = sd_event_loop(m->event);
if (r < 0)
/* Inform the service manager that we are going down, so that it will queue all
* further start requests, instead of assuming we are still running. */
- (void) sd_notify(false, NOTIFY_STOPPING);
+ (void) sd_notify(false, NOTIFY_STOPPING_MESSAGE);
r = bus_async_unregister_and_exit(e, bus, name);
if (r < 0)
#include "macro.h"
-#define NOTIFY_READY "READY=1\n" "STATUS=Processing requests..."
-#define NOTIFY_STOPPING "STOPPING=1\n" "STATUS=Shutting down..."
+#define NOTIFY_READY_MESSAGE "READY=1\n" "STATUS=Processing requests..."
+#define NOTIFY_STOPPING_MESSAGE "STOPPING=1\n" "STATUS=Shutting down..."
static inline const char* notify_start(const char *start, const char *stop) {
if (start)
if (r < 0)
return r;
- notify = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
}
for (;;) {
return r;
}
- notify_stop = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_stop = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
r = sd_event_loop(context.event);
if (r < 0)
return log_error_errno(r, "Failed to run event loop: %m");
_unused_ _cleanup_(notify_on_cleanup) const char *notify_message =
notify_start("READY=1\n"
"STATUS=Exposing disks in target mode...",
- NOTIFY_STOPPING);
+ NOTIFY_STOPPING_MESSAGE);
r = sd_event_loop(event);
if (r < 0)
if (r < 0)
return r;
- r = sd_notify(false, NOTIFY_READY);
+ r = sd_notify(false, NOTIFY_READY_MESSAGE);
if (r < 0)
log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
notify_message = notify_start("READY=1\n"
"STATUS=Daemon is running",
- NOTIFY_STOPPING);
+ NOTIFY_STOPPING_MESSAGE);
r = manager_setup_save_time_event(m);
if (r < 0)
}
_unused_ _cleanup_(notify_on_cleanup) const char *notify_stop =
- notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
for (;;) {
usec_t timeout = USEC_INFINITY;
manager->exit = true;
- (void) sd_notify(/* unset= */ false, NOTIFY_STOPPING);
+ (void) sd_notify(/* unset= */ false, NOTIFY_STOPPING_MESSAGE);
/* close sources of new events and discard buffered events */
manager->ctrl = udev_ctrl_unref(manager->ctrl);
log_warning_errno(r, "Failed to apply permissions on static device nodes, ignoring: %m");
_unused_ _cleanup_(notify_on_cleanup) const char *notify_message =
- notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
/* We will start processing events in the loop below. Before starting processing, let's remove the
* event serialization fd from the fdstore, to avoid retrieving the serialized events again in future
if (r < 0)
return log_error_errno(r, "Failed to start up daemon: %m");
- notify_stop = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
+ notify_stop = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
r = sd_event_loop(m->event);
if (r < 0)