Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 1 | #include "config.h" |
| 2 | |
| 3 | #include "sync_manager.hpp" |
| 4 | #include "sync_watch.hpp" |
| 5 | |
| 6 | #include <systemd/sd-event.h> |
| 7 | |
Adriana Kobylak | b072d1b | 2018-04-24 11:37:21 -0500 | [diff] [blame] | 8 | #include <exception> |
| 9 | #include <phosphor-logging/log.hpp> |
Adriana Kobylak | 7e8d76b | 2018-04-20 10:03:01 -0500 | [diff] [blame] | 10 | #include <sdbusplus/bus.hpp> |
| 11 | #include <sdbusplus/server/manager.hpp> |
Adriana Kobylak | 7e8d76b | 2018-04-20 10:03:01 -0500 | [diff] [blame] | 12 | |
| 13 | int main(int argc, char* argv[]) |
| 14 | { |
| 15 | auto bus = sdbusplus::bus::new_default(); |
| 16 | |
Adriana Kobylak | b072d1b | 2018-04-24 11:37:21 -0500 | [diff] [blame] | 17 | sd_event* loop = nullptr; |
| 18 | sd_event_default(&loop); |
| 19 | |
Adriana Kobylak | 7e8d76b | 2018-04-20 10:03:01 -0500 | [diff] [blame] | 20 | sdbusplus::server::manager::manager objManager(bus, SOFTWARE_OBJPATH); |
Adriana Kobylak | b072d1b | 2018-04-24 11:37:21 -0500 | [diff] [blame] | 21 | |
| 22 | try |
| 23 | { |
| 24 | phosphor::software::manager::Sync syncManager; |
Adriana Kobylak | b072d1b | 2018-04-24 11:37:21 -0500 | [diff] [blame] | 25 | |
| 26 | using namespace phosphor::software::manager; |
| 27 | phosphor::software::manager::SyncWatch watch( |
Adriana Kobylak | a907434 | 2018-05-08 11:52:44 -0500 | [diff] [blame] | 28 | *loop, std::bind(std::mem_fn(&Sync::processEntry), &syncManager, |
| 29 | std::placeholders::_1, std::placeholders::_2)); |
Adriana Kobylak | b072d1b | 2018-04-24 11:37:21 -0500 | [diff] [blame] | 30 | bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL); |
| 31 | sd_event_loop(loop); |
| 32 | } |
| 33 | catch (std::exception& e) |
| 34 | { |
| 35 | using namespace phosphor::logging; |
| 36 | log<level::ERR>(e.what()); |
| 37 | sd_event_unref(loop); |
| 38 | return -1; |
| 39 | } |
| 40 | |
| 41 | sd_event_unref(loop); |
Adriana Kobylak | 7e8d76b | 2018-04-20 10:03:01 -0500 | [diff] [blame] | 42 | |
| 43 | return 0; |
| 44 | } |