Handle activated child stdout/stderr correctly in systemd environment
authorChengwei Yang <chengwei.yang@intel.com>
Tue, 15 Oct 2013 05:27:51 +0000 (13:27 +0800)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 1 Nov 2013 12:41:02 +0000 (12:41 +0000)
commit5be1e77829680ad1beac235d2f454570991ee36e
tree0be89b330f69e724b68b2c6f1aff4a38f342eb56
parentec6ea1a6a8ad1d5e3c1280a55207e9b4f5742814
Handle activated child stdout/stderr correctly in systemd environment

In systemd environment, dbus-daemon will run as no-fork mode since this
is the recommended practice of systemd.

In that scenario, child activated by dbus-daemon will inherit
dbus-daemon standard streams, includes stdin/stdout/stderr. stdin will
be redirected to /dev/null by systemd and stdout/stderr will be catched
by systemd log subsystem. Since the child inherit stdout/stderr from
dbus-daemon, so from systemd journal log, the child log output will be
identified with dbus-daemon identifier. So it's a little confusing.

This patch redirects the child stdout/stderr to systemd journal stream,
and with its owned service name as identifier. However, thing not fixed
perfectly due to the socket ucred of the child is owned by dbus-daemon,
so the pid isn't the real pid of the chile.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68559
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
configure.ac
dbus/dbus-spawn.c