X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fdaemon.c;h=0dcc66ff742c10e48275f4adb9694a6712c93850;hb=c75d15113c56e30ea5a1ace777cd3105c7b750d3;hp=1e3f0029514ee474b7e07b07eb5696e593fd1759;hpb=8fef8c7121222233075a03d57db7e0b48d5f6be5;p=openvswitch diff --git a/lib/daemon.c b/lib/daemon.c index 1e3f0029..0dcc66ff 100644 --- a/lib/daemon.c +++ b/lib/daemon.c @@ -23,6 +23,8 @@ #include #include "fatal-signal.h" #include "dirs.h" +#include "lockfile.h" +#include "timeval.h" #include "util.h" #define THIS_MODULE VLM_daemon @@ -79,6 +81,13 @@ set_no_chdir(void) chdir_ = false; } +/* Will we chdir to "/" as part of daemonizing? */ +bool +is_chdir_enabled(void) +{ + return chdir_; +} + /* Normally, die_if_already_running() will terminate the program with a message * if a locked pidfile already exists. If this function is called, * die_if_already_running() will merely log a warning. */ @@ -96,6 +105,13 @@ set_detach(void) detach = true; } +/* Will daemonize() really detach? */ +bool +get_detach(void) +{ + return detach; +} + /* If a pidfile has been configured and that pidfile already exists and is * locked by a running process, returns the pid of the running process. * Otherwise, returns 0. */ @@ -222,6 +238,8 @@ daemonize(void) if (chdir_) { chdir("/"); } + time_postfork(); + lockfile_postfork(); break; case -1: