Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 1 | #include "config.h" |
Jayanth Othayoth | cb65ffc | 2018-10-16 08:29:32 -0500 | [diff] [blame] | 2 | |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 3 | #include "core_manager.hpp" |
| 4 | #include "watch.hpp" |
Jayanth Othayoth | cb65ffc | 2018-10-16 08:29:32 -0500 | [diff] [blame] | 5 | #include "xyz/openbmc_project/Common/error.hpp" |
| 6 | |
| 7 | #include <phosphor-logging/elog-errors.hpp> |
| 8 | #include <sdbusplus/bus.hpp> |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 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", |
Gunnar Mills | 11eaab7 | 2017-10-19 16:07:31 -0500 | [diff] [blame] | 22 | entry("RC=%d", rc)); |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 23 | report<InternalFailure>(); |
| 24 | return -1; |
| 25 | } |
| 26 | phosphor::dump::EventPtr eventP{event}; |
| 27 | event = nullptr; |
| 28 | |
| 29 | try |
| 30 | { |
Jayanth Othayoth | bf6ec60 | 2017-08-28 01:48:49 -0500 | [diff] [blame] | 31 | phosphor::dump::core::Manager manager(eventP); |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 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", |
Gunnar Mills | 11eaab7 | 2017-10-19 16:07:31 -0500 | [diff] [blame] | 37 | entry("RC=%d", rc)); |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 38 | elog<InternalFailure>(); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | catch (InternalFailure& e) |
| 43 | { |
| 44 | commit<InternalFailure>(); |
| 45 | return -1; |
| 46 | } |
| 47 | |
| 48 | return 0; |
| 49 | } |