Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 1 | #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 | |
| 9 | int 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", |
| 21 | entry("rc=%d", rc)); |
| 22 | report<InternalFailure>(); |
| 23 | return -1; |
| 24 | } |
| 25 | phosphor::dump::EventPtr eventP{event}; |
| 26 | event = nullptr; |
| 27 | |
| 28 | try |
| 29 | { |
Jayanth Othayoth | bf6ec60 | 2017-08-28 01:48:49 -0500 | [diff] [blame] | 30 | phosphor::dump::core::Manager manager(eventP); |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 31 | |
| 32 | auto rc = sd_event_loop(eventP.get()); |
| 33 | if (rc < 0) |
| 34 | { |
| 35 | log<level::ERR>("Error occurred during the sd_event_loop", |
| 36 | entry("rc=%d", rc)); |
| 37 | elog<InternalFailure>(); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | catch (InternalFailure& e) |
| 42 | { |
| 43 | commit<InternalFailure>(); |
| 44 | return -1; |
| 45 | } |
| 46 | |
| 47 | return 0; |
| 48 | } |