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 <phosphor-logging/elog-errors.hpp>
8 #include <sdbusplus/bus.hpp>
9 
10 int main(int argc, char* argv[])
11 {
12     using namespace phosphor::logging;
13     using InternalFailure =
14         sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
15 
16     auto bus = sdbusplus::bus::new_default();
17     sd_event* event = nullptr;
18     auto rc = sd_event_default(&event);
19     if (rc < 0)
20     {
21         log<level::ERR>("Error occurred during the sd_event_default",
22                         entry("RC=%d", rc));
23         report<InternalFailure>();
24         return -1;
25     }
26     phosphor::dump::EventPtr eventP{event};
27     event = nullptr;
28 
29     try
30     {
31         phosphor::dump::core::Manager manager(eventP);
32 
33         auto rc = sd_event_loop(eventP.get());
34         if (rc < 0)
35         {
36             log<level::ERR>("Error occurred during the sd_event_loop",
37                             entry("RC=%d", rc));
38             elog<InternalFailure>();
39         }
40     }
41 
42     catch (InternalFailure& e)
43     {
44         commit<InternalFailure>();
45         return -1;
46     }
47 
48     return 0;
49 }
50