]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
config: set g_daemon flag; only create pid file is daemon (even if in foreground)
authorSage Weil <sage@newdream.net>
Mon, 20 Apr 2009 22:17:13 +0000 (15:17 -0700)
committerSage Weil <sage@newdream.net>
Mon, 20 Apr 2009 22:17:13 +0000 (15:17 -0700)
src/ceph.cc
src/common/common_init.cc
src/config.cc
src/config.h
src/msg/SimpleMessenger.cc

index ca8e09855e030c2cdc020426adbd872e6cd34947..439594711130ad80b321cece085e022f42a4c3dd 100644 (file)
@@ -580,7 +580,6 @@ int main(int argc, const char **argv, const char *envp[])
   
   // start up network
   rank.bind();
-  g_conf.daemonize = false; // not us!
   messenger = rank.register_entity(entity_name_t::ADMIN());
   messenger->set_dispatcher(&dispatcher);
 
index 34777aca1f9b4c2f3ba8e807020071886a4f4a21..8ea3adfb2faa544ba7460fd045d261e98bb3e25f 100644 (file)
@@ -7,6 +7,7 @@ void common_init(std::vector<const char*>& args, const char *module_type, bool d
   tls_init();
   tls_get_val()->disable_assert = 0;
 
+  g_daemon = daemon;
   if (daemon) {
     cout << " ** WARNING: Ceph is still under heavy development, and is only suitable for **\n";
     cout << " **          testing and review.  Do not trust it with important data.       **" << std::endl;
index bf96d688eb0ca36d5456ff36e0723b1a4681ac4b..da10d2ba2085bbe085825cc4f6fed7fd418fbb47 100644 (file)
@@ -138,11 +138,11 @@ std::map<entity_name_t,float> g_fake_kill_after;
 entity_addr_t g_my_addr;
 
 md_config_t g_conf;
+bool g_daemon = false;
 
 #include <stdlib.h>
 #include <string.h>
 
-
 void env_to_vec(std::vector<const char*>& args) 
 {
   char *p = getenv("CEPH_ARGS");
index c422f1114bb25efbc709dfe772a34cebed072597..eff01383a3e3ceca8ebbc69c088f95ddab97b5a3 100644 (file)
@@ -39,6 +39,8 @@ extern const char *get_pool_name(int pool);
 
 extern entity_addr_t g_my_addr;
 
+extern bool g_daemon;
+
 struct md_config_t {
   char *type;
   char *id;
index 995b0bf5d2ff0ac28159ce2cee207a469e05b3cf..b6eaadb85e631c1ecdd41538c0624a48404d2251 100644 (file)
@@ -409,7 +409,7 @@ int Rank::start(bool nodaemon)
     }
 
     _dout_rename_output_file();
-  } else {
+  } else if (g_daemon) {
     write_pid_file(getpid());
   }