blob: 4ef6095adf2b80ac5fe8e6a79e139757bc3ed429 [file] [log] [blame]
Jayanth Othayothd02153c2017-07-02 22:29:42 -05001#include <sdbusplus/bus.hpp>
2#include <phosphor-logging/elog-errors.hpp>
3
4#include "xyz/openbmc_project/Common/error.hpp"
5#include "config.h"
6#include "core_manager.hpp"
7#include "watch.hpp"
8
9int main(int argc, char* argv[])
10{
11 using namespace phosphor::logging;
12 using InternalFailure =
13 sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
14
15 auto bus = sdbusplus::bus::new_default();
16 sd_event* event = nullptr;
17 auto rc = sd_event_default(&event);
18 if (rc < 0)
19 {
20 log<level::ERR>("Error occurred during the sd_event_default",
Gunnar Mills11eaab72017-10-19 16:07:31 -050021 entry("RC=%d", rc));
Jayanth Othayothd02153c2017-07-02 22:29:42 -050022 report<InternalFailure>();
23 return -1;
24 }
25 phosphor::dump::EventPtr eventP{event};
26 event = nullptr;
27
28 try
29 {
Jayanth Othayothbf6ec602017-08-28 01:48:49 -050030 phosphor::dump::core::Manager manager(eventP);
Jayanth Othayothd02153c2017-07-02 22:29:42 -050031
32 auto rc = sd_event_loop(eventP.get());
33 if (rc < 0)
34 {
35 log<level::ERR>("Error occurred during the sd_event_loop",
Gunnar Mills11eaab72017-10-19 16:07:31 -050036 entry("RC=%d", rc));
Jayanth Othayothd02153c2017-07-02 22:29:42 -050037 elog<InternalFailure>();
38 }
39 }
40
41 catch (InternalFailure& e)
42 {
43 commit<InternalFailure>();
44 return -1;
45 }
46
47 return 0;
48}