#include <memory>
#include <string>
+#include <cstring>
namespace {
ret = PT->taskreader(PT,p,t,path);
if (errno && errno != ENOENT)
goto out;
+ errno = 0;
if (ret != NULL)
return ret;
}
m_proc = readproc(proctabPtr.get(), nullptr);
if (!m_proc)
ThrowMsg(Exception::ProcError,
- "Unable to read process information for " << pid);
+ "Unable to read process information for " << m_pid);
proc_t *thread;
while ((thread = readtask_priv(proctabPtr.get(), m_proc))) {
}
if (errno == EACCES) {
LogError("Permission denied while reading proc data, some threads might not be "
- "synchronized for " << pid);
+ "synchronized for " << m_pid);
return false;
}
- if (errno)
+ if (errno) {
+ static const unsigned ERROR_MSG_LEN = 1024;
+ char error_msg[ERROR_MSG_LEN];
+ const char *e = strerror_r(errno, error_msg, ERROR_MSG_LEN);
+
ThrowMsg(Exception::ProcError,
- "Unable to read process information for " << pid);
+ "Unable to read process information for " << m_pid << ": " << e);
+ }
LogDebug("Reading proc data for " << m_threads.size() << " additional threads beside main thread");
return true;