2011-06-17 03:15:24 +00:00
|
|
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
|
|
|
|
// vim: ts=8 sw=2 smarttab
|
|
|
|
/*
|
|
|
|
* Ceph - scalable distributed file system
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 New Dream Network
|
|
|
|
*
|
|
|
|
* This is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software
|
|
|
|
* Foundation. See file COPYING.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CEPH_COMMON_GLOBAL_INIT_H
|
|
|
|
#define CEPH_COMMON_GLOBAL_INIT_H
|
|
|
|
|
|
|
|
#include <deque>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "common/code_environment.h"
|
|
|
|
#include "common/common_init.h"
|
|
|
|
|
|
|
|
class CephContext;
|
|
|
|
|
2011-06-21 20:00:04 +00:00
|
|
|
/*
|
|
|
|
* global_init is the first initialization function that
|
|
|
|
* daemons and utility programs need to call. It takes care of a lot of
|
|
|
|
* initialization, including setting up g_ceph_context.
|
|
|
|
*/
|
2012-03-12 20:15:50 +00:00
|
|
|
void global_init(std::vector < const char * > *alt_def_args, std::vector < const char* >& args,
|
2011-06-17 03:15:24 +00:00
|
|
|
uint32_t module_type, code_environment_t code_env, int flags);
|
2011-06-21 20:00:04 +00:00
|
|
|
|
2013-05-03 18:29:24 +00:00
|
|
|
/*
|
|
|
|
* perform all of the steps that global_init_daemonize performs just prior
|
|
|
|
* to actually forking (via daemon(3)). return 0 if we are going to proceed
|
|
|
|
* with the fork, or -1 otherwise.
|
|
|
|
*/
|
|
|
|
int global_init_prefork(CephContext *cct, int flags);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* perform all of the steps that global_init_daemonize performs just after
|
|
|
|
* the fork.
|
|
|
|
*/
|
|
|
|
void global_init_postfork(CephContext *cct, int flags);
|
|
|
|
|
2011-06-21 20:00:04 +00:00
|
|
|
/*
|
|
|
|
* global_init_daemonize handles daemonizing a process.
|
|
|
|
*
|
2013-05-03 18:29:24 +00:00
|
|
|
* If this is called, it *must* be called before common_init_finish.
|
|
|
|
* Note that this is equivalent to calling _prefork(), daemon(), and
|
|
|
|
* _postfork.
|
2011-06-21 20:00:04 +00:00
|
|
|
*/
|
2011-06-17 03:15:24 +00:00
|
|
|
void global_init_daemonize(CephContext *cct, int flags);
|
2011-06-21 20:00:04 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* global_init_chdir changes the process directory.
|
|
|
|
*
|
|
|
|
* If this is called, it *must* be called before common_init_finish
|
|
|
|
*/
|
2011-06-17 03:15:24 +00:00
|
|
|
void global_init_chdir(const CephContext *cct);
|
|
|
|
|
2011-06-21 20:00:04 +00:00
|
|
|
/*
|
|
|
|
* Explicitly shut down stderr. Usually, you don't need to do
|
|
|
|
* this, because global_init_daemonize will do it for you. However, in some
|
|
|
|
* rare cases you need to call this explicitly.
|
|
|
|
*
|
|
|
|
* If this is called, it *must* be called before common_init_finish
|
|
|
|
*/
|
|
|
|
int global_init_shutdown_stderr(CephContext *cct);
|
|
|
|
|
2011-12-01 17:17:00 +00:00
|
|
|
/**
|
|
|
|
* print daemon startup banner/warning
|
|
|
|
*/
|
|
|
|
void global_print_banner(void);
|
|
|
|
|
2011-06-17 03:15:24 +00:00
|
|
|
#endif
|