blob: 7a37a75c98f6cfc297334e2e167a87a2e19554ef [file] [log] [blame]
Jayanth Othayothd02153c2017-07-02 22:29:42 -05001#include "config.h"
Jayanth Othayothcb65ffc2018-10-16 08:29:32 -05002
Jayanth Othayothd02153c2017-07-02 22:29:42 -05003#include "core_manager.hpp"
4#include "watch.hpp"
Jayanth Othayothcb65ffc2018-10-16 08:29:32 -05005#include "xyz/openbmc_project/Common/error.hpp"
6
7#include <phosphor-logging/elog-errors.hpp>
Dhruvaraj Subhashchandrand1f670f2023-06-05 22:19:25 -05008#include <phosphor-logging/lg2.hpp>
Jayanth Othayothcb65ffc2018-10-16 08:29:32 -05009#include <sdbusplus/bus.hpp>
Jayanth Othayothd02153c2017-07-02 22:29:42 -050010
Ramesh Iyyarbb410df2020-08-03 03:13:04 -050011int main()
Jayanth Othayothd02153c2017-07-02 22:29:42 -050012{
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 Subhashchandrand1f670f2023-06-05 22:19:25 -050022 lg2::error("Error occurred during the sd_event_default, rc: {RC}", "RC",
23 rc);
Jayanth Othayothd02153c2017-07-02 22:29:42 -050024 report<InternalFailure>();
25 return -1;
26 }
27 phosphor::dump::EventPtr eventP{event};
28 event = nullptr;
29
30 try
31 {
Jayanth Othayothbf6ec602017-08-28 01:48:49 -050032 phosphor::dump::core::Manager manager(eventP);
Jayanth Othayothd02153c2017-07-02 22:29:42 -050033
34 auto rc = sd_event_loop(eventP.get());
35 if (rc < 0)
36 {
Dhruvaraj Subhashchandrand1f670f2023-06-05 22:19:25 -050037 lg2::error("Error occurred during the sd_event_loop, rc: {RC}",
38 "RC", rc);
Jayanth Othayothd02153c2017-07-02 22:29:42 -050039 elog<InternalFailure>();
40 }
41 }
42
Patrick Williams9d2d7222021-10-06 12:44:44 -050043 catch (const InternalFailure& e)
Jayanth Othayothd02153c2017-07-02 22:29:42 -050044 {
45 commit<InternalFailure>();
46 return -1;
47 }
48
49 return 0;
50}