X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fdaemon.h;h=8cbcfafe2442472eb1e16ea65269a2980ea498af;hb=d978fa4832bbc5176e05edd05bcdf2452a8dded2;hp=dd85b463185e14236446c13f780b2f74ad4d98ef;hpb=8274ae959ac0b158c3e3206b3810af608fb93785;p=sliver-openvswitch.git diff --git a/lib/daemon.h b/lib/daemon.h index dd85b4631..8cbcfafe2 100644 --- a/lib/daemon.h +++ b/lib/daemon.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,12 +28,12 @@ OPT_PIDFILE, \ OPT_MONITOR -#define DAEMON_LONG_OPTIONS \ - {"detach", no_argument, 0, OPT_DETACH}, \ - {"no-chdir", no_argument, 0, OPT_NO_CHDIR}, \ - {"pidfile", optional_argument, 0, OPT_PIDFILE}, \ - {"overwrite-pidfile", no_argument, 0, OPT_OVERWRITE_PIDFILE},\ - {"monitor", no_argument, 0, OPT_MONITOR} +#define DAEMON_LONG_OPTIONS \ + {"detach", no_argument, NULL, OPT_DETACH}, \ + {"no-chdir", no_argument, NULL, OPT_NO_CHDIR}, \ + {"pidfile", optional_argument, NULL, OPT_PIDFILE}, \ + {"overwrite-pidfile", no_argument, NULL, OPT_OVERWRITE_PIDFILE}, \ + {"monitor", no_argument, NULL, OPT_MONITOR} #define DAEMON_OPTION_HANDLERS \ case OPT_DETACH: \ @@ -64,12 +64,16 @@ bool is_chdir_enabled(void); void set_detach(void); bool get_detach(void); void daemon_set_monitor(void); +void daemon_save_fd(int fd); void daemonize(void); void daemonize_start(void); void daemonize_complete(void); -void die_if_already_running(void); void ignore_existing_pidfile(void); void daemon_usage(void); pid_t read_pidfile(const char *name); +pid_t read_pidfile_if_exists(const char *name); + +pid_t fork_and_clean_up(void); +void daemonize_post_detach(void); #endif /* daemon.h */