diff options
author | Elliott Hughes <enh@google.com> | 2015-06-30 08:22:24 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-06-30 10:41:15 -0700 |
commit | 6ed68cc412752e4c78755df9a1516e610ec66fa8 (patch) | |
tree | 287929b99130bf3a06b67b5abf2d3b4b6d8199f3 /libutils/ProcessCallStack.cpp | |
parent | 692dc75d9fbf5c256cd8c66219a930ae0fe9f523 (diff) |
Consistently use strerror in libutils.
It's easier for people to debug, and side-steps the problem that errno
values differ between architectures.
Bug: http://b/17458391
Change-Id: I1db9b2cbb653839d3936b91e37e5cff02671318a
Diffstat (limited to 'libutils/ProcessCallStack.cpp')
-rw-r--r-- | libutils/ProcessCallStack.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libutils/ProcessCallStack.cpp b/libutils/ProcessCallStack.cpp index db07e563f..011c30291 100644 --- a/libutils/ProcessCallStack.cpp +++ b/libutils/ProcessCallStack.cpp @@ -17,9 +17,10 @@ #define LOG_TAG "ProcessCallStack" // #define LOG_NDEBUG 0 -#include <string.h> -#include <stdio.h> #include <dirent.h> +#include <errno.h> +#include <stdio.h> +#include <string.h> #include <utils/Log.h> #include <utils/Errors.h> @@ -135,8 +136,8 @@ void ProcessCallStack::update() { dp = opendir(PATH_SELF_TASK); if (dp == NULL) { - ALOGE("%s: Failed to update the process's call stacks (errno = %d, '%s')", - __FUNCTION__, errno, strerror(errno)); + ALOGE("%s: Failed to update the process's call stacks: %s", + __FUNCTION__, strerror(errno)); return; } @@ -172,8 +173,8 @@ void ProcessCallStack::update() { ssize_t idx = mThreadMap.add(tid, ThreadInfo()); if (idx < 0) { // returns negative error value on error - ALOGE("%s: Failed to add new ThreadInfo (errno = %zd, '%s')", - __FUNCTION__, idx, strerror(-idx)); + ALOGE("%s: Failed to add new ThreadInfo: %s", + __FUNCTION__, strerror(-idx)); continue; } @@ -195,8 +196,8 @@ void ProcessCallStack::update() { __FUNCTION__, tid, threadInfo.callStack.size()); } if (code != 0) { // returns positive error value on error - ALOGE("%s: Failed to readdir from %s (errno = %d, '%s')", - __FUNCTION__, PATH_SELF_TASK, -code, strerror(code)); + ALOGE("%s: Failed to readdir from %s: %s", + __FUNCTION__, PATH_SELF_TASK, strerror(code)); } #endif |