daemon: Start monitor process, not daemon process, in new session.
authorBen Pfaff <blp@nicira.com>
Thu, 13 Dec 2012 22:01:23 +0000 (14:01 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 13 Dec 2012 22:33:52 +0000 (14:33 -0800)
commit6563d66e8305d35d43d6d42ff3491493bf600a2f
tree2991c71195916614aa8c10db8b46cf3fd983faac
parenteb28b60b6771c1b4d550aef6a760bdd97dbb9a5c
daemon: Start monitor process, not daemon process, in new session.

To keep control+C and other signals in the initiating session from killing
the monitor process, we need to put the monitor process into its own
session.  However, until this point, we've only done that for the daemon
processes that the monitor started, which means that control+C would kill
the monitor but not the daemons that it launched.

I don't know of a benefit to putting the monitor and daemon processes in
different sessions, as opposed to one new session for both of them, so
this change does the latter.

daemonize_post_detach() is called from one additional context where we'd
want to be in a new session, the worker_start() function, but that function
is documented as to be called after daemonize_start(), in which case we
will (after this commit) already have called setsid(), so no additional
change is required there.

Bug #14280.
Reported-by: Gordon Good <ggood@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/daemon.c
python/ovs/daemon.py