summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2016-03-08 18:18:26 -0600
committerMark Salyzyn2017-02-08 15:37:44 -0600
commitcf983bcbae801e4660521b9747d9a7516e7df1c1 (patch)
tree0939db184ee66125fc810d82bd7841b1a05c5396 /liblog/logger.h
parent62d0d2d683f5d19cf9d451548bd03c4b4f53c42e (diff)
downloadplatform-system-core-cf983bcbae801e4660521b9747d9a7516e7df1c1.tar.gz
platform-system-core-cf983bcbae801e4660521b9747d9a7516e7df1c1.tar.xz
platform-system-core-cf983bcbae801e4660521b9747d9a7516e7df1c1.zip
liblog: add android_log_logger_list management
Add list of android_log_logger_list entities as a way of accessing the list of transport contexts from within one of the transports. This will enable us to iterate back to an internal transport context which may house a last index or signalling semaphore to propagate a wakeup on a blocking read. Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests, logcat-unit-tests Bug: 27405083 Change-Id: I0a5e793946c020d97ffe10192369998e4ed92a83
Diffstat (limited to 'liblog/logger.h')
-rw-r--r--liblog/logger.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/liblog/logger.h b/liblog/logger.h
index d332c0325..471a52993 100644
--- a/liblog/logger.h
+++ b/liblog/logger.h
@@ -99,6 +99,7 @@ struct android_log_transport_read {
99}; 99};
100 100
101struct android_log_logger_list { 101struct android_log_logger_list {
102 struct listnode node;
102 struct listnode logger; 103 struct listnode logger;
103 struct listnode transport; 104 struct listnode transport;
104 int mode; 105 int mode;
@@ -146,6 +147,41 @@ struct android_log_transport_context {
146 (logp) = node_to_item((logp)->node.next, \ 147 (logp) = node_to_item((logp)->node.next, \
147 struct android_log_logger, node)) 148 struct android_log_logger, node))
148 149
150/*
151 * Global list of log readers.
152 *
153 * Usage case: search out transport contexts for all readers
154 */
155
156LIBLOG_HIDDEN struct listnode __android_log_readers;
157
158#if defined(_WIN32)
159#define logger_list_rdlock()
160#define logger_list_wrlock()
161#define logger_list_unlock()
162#else
163LIBLOG_HIDDEN pthread_rwlock_t __android_log_readers_lock;
164
165#define logger_list_rdlock() pthread_rwlock_rdlock(&__android_log_readers_lock)
166#define logger_list_wrlock() pthread_rwlock_wrlock(&__android_log_readers_lock)
167#define logger_list_unlock() pthread_rwlock_unlock(&__android_log_readers_lock)
168#endif
169
170/* Must be called with logger_list_rdlock() or logger_list_wrlock() held */
171#define logger_list_for_each(logger_list) \
172 for ((logger_list) = node_to_item(&__android_log_readers, \
173 struct android_log_logger_list, \
174 node); \
175 (logger_list) != node_to_item(&__android_log_readers, \
176 struct android_log_logger_list, \
177 node) && \
178 (logger_list) != node_to_item((logger_list)->node.next, \
179 struct android_log_logger_list, \
180 node); \
181 (logger_list) = node_to_item((logger_list)->node.next, \
182 struct android_log_logger_list, \
183 node))
184
149/* OS specific dribs and drabs */ 185/* OS specific dribs and drabs */
150 186
151#if defined(_WIN32) 187#if defined(_WIN32)