• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef FAULT_LOGGER_DAEMON_H_
16 #define FAULT_LOGGER_DAEMON_H_
17 
18 #include <cstdint>
19 #include <memory>
20 
21 #include "epoll_manager.h"
22 #include "temp_file_manager.h"
23 #include "fault_logger_server.h"
24 
25 namespace OHOS {
26 namespace HiviewDFX {
27 
28 enum class EpollManagerType {
29     MAIN_SERVER,
30     HELPER_SERVER,
31 };
32 class FaultLoggerDaemon {
33 public:
34     FaultLoggerDaemon(const FaultLoggerDaemon&) = delete;
35     FaultLoggerDaemon(FaultLoggerDaemon&&) = delete;
36 
37     FaultLoggerDaemon &operator=(const FaultLoggerDaemon&) = delete;
38     FaultLoggerDaemon &operator=(FaultLoggerDaemon&&) = delete;
39 
40     static FaultLoggerDaemon& GetInstance();
41     int32_t StartServer();
42     static EpollManager& GetEpollManager(EpollManagerType type);
43 private:
44     FaultLoggerDaemon();
45     ~FaultLoggerDaemon();
46     EpollManager mainEpollManager_;
47     EpollManager secondaryEpollManager_;
48     SocketServer mainServer_;
49     TempFileManager tempFileManager_;
50 };
51 } // namespace HiviewDFX
52 } // namespace OHOS
53 #endif // FAULT_LOGGER_DAEMON_H_
54