1 #include "config.h"
2 
3 #include "core_manager.hpp"
4 #include "watch.hpp"
5 #include "xyz/openbmc_project/Common/error.hpp"
6 
7 #include <fmt/core.h>
8 
9 #include <phosphor-logging/elog-errors.hpp>
10 #include <sdbusplus/bus.hpp>
11 
12 int main()
13 {
14     using namespace phosphor::logging;
15     using InternalFailure =
16         sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
17 
18     auto bus = sdbusplus::bus::new_default();
19     sd_event* event = nullptr;
20     auto rc = sd_event_default(&event);
21     if (rc < 0)
22     {
23         log<level::ERR>(
24             fmt::format("Error occurred during the sd_event_default, rc({})",
25                         rc)
26                 .c_str());
27         report<InternalFailure>();
28         return -1;
29     }
30     phosphor::dump::EventPtr eventP{event};
31     event = nullptr;
32 
33     try
34     {
35         phosphor::dump::core::Manager manager(eventP);
36 
37         auto rc = sd_event_loop(eventP.get());
38         if (rc < 0)
39         {
40             log<level::ERR>(
41                 fmt::format("Error occurred during the sd_event_loop, rc({})",
42                             rc)
43                     .c_str());
44             elog<InternalFailure>();
45         }
46     }
47 
48     catch (const InternalFailure& e)
49     {
50         commit<InternalFailure>();
51         return -1;
52     }
53 
54     return 0;
55 }
56