summaryrefslogtreecommitdiff
path: root/src/core/dbus-scope.c
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2019-03-18 20:59:36 +0100
committerFranck Bui <fbui@suse.com>2019-03-20 10:51:49 +0100
commitf75f613d259e9332be8e9657fa37e73f7aabcb8a (patch)
tree7900f402ac0b87da60b90e6c429a93a5abd8a621 /src/core/dbus-scope.c
parent4d05154600f64e9d5c9800ff9f61167fe80a08ba (diff)
downloadsystemd-f75f613d259e9332be8e9657fa37e73f7aabcb8a.tar.gz
core: reduce the number of stalled PIDs from the watched processes list when possible
Some PIDs can remain in the watched list even though their processes have exited since a long time. It can easily happen if the main process of a forking service manages to spawn a child before the control process exits for example. However when a pid is about to be mapped to a unit by calling unit_watch_pid(), the caller usually knows if the pid should belong to this unit exclusively: if we just forked() off a child, then we can be sure that its PID is otherwise unused. In this case we take this opportunity to remove any stalled PIDs from the watched process list. If we learnt about a PID in any other form (for example via PID file, via searching, MAINPID= and so on), then we can't assume anything.
Diffstat (limited to 'src/core/dbus-scope.c')
-rw-r--r--src/core/dbus-scope.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c
index bb807df2e9..8eb915e508 100644
--- a/src/core/dbus-scope.c
+++ b/src/core/dbus-scope.c
@@ -106,7 +106,7 @@ static int bus_scope_set_transient_property(
return r;
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
- r = unit_watch_pid(UNIT(s), pid);
+ r = unit_watch_pid(UNIT(s), pid, false);
if (r < 0 && r != -EEXIST)
return r;
}