forked from openbmc/phosphor-bmc-code-mgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsync_manager_main.cpp
44 lines (34 loc) · 1.06 KB
/
sync_manager_main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "config.h"
#include "sync_manager.hpp"
#include "sync_watch.hpp"
#include <systemd/sd-event.h>
#include <exception>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/manager.hpp>
int main(int argc, char* argv[])
{
auto bus = sdbusplus::bus::new_default();
sd_event* loop = nullptr;
sd_event_default(&loop);
sdbusplus::server::manager::manager objManager(bus, SOFTWARE_OBJPATH);
try
{
phosphor::software::manager::Sync syncManager;
using namespace phosphor::software::manager;
phosphor::software::manager::SyncWatch watch(
*loop, std::bind(std::mem_fn(&Sync::processEntry), &syncManager,
std::placeholders::_1, std::placeholders::_2));
bus.attach_event(loop, SD_EVENT_PRIORITY_NORMAL);
sd_event_loop(loop);
}
catch (std::exception& e)
{
using namespace phosphor::logging;
log<level::ERR>(e.what());
sd_event_unref(loop);
return -1;
}
sd_event_unref(loop);
return 0;
}