Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / common / code_environment.h
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_CODE_ENVIRONMENT_H
16 #define CEPH_COMMON_CODE_ENVIRONMENT_H
17
18 enum code_environment_t {
19   CODE_ENVIRONMENT_UTILITY = 0,
20   CODE_ENVIRONMENT_DAEMON = 1,
21   CODE_ENVIRONMENT_LIBRARY = 2,
22   CODE_ENVIRONMENT_UTILITY_NODOUT = 3,
23 };
24
25 #ifdef __cplusplus
26 #include <iosfwd>
27 #include <string>
28
29 extern "C" code_environment_t g_code_env;
30 extern "C" const char *code_environment_to_str(enum code_environment_t e);
31 std::ostream &operator<<(std::ostream &oss, const enum code_environment_t e);
32 extern "C" int get_process_name(char *buf, int len);
33 std::string get_process_name_cpp();
34
35 #else
36
37 extern code_environment_t g_code_env;
38 const char *code_environment_to_str(const enum code_environment_t e);
39 extern int get_process_name(char *buf, int len);
40
41 #endif
42
43 #endif