Add configure option for how read fails behave

Different platforms have different requirements for handling
hwmon sysfs access failures.

The default behavior is that a read failure leads to the daemon
exiting after some number of read failures.  This can be controlled
to then remove the object from the dbus on failure.  Now, it can
instead be controlled to return -errno on read failure.

This new behavior to set the value to -errno must be checked by
whatever mechanism is reporting the value.

Change-Id: I50b93aea56f22267da79c9571319f281e24a1e6f
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/sysfs.cpp b/sysfs.cpp
index f348be4..5c7dbee 100644
--- a/sysfs.cpp
+++ b/sysfs.cpp
@@ -21,6 +21,7 @@
 #include <memory>
 #include <phosphor-logging/log.hpp>
 #include <thread>
+#include "config.h"
 #include "sysfs.hpp"
 
 using namespace std::string_literals;
@@ -361,6 +362,9 @@
                     !retries)
             {
                 // Not a retryable error or out of retries.
+#ifdef NEGATIVE_ERRNO_ON_FAIL
+                return -rc;
+#endif
 
                 // Work around GCC bugs 53984 and 66145 for callers by
                 // explicitly raising system_error here.