From fd12160087e77dbaa00dcac132979be1153e6c77 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 1 Apr 2019 12:22:55 -0700 Subject: [PATCH] libutils: more detailed logging. The question arose on the bug of whether this is a legit errno or just a stale value. Bug: http://b/129139241 Test: ran tests Change-Id: I486176496028f04d4fcccdd0b29a3df6b13849c9 --- libutils/Looper.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libutils/Looper.cpp b/libutils/Looper.cpp index b3f943d42..2d696eb1f 100644 --- a/libutils/Looper.cpp +++ b/libutils/Looper.cpp @@ -76,8 +76,8 @@ Looper::~Looper() { } void Looper::initTLSKey() { - int result = pthread_key_create(& gTLSKey, threadDestructor); - LOG_ALWAYS_FATAL_IF(result != 0, "Could not allocate TLS key."); + int error = pthread_key_create(&gTLSKey, threadDestructor); + LOG_ALWAYS_FATAL_IF(error != 0, "Could not allocate TLS key: %s", strerror(error)); } void Looper::threadDestructor(void *st) { @@ -399,8 +399,8 @@ void Looper::wake() { ssize_t nWrite = TEMP_FAILURE_RETRY(write(mWakeEventFd.get(), &inc, sizeof(uint64_t))); if (nWrite != sizeof(uint64_t)) { if (errno != EAGAIN) { - LOG_ALWAYS_FATAL("Could not write wake signal to fd %d: %s", mWakeEventFd.get(), - strerror(errno)); + LOG_ALWAYS_FATAL("Could not write wake signal to fd %d (returned %zd): %s", + mWakeEventFd.get(), nWrite, strerror(errno)); } } }