X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fdaemon.h;fp=lib%2Fdaemon.h;h=d62dd4f01ae381c5008861d84381cc5d26026960;hb=91a1e24d09ba1f08b1f8c08815f595187c6ef946;hp=a54aa5204aa2b2616ba8a0f809fcede9452a9c48;hpb=c4fca56af2c5cfc8ecfb33648bf4722d3bec5388;p=sliver-openvswitch.git diff --git a/lib/daemon.h b/lib/daemon.h index a54aa5204..d62dd4f01 100644 --- a/lib/daemon.h +++ b/lib/daemon.h @@ -17,12 +17,18 @@ #ifndef DAEMON_H #define DAEMON_H 1 +#include #include #include -#define DAEMON_LONG_OPTIONS \ - {"detach", no_argument, 0, 'D'}, \ - {"force", no_argument, 0, 'f'}, \ +enum { + OPT_NO_CHDIR = UCHAR_MAX + 2048 +}; + +#define DAEMON_LONG_OPTIONS \ + {"detach", no_argument, 0, 'D'}, \ + {"no-chdir", no_argument, 0, OPT_NO_CHDIR}, \ + {"force", no_argument, 0, 'f'}, \ {"pidfile", optional_argument, 0, 'P'} #define DAEMON_OPTION_HANDLERS \ @@ -30,6 +36,10 @@ set_detach(); \ break; \ \ + case OPT_NO_CHDIR: \ + set_no_chdir(); \ + break; \ + \ case 'P': \ set_pidfile(optarg); \ break; \ @@ -41,6 +51,7 @@ char *make_pidfile_name(const char *name); void set_pidfile(const char *name); const char *get_pidfile(void); +void set_no_chdir(void); void set_detach(void); void daemonize(void); void die_if_already_running(void);