--- a/src/utils/log.h
+++ b/src/utils/log.h
@@ -34,6 +34,8 @@
#ifndef _LOG_H_X_INCLUDED_
#define _LOG_H_X_INCLUDED_
+#include <string.h>
+
#include <fstream>
#include <iostream>
#include <string>
@@ -191,4 +193,17 @@
#endif
#define LOGFATAL LOGFAT
+#if (_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE
+#define LOGSYSERR(who, what, arg) { \
+ char buf[200]; buf[0] = 0; strerror_r(errno, buf, 200); \
+ LOGERR(who << ": " << what << "(" << arg << "): errno " << errno << \
+ ": " << buf << std::endl); \
+ }
+#else
+#define LOGSYSERR(who, what, arg) { \
+ char buf[200]; buf[0] = 0; \
+ LOGERR(who << ": " << what << "(" << arg << "): errno " << errno << \
+ ": " << strerror_r(errno, buf, 200) << std::endl); \
+ }
+#endif
#endif /* _LOG_H_X_INCLUDED_ */