summaryrefslogtreecommitdiff
path: root/libc/async_safe/async_safe_log.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-09-19 14:02:50 -0700
committerElliott Hughes <enh@google.com>2017-09-19 14:02:50 -0700
commit53dc9dd70155fd75af744cbebecc563658c69818 (patch)
tree2c115be9ba0a403a6a42d9e880746275313dbd79 /libc/async_safe/async_safe_log.cpp
parentcce6ada00ad055ac52791526e44b1f223bec8ce4 (diff)
Improve pthread_create failure handling.
Return EAGAIN rather than aborting if we fail to set up the TLS for a new thread. Add a test that uses all the VMAs so we can properly test these edge cases. Add an explicit test for pthread_attr_setdetachstate, which we use in the previous test, but other than that has no tests. Remove support for ro.logd.timestamp/persist.logd.timestamp, which doesn't seem to be used, and which prevents us from logging failures in cases where mmap fails (because we need to mmap in the system property implementation). Bug: http://b/65608572 Test: ran tests Change-Id: I9009f06546e1c2cc55eff996d08b55eff3482343
Diffstat (limited to 'libc/async_safe/async_safe_log.cpp')
-rw-r--r--libc/async_safe/async_safe_log.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/libc/async_safe/async_safe_log.cpp b/libc/async_safe/async_safe_log.cpp
index d81ef34ce..78f62bdba 100644
--- a/libc/async_safe/async_safe_log.cpp
+++ b/libc/async_safe/async_safe_log.cpp
@@ -468,19 +468,6 @@ static int open_log_socket() {
return log_fd;
}
-static clockid_t log_clockid() {
- static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
- ScopedPthreadMutexLocker locker(&mutex);
-
- static CachedProperty ro_logd_timestamp("ro.logd.timestamp");
- static CachedProperty persist_logd_timestamp("persist.logd.timestamp");
-
- char ch = persist_logd_timestamp.Get()[0];
- if (ch == '\0') ch = ro_logd_timestamp.Get()[0];
-
- return (tolower(ch) == 'm') ? CLOCK_MONOTONIC : CLOCK_REALTIME;
-}
-
struct log_time { // Wire format
uint32_t tv_sec;
uint32_t tv_nsec;
@@ -501,7 +488,7 @@ int async_safe_write_log(int priority, const char* tag, const char* msg) {
vec[1].iov_base = &tid;
vec[1].iov_len = sizeof(tid);
timespec ts;
- clock_gettime(log_clockid(), &ts);
+ clock_gettime(CLOCK_REALTIME, &ts);
log_time realtime_ts;
realtime_ts.tv_sec = ts.tv_sec;
realtime_ts.tv_nsec = ts.tv_nsec;