1 #include "config.h" 2 3 #include "sync_manager.hpp" 4 #include "sync_watch.hpp" 5 6 #include <systemd/sd-event.h> 7 8 #include <phosphor-logging/lg2.hpp> 9 #include <sdbusplus/bus.hpp> 10 #include <sdbusplus/server/manager.hpp> 11 12 #include <exception> 13 main()14int main() 15 { 16 auto bus = sdbusplus::bus::new_default(); 17 18 sd_event* loop = nullptr; 19 sd_event_default(&loop); 20 21 sdbusplus::server::manager_t objManager(bus, SOFTWARE_OBJPATH); 22 23 try 24 { 25 using namespace phosphor::software::manager; 26 auto syncCallback = std::bind( 27 &Sync::processEntry, std::placeholders::_1, std::placeholders::_2); 28 phosphor::software::manager::SyncWatch watch(*loop, syncCallback); 29 bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL); 30 sd_event_loop(loop); 31 } 32 catch (const std::exception& e) 33 { 34 lg2::error("Error in event loop: {ERROR}", "ERROR", e); 35 sd_event_unref(loop); 36 return -1; 37 } 38 39 sd_event_unref(loop); 40 41 return 0; 42 } 43