On Bug #32992, Colin wrote: > Stepping back a bit, does anyone have any idea what the heck is going on in > dbus-spawn.c? Why is there an "intermediate child between the main process and > the grandchild"?? Why aren't we just executing the child directly? > > The commit message doesn't say... Meanwhile, the source code has this comment, dating back to Havoc's initial introduction of DBusBabysitter: > /* > * I'm pretty sure this whole spawn file could be made simpler, > * if you thought about it a bit. > */ One thing that's particularly confusing is that there are three processes: - the main process (typically dbus-daemon) - the "babysitter process" - the grandchild, which calls exec() and in the main process, there's a DBusBabysitter object. Most of the comments, variable names, etc., say "the babysitter", so it's unclear whether they're talking about the DBusBabysitter object or the babysitter process.
Back on Bug #32992, Colin wrote: > Apparently this is a trick to avoid having the parent deal with SIGCHLD if it > wasn't expecting it, see: > > http://compgroups.net/comp.unix.programmer/the-need-for-double-forking
See also Attachment #74834 [details], Attachment #74836 [details], Attachment #74837 [details], Attachment #74839 [details] on Bug #60859 - in particular, the second of those documents why dbus-spawn looks like it does.
Patches documenting this were merged.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.