summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-11-06 12:26:52 -0800
committerMark Salyzyn <salyzyn@google.com>2015-11-19 13:14:16 -0800
commit2d2e0a5c5eb0b0ea2fe1349da50e22228965faf9 (patch)
treeef9d05a98bc0eb3fe698089c0701e1db503ced29 /include
parent9f903687011c195154b0c69c02e6aaa35c867242 (diff)
downloadcore-2d2e0a5c5eb0b0ea2fe1349da50e22228965faf9.tar.gz
core-2d2e0a5c5eb0b0ea2fe1349da50e22228965faf9.tar.bz2
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')
-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 {
/*
* Use the per-tag properties "log.tag.<tagname>" to generate a runtime
- * result of non-zero to expose a log.
+ * result of non-zero to expose a log. prio is ANDROID_LOG_VERBOSE to
+ * ANDROID_LOG_FATAL. default_prio if no property. Undefined behavior if
+ * any other value.
*/
-int __android_log_is_loggable(int prio, const char *tag, int def);
+int __android_log_is_loggable(int prio, const char *tag, int default_prio);
int __android_log_error_write(int tag, const char *subTag, int32_t uid, const char *data,
uint32_t dataLen);