chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
modules-load: filter out double modules
[elogind.git]
/
src
/
service.c
diff --git
a/src/service.c
b/src/service.c
index f5ad509dae97ae558d49f9b4e0dbbd853fbe1cc6..5050bcafa1e993553b7979ba5e3195340f43ea10 100644
(file)
--- a/
src/service.c
+++ b/
src/service.c
@@
-65,7
+65,7
@@
static const struct {
{ "boot.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT },
#endif
{ "boot.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT },
#endif
-#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU) || defined(TARGET_
FRUGALWARE) || defined(TARGET_
ANGSTROM)
+#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU) || defined(TARGET_ANGSTROM)
/* Debian style rcS.d */
{ "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT },
#endif
/* Debian style rcS.d */
{ "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT },
#endif
@@
-783,19
+783,6
@@
static int service_load_sysv_path(Service *s, const char *path) {
free(short_description);
short_description = d;
free(short_description);
short_description = d;
- } else if (startswith_no_case(t, "X-Interactive:")) {
- int b;
-
- if ((b = parse_boolean(strstrip(t+14))) < 0) {
- log_warning("[%s:%u] Couldn't parse interactive flag. Ignoring.", path, line);
- continue;
- }
-
- if (b)
- s->exec_context.std_input = EXEC_INPUT_TTY;
- else
- s->exec_context.std_input = EXEC_INPUT_NULL;
-
} else if (state == LSB_DESCRIPTION) {
if (startswith(l, "#\t") || startswith(l, "# ")) {
} else if (state == LSB_DESCRIPTION) {
if (startswith(l, "#\t") || startswith(l, "# ")) {
@@
-1282,11
+1269,8
@@
static int service_load_pid_file(Service *s) {
assert(s);
assert(s);
- if (s->main_pid_known)
- return 0;
-
if (!s->pid_file)
if (!s->pid_file)
- return
0
;
+ return
-ENOENT
;
if ((r = read_one_line_file(s->pid_file, &k)) < 0)
return r;
if ((r = read_one_line_file(s->pid_file, &k)) < 0)
return r;
@@
-1303,6
+1287,16
@@
static int service_load_pid_file(Service *s) {
return -ESRCH;
}
return -ESRCH;
}
+ if (s->main_pid_known) {
+ if (pid == s->main_pid)
+ return 0;
+
+ log_debug("Main PID changing: %lu -> %lu",
+ (unsigned long) s->main_pid, (unsigned long) pid);
+ service_unwatch_main_pid(s);
+ s->main_pid_known = false;
+ }
+
if ((r = service_set_main_pid(s, pid)) < 0)
return r;
if ((r = service_set_main_pid(s, pid)) < 0)
return r;
@@
-2588,6
+2582,11
@@
static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
success = is_clean_exit(code, status);
if (s->main_pid == pid) {
success = is_clean_exit(code, status);
if (s->main_pid == pid) {
+ /* Forking services may occasionally move to a new PID.
+ * As long as they update the PID file before exiting the old
+ * PID, they're fine. */
+ if (service_load_pid_file(s) == 0)
+ return;
s->main_pid = 0;
exec_status_exit(&s->main_exec_status, &s->exec_context, pid, code, status);
s->main_pid = 0;
exec_status_exit(&s->main_exec_status, &s->exec_context, pid, code, status);