From 5d5a7116ac447ccf0b3d3fe30152983dcb749652 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Wed, 15 Jun 2011 13:41:26 -0700 Subject: [PATCH] common_init: misc globals cleanup Signed-off-by: Colin McCabe --- src/common/common_init.cc | 12 ++++++------ src/common/common_init.h | 5 ++--- src/cosd.cc | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/common/common_init.cc b/src/common/common_init.cc index acaa277ab07eb..da6839a016b20 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -157,7 +157,7 @@ static void pidfile_remove_void(void) * behavior that the file descriptor that gets assigned is the lowest * available one. */ -int common_init_shutdown_stderr(void) +int common_init_shutdown_stderr(CephContext *cct) { TEMP_FAILURE_RETRY(close(STDERR_FILENO)); if (open("/dev/null", O_RDONLY) < 0) { @@ -166,11 +166,11 @@ int common_init_shutdown_stderr(void) << err << dendl; return 1; } - g_ceph_context._doss->handle_stderr_shutdown(); + cct->_doss->handle_stderr_shutdown(); return 0; } -void common_init_daemonize(const CephContext *cct, int flags) +void common_init_daemonize(CephContext *cct, int flags) { if (g_code_env != CODE_ENVIRONMENT_DAEMON) return; @@ -220,7 +220,7 @@ void common_init_daemonize(const CephContext *cct, int flags) exit(1); } if (!(flags & CINIT_FLAG_NO_DEFAULT_CONFIG_FILE)) { - ret = common_init_shutdown_stderr(); + ret = common_init_shutdown_stderr(cct); if (ret) { derr << "common_init_daemonize: common_init_shutdown_stderr failed with " << "error code " << ret << dendl; @@ -228,13 +228,13 @@ void common_init_daemonize(const CephContext *cct, int flags) } } pidfile_write(g_conf); - ret = g_ceph_context._doss->handle_pid_change(g_conf); + ret = cct->_doss->handle_pid_change(g_conf); if (ret) { derr << "common_init_daemonize: _doss->handle_pid_change failed with " << "error code " << ret << dendl; exit(1); } - dout(1) << "finished common_init_daemonize" << dendl; + ldout(cct, 1) << "finished common_init_daemonize" << dendl; } void common_init_chdir(const CephContext *cct) diff --git a/src/common/common_init.h b/src/common/common_init.h index ff20b9128b48d..848236c538025 100644 --- a/src/common/common_init.h +++ b/src/common/common_init.h @@ -28,9 +28,8 @@ void complain_about_parse_errors(std::deque *parse_errors); void common_init(std::vector < const char* >& args, uint32_t module_type, code_environment_t code_env, int flags); void output_ceph_version(); -int common_init_shutdown_stderr(); -void common_init_daemonize(const CephContext *cct, int flags); -int common_init_shutdown_stderr(void); +int common_init_shutdown_stderr(CephContext *cct); +void common_init_daemonize(CephContext *cct, int flags); void common_init_finish(CephContext *cct); void common_init_chdir(const CephContext *cct); diff --git a/src/cosd.cc b/src/cosd.cc index fb0734bad3c1a..ca6a60d64280c 100644 --- a/src/cosd.cc +++ b/src/cosd.cc @@ -293,7 +293,7 @@ int main(int argc, const char **argv) } // Now close the standard file descriptors - common_init_shutdown_stderr(); + common_init_shutdown_stderr(&g_ceph_context); client_messenger->start(); messenger_hb->start(); -- 2.39.5