summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2015-11-06 14:26:52 -0600
committerMark Salyzyn2015-11-19 15:14:16 -0600
commit2d2e0a5c5eb0b0ea2fe1349da50e22228965faf9 (patch)
treeef9d05a98bc0eb3fe698089c0701e1db503ced29 /include/log/log.h
parent9f903687011c195154b0c69c02e6aaa35c867242 (diff)
downloadplatform-system-core-2d2e0a5c5eb0b0ea2fe1349da50e22228965faf9.tar.gz
platform-system-core-2d2e0a5c5eb0b0ea2fe1349da50e22228965faf9.tar.xz
platform-system-core-2d2e0a5c5eb0b0ea2fe1349da50e22228965faf9.zip
liblog: resolve deadlocks
Although ever present, an increased regression introduced with commit b6bee33182cedea49199eb2252b3f3b442899c6d (liblog: logd: support logd.timestamp = monotonic). A signal handler can interrupt in locked context, if log is written in the signal handler, we are in deadlock. To reduce the contention and chances for this problem separate out timestamp lock from is loggable lock to reduce contention situations. Provide a best-guess response if lock would fail in timestamp path. Use a common lock() inline within each module, with a comment speaking to the issues surrounding calling a function that has a mutex within a signal handler. ToDo: Hold off signals temporarily in mainline, restart when unblock. Can not use pthread_sigmask(SIG_BLOCK,,) as it breaks AtCmd. Signed-off-by: Mark Salyzyn <salyzyn@google.com> Bug: 25563384 Change-Id: I47e2c87c988c3e359eb9eef129c6a3a08e9eedef
Diffstat (limited to 'include/log/log.h')
-rw-r--r--include/log/log.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/log/log.h b/include/log/log.h
index 1cdf7bc49..086d7427b 100644
--- a/include/log/log.h
+++ b/include/log/log.h
@@ -614,9 +614,11 @@ typedef enum log_id {
614 614
615/* 615/*
616 * Use the per-tag properties "log.tag.<tagname>" to generate a runtime 616 * Use the per-tag properties "log.tag.<tagname>" to generate a runtime
617 * result of non-zero to expose a log. 617 * result of non-zero to expose a log. prio is ANDROID_LOG_VERBOSE to
618 * ANDROID_LOG_FATAL. default_prio if no property. Undefined behavior if
619 * any other value.
618 */ 620 */
619int __android_log_is_loggable(int prio, const char *tag, int def); 621int __android_log_is_loggable(int prio, const char *tag, int default_prio);
620 622
621int __android_log_error_write(int tag, const char *subTag, int32_t uid, const char *data, 623int __android_log_error_write(int tag, const char *subTag, int32_t uid, const char *data,
622 uint32_t dataLen); 624 uint32_t dataLen);