X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=python%2Fovs%2Fdaemon.py;h=6dff3a02fcbd8e430a2c45f2ce7e21b58538e84c;hb=9466d7d4b9388f276a99506d9d8a4eca84fb509f;hp=eaaaa519b92223180d5559ba1c8b911cdf9e1581;hpb=e4bd5e2a6c4223fd9cfb2dd1ad82a4eeb1b1fbe6;p=openvswitch diff --git a/python/ovs/daemon.py b/python/ovs/daemon.py index eaaaa519..6dff3a02 100644 --- a/python/ovs/daemon.py +++ b/python/ovs/daemon.py @@ -52,6 +52,8 @@ _monitor = False # File descriptor used by daemonize_start() and daemonize_complete(). _daemonize_fd = None +RESTART_EXIT_CODE = 5 + def make_pidfile_name(name): """Returns the file name that would be used for a pidfile if 'name' were provided to set_pidfile().""" @@ -266,6 +268,11 @@ def _fork_notify_startup(fd): os.close(fd) def _should_restart(status): + global RESTART_EXIT_CODE + + if os.WIFEXITED(status) and os.WEXITSTATUS(status) == RESTART_EXIT_CODE: + return True + if os.WIFSIGNALED(status): for signame in ("SIGABRT", "SIGALRM", "SIGBUS", "SIGFPE", "SIGILL", "SIGPIPE", "SIGSEGV", "SIGXCPU", "SIGXFSZ"):