diff --git a/liblog/README b/liblog/README index 40a39ad8b..5a845be0e 100644 --- a/liblog/README +++ b/liblog/README @@ -108,10 +108,10 @@ SYNOPSIS int android_log_destroy(android_log_context *ctx) - #include + #include - int android_set_log_frontend(int frontend_flag) - int android_get_log_frontend() + int android_set_log_transport(int transport_flag) + int android_get_log_transport() Link with -llog @@ -167,12 +167,12 @@ DESCRIPTION when opening the sub-log. It is recommended to open the log ANDROID_LOG_RDONLY in these cases. - android_set_log_frontend() selects frontend filters. Argument is either - LOGGER_DEFAULT, LOGGER_LOGD, LOGGER_NULL or LOGGER_LOCAL. Log to logger - daemon for default or logd, drop contents on floor, or log into local - memory respectively. Both android_set_log_frontend() and - android_get_log_frontend() return the current frontend mask, or a - negative errno for any problems. + android_set_log_transport() selects transport filters. Argument is + either LOGGER_DEFAULT, LOGGER_LOGD, LOGGER_NULL or LOGGER_LOCAL. Log to + logger daemon for default or logd, drop contents on floor, or log into + local memory respectively. Both android_set_log_transport() + and android_get_log_transport() return the current transport mask, or + a negative errno for any problems. ERRORS If messages fail, a negative error code will be returned to the caller. diff --git a/liblog/config_read.c b/liblog/config_read.c index 718b77991..ca80c8046 100644 --- a/liblog/config_read.c +++ b/liblog/config_read.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include #include "config_read.h" #include "logger.h" @@ -55,15 +55,15 @@ static void __android_log_add_transport( } LIBLOG_HIDDEN void __android_log_config_read() { - if (__android_log_frontend & LOGGER_LOCAL) { + if (__android_log_transport & LOGGER_LOCAL) { extern struct android_log_transport_read localLoggerRead; __android_log_add_transport(&__android_log_transport_read, &localLoggerRead); } #if (FAKE_LOG_DEVICE == 0) - if ((__android_log_frontend == LOGGER_DEFAULT) || - (__android_log_frontend & LOGGER_LOGD)) { + if ((__android_log_transport == LOGGER_DEFAULT) || + (__android_log_transport & LOGGER_LOGD)) { extern struct android_log_transport_read logdLoggerRead; extern struct android_log_transport_read pmsgLoggerRead; diff --git a/liblog/config_write.c b/liblog/config_write.c index 22570709f..0a8b52f20 100644 --- a/liblog/config_write.c +++ b/liblog/config_write.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include #include "config_write.h" #include "logger.h" @@ -55,15 +55,15 @@ static void __android_log_add_transport( } LIBLOG_HIDDEN void __android_log_config_write() { - if (__android_log_frontend & LOGGER_LOCAL) { + if (__android_log_transport & LOGGER_LOCAL) { extern struct android_log_transport_write localLoggerWrite; __android_log_add_transport(&__android_log_transport_write, &localLoggerWrite); } - if ((__android_log_frontend == LOGGER_DEFAULT) || - (__android_log_frontend & LOGGER_LOGD)) { + if ((__android_log_transport == LOGGER_DEFAULT) || + (__android_log_transport & LOGGER_LOGD)) { #if (FAKE_LOG_DEVICE == 0) extern struct android_log_transport_write logdLoggerWrite; extern struct android_log_transport_write pmsgLoggerWrite; @@ -79,7 +79,7 @@ LIBLOG_HIDDEN void __android_log_config_write() { #endif } - if (__android_log_frontend & LOGGER_STDERR) { + if (__android_log_transport & LOGGER_STDERR) { extern struct android_log_transport_write stderrLoggerWrite; /* diff --git a/liblog/include/log/log_frontend.h b/liblog/include/log/log_transport.h similarity index 66% rename from liblog/include/log/log_frontend.h rename to liblog/include/log/log_transport.h index 8a69f5efc..80b30db45 100644 --- a/liblog/include/log/log_frontend.h +++ b/liblog/include/log/log_transport.h @@ -7,15 +7,15 @@ ** General Public License. */ -#ifndef _LIBS_LOG_FRONTEND_H -#define _LIBS_LOG_FRONTEND_H +#ifndef _LIBS_LOG_TRANSPORT_H +#define _LIBS_LOG_TRANSPORT_H #ifdef __cplusplus extern "C" { #endif /* - * Logging frontends, bit mask to select features. Function returns selection. + * Logging transports, bit mask to select features. Function returns selection. */ /* clang-format off */ #define LOGGER_DEFAULT 0x00 @@ -26,12 +26,12 @@ extern "C" { #define LOGGER_STDERR 0x10 /* logs sent to stderr */ /* clang-format on */ -/* Both return the selected frontend flag mask, or negative errno */ -int android_set_log_frontend(int frontend_flag); -int android_get_log_frontend(); +/* Both return the selected transport flag mask, or negative errno */ +int android_set_log_transport(int transport_flag); +int android_get_log_transport(); #ifdef __cplusplus } #endif -#endif /* _LIBS_LOG_FRONTEND_H */ +#endif /* _LIBS_LOG_TRANSPORT_H */ diff --git a/liblog/local_logger.c b/liblog/local_logger.c index 9906eb724..522867d4f 100644 --- a/liblog/local_logger.c +++ b/liblog/local_logger.c @@ -27,7 +27,7 @@ #include #include /* template, no library dependency */ -#include +#include #include #include #include @@ -273,7 +273,7 @@ static int writeToLocalAvailable(log_id_t logId) { /* Android hard coded permitted, system goes to logd */ #if !defined(__MINGW32__) - if (__android_log_frontend == LOGGER_DEFAULT) { + if (__android_log_transport == LOGGER_DEFAULT) { uid = __android_log_uid(); if ((uid < AID_APP) && (getpwuid(uid) != NULL)) { return -EPERM; diff --git a/liblog/logger.h b/liblog/logger.h index 1a39ec092..246b33ccc 100644 --- a/liblog/logger.h +++ b/liblog/logger.h @@ -193,7 +193,7 @@ LIBLOG_HIDDEN void __android_log_lock(); LIBLOG_HIDDEN int __android_log_trylock(); LIBLOG_HIDDEN void __android_log_unlock(); -LIBLOG_HIDDEN int __android_log_frontend; +LIBLOG_HIDDEN int __android_log_transport; __END_DECLS diff --git a/liblog/logger_write.c b/liblog/logger_write.c index 79de6ce6f..d322c0f0d 100644 --- a/liblog/logger_write.c +++ b/liblog/logger_write.c @@ -25,7 +25,7 @@ #endif #include -#include +#include #include #include @@ -609,12 +609,12 @@ static int __write_to_log_null(log_id_t log_id, struct iovec* vec, size_t nr) { /* Following functions need access to our internal write_to_log status */ -LIBLOG_HIDDEN int __android_log_frontend; +LIBLOG_HIDDEN int __android_log_transport; -LIBLOG_ABI_PUBLIC int android_set_log_frontend(int frontend_flag) { +LIBLOG_ABI_PUBLIC int android_set_log_transport(int transport_flag) { int retval; - if (frontend_flag < 0) { + if (transport_flag < 0) { return -EINVAL; } @@ -622,7 +622,7 @@ LIBLOG_ABI_PUBLIC int android_set_log_frontend(int frontend_flag) { __android_log_lock(); - if (frontend_flag & LOGGER_NULL) { + if (transport_flag & LOGGER_NULL) { write_to_log = __write_to_log_null; __android_log_unlock(); @@ -630,12 +630,12 @@ LIBLOG_ABI_PUBLIC int android_set_log_frontend(int frontend_flag) { return retval; } - __android_log_frontend &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR; + __android_log_transport &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR; - frontend_flag &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR; + transport_flag &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR; - if (__android_log_frontend != frontend_flag) { - __android_log_frontend = frontend_flag; + if (__android_log_transport != transport_flag) { + __android_log_transport = transport_flag; __android_log_config_write_close(); __android_log_config_read_close(); @@ -646,22 +646,22 @@ LIBLOG_ABI_PUBLIC int android_set_log_frontend(int frontend_flag) { write_to_log = __write_to_log_init; } - retval = __android_log_frontend; + retval = __android_log_transport; __android_log_unlock(); return retval; } -LIBLOG_ABI_PUBLIC int android_get_log_frontend() { +LIBLOG_ABI_PUBLIC int android_get_log_transport() { int ret = LOGGER_DEFAULT; __android_log_lock(); if (write_to_log == __write_to_log_null) { ret = LOGGER_NULL; } else { - __android_log_frontend &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR; - ret = __android_log_frontend; + __android_log_transport &= LOGGER_LOCAL | LOGGER_LOGD | LOGGER_STDERR; + ret = __android_log_transport; if ((write_to_log != __write_to_log_init) && (write_to_log != __write_to_log_daemon)) { ret = -EINVAL; diff --git a/liblog/tests/liblog_benchmark.cpp b/liblog/tests/liblog_benchmark.cpp index 5ce9804eb..3f795526c 100644 --- a/liblog/tests/liblog_benchmark.cpp +++ b/liblog/tests/liblog_benchmark.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include "benchmark.h" @@ -80,11 +80,11 @@ static void BM_log_maximum(int iters) { BENCHMARK(BM_log_maximum); static void set_log_null() { - android_set_log_frontend(LOGGER_NULL); + android_set_log_transport(LOGGER_NULL); } static void set_log_default() { - android_set_log_frontend(LOGGER_DEFAULT); + android_set_log_transport(LOGGER_DEFAULT); } static void BM_log_maximum_null(int iters) { diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp index cb8c7c64b..d68ca46d0 100644 --- a/liblog/tests/liblog_test.cpp +++ b/liblog/tests/liblog_test.cpp @@ -36,7 +36,7 @@ #endif #include #include -#include +#include #include #include #include @@ -255,7 +255,7 @@ TEST(liblog, __android_log_btwrite__android_logger_list_read) { } #if (defined(__ANDROID__) || defined(USING_LOGGER_LOCAL)) -static void print_frontend(const char* prefix, int logger) { +static void print_transport(const char* prefix, int logger) { static const char orstr[] = " | "; if (!prefix) { @@ -305,21 +305,21 @@ static void print_frontend(const char* prefix, int logger) { // This test makes little sense standalone, and requires the tests ahead // and behind us, to make us whole. We could incorporate a prefix and // suffix test to make this standalone, but opted to not complicate this. -TEST(liblog, android_set_log_frontend) { +TEST(liblog, android_set_log_transport) { #if (defined(__ANDROID__) || defined(USING_LOGGER_LOCAL)) #ifdef TEST_PREFIX TEST_PREFIX #endif - int logger = android_get_log_frontend(); - print_frontend("android_get_log_frontend = ", logger); + int logger = android_get_log_transport(); + print_transport("android_get_log_transport = ", logger); EXPECT_NE(LOGGER_NULL, logger); int ret; - EXPECT_EQ(LOGGER_NULL, ret = android_set_log_frontend(LOGGER_NULL)); - print_frontend("android_set_log_frontend = ", ret); - EXPECT_EQ(LOGGER_NULL, ret = android_get_log_frontend()); - print_frontend("android_get_log_frontend = ", ret); + EXPECT_EQ(LOGGER_NULL, ret = android_set_log_transport(LOGGER_NULL)); + print_transport("android_set_log_transport = ", ret); + EXPECT_EQ(LOGGER_NULL, ret = android_get_log_transport()); + print_transport("android_get_log_transport = ", ret); pid_t pid = getpid(); @@ -364,10 +364,10 @@ TEST(liblog, android_set_log_frontend) { android_logger_list_close(logger_list); - EXPECT_EQ(logger, ret = android_set_log_frontend(logger)); - print_frontend("android_set_log_frontend = ", ret); - EXPECT_EQ(logger, ret = android_get_log_frontend()); - print_frontend("android_get_log_frontend = ", ret); + EXPECT_EQ(logger, ret = android_set_log_transport(logger)); + print_transport("android_set_log_transport = ", ret); + EXPECT_EQ(logger, ret = android_get_log_transport()); + print_transport("android_get_log_transport = ", ret); // False negative if liblog.__android_log_btwrite__android_logger_list_read // fails above, so we will likely succeed. But we will have so many diff --git a/liblog/tests/liblog_test_default.cpp b/liblog/tests/liblog_test_default.cpp index 079ba07ca..cbd0d259e 100644 --- a/liblog/tests/liblog_test_default.cpp +++ b/liblog/tests/liblog_test_default.cpp @@ -1,5 +1,5 @@ #ifdef __ANDROID__ -#include -#define TEST_PREFIX android_set_log_frontend(LOGGER_DEFAULT); +#include +#define TEST_PREFIX android_set_log_transport(LOGGER_DEFAULT); #endif #include "liblog_test.cpp" diff --git a/liblog/tests/liblog_test_local.cpp b/liblog/tests/liblog_test_local.cpp index 5f7f645fc..9d7b3d7c9 100644 --- a/liblog/tests/liblog_test_local.cpp +++ b/liblog/tests/liblog_test_local.cpp @@ -1,4 +1,4 @@ -#include +#include #define liblog liblog_local -#define TEST_PREFIX android_set_log_frontend(LOGGER_LOCAL); +#define TEST_PREFIX android_set_log_transport(LOGGER_LOCAL); #include "liblog_test.cpp" diff --git a/liblog/tests/liblog_test_stderr.cpp b/liblog/tests/liblog_test_stderr.cpp index f0cb192d7..f9e4e1f9b 100644 --- a/liblog/tests/liblog_test_stderr.cpp +++ b/liblog/tests/liblog_test_stderr.cpp @@ -1,5 +1,5 @@ -#include +#include #define liblog liblog_stderr -#define TEST_PREFIX android_set_log_frontend(LOGGER_STDERR); +#define TEST_PREFIX android_set_log_transport(LOGGER_STDERR); #define USING_LOGGER_STDERR #include "liblog_test.cpp" diff --git a/liblog/tests/liblog_test_stderr_local.cpp b/liblog/tests/liblog_test_stderr_local.cpp index 1555b4e00..21406ca0a 100644 --- a/liblog/tests/liblog_test_stderr_local.cpp +++ b/liblog/tests/liblog_test_stderr_local.cpp @@ -1,4 +1,4 @@ -#include +#include #define liblog liblog_stderr_local -#define TEST_PREFIX android_set_log_frontend(LOGGER_LOCAL | LOGGER_STDERR); +#define TEST_PREFIX android_set_log_transport(LOGGER_LOCAL | LOGGER_STDERR); #include "liblog_test.cpp"