diff options
author | Mark Salyzyn <salyzyn@google.com> | 2016-03-10 08:25:33 -0800 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2016-03-10 14:44:27 -0800 |
commit | 6d753faaf8694792433eb78c5c3572efd74a3d54 (patch) | |
tree | e492ecad9e80855575f7050fab0e250bf8963b7f /liblog/fake_log_device.c | |
parent | 029c7373801b9e1791df334efa36588c216b4ab2 (diff) | |
download | core-6d753faaf8694792433eb78c5c3572efd74a3d54.tar.gz core-6d753faaf8694792433eb78c5c3572efd74a3d54.tar.bz2 core-6d753faaf8694792433eb78c5c3572efd74a3d54.zip |
liblog: audit declare LIBLOG_ABI_PUBLIC
(cherry pick from commit be1d3c21b57d3e67c6a9682f3b2f0838486a3ee8)
- replace <sys/cdefs.h> with local "log_cdefs.h" which
fortifies and expands definitions, adding LIBLOG_ABI_PUBLIC,
LIBLOG_HIDDEN, LIBLOG_ABI_PRIVATE and LIBLOG_WEAK.
- clearly tag each interface as LIBLOG_ABI_PUBLIC, LIBLOG_HIDDEN,
LIBLOG_ABI_PRIVATE, LIBLOG_WEAK or static depending on scope
- Add -fvisibility=hidden to ensure nothing else leaks
- some code standard adjustments
Bug: 27566046
Change-Id: Ic14033c4e6d833d973beb035ddc1c6134fb35a3f
Diffstat (limited to 'liblog/fake_log_device.c')
-rw-r--r-- | liblog/fake_log_device.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/liblog/fake_log_device.c b/liblog/fake_log_device.c index aa88bedf8..c73e03e21 100644 --- a/liblog/fake_log_device.c +++ b/liblog/fake_log_device.c @@ -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 */ @@ -512,7 +508,7 @@ static void showLog(LogState *state, } numLines -= 1; } - + /* * Write the entire message to the log file with a single writev() call. * We need to use this rather than a collection of printf()s on a FILE* @@ -531,10 +527,10 @@ static void showLog(LogState *state, int cc = writev(fileno(stderr), vec, v-vec); if (cc == totalLen) break; - + if (cc < 0) { if(errno == EINTR) continue; - + /* can't really log the failure; for now, throw out a stderr */ fprintf(stderr, "+++ LOG: write failed (errno=%d)\n", errno); break; @@ -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(); @@ -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; |