Loading liblog/Android.mk +3 −3 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ LOCAL_SRC_FILES := $(liblog_host_sources) LOCAL_SRC_FILES_darwin := event_tag_map.c LOCAL_SRC_FILES_linux := event_tag_map.c LOCAL_SRC_FILES_windows := uio.c LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -Werror $(liblog_cflags) LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -Werror -fvisibility=hidden $(liblog_cflags) LOCAL_MULTILIB := both LOCAL_MODULE_HOST_OS := darwin linux windows include $(BUILD_HOST_STATIC_LIBRARY) Loading @@ -59,7 +59,7 @@ include $(BUILD_HOST_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := liblog LOCAL_SRC_FILES := $(liblog_target_sources) LOCAL_CFLAGS := -Werror $(liblog_cflags) LOCAL_CFLAGS := -Werror -fvisibility=hidden $(liblog_cflags) # AddressSanitizer runtime library depends on liblog. LOCAL_SANITIZE := never include $(BUILD_STATIC_LIBRARY) Loading @@ -67,7 +67,7 @@ include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := liblog LOCAL_WHOLE_STATIC_LIBRARIES := liblog LOCAL_CFLAGS := -Werror $(liblog_cflags) LOCAL_CFLAGS := -Werror -fvisibility=hidden $(liblog_cflags) # TODO: This is to work around b/24465209. Remove after root cause is fixed LOCAL_LDFLAGS_arm := -Wl,--hash-style=both Loading liblog/event_tag_map.c +6 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ #include <log/event_tag_map.h> #include <log/log.h> #include "log_cdefs.h" #define OUT_TAG "EventTagMap" /* Loading Loading @@ -61,7 +63,7 @@ static int sortTags(EventTagMap* map); * We create a private mapping because we want to terminate the log tag * strings with '\0'. */ EventTagMap* android_openEventTagMap(const char* fileName) LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName) { EventTagMap* newTagMap; off_t end; Loading Loading @@ -109,7 +111,7 @@ fail: /* * Close the map. */ void android_closeEventTagMap(EventTagMap* map) LIBLOG_ABI_PUBLIC void android_closeEventTagMap(EventTagMap* map) { if (map == NULL) return; Loading @@ -123,7 +125,8 @@ void android_closeEventTagMap(EventTagMap* map) * * The entries are sorted by tag number, so we can do a binary search. */ const char* android_lookupEventTag(const EventTagMap* map, int tag) LIBLOG_ABI_PUBLIC const char* android_lookupEventTag(const EventTagMap* map, int tag) { int hi, lo, mid; Loading liblog/fake_log_device.c +15 −16 Original line number Diff line number Diff line Loading @@ -19,23 +19,19 @@ * passed on to the underlying (fake) log device. When not in the * simulator, messages are printed to stderr. */ #include "fake_log_device.h" #include <ctype.h> #include <errno.h> #include <fcntl.h> #if !defined(_WIN32) #include <pthread.h> #endif #include <stdlib.h> #include <string.h> #include <log/logd.h> #if !defined(_WIN32) #include <pthread.h> #endif #ifndef __unused #define __unused __attribute__((__unused__)) #endif #include "fake_log_device.h" #include "log_cdefs.h" #define kMaxTagLen 16 /* from the long-dead utils/Log.cpp */ Loading Loading @@ -683,7 +679,7 @@ static void setRedirects() } } int fakeLogOpen(const char *pathName, int flags) LIBLOG_HIDDEN int fakeLogOpen(const char *pathName, int flags) { if (redirectOpen == NULL) { setRedirects(); Loading @@ -702,19 +698,22 @@ int fakeLogOpen(const char *pathName, int flags) * call is in the exit handler. Logging can continue in the exit handler to * help debug HOST tools ... */ int fakeLogClose(int fd) LIBLOG_HIDDEN int fakeLogClose(int fd) { /* Assume that open() was called first. */ return redirectClose(fd); } ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count) LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count) { /* Assume that open() was called first. */ return redirectWritev(fd, vector, count); } int __android_log_is_loggable(int prio, const char *tag __unused, int def) LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio, const char *tag __unused, int def) { int logLevel = def; return logLevel >= 0 && prio >= logLevel; Loading liblog/fake_log_device.h +6 −3 Original line number Diff line number Diff line Loading @@ -19,10 +19,13 @@ #include <sys/types.h> #include "log_cdefs.h" struct iovec; int fakeLogOpen(const char *pathName, int flags); int fakeLogClose(int fd); ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count); LIBLOG_HIDDEN int fakeLogOpen(const char *pathName, int flags); LIBLOG_HIDDEN int fakeLogClose(int fd); LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count); #endif // _LIBLOG_FAKE_LOG_DEVICE_H liblog/log_cdefs.h 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _LIBLOG_CDEFS_H__ #define _LIBLOG_CDEFS_H__ #include <sys/cdefs.h> /* Declare this library function hidden and internal */ #if defined(_WIN32) #define LIBLOG_HIDDEN #else #define LIBLOG_HIDDEN __attribute__((visibility("hidden"))) #endif /* Declare this library function visible and external */ #if defined(_WIN32) #define LIBLOG_ABI_PUBLIC #else #define LIBLOG_ABI_PUBLIC __attribute__((visibility("default"))) #endif /* Declare this library function visible but private */ #define LIBLOG_ABI_PRIVATE LIBLOG_ABI_PUBLIC /* * Declare this library function as reimplementation. * Prevent circular dependencies, but allow _real_ library to hijack */ #if defined(_WIN32) #define LIBLOG_WEAK static /* Accept that it is totally private */ #else #define LIBLOG_WEAK __attribute__((weak,visibility("default"))) #endif /* Unused argument. For C code only, remove symbol name for C++ */ #ifndef __unused #define __unused __attribute__((__unused__)) #endif #endif /* _LIBLOG_CDEFS_H__ */ Loading
liblog/Android.mk +3 −3 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ LOCAL_SRC_FILES := $(liblog_host_sources) LOCAL_SRC_FILES_darwin := event_tag_map.c LOCAL_SRC_FILES_linux := event_tag_map.c LOCAL_SRC_FILES_windows := uio.c LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -Werror $(liblog_cflags) LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -Werror -fvisibility=hidden $(liblog_cflags) LOCAL_MULTILIB := both LOCAL_MODULE_HOST_OS := darwin linux windows include $(BUILD_HOST_STATIC_LIBRARY) Loading @@ -59,7 +59,7 @@ include $(BUILD_HOST_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := liblog LOCAL_SRC_FILES := $(liblog_target_sources) LOCAL_CFLAGS := -Werror $(liblog_cflags) LOCAL_CFLAGS := -Werror -fvisibility=hidden $(liblog_cflags) # AddressSanitizer runtime library depends on liblog. LOCAL_SANITIZE := never include $(BUILD_STATIC_LIBRARY) Loading @@ -67,7 +67,7 @@ include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := liblog LOCAL_WHOLE_STATIC_LIBRARIES := liblog LOCAL_CFLAGS := -Werror $(liblog_cflags) LOCAL_CFLAGS := -Werror -fvisibility=hidden $(liblog_cflags) # TODO: This is to work around b/24465209. Remove after root cause is fixed LOCAL_LDFLAGS_arm := -Wl,--hash-style=both Loading
liblog/event_tag_map.c +6 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ #include <log/event_tag_map.h> #include <log/log.h> #include "log_cdefs.h" #define OUT_TAG "EventTagMap" /* Loading Loading @@ -61,7 +63,7 @@ static int sortTags(EventTagMap* map); * We create a private mapping because we want to terminate the log tag * strings with '\0'. */ EventTagMap* android_openEventTagMap(const char* fileName) LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName) { EventTagMap* newTagMap; off_t end; Loading Loading @@ -109,7 +111,7 @@ fail: /* * Close the map. */ void android_closeEventTagMap(EventTagMap* map) LIBLOG_ABI_PUBLIC void android_closeEventTagMap(EventTagMap* map) { if (map == NULL) return; Loading @@ -123,7 +125,8 @@ void android_closeEventTagMap(EventTagMap* map) * * The entries are sorted by tag number, so we can do a binary search. */ const char* android_lookupEventTag(const EventTagMap* map, int tag) LIBLOG_ABI_PUBLIC const char* android_lookupEventTag(const EventTagMap* map, int tag) { int hi, lo, mid; Loading
liblog/fake_log_device.c +15 −16 Original line number Diff line number Diff line Loading @@ -19,23 +19,19 @@ * passed on to the underlying (fake) log device. When not in the * simulator, messages are printed to stderr. */ #include "fake_log_device.h" #include <ctype.h> #include <errno.h> #include <fcntl.h> #if !defined(_WIN32) #include <pthread.h> #endif #include <stdlib.h> #include <string.h> #include <log/logd.h> #if !defined(_WIN32) #include <pthread.h> #endif #ifndef __unused #define __unused __attribute__((__unused__)) #endif #include "fake_log_device.h" #include "log_cdefs.h" #define kMaxTagLen 16 /* from the long-dead utils/Log.cpp */ Loading Loading @@ -683,7 +679,7 @@ static void setRedirects() } } int fakeLogOpen(const char *pathName, int flags) LIBLOG_HIDDEN int fakeLogOpen(const char *pathName, int flags) { if (redirectOpen == NULL) { setRedirects(); Loading @@ -702,19 +698,22 @@ int fakeLogOpen(const char *pathName, int flags) * call is in the exit handler. Logging can continue in the exit handler to * help debug HOST tools ... */ int fakeLogClose(int fd) LIBLOG_HIDDEN int fakeLogClose(int fd) { /* Assume that open() was called first. */ return redirectClose(fd); } ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count) LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count) { /* Assume that open() was called first. */ return redirectWritev(fd, vector, count); } int __android_log_is_loggable(int prio, const char *tag __unused, int def) LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio, const char *tag __unused, int def) { int logLevel = def; return logLevel >= 0 && prio >= logLevel; Loading
liblog/fake_log_device.h +6 −3 Original line number Diff line number Diff line Loading @@ -19,10 +19,13 @@ #include <sys/types.h> #include "log_cdefs.h" struct iovec; int fakeLogOpen(const char *pathName, int flags); int fakeLogClose(int fd); ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count); LIBLOG_HIDDEN int fakeLogOpen(const char *pathName, int flags); LIBLOG_HIDDEN int fakeLogClose(int fd); LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count); #endif // _LIBLOG_FAKE_LOG_DEVICE_H
liblog/log_cdefs.h 0 → 100644 +54 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _LIBLOG_CDEFS_H__ #define _LIBLOG_CDEFS_H__ #include <sys/cdefs.h> /* Declare this library function hidden and internal */ #if defined(_WIN32) #define LIBLOG_HIDDEN #else #define LIBLOG_HIDDEN __attribute__((visibility("hidden"))) #endif /* Declare this library function visible and external */ #if defined(_WIN32) #define LIBLOG_ABI_PUBLIC #else #define LIBLOG_ABI_PUBLIC __attribute__((visibility("default"))) #endif /* Declare this library function visible but private */ #define LIBLOG_ABI_PRIVATE LIBLOG_ABI_PUBLIC /* * Declare this library function as reimplementation. * Prevent circular dependencies, but allow _real_ library to hijack */ #if defined(_WIN32) #define LIBLOG_WEAK static /* Accept that it is totally private */ #else #define LIBLOG_WEAK __attribute__((weak,visibility("default"))) #endif /* Unused argument. For C code only, remove symbol name for C++ */ #ifndef __unused #define __unused __attribute__((__unused__)) #endif #endif /* _LIBLOG_CDEFS_H__ */