chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
load-fragment: fix parsing of Socket= setting
[elogind.git]
/
src
/
manager.c
diff --git
a/src/manager.c
b/src/manager.c
index 6311c103618a72ec0ab8335ae9ae2aaec5165334..7fd860ed06666db407eb06c42920d3eb5c287e2f 100644
(file)
--- a/
src/manager.c
+++ b/
src/manager.c
@@
-41,6
+41,8
@@
#include <libaudit.h>
#endif
#include <libaudit.h>
#endif
+#include <systemd/sd-daemon.h>
+
#include "manager.h"
#include "hashmap.h"
#include "macro.h"
#include "manager.h"
#include "hashmap.h"
#include "macro.h"
@@
-58,7
+60,7
@@
#include "special.h"
#include "bus-errors.h"
#include "exit-status.h"
#include "special.h"
#include "bus-errors.h"
#include "exit-status.h"
-#include "
sd-daemon
.h"
+#include "
virt
.h"
/* As soon as 16 units are in our GC queue, make sure to run a gc sweep */
#define GC_QUEUE_ENTRIES_MAX 16
/* As soon as 16 units are in our GC queue, make sure to run a gc sweep */
#define GC_QUEUE_ENTRIES_MAX 16
@@
-230,7
+232,7
@@
int manager_new(ManagerRunningAs running_as, Manager **_m) {
dual_timestamp_get(&m->startup_timestamp);
m->running_as = running_as;
dual_timestamp_get(&m->startup_timestamp);
m->running_as = running_as;
- m->name_data_slot = m->subscribed_data_slot = -1;
+ m->name_data_slot = m->
conn_data_slot = m->
subscribed_data_slot = -1;
m->exit_code = _MANAGER_EXIT_CODE_INVALID;
m->pin_cgroupfs_fd = -1;
m->exit_code = _MANAGER_EXIT_CODE_INVALID;
m->pin_cgroupfs_fd = -1;
@@
-285,7
+287,10
@@
int manager_new(ManagerRunningAs running_as, Manager **_m) {
goto fail;
#ifdef HAVE_AUDIT
goto fail;
#ifdef HAVE_AUDIT
- if ((m->audit_fd = audit_open()) < 0)
+ if ((m->audit_fd = audit_open()) < 0 &&
+ /* If the kernel lacks netlink or audit support,
+ * don't worry about it. */
+ errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT)
log_error("Failed to connect to audit log: %m");
#endif
log_error("Failed to connect to audit log: %m");
#endif
@@
-1213,13
+1218,18
@@
static int transaction_apply(Manager *m, JobMode mode) {
/* When isolating first kill all installed jobs which
* aren't part of the new transaction */
/* When isolating first kill all installed jobs which
* aren't part of the new transaction */
+ rescan:
HASHMAP_FOREACH(j, m->jobs, i) {
assert(j->installed);
if (hashmap_get(m->transaction_jobs, j->unit))
continue;
HASHMAP_FOREACH(j, m->jobs, i) {
assert(j->installed);
if (hashmap_get(m->transaction_jobs, j->unit))
continue;
- job_finish_and_invalidate(j, JOB_CANCELED);
+ /* 'j' itself is safe to remove, but if other jobs
+ are invalidated recursively, our iterator may become
+ invalid and we need to start over. */
+ if (job_finish_and_invalidate(j, JOB_CANCELED) > 0)
+ goto rescan;
}
}
}
}
@@
-2023,7
+2033,7
@@
static int manager_dispatch_sigchld(Manager *m) {
if (si.si_code == CLD_EXITED || si.si_code == CLD_KILLED || si.si_code == CLD_DUMPED) {
char *name = NULL;
if (si.si_code == CLD_EXITED || si.si_code == CLD_KILLED || si.si_code == CLD_DUMPED) {
char *name = NULL;
- get_process_
name
(si.si_pid, &name);
+ get_process_
comm
(si.si_pid, &name);
log_debug("Got SIGCHLD for process %lu (%s)", (unsigned long) si.si_pid, strna(name));
free(name);
}
log_debug("Got SIGCHLD for process %lu (%s)", (unsigned long) si.si_pid, strna(name));
free(name);
}
@@
-2108,14
+2118,14
@@
static int manager_process_signal_fd(Manager *m) {
if (sfsi.ssi_pid > 0) {
char *p = NULL;
if (sfsi.ssi_pid > 0) {
char *p = NULL;
- get_process_
name
(sfsi.ssi_pid, &p);
+ get_process_
comm
(sfsi.ssi_pid, &p);
log_debug("Received SIG%s from PID %lu (%s).",
log_debug("Received SIG%s from PID %lu (%s).",
- s
trna(signal_to_string(sfsi.ssi_signo)
),
+ s
ignal_to_string(sfsi.ssi_signo
),
(unsigned long) sfsi.ssi_pid, strna(p));
free(p);
} else
(unsigned long) sfsi.ssi_pid, strna(p));
free(p);
} else
- log_debug("Received SIG%s.", s
trna(signal_to_string(sfsi.ssi_signo)
));
+ log_debug("Received SIG%s.", s
ignal_to_string(sfsi.ssi_signo
));
switch (sfsi.ssi_signo) {
switch (sfsi.ssi_signo) {
@@
-2233,8
+2243,9
@@
static int manager_process_signal_fd(Manager *m) {
if ((int) sfsi.ssi_signo >= SIGRTMIN+0 &&
(int) sfsi.ssi_signo < SIGRTMIN+(int) ELEMENTSOF(target_table)) {
if ((int) sfsi.ssi_signo >= SIGRTMIN+0 &&
(int) sfsi.ssi_signo < SIGRTMIN+(int) ELEMENTSOF(target_table)) {
- manager_start_target(m, target_table[sfsi.ssi_signo - SIGRTMIN],
- (sfsi.ssi_signo == 1 || sfsi.ssi_signo == 2) ? JOB_ISOLATE : JOB_REPLACE);
+ int idx = (int) sfsi.ssi_signo - SIGRTMIN;
+ manager_start_target(m, target_table[idx],
+ (idx == 1 || idx == 2) ? JOB_ISOLATE : JOB_REPLACE);
break;
}
break;
}
@@
-2282,7
+2293,7
@@
static int manager_process_signal_fd(Manager *m) {
break;
default:
break;
default:
- log_warning("Got unhandled signal <%s>.", s
trna(signal_to_string(sfsi.ssi_signo)
));
+ log_warning("Got unhandled signal <%s>.", s
ignal_to_string(sfsi.ssi_signo
));
}
}
}
}
}
}