regs: Handle HUP signals
Enable capturing and handling a HUP signal to reload configuration data.
Tested:
Handler function called upon receiving a SIGHUP
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: I41d136ede5f2a4c0bf595ee58993a4408f153013
diff --git a/phosphor-regulators/src/main.cpp b/phosphor-regulators/src/main.cpp
index 35a3b49..04d3e21 100644
--- a/phosphor-regulators/src/main.cpp
+++ b/phosphor-regulators/src/main.cpp
@@ -18,6 +18,10 @@
#include <sdbusplus/bus.hpp>
#include <sdeventplus/event.hpp>
+#include <sdeventplus/source/signal.hpp>
+#include <stdplus/signal.hpp>
+
+#include <functional>
int main(void)
{
@@ -29,5 +33,12 @@
regulators::Manager manager(bus, event);
+ // Handle HUP signals
+ stdplus::signal::block(SIGHUP);
+ sdeventplus::source::Signal signal(
+ event, SIGHUP,
+ std::bind(®ulators::Manager::sighupHandler, &manager,
+ std::placeholders::_1, std::placeholders::_2));
+
return event.loop();
}