summaryrefslogtreecommitdiffstats
path: root/occ_errors.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'occ_errors.hpp')
-rw-r--r--occ_errors.hpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/occ_errors.hpp b/occ_errors.hpp
index ebacc8a..f623704 100644
--- a/occ_errors.hpp
+++ b/occ_errors.hpp
@@ -36,7 +36,7 @@ class Error
Error(EventPtr& event, const fs::path& file,
std::function<void(bool)> callBack = nullptr) :
event(event),
- file(fs::path(DEV_PATH) / file), callBack(callBack)
+ file(file), callBack(callBack)
{
// Nothing to do here.
}
@@ -49,12 +49,23 @@ class Error
}
}
- /** @brief Starts to monitor for error conditions */
- void addWatch();
+ /** @brief Starts to monitor for error conditions
+ *
+ * @param[in] poll - Indicates whether or not the error file should
+ * actually be polled for changes. Disabling polling is
+ * necessary for error files that don't support the poll
+ * file operation.
+ */
+ void addWatch(bool poll = true);
/** @brief Removes error watch */
void removeWatch();
+ inline void setFile(const fs::path& f)
+ {
+ file = f;
+ }
+
private:
/** @brief sd_event wrapped in unique_ptr */
EventPtr& event;
@@ -95,7 +106,7 @@ class Error
int fd = -1;
/** Error file */
- const fs::path file;
+ fs::path file;
/** @brief Optional function to call on error scenario */
std::function<void(bool)> callBack;
OpenPOWER on IntegriCloud