control: Support reloading configurations with SIGHUP
Support the use of SIGHUP to reload the JSON configuration files where
all configuration files must succeed in being parsed to enable the use
of the config files found. This is particularly useful in placing one or
more override fan control configuration files and having fan control
immediately begin to use them on a system.
To minimize complexity, the creation of the Manager object when fan
control starts or receiving a SIGHUP use the same configuration file
loading method. This way if any future changes in this area only needs
to be done in one place.
Change-Id: Iaf906c3b4611ba88f45b5684935cf477045eeb2b
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/manager.hpp b/control/json/manager.hpp
index 657f51a..c5b591d 100644
--- a/control/json/manager.hpp
+++ b/control/json/manager.hpp
@@ -134,6 +134,13 @@
Manager(const sdeventplus::Event& event);
/**
+ * @brief Callback function to handle receiving a HUP signal to reload the
+ * JSON configurations.
+ */
+ void sighupHandler(sdeventplus::source::Signal&,
+ const struct signalfd_siginfo*);
+
+ /**
* @brief Get the active profiles of the system where an empty list
* represents that only configuration entries without a profile defined will
* be loaded.
@@ -451,6 +458,16 @@
std::map<configKey, std::unique_ptr<Event>> _events;
/**
+ * @brief Load all the fan control JSON configuration files
+ *
+ * This is where all the fan control JSON configuration files are parsed and
+ * loaded into their associated objects. Anything that needs to be done when
+ * the Manager object is constructed or handling a SIGHUP to reload the
+ * configurations needs to be done here.
+ */
+ void load();
+
+ /**
* @brief Find the service name for a given path and interface from the
* cached dataset
*