diff options
-rw-r--r-- | liblog/logger.h | 6 | ||||
-rw-r--r-- | liblog/logger_lock.c | 26 | ||||
-rw-r--r-- | liblog/pmsg_writer.c | 2 |
3 files changed, 5 insertions, 29 deletions
diff --git a/liblog/logger.h b/liblog/logger.h index 508725610..2a4cfcb56 100644 --- a/liblog/logger.h +++ b/liblog/logger.h | |||
@@ -146,11 +146,13 @@ struct android_log_transport_context { | |||
146 | /* OS specific dribs and drabs */ | 146 | /* OS specific dribs and drabs */ |
147 | 147 | ||
148 | #if defined(_WIN32) | 148 | #if defined(_WIN32) |
149 | #include <private/android_filesystem_config.h> | ||
149 | typedef uint32_t uid_t; | 150 | typedef uint32_t uid_t; |
151 | static inline uid_t __android_log_uid() { return AID_SYSTEM; } | ||
152 | #else | ||
153 | static inline uid_t __android_log_uid() { return getuid(); } | ||
150 | #endif | 154 | #endif |
151 | 155 | ||
152 | LIBLOG_HIDDEN uid_t __android_log_uid(); | ||
153 | LIBLOG_HIDDEN pid_t __android_log_pid(); | ||
154 | LIBLOG_HIDDEN void __android_log_lock(); | 156 | LIBLOG_HIDDEN void __android_log_lock(); |
155 | LIBLOG_HIDDEN int __android_log_trylock(); | 157 | LIBLOG_HIDDEN int __android_log_trylock(); |
156 | LIBLOG_HIDDEN void __android_log_unlock(); | 158 | LIBLOG_HIDDEN void __android_log_unlock(); |
diff --git a/liblog/logger_lock.c b/liblog/logger_lock.c index ee979bd5e..14feee078 100644 --- a/liblog/logger_lock.c +++ b/liblog/logger_lock.c | |||
@@ -22,34 +22,8 @@ | |||
22 | #include <pthread.h> | 22 | #include <pthread.h> |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #include <private/android_filesystem_config.h> | ||
26 | |||
27 | #include "logger.h" | 25 | #include "logger.h" |
28 | 26 | ||
29 | LIBLOG_HIDDEN uid_t __android_log_uid() | ||
30 | { | ||
31 | #if defined(_WIN32) | ||
32 | return AID_SYSTEM; | ||
33 | #else | ||
34 | static uid_t last_uid = AID_ROOT; /* logd *always* starts up as AID_ROOT */ | ||
35 | |||
36 | if (last_uid == AID_ROOT) { /* have we called to get the UID yet? */ | ||
37 | last_uid = getuid(); | ||
38 | } | ||
39 | return last_uid; | ||
40 | #endif | ||
41 | } | ||
42 | |||
43 | LIBLOG_HIDDEN pid_t __android_log_pid() | ||
44 | { | ||
45 | static pid_t last_pid = (pid_t) -1; | ||
46 | |||
47 | if (last_pid == (pid_t) -1) { | ||
48 | last_pid = getpid(); | ||
49 | } | ||
50 | return last_pid; | ||
51 | } | ||
52 | |||
53 | #if !defined(_WIN32) | 27 | #if !defined(_WIN32) |
54 | static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; | 28 | static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; |
55 | #endif | 29 | #endif |
diff --git a/liblog/pmsg_writer.c b/liblog/pmsg_writer.c index 2ba31fab1..944febae8 100644 --- a/liblog/pmsg_writer.c +++ b/liblog/pmsg_writer.c | |||
@@ -142,7 +142,7 @@ static int pmsgWrite(log_id_t logId, struct timespec *ts, | |||
142 | pmsgHeader.magic = LOGGER_MAGIC; | 142 | pmsgHeader.magic = LOGGER_MAGIC; |
143 | pmsgHeader.len = sizeof(pmsgHeader) + sizeof(header); | 143 | pmsgHeader.len = sizeof(pmsgHeader) + sizeof(header); |
144 | pmsgHeader.uid = __android_log_uid(); | 144 | pmsgHeader.uid = __android_log_uid(); |
145 | pmsgHeader.pid = __android_log_pid(); | 145 | pmsgHeader.pid = getpid(); |
146 | 146 | ||
147 | header.id = logId; | 147 | header.id = logId; |
148 | header.tid = gettid(); | 148 | header.tid = gettid(); |