|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 8bb2d17d2b89e87b2e9d8f6c147a757f4670b0fc Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Lennart Poettering <lennart@poettering.net>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Thu, 21 Aug 2014 16:19:25 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] service: remove some pointless linebreaks, to make things
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
more readable
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/core/service.c | 200 +++++++++++++++++------------------------------------
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 65 insertions(+), 135 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/core/service.c b/src/core/service.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 008e81437d..f10582d89e 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/core/service.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/core/service.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -135,8 +135,7 @@ static void service_unwatch_pid_file(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (!s->pid_file_pathspec)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(UNIT(s)->id, "Stopping watch for %s's PID file %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id, s->pid_file_pathspec->path);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(UNIT(s)->id, "Stopping watch for %s's PID file %s", UNIT(s)->id, s->pid_file_pathspec->path);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
path_spec_unwatch(s->pid_file_pathspec);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
path_spec_done(s->pid_file_pathspec);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
free(s->pid_file_pathspec);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -166,10 +165,7 @@ static int service_set_main_pid(Service *s, pid_t pid) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->main_pid_known = true;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (get_parent_of_pid(pid, &ppid) >= 0 && ppid != getpid()) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s: Supervising process "PID_FMT" which is not our child. We'll most likely not notice when it exits.",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s: Supervising process "PID_FMT" which is not our child. We'll most likely not notice when it exits.", UNIT(s)->id, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->main_pid_alien = true;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->main_pid_alien = false;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -362,14 +358,12 @@ static int service_add_default_dependencies(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* majority of services. */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* First, pull in base system */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- SPECIAL_BASIC_TARGET, NULL, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_BASIC_TARGET, NULL, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* Second, activate normal shutdown */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- SPECIAL_SHUTDOWN_TARGET, NULL, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -392,8 +386,8 @@ static void service_fix_output(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static int service_load(Unit *u) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- int r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Service *s = SERVICE(u);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ int r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert(s);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -556,25 +550,20 @@ static int service_load_pid_file(Service *s, bool may_warn) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
r = read_one_line_file(s->pid_file, &k);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (may_warn)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_info_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "PID file %s not readable (yet?) after %s.",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- s->pid_file, service_state_to_string(s->state));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_info_unit(UNIT(s)->id, "PID file %s not readable (yet?) after %s.", s->pid_file, service_state_to_string(s->state));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
r = parse_pid(k, &pid;;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (may_warn)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_info_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "Failed to read PID from file %s: %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- s->pid_file, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_info_unit(UNIT(s)->id, "Failed to read PID from file %s: %s", s->pid_file, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (!pid_is_alive(pid)) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (may_warn)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
log_info_unit(UNIT(s)->id, "PID "PID_FMT" read from file %s does not exist or is a zombie.", pid, s->pid_file);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return -ESRCH;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -582,14 +571,12 @@ static int service_load_pid_file(Service *s, bool may_warn) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (pid == s->main_pid)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "Main PID changing: "PID_FMT" -> "PID_FMT,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- s->main_pid, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(UNIT(s)->id, "Main PID changing: "PID_FMT" -> "PID_FMT, s->main_pid, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_unwatch_main_pid(s);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->main_pid_known = false;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "Main PID loaded: "PID_FMT, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(UNIT(s)->id, "Main PID loaded: "PID_FMT, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
r = service_set_main_pid(s, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -598,9 +585,7 @@ static int service_load_pid_file(Service *s, bool may_warn) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
r = unit_watch_pid(UNIT(s), pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* FIXME: we need to do something here */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "Failed to watch PID "PID_FMT" from service %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- pid, UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "Failed to watch PID "PID_FMT" from service %s", pid, UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -627,19 +612,19 @@ static int service_search_main_pid(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (pid <= 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return -ENOENT;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "Main PID guessed: "PID_FMT, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(UNIT(s)->id, "Main PID guessed: "PID_FMT, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
r = service_set_main_pid(s, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
r = unit_watch_pid(UNIT(s), pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (r < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* FIXME: we need to do something here */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "Failed to watch PID "PID_FMT" from service %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- pid, UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "Failed to watch PID "PID_FMT" from service %s", pid, UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static void service_set_state(Service *s, ServiceState state) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1096,9 +1081,7 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s failed to run install restart timer: %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s failed to run install restart timer: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1136,9 +1119,7 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s failed to run 'stop-post' task: %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s failed to run 'stop-post' task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1183,8 +1164,7 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_stop_post(s, SERVICE_FAILURE_RESOURCES);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1227,8 +1207,7 @@ static void service_enter_stop(Service *s, ServiceResult f) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s failed to run 'stop' task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s failed to run 'stop' task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1282,8 +1261,7 @@ static void service_enter_start_post(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1375,8 +1353,7 @@ static void service_enter_start(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s failed to run 'start' task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s failed to run 'start' task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1489,9 +1466,7 @@ static void service_enter_reload(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s failed to run 'reload' task: %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s failed to run 'reload' task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->reload_result = SERVICE_FAILURE_RESOURCES;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_running(s, SERVICE_SUCCESS);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1525,9 +1500,7 @@ static void service_run_next_control(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s failed to run next control task: %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s failed to run next control task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (s->state == SERVICE_START_PRE)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1572,8 +1545,7 @@ static void service_run_next_main(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s failed to run next main task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s failed to run next main task: %s", UNIT(s)->id, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1588,41 +1560,35 @@ static int service_execute_action(Service *s, FailureAction action, const char *
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_FAILURE_ACTION_NONE:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (log_action_none)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s %s, refusing to start.", UNIT(s)->id, reason);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s %s, refusing to start.", UNIT(s)->id, reason);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_FAILURE_ACTION_REBOOT: {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
int r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s %s, rebooting.", UNIT(s)->id, reason);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s %s, rebooting.", UNIT(s)->id, reason);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- r = manager_add_job_by_name(UNIT(s)->manager, JOB_START,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- SPECIAL_REBOOT_TARGET, JOB_REPLACE,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- true, &error, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ r = manager_add_job_by_name(UNIT(s)->manager, JOB_START, SPECIAL_REBOOT_TARGET, JOB_REPLACE, true, &error, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_error_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "Failed to reboot: %s.", bus_error_message(&error, r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error_unit(UNIT(s)->id, "Failed to reboot: %s.", bus_error_message(&error, r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_FAILURE_ACTION_REBOOT_FORCE:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s %s, forcibly rebooting.", UNIT(s)->id, reason);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s %s, forcibly rebooting.", UNIT(s)->id, reason);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
UNIT(s)->manager->exit_code = MANAGER_REBOOT;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_FAILURE_ACTION_REBOOT_IMMEDIATE:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s %s, rebooting immediately.", UNIT(s)->id, reason);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s %s, rebooting immediately.", UNIT(s)->id, reason);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
sync();
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (s->reboot_arg) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
log_info("Rebooting with argument '%s'.", s->reboot_arg);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- LINUX_REBOOT_CMD_RESTART2, s->reboot_arg);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, s->reboot_arg);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
log_info("Rebooting.");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1630,8 +1596,7 @@ static int service_execute_action(Service *s, FailureAction action, const char *
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
default:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_error_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "failure action=%i", action);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error_unit(UNIT(s)->id, "failure action=%i", action);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert_not_reached("Unknown FailureAction.");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1990,7 +1955,7 @@ _pure_ static bool service_check_snapshot(Unit *u) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert(s);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- return (s->socket_fd < 0);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return s->socket_fd < 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static int service_retry_pid_file(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2012,24 +1977,19 @@ static int service_retry_pid_file(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static int service_watch_pid_file(Service *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
int r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "Setting watch for %s's PID file %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id, s->pid_file_pathspec->path);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(UNIT(s)->id, "Setting watch for %s's PID file %s", UNIT(s)->id, s->pid_file_pathspec->path);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
r = path_spec_watch(s->pid_file_pathspec, service_dispatch_io);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
goto fail;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* the pidfile might have appeared just before we set the watch */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "Trying to read %s's PID file %s in case it changed",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id, s->pid_file_pathspec->path);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(UNIT(s)->id, "Trying to read %s's PID file %s in case it changed", UNIT(s)->id, s->pid_file_pathspec->path);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_retry_pid_file(s);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fail:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_error_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "Failed to set a watch for %s's PID file %s: %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id, s->pid_file_pathspec->path, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error_unit(UNIT(s)->id, "Failed to set a watch for %s's PID file %s: %s", UNIT(s)->id, s->pid_file_pathspec->path, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_unwatch_pid_file(s);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2116,8 +2076,8 @@ static void service_notify_cgroup_empty_event(Unit *u) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* If we were hoping for the daemon to write its PID file,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* we can give up now. */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (s->pid_file_pathspec) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(u->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s never wrote its PID file. Failing.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(u->id, "%s never wrote its PID file. Failing.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_unwatch_pid_file(s);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (s->state == SERVICE_START)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2223,9 +2183,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* There is another command to *
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* execute, so let's do that. */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(u->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s running next main command for state %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- u->id, service_state_to_string(s->state));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(u->id, "%s running next main command for state %s", u->id, service_state_to_string(s->state));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_run_next_main(s);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2285,8 +2243,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->control_pid = 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (s->control_command) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- exec_status_exit(&s->control_command->exec_status,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- &s->exec_context, pid, code, status);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ exec_status_exit(&s->control_command->exec_status, &s->exec_context, pid, code, status);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (s->control_command->ignore)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
f = SERVICE_SUCCESS;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2311,9 +2268,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/* There is another command to *
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* execute, so let's do that. */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(u->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s running next control command for state %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- u->id, service_state_to_string(s->state));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(u->id, "%s running next control command for state %s", u->id, service_state_to_string(s->state));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_run_next_control(s);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2323,9 +2278,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->control_command = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->control_command_id = _SERVICE_EXEC_COMMAND_INVALID;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(u->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s got final SIGCHLD for state %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- u->id, service_state_to_string(s->state));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(u->id, "%s got final SIGCHLD for state %s", u->id, service_state_to_string(s->state));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
switch (s->state) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2453,40 +2406,32 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_START_PRE:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_START:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s %s operation timed out. Terminating.",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- s->state == SERVICE_START ? "start" : "start-pre");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s %s operation timed out. Terminating.", UNIT(s)->id, s->state == SERVICE_START ? "start" : "start-pre");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_TIMEOUT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_START_POST:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s start-post operation timed out. Stopping.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s start-post operation timed out. Stopping.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_stop(s, SERVICE_FAILURE_TIMEOUT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_RELOAD:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s reload operation timed out. Stopping.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s reload operation timed out. Stopping.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->reload_result = SERVICE_FAILURE_TIMEOUT;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_running(s, SERVICE_SUCCESS);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_STOP:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s stopping timed out. Terminating.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s stopping timed out. Terminating.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_TIMEOUT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_STOP_SIGTERM:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (s->kill_context.send_sigkill) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s stop-sigterm timed out. Killing.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s stop-sigterm timed out. Killing.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_FAILURE_TIMEOUT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s stop-sigterm timed out. Skipping SIGKILL.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s stop-sigterm timed out. Skipping SIGKILL.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_stop_post(s, SERVICE_FAILURE_TIMEOUT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2497,34 +2442,28 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* Must be something we cannot kill, so let's just be
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
* weirded out and continue */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_stop_post(s, SERVICE_FAILURE_TIMEOUT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_STOP_POST:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s stop-post timed out. Terminating.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s stop-post timed out. Terminating.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_TIMEOUT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_FINAL_SIGTERM:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (s->kill_context.send_sigkill) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s stop-final-sigterm timed out. Killing.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s stop-final-sigterm timed out. Killing.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_FINAL_SIGKILL, SERVICE_FAILURE_TIMEOUT);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
} else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s stop-final-sigterm timed out. Skipping SIGKILL. Entering failed mode.",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s stop-final-sigterm timed out. Skipping SIGKILL. Entering failed mode.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_dead(s, SERVICE_FAILURE_TIMEOUT, false);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case SERVICE_FINAL_SIGKILL:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s still around after final SIGKILL. Entering failed mode.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(UNIT(s)->id, "%s still around after final SIGKILL. Entering failed mode.", UNIT(s)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_dead(s, SERVICE_FAILURE_TIMEOUT, true);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2551,10 +2490,9 @@ static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert(s);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert(source == s->watchdog_event_source);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_error_unit(UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s watchdog timeout (limit %s)!",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error_unit(UNIT(s)->id, "%s watchdog timeout (limit %s)!", UNIT(s)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
format_timespan(t, sizeof(t), s->watchdog_usec, 1));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_WATCHDOG);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2571,9 +2509,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
u->id, pid, tags && *tags ? tags[0] : "(empty)");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (s->notify_access == NOTIFY_NONE) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_warning_unit(u->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s: Got notification message from PID "PID_FMT", but reception is disabled.",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- u->id, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_warning_unit(u->id, "%s: Got notification message from PID "PID_FMT", but reception is disabled.", u->id, pid);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2693,17 +2629,11 @@ static void service_bus_name_owner_change(
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert(old_owner || new_owner);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
if (old_owner && new_owner)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(u->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s's D-Bus name %s changed owner from %s to %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- u->id, name, old_owner, new_owner);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(u->id, "%s's D-Bus name %s changed owner from %s to %s", u->id, name, old_owner, new_owner);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
else if (old_owner)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(u->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s's D-Bus name %s no longer registered by %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- u->id, name, old_owner);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(u->id, "%s's D-Bus name %s no longer registered by %s", u->id, name, old_owner);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
else
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- log_debug_unit(u->id,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- "%s's D-Bus name %s now registered by %s",
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- u->id, name, new_owner);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_debug_unit(u->id, "%s's D-Bus name %s now registered by %s", u->id, name, new_owner);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
s->bus_name_good = !!new_owner;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|