summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2016-10-10 09:27:42 -0500
committerMark Salyzyn2016-10-13 16:43:42 -0500
commitdb8a266aea6c12b0fb8ee3587d72333662b05266 (patch)
treec10491cebcf0b69c99aa0e8ed56611a50d0080b4 /liblog/logger.h
parentbf0cf4e22d594db03c1dcef57fd18d3ae038eefb (diff)
downloadplatform-system-core-db8a266aea6c12b0fb8ee3587d72333662b05266.tar.gz
platform-system-core-db8a266aea6c12b0fb8ee3587d72333662b05266.tar.xz
platform-system-core-db8a266aea6c12b0fb8ee3587d72333662b05266.zip
liblog: __android_log_pmsg_file_write() cleanup
__android_log_pmsg_file_write() will open /dev/pmsg0 if not already, and will close it if we opened it. Added atomic access to the android_log_context as insurance. Fortify and correct pmsg tests. Test: gTest liblog-unit-tests --gtest_filter=liblog.__android_log_pmsg_file_* Bug: 31958686 Change-Id: I2cf6f971b6968938f471fda67367efe20dae3004
Diffstat (limited to 'liblog/logger.h')
-rw-r--r--liblog/logger.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/liblog/logger.h b/liblog/logger.h
index 8fb2b4d47..d4f243ab2 100644
--- a/liblog/logger.h
+++ b/liblog/logger.h
@@ -17,6 +17,7 @@
17#ifndef _LIBLOG_LOGGER_H__ 17#ifndef _LIBLOG_LOGGER_H__
18#define _LIBLOG_LOGGER_H__ 18#define _LIBLOG_LOGGER_H__
19 19
20#include <stdatomic.h>
20#include <stdbool.h> 21#include <stdbool.h>
21#include <log/uio.h> 22#include <log/uio.h>
22 23
@@ -31,9 +32,10 @@ __BEGIN_DECLS
31/* Union, sock or fd of zero is not allowed unless static initialized */ 32/* Union, sock or fd of zero is not allowed unless static initialized */
32union android_log_context { 33union android_log_context {
33 void *private; 34 void *private;
34 int sock; 35 atomic_int sock;
35 int fd; 36 atomic_int fd;
36 struct listnode *node; 37 struct listnode *node;
38 atomic_uintptr_t atomic_pointer;
37}; 39};
38 40
39struct android_log_transport_write { 41struct android_log_transport_write {