mirror of
https://github.com/systemd/systemd.git
synced 2025-01-28 21:47:38 +03:00
core: priorize notification fd processing over notification fd process via sd-event's logic
This commit is contained in:
parent
0e6eaa2d98
commit
fa28bc2df7
@ -135,6 +135,12 @@ static int manager_setup_notify(Manager *m) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
/* Process signals a bit earlier than SIGCHLD, so that we can
|
||||
* still identify to which service an exit message belongs */
|
||||
r = sd_event_source_set_priority(m->notify_event_source, -7);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
sa.un.sun_path[0] = '@';
|
||||
m->notify_socket = strdup(sa.un.sun_path);
|
||||
if (!m->notify_socket)
|
||||
@ -367,7 +373,10 @@ static int manager_setup_signals(Manager *m) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* Process signals a bit earlier than the rest of things */
|
||||
/* Process signals a bit earlier than the rest of things, but
|
||||
* later that notify_fd processing, so that the notify
|
||||
* processing can still figure out to which process/service a
|
||||
* message belongs, before we reap the process. */
|
||||
r = sd_event_source_set_priority(m->signal_event_source, -5);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -1331,7 +1340,6 @@ static int manager_dispatch_sigchld(Manager *m) {
|
||||
for (;;) {
|
||||
siginfo_t si = {};
|
||||
Unit *u;
|
||||
int r;
|
||||
|
||||
/* First we call waitd() for a PID and do not reap the
|
||||
* zombie. That way we can still access /proc/$PID for
|
||||
@ -1357,14 +1365,6 @@ static int manager_dispatch_sigchld(Manager *m) {
|
||||
log_debug("Got SIGCHLD for process %lu (%s)", (unsigned long) si.si_pid, strna(name));
|
||||
}
|
||||
|
||||
/* Let's flush any message the dying child might still
|
||||
* have queued for us. This ensures that the process
|
||||
* still exists in /proc so that we can figure out
|
||||
* which cgroup and hence unit it belongs to. */
|
||||
r = manager_dispatch_notify_fd(m->notify_event_source, m->notify_fd, EPOLLIN, m);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* And now figure out the unit this belongs to */
|
||||
u = hashmap_get(m->watch_pids, LONG_TO_PTR(si.si_pid));
|
||||
if (!u)
|
||||
|
Loading…
x
Reference in New Issue
Block a user