From 6ed68cc412752e4c78755df9a1516e610ec66fa8 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 30 Jun 2015 08:22:24 -0700 Subject: 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 --- libutils/ProcessCallStack.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'libutils/ProcessCallStack.cpp') 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 -#include #include +#include +#include +#include #include #include @@ -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 -- cgit v1.2.3