]> git.proxmox.com Git - ceph.git/blame - ceph/src/global/global_init.h
bump version to 18.2.4-pve3
[ceph.git] / ceph / src / global / global_init.h
CommitLineData
7c673cae
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3/*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2011 New Dream Network
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14
15#ifndef CEPH_COMMON_GLOBAL_INIT_H
16#define CEPH_COMMON_GLOBAL_INIT_H
17
18#include <stdint.h>
19#include <vector>
11fdf7f2 20#include <map>
7c673cae 21#include <boost/intrusive_ptr.hpp>
11fdf7f2 22#include "include/ceph_assert.h"
f67539c2 23#include "common/ceph_context.h"
7c673cae
FG
24#include "common/code_environment.h"
25#include "common/common_init.h"
26
7c673cae
FG
27/*
28 * global_init is the first initialization function that
29 * daemons and utility programs need to call. It takes care of a lot of
30 * initialization, including setting up g_ceph_context.
31 */
32boost::intrusive_ptr<CephContext>
11fdf7f2
TL
33global_init(
34 const std::map<std::string,std::string> *defaults,
35 std::vector < const char* >& args,
36 uint32_t module_type,
37 code_environment_t code_env,
f67539c2 38 int flags, bool run_pre_init = true);
7c673cae
FG
39
40// just the first half; enough to get config parsed but doesn't start up the
41// cct or log.
11fdf7f2 42void global_pre_init(const std::map<std::string,std::string> *defaults,
7c673cae
FG
43 std::vector < const char* >& args,
44 uint32_t module_type, code_environment_t code_env,
b32b8144 45 int flags);
7c673cae
FG
46
47/*
48 * perform all of the steps that global_init_daemonize performs just prior
49 * to actually forking (via daemon(3)). return 0 if we are going to proceed
50 * with the fork, or -1 otherwise.
51 */
52int global_init_prefork(CephContext *cct);
53
54/*
55 * perform all the steps that global_init_daemonize performs just after
56 * the fork, except closing stderr, which we'll do later on.
57 */
58void global_init_postfork_start(CephContext *cct);
59
60/*
61 * close stderr, thus completing the postfork.
62 */
63void global_init_postfork_finish(CephContext *cct);
64
65
66/*
67 * global_init_daemonize handles daemonizing a process.
68 *
69 * If this is called, it *must* be called before common_init_finish.
70 * Note that this is equivalent to calling _prefork(), daemon(), and
71 * _postfork.
72 */
73void global_init_daemonize(CephContext *cct);
74
75/*
76 * global_init_chdir changes the process directory.
77 *
78 * If this is called, it *must* be called before common_init_finish
79 */
80void global_init_chdir(const CephContext *cct);
81
82/*
83 * Explicitly shut down stderr. Usually, you don't need to do
84 * this, because global_init_daemonize will do it for you. However, in some
85 * rare cases you need to call this explicitly.
86 *
87 * If this is called, it *must* be called before common_init_finish
88 */
89int global_init_shutdown_stderr(CephContext *cct);
90
91/*
92 * Preload the erasure coding libraries to detect early issues with
93 * configuration.
94 */
95int global_init_preload_erasure_code(const CephContext *cct);
96
97/**
98 * print daemon startup banner/warning
99 */
100void global_print_banner(void);
7c673cae 101#endif