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> |
Dhruvaraj Subhashchandran | d1f670f | 2023-06-05 22:19:25 -0500 | [diff] [blame] | 8 | #include <phosphor-logging/lg2.hpp> |
Jayanth Othayoth | cb65ffc | 2018-10-16 08:29:32 -0500 | [diff] [blame] | 9 | #include <sdbusplus/bus.hpp> |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 10 | |
Ramesh Iyyar | bb410df | 2020-08-03 03:13:04 -0500 | [diff] [blame] | 11 | int main() |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 12 | { |
| 13 | using namespace phosphor::logging; |
| 14 | using InternalFailure = |
| 15 | sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; |
| 16 | |
| 17 | auto bus = sdbusplus::bus::new_default(); |
| 18 | sd_event* event = nullptr; |
| 19 | auto rc = sd_event_default(&event); |
| 20 | if (rc < 0) |
| 21 | { |
Dhruvaraj Subhashchandran | d1f670f | 2023-06-05 22:19:25 -0500 | [diff] [blame] | 22 | lg2::error("Error occurred during the sd_event_default, rc: {RC}", "RC", |
| 23 | rc); |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 24 | report<InternalFailure>(); |
| 25 | return -1; |
| 26 | } |
| 27 | phosphor::dump::EventPtr eventP{event}; |
| 28 | event = nullptr; |
| 29 | |
| 30 | try |
| 31 | { |
Jayanth Othayoth | bf6ec60 | 2017-08-28 01:48:49 -0500 | [diff] [blame] | 32 | phosphor::dump::core::Manager manager(eventP); |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 33 | |
| 34 | auto rc = sd_event_loop(eventP.get()); |
| 35 | if (rc < 0) |
| 36 | { |
Dhruvaraj Subhashchandran | d1f670f | 2023-06-05 22:19:25 -0500 | [diff] [blame] | 37 | lg2::error("Error occurred during the sd_event_loop, rc: {RC}", |
| 38 | "RC", rc); |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 39 | elog<InternalFailure>(); |
| 40 | } |
| 41 | } |
| 42 | |
Patrick Williams | 9d2d722 | 2021-10-06 12:44:44 -0500 | [diff] [blame] | 43 | catch (const InternalFailure& e) |
Jayanth Othayoth | d02153c | 2017-07-02 22:29:42 -0500 | [diff] [blame] | 44 | { |
| 45 | commit<InternalFailure>(); |
| 46 | return -1; |
| 47 | } |
| 48 | |
| 49 | return 0; |
| 50 | } |