chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
service: execute ExecStopPost= commands when the watchdog timeout hits
[elogind.git]
/
src
/
core
/
service.c
diff --git
a/src/core/service.c
b/src/core/service.c
index cf19ccb7b8e43b19caef6f039de12bd54d72d26c..20990d2a19bfcd97e0c8dc7f5bfdf612c33f84e7 100644
(file)
--- a/
src/core/service.c
+++ b/
src/core/service.c
@@
-235,7
+235,7
@@
static void service_stop_watchdog(Service *s) {
s->watchdog_timestamp.monotonic = 0;
}
s->watchdog_timestamp.monotonic = 0;
}
-static void service_enter_
dead(Service *s, ServiceResult f, bool allow_restart
);
+static void service_enter_
signal(Service *s, ServiceState state, ServiceResult f
);
static void service_handle_watchdog(Service *s) {
usec_t offset;
static void service_handle_watchdog(Service *s) {
usec_t offset;
@@
-249,7
+249,7
@@
static void service_handle_watchdog(Service *s) {
offset = now(CLOCK_MONOTONIC) - s->watchdog_timestamp.monotonic;
if (offset >= s->watchdog_usec) {
log_error_unit(UNIT(s)->id, "%s watchdog timeout!", UNIT(s)->id);
offset = now(CLOCK_MONOTONIC) - s->watchdog_timestamp.monotonic;
if (offset >= s->watchdog_usec) {
log_error_unit(UNIT(s)->id, "%s watchdog timeout!", UNIT(s)->id);
- service_enter_
dead(s, SERVICE_FAILURE_WATCHDOG, true
);
+ service_enter_
signal(s, SERVICE_STOP_SIGKILL, SERVICE_FAILURE_WATCHDOG
);
return;
}
return;
}
@@
-1275,7
+1275,7
@@
static void service_dump(Unit *u, FILE *f, const char *prefix) {
ServiceExecCommand c;
Service *s = SERVICE(u);
const char *prefix2;
ServiceExecCommand c;
Service *s = SERVICE(u);
const char *prefix2;
-
char _cleanup_free_
*p2 = NULL;
+
_cleanup_free_ char
*p2 = NULL;
assert(s);
assert(s);
@@
-1373,7
+1373,7
@@
static void service_dump(Unit *u, FILE *f, const char *prefix) {
}
static int service_load_pid_file(Service *s, bool may_warn) {
}
static int service_load_pid_file(Service *s, bool may_warn) {
-
char _cleanup_free_
*k = NULL;
+
_cleanup_free_ char
*k = NULL;
int r;
pid_t pid;
int r;
pid_t pid;
@@
-1466,6
+1466,9
@@
static int service_search_main_pid(Service *s) {
r = unit_watch_pid(UNIT(s), pid);
if (r < 0)
/* FIXME: we need to do something here */
r = unit_watch_pid(UNIT(s), pid);
if (r < 0)
/* FIXME: we need to do something here */
+ log_warning_unit(UNIT(s)->id,
+ "Failed to watch PID %lu from service %s",
+ (unsigned long) pid, UNIT(s)->id);
return r;
return 0;
return r;
return 0;
@@
-1740,9
+1743,9
@@
static int service_spawn(
pid_t pid;
int r;
int *fds = NULL;
pid_t pid;
int r;
int *fds = NULL;
-
int _cleanup_free_
*fdsbuf = NULL;
+
_cleanup_free_ int
*fdsbuf = NULL;
unsigned n_fds = 0, n_env = 0;
unsigned n_fds = 0, n_env = 0;
- char _cleanup_strv_free_
+ _cleanup_strv_free_ char
**argv = NULL, **final_env = NULL, **our_env = NULL;
assert(s);
**argv = NULL, **final_env = NULL, **our_env = NULL;
assert(s);
@@
-1875,7
+1878,7
@@
static int main_pid_good(Service *s) {
return -EAGAIN;
}
return -EAGAIN;
}
-static int control_pid_good(Service *s) {
+
_pure_
static int control_pid_good(Service *s) {
assert(s);
return s->control_pid > 0;
assert(s);
return s->control_pid > 0;
@@
-1936,8
+1939,6
@@
fail:
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false);
}
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false);
}
-static void service_enter_signal(Service *s, ServiceState state, ServiceResult f);
-
static void service_enter_stop_post(Service *s, ServiceResult f) {
int r;
assert(s);
static void service_enter_stop_post(Service *s, ServiceResult f) {
int r;
assert(s);
@@
-2567,7
+2568,7
@@
static int service_reload(Unit *u) {
return 0;
}
return 0;
}
-static bool service_can_reload(Unit *u) {
+
_pure_
static bool service_can_reload(Unit *u) {
Service *s = SERVICE(u);
assert(s);
Service *s = SERVICE(u);
assert(s);
@@
-2779,7
+2780,7
@@
static int service_deserialize_item(Unit *u, const char *key, const char *value,
return 0;
}
return 0;
}
-static UnitActiveState service_active_state(Unit *u) {
+
_pure_
static UnitActiveState service_active_state(Unit *u) {
const UnitActiveState *table;
assert(u);
const UnitActiveState *table;
assert(u);
@@
-2815,7
+2816,7
@@
static bool service_check_gc(Unit *u) {
return false;
}
return false;
}
-static bool service_check_snapshot(Unit *u) {
+
_pure_
static bool service_check_snapshot(Unit *u) {
Service *s = SERVICE(u);
assert(s);
Service *s = SERVICE(u);
assert(s);
@@
-3444,10
+3445,10
@@
static void service_notify_message(Unit *u, pid_t pid, char **tags) {
static int service_enumerate(Manager *m) {
char **p;
unsigned i;
static int service_enumerate(Manager *m) {
char **p;
unsigned i;
-
DIR _cleanup_closedir_
*d = NULL;
-
char _cleanup_free_
*path = NULL, *fpath = NULL, *name = NULL;
+
_cleanup_closedir_ DIR
*d = NULL;
+
_cleanup_free_ char
*path = NULL, *fpath = NULL, *name = NULL;
Set *runlevel_services[ELEMENTSOF(rcnd_table)] = {};
Set *runlevel_services[ELEMENTSOF(rcnd_table)] = {};
-
Set _cleanup_set_free_
*shutdown_services = NULL;
+
_cleanup_set_free_ Set
*shutdown_services = NULL;
Unit *service;
Iterator j;
int r;
Unit *service;
Iterator j;
int r;