summaryrefslogtreecommitdiff
path: root/libutils/ProcessCallStack.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-09-29 16:38:45 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-09-29 16:38:45 +0000
commit833df5cd54e85e359c2a9ccb38221658090cf77d (patch)
tree4e7ad8abe0b1546704777a902ac1bc441ad22440 /libutils/ProcessCallStack.cpp
parentdfd30c4a169e6b9e3da132769f0ad2b626703cd2 (diff)
parent9f206938edc2243e4e4f5de74d67e15befd95576 (diff)
Merge "Use readdir instead of readdir_r."
Diffstat (limited to 'libutils/ProcessCallStack.cpp')
-rw-r--r--libutils/ProcessCallStack.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/libutils/ProcessCallStack.cpp b/libutils/ProcessCallStack.cpp
index 4e87a9875a..73ed4ebefd 100644
--- a/libutils/ProcessCallStack.cpp
+++ b/libutils/ProcessCallStack.cpp
@@ -131,9 +131,6 @@ void ProcessCallStack::clear() {
}
void ProcessCallStack::update() {
- struct dirent *ep;
- struct dirent entry;
-
std::unique_ptr<DIR, decltype(&closedir)> dp(opendir(PATH_SELF_TASK), closedir);
if (dp == NULL) {
ALOGE("%s: Failed to update the process's call stacks: %s",
@@ -158,8 +155,8 @@ void ProcessCallStack::update() {
* Each tid is a directory inside of /proc/self/task
* - Read every file in directory => get every tid
*/
- int code;
- while ((code = readdir_r(dp.get(), &entry, &ep)) == 0 && ep != NULL) {
+ dirent* ep;
+ while ((ep = readdir(dp.get())) != NULL) {
pid_t tid = -1;
sscanf(ep->d_name, "%d", &tid);
@@ -194,10 +191,6 @@ void ProcessCallStack::update() {
ALOGV("%s: Got call stack for tid %d (size %zu)",
__FUNCTION__, tid, threadInfo.callStack.size());
}
- if (code != 0) { // returns positive error value on error
- ALOGE("%s: Failed to readdir from %s: %s",
- __FUNCTION__, PATH_SELF_TASK, strerror(code));
- }
}
void ProcessCallStack::log(const char* logtag, android_LogPriority priority,