Merge "liblog: remove visibility macros"
am: ea57928f00
Change-Id: I5edc052fc08d4d56ff5dd2657b1d25e7736a3830
This commit is contained in:
commit
4f05886f51
26 changed files with 141 additions and 191 deletions
|
|
@ -101,7 +101,6 @@ cc_library {
|
|||
|
||||
cflags: [
|
||||
"-Werror",
|
||||
"-fvisibility=hidden",
|
||||
// This is what we want to do:
|
||||
// liblog_cflags := $(shell \
|
||||
// sed -n \
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@
|
|||
#include "config_read.h"
|
||||
#include "logger.h"
|
||||
|
||||
LIBLOG_HIDDEN struct listnode __android_log_transport_read = {&__android_log_transport_read,
|
||||
&__android_log_transport_read};
|
||||
LIBLOG_HIDDEN struct listnode __android_log_persist_read = {&__android_log_persist_read,
|
||||
&__android_log_persist_read};
|
||||
struct listnode __android_log_transport_read = {&__android_log_transport_read,
|
||||
&__android_log_transport_read};
|
||||
struct listnode __android_log_persist_read = {&__android_log_persist_read,
|
||||
&__android_log_persist_read};
|
||||
|
||||
static void __android_log_add_transport(struct listnode* list,
|
||||
struct android_log_transport_read* transport) {
|
||||
|
|
@ -52,7 +52,7 @@ static void __android_log_add_transport(struct listnode* list,
|
|||
}
|
||||
}
|
||||
|
||||
LIBLOG_HIDDEN void __android_log_config_read() {
|
||||
void __android_log_config_read() {
|
||||
#if (FAKE_LOG_DEVICE == 0)
|
||||
if ((__android_log_transport == LOGGER_DEFAULT) || (__android_log_transport & LOGGER_LOGD)) {
|
||||
extern struct android_log_transport_read logdLoggerRead;
|
||||
|
|
@ -64,7 +64,7 @@ LIBLOG_HIDDEN void __android_log_config_read() {
|
|||
#endif
|
||||
}
|
||||
|
||||
LIBLOG_HIDDEN void __android_log_config_read_close() {
|
||||
void __android_log_config_read_close() {
|
||||
struct android_log_transport_read* transport;
|
||||
struct listnode* n;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern LIBLOG_HIDDEN struct listnode __android_log_transport_read;
|
||||
extern LIBLOG_HIDDEN struct listnode __android_log_persist_read;
|
||||
extern struct listnode __android_log_transport_read;
|
||||
extern struct listnode __android_log_persist_read;
|
||||
|
||||
#define read_transport_for_each(transp, transports) \
|
||||
for ((transp) = node_to_item((transports)->next, \
|
||||
|
|
@ -46,7 +46,7 @@ extern LIBLOG_HIDDEN struct listnode __android_log_persist_read;
|
|||
(transp) = node_to_item((n), struct android_log_transport_read, node), \
|
||||
(n) = (transp)->node.next)
|
||||
|
||||
LIBLOG_HIDDEN void __android_log_config_read();
|
||||
LIBLOG_HIDDEN void __android_log_config_read_close();
|
||||
void __android_log_config_read();
|
||||
void __android_log_config_read_close();
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@
|
|||
#include "config_write.h"
|
||||
#include "logger.h"
|
||||
|
||||
LIBLOG_HIDDEN struct listnode __android_log_transport_write = {&__android_log_transport_write,
|
||||
&__android_log_transport_write};
|
||||
LIBLOG_HIDDEN struct listnode __android_log_persist_write = {&__android_log_persist_write,
|
||||
&__android_log_persist_write};
|
||||
struct listnode __android_log_transport_write = {&__android_log_transport_write,
|
||||
&__android_log_transport_write};
|
||||
struct listnode __android_log_persist_write = {&__android_log_persist_write,
|
||||
&__android_log_persist_write};
|
||||
|
||||
static void __android_log_add_transport(struct listnode* list,
|
||||
struct android_log_transport_write* transport) {
|
||||
|
|
@ -52,7 +52,7 @@ static void __android_log_add_transport(struct listnode* list,
|
|||
}
|
||||
}
|
||||
|
||||
LIBLOG_HIDDEN void __android_log_config_write() {
|
||||
void __android_log_config_write() {
|
||||
if ((__android_log_transport == LOGGER_DEFAULT) || (__android_log_transport & LOGGER_LOGD)) {
|
||||
#if (FAKE_LOG_DEVICE == 0)
|
||||
extern struct android_log_transport_write logdLoggerWrite;
|
||||
|
|
@ -89,7 +89,7 @@ LIBLOG_HIDDEN void __android_log_config_write() {
|
|||
}
|
||||
}
|
||||
|
||||
LIBLOG_HIDDEN void __android_log_config_write_close() {
|
||||
void __android_log_config_write_close() {
|
||||
struct android_log_transport_write* transport;
|
||||
struct listnode* n;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern LIBLOG_HIDDEN struct listnode __android_log_transport_write;
|
||||
extern LIBLOG_HIDDEN struct listnode __android_log_persist_write;
|
||||
extern struct listnode __android_log_transport_write;
|
||||
extern struct listnode __android_log_persist_write;
|
||||
|
||||
#define write_transport_for_each(transp, transports) \
|
||||
for ((transp) = node_to_item((transports)->next, \
|
||||
|
|
@ -46,7 +46,7 @@ extern LIBLOG_HIDDEN struct listnode __android_log_persist_write;
|
|||
(transp) = node_to_item((n), struct android_log_transport_write, node), \
|
||||
(n) = (transp)->node.next)
|
||||
|
||||
LIBLOG_HIDDEN void __android_log_config_write();
|
||||
LIBLOG_HIDDEN void __android_log_config_write_close();
|
||||
void __android_log_config_write();
|
||||
void __android_log_config_write_close();
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ static int parseMapLines(EventTagMap* map, size_t which) {
|
|||
//
|
||||
// We create a private mapping because we want to terminate the log tag
|
||||
// strings with '\0'.
|
||||
LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName) {
|
||||
EventTagMap* android_openEventTagMap(const char* fileName) {
|
||||
EventTagMap* newTagMap;
|
||||
off_t end[NUM_MAPS];
|
||||
int save_errno, fd[NUM_MAPS];
|
||||
|
|
@ -488,7 +488,7 @@ fail_errno:
|
|||
}
|
||||
|
||||
// Close the map.
|
||||
LIBLOG_ABI_PUBLIC void android_closeEventTagMap(EventTagMap* map) {
|
||||
void android_closeEventTagMap(EventTagMap* map) {
|
||||
if (map) delete map;
|
||||
}
|
||||
|
||||
|
|
@ -535,9 +535,7 @@ static const TagFmt* __getEventTag(EventTagMap* map, unsigned int tag) {
|
|||
}
|
||||
|
||||
// Look up an entry in the map.
|
||||
LIBLOG_ABI_PUBLIC const char* android_lookupEventTag_len(const EventTagMap* map,
|
||||
size_t* len,
|
||||
unsigned int tag) {
|
||||
const char* android_lookupEventTag_len(const EventTagMap* map, size_t* len, unsigned int tag) {
|
||||
if (len) *len = 0;
|
||||
const TagFmt* str = map->find(tag);
|
||||
if (!str) {
|
||||
|
|
@ -549,8 +547,7 @@ LIBLOG_ABI_PUBLIC const char* android_lookupEventTag_len(const EventTagMap* map,
|
|||
}
|
||||
|
||||
// Look up an entry in the map.
|
||||
LIBLOG_ABI_PUBLIC const char* android_lookupEventFormat_len(
|
||||
const EventTagMap* map, size_t* len, unsigned int tag) {
|
||||
const char* android_lookupEventFormat_len(const EventTagMap* map, size_t* len, unsigned int tag) {
|
||||
if (len) *len = 0;
|
||||
const TagFmt* str = map->find(tag);
|
||||
if (!str) {
|
||||
|
|
@ -565,8 +562,7 @@ LIBLOG_ABI_PUBLIC const char* android_lookupEventFormat_len(
|
|||
// since it will cause the map to change from Shared and backed by a file,
|
||||
// to Private Dirty and backed up by swap, albeit highly compressible. By
|
||||
// deprecating this function everywhere, we save 100s of MB of memory space.
|
||||
LIBLOG_ABI_PUBLIC const char* android_lookupEventTag(const EventTagMap* map,
|
||||
unsigned int tag) {
|
||||
const char* android_lookupEventTag(const EventTagMap* map, unsigned int tag) {
|
||||
size_t len;
|
||||
const char* tagStr = android_lookupEventTag_len(map, &len, tag);
|
||||
|
||||
|
|
@ -578,9 +574,7 @@ LIBLOG_ABI_PUBLIC const char* android_lookupEventTag(const EventTagMap* map,
|
|||
}
|
||||
|
||||
// Look up tagname, generate one if necessary, and return a tag
|
||||
LIBLOG_ABI_PUBLIC int android_lookupEventTagNum(EventTagMap* map,
|
||||
const char* tagname,
|
||||
const char* format, int prio) {
|
||||
int android_lookupEventTagNum(EventTagMap* map, const char* tagname, const char* format, int prio) {
|
||||
const char* ep = endOfTag(tagname);
|
||||
size_t len = ep - tagname;
|
||||
if (!len || *ep) {
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@ static void showLog(LogState* state, int logPrio, const char* tag, const char* m
|
|||
* tag (N bytes -- null-terminated ASCII string)
|
||||
* message (N bytes -- null-terminated ASCII string)
|
||||
*/
|
||||
LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count) {
|
||||
ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count) {
|
||||
LogState* state;
|
||||
|
||||
/* Make sure that no-one frees the LogState while we're using it.
|
||||
|
|
@ -623,7 +623,7 @@ LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd, const struct iovec* vector, int coun
|
|||
* call is in the exit handler. Logging can continue in the exit handler to
|
||||
* help debug HOST tools ...
|
||||
*/
|
||||
LIBLOG_HIDDEN int fakeLogClose(int fd) {
|
||||
int fakeLogClose(int fd) {
|
||||
deleteFakeFd(fd);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -631,7 +631,7 @@ LIBLOG_HIDDEN int fakeLogClose(int fd) {
|
|||
/*
|
||||
* Open a log output device and return a fake fd.
|
||||
*/
|
||||
LIBLOG_HIDDEN int fakeLogOpen(const char* pathName) {
|
||||
int fakeLogOpen(const char* pathName) {
|
||||
LogState* logState;
|
||||
int fd = -1;
|
||||
|
||||
|
|
@ -650,20 +650,20 @@ LIBLOG_HIDDEN int fakeLogOpen(const char* pathName) {
|
|||
return fd;
|
||||
}
|
||||
|
||||
LIBLOG_HIDDEN ssize_t __send_log_msg(char*, size_t) {
|
||||
ssize_t __send_log_msg(char*, size_t) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio, const char*, int def) {
|
||||
int __android_log_is_loggable(int prio, const char*, int def) {
|
||||
int logLevel = def;
|
||||
return logLevel >= 0 && prio >= logLevel;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_is_loggable_len(int prio, const char*, size_t, int def) {
|
||||
int __android_log_is_loggable_len(int prio, const char*, size_t, int def) {
|
||||
int logLevel = def;
|
||||
return logLevel >= 0 && prio >= logLevel;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PRIVATE int __android_log_is_debuggable() {
|
||||
int __android_log_is_debuggable() {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,14 +25,13 @@ struct iovec;
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
LIBLOG_HIDDEN int fakeLogOpen(const char* pathName);
|
||||
LIBLOG_HIDDEN int fakeLogClose(int fd);
|
||||
LIBLOG_HIDDEN ssize_t fakeLogWritev(int fd, const struct iovec* vector,
|
||||
int count);
|
||||
int fakeLogOpen(const char* pathName);
|
||||
int fakeLogClose(int fd);
|
||||
ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count);
|
||||
|
||||
LIBLOG_HIDDEN ssize_t __send_log_msg(char*, size_t);
|
||||
LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio, const char*, int def);
|
||||
LIBLOG_ABI_PUBLIC int __android_log_is_loggable_len(int prio, const char*, size_t, int def);
|
||||
LIBLOG_ABI_PRIVATE int __android_log_is_debuggable();
|
||||
ssize_t __send_log_msg(char*, size_t);
|
||||
int __android_log_is_loggable(int prio, const char*, int def);
|
||||
int __android_log_is_loggable_len(int prio, const char*, size_t, int def);
|
||||
int __android_log_is_debuggable();
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ static int fakeWrite(log_id_t log_id, struct timespec* ts, struct iovec* vec, si
|
|||
|
||||
static int logFds[(int)LOG_ID_MAX] = {-1, -1, -1, -1, -1, -1};
|
||||
|
||||
LIBLOG_HIDDEN struct android_log_transport_write fakeLoggerWrite = {
|
||||
struct android_log_transport_write fakeLoggerWrite = {
|
||||
.node = {&fakeLoggerWrite.node, &fakeLoggerWrite.node},
|
||||
.context.priv = &logFds,
|
||||
.name = "fake",
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ static void init_parser_context(android_log_context_internal* context, const cha
|
|||
context->read_write_flag = kAndroidLoggerRead;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC android_log_context create_android_logger(uint32_t tag) {
|
||||
android_log_context create_android_logger(uint32_t tag) {
|
||||
android_log_context_internal* context;
|
||||
|
||||
context =
|
||||
|
|
@ -86,7 +86,7 @@ LIBLOG_ABI_PUBLIC android_log_context create_android_logger(uint32_t tag) {
|
|||
return (android_log_context)context;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC android_log_context create_android_log_parser(const char* msg, size_t len) {
|
||||
android_log_context create_android_log_parser(const char* msg, size_t len) {
|
||||
android_log_context_internal* context;
|
||||
size_t i;
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ LIBLOG_ABI_PUBLIC android_log_context create_android_log_parser(const char* msg,
|
|||
return (android_log_context)context;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_destroy(android_log_context* ctx) {
|
||||
int android_log_destroy(android_log_context* ctx) {
|
||||
android_log_context_internal* context;
|
||||
|
||||
context = (android_log_context_internal*)*ctx;
|
||||
|
|
@ -113,7 +113,7 @@ LIBLOG_ABI_PUBLIC int android_log_destroy(android_log_context* ctx) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_reset(android_log_context ctx) {
|
||||
int android_log_reset(android_log_context ctx) {
|
||||
android_log_context_internal* context;
|
||||
uint32_t tag;
|
||||
|
||||
|
|
@ -129,8 +129,7 @@ LIBLOG_ABI_PUBLIC int android_log_reset(android_log_context ctx) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_parser_reset(android_log_context ctx, const char* msg,
|
||||
size_t len) {
|
||||
int android_log_parser_reset(android_log_context ctx, const char* msg, size_t len) {
|
||||
android_log_context_internal* context;
|
||||
|
||||
context = (android_log_context_internal*)ctx;
|
||||
|
|
@ -144,7 +143,7 @@ LIBLOG_ABI_PUBLIC int android_log_parser_reset(android_log_context ctx, const ch
|
|||
return 0;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_write_list_begin(android_log_context ctx) {
|
||||
int android_log_write_list_begin(android_log_context ctx) {
|
||||
size_t needed;
|
||||
android_log_context_internal* context;
|
||||
|
||||
|
|
@ -185,7 +184,7 @@ static inline void copy4LE(uint8_t* buf, uint32_t val) {
|
|||
buf[3] = (val >> 24) & 0xFF;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_write_int32(android_log_context ctx, int32_t value) {
|
||||
int android_log_write_int32(android_log_context ctx, int32_t value) {
|
||||
size_t needed;
|
||||
android_log_context_internal* context;
|
||||
|
||||
|
|
@ -219,7 +218,7 @@ static inline void copy8LE(uint8_t* buf, uint64_t val) {
|
|||
buf[7] = (val >> 56) & 0xFF;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_write_int64(android_log_context ctx, int64_t value) {
|
||||
int android_log_write_int64(android_log_context ctx, int64_t value) {
|
||||
size_t needed;
|
||||
android_log_context_internal* context;
|
||||
|
||||
|
|
@ -242,8 +241,7 @@ LIBLOG_ABI_PUBLIC int android_log_write_int64(android_log_context ctx, int64_t v
|
|||
return 0;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_write_string8_len(android_log_context ctx, const char* value,
|
||||
size_t maxlen) {
|
||||
int android_log_write_string8_len(android_log_context ctx, const char* value, size_t maxlen) {
|
||||
size_t needed;
|
||||
ssize_t len;
|
||||
android_log_context_internal* context;
|
||||
|
|
@ -278,11 +276,11 @@ LIBLOG_ABI_PUBLIC int android_log_write_string8_len(android_log_context ctx, con
|
|||
return len;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_write_string8(android_log_context ctx, const char* value) {
|
||||
int android_log_write_string8(android_log_context ctx, const char* value) {
|
||||
return android_log_write_string8_len(ctx, value, MAX_EVENT_PAYLOAD);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_write_float32(android_log_context ctx, float value) {
|
||||
int android_log_write_float32(android_log_context ctx, float value) {
|
||||
size_t needed;
|
||||
uint32_t ivalue;
|
||||
android_log_context_internal* context;
|
||||
|
|
@ -307,7 +305,7 @@ LIBLOG_ABI_PUBLIC int android_log_write_float32(android_log_context ctx, float v
|
|||
return 0;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_write_list_end(android_log_context ctx) {
|
||||
int android_log_write_list_end(android_log_context ctx) {
|
||||
android_log_context_internal* context;
|
||||
|
||||
context = (android_log_context_internal*)ctx;
|
||||
|
|
@ -337,7 +335,7 @@ LIBLOG_ABI_PUBLIC int android_log_write_list_end(android_log_context ctx) {
|
|||
/*
|
||||
* Logs the list of elements to the event log.
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC int android_log_write_list(android_log_context ctx, log_id_t id) {
|
||||
int android_log_write_list(android_log_context ctx, log_id_t id) {
|
||||
android_log_context_internal* context;
|
||||
const char* msg;
|
||||
ssize_t len;
|
||||
|
|
@ -371,7 +369,7 @@ LIBLOG_ABI_PUBLIC int android_log_write_list(android_log_context ctx, log_id_t i
|
|||
: __android_log_security_bwrite(context->tag, msg, len));
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PRIVATE int android_log_write_list_buffer(android_log_context ctx, const char** buffer) {
|
||||
int android_log_write_list_buffer(android_log_context ctx, const char** buffer) {
|
||||
android_log_context_internal* context;
|
||||
const char* msg;
|
||||
ssize_t len;
|
||||
|
|
@ -593,10 +591,10 @@ static android_log_list_element android_log_read_next_internal(android_log_conte
|
|||
}
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC android_log_list_element android_log_read_next(android_log_context ctx) {
|
||||
android_log_list_element android_log_read_next(android_log_context ctx) {
|
||||
return android_log_read_next_internal(ctx, 0);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC android_log_list_element android_log_peek_next(android_log_context ctx) {
|
||||
android_log_list_element android_log_peek_next(android_log_context ctx) {
|
||||
return android_log_read_next_internal(ctx, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
#define MAX_SUBTAG_LEN 32
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_error_write(int tag, const char* subTag, int32_t uid,
|
||||
const char* data, uint32_t dataLen) {
|
||||
int __android_log_error_write(int tag, const char* subTag, int32_t uid, const char* data,
|
||||
uint32_t dataLen) {
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (subTag && (data || !dataLen)) {
|
||||
|
|
|
|||
|
|
@ -19,25 +19,6 @@
|
|||
#include <sys/cdefs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Helpful private sys/cdefs.h like definitions */
|
||||
|
||||
/* 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
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
|
||||
#include "log_portability.h"
|
||||
|
||||
LIBLOG_ABI_PRIVATE const char log_time::default_format[] = "%m-%d %H:%M:%S.%q";
|
||||
LIBLOG_ABI_PRIVATE const timespec log_time::EPOCH = { 0, 0 };
|
||||
const char log_time::default_format[] = "%m-%d %H:%M:%S.%q";
|
||||
const timespec log_time::EPOCH = {0, 0};
|
||||
|
||||
// Add %#q for fractional seconds to standard strptime function
|
||||
|
||||
LIBLOG_ABI_PRIVATE char* log_time::strptime(const char* s, const char* format) {
|
||||
char* log_time::strptime(const char* s, const char* format) {
|
||||
time_t now;
|
||||
#ifdef __linux__
|
||||
*this = log_time(CLOCK_REALTIME);
|
||||
|
|
@ -134,7 +134,7 @@ LIBLOG_ABI_PRIVATE char* log_time::strptime(const char* s, const char* format) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PRIVATE log_time log_time::operator-=(const timespec& T) {
|
||||
log_time log_time::operator-=(const timespec& T) {
|
||||
// No concept of negative time, clamp to EPOCH
|
||||
if (*this <= T) {
|
||||
return *this = log_time(EPOCH);
|
||||
|
|
@ -151,7 +151,7 @@ LIBLOG_ABI_PRIVATE log_time log_time::operator-=(const timespec& T) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PRIVATE log_time log_time::operator+=(const timespec& T) {
|
||||
log_time log_time::operator+=(const timespec& T) {
|
||||
this->tv_nsec += (unsigned long int)T.tv_nsec;
|
||||
if (this->tv_nsec >= NS_PER_SEC) {
|
||||
this->tv_nsec -= NS_PER_SEC;
|
||||
|
|
@ -162,7 +162,7 @@ LIBLOG_ABI_PRIVATE log_time log_time::operator+=(const timespec& T) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PRIVATE log_time log_time::operator-=(const log_time& T) {
|
||||
log_time log_time::operator-=(const log_time& T) {
|
||||
// No concept of negative time, clamp to EPOCH
|
||||
if (*this <= T) {
|
||||
return *this = log_time(EPOCH);
|
||||
|
|
@ -179,7 +179,7 @@ LIBLOG_ABI_PRIVATE log_time log_time::operator-=(const log_time& T) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PRIVATE log_time log_time::operator+=(const log_time& T) {
|
||||
log_time log_time::operator+=(const log_time& T) {
|
||||
this->tv_nsec += T.tv_nsec;
|
||||
if (this->tv_nsec >= NS_PER_SEC) {
|
||||
this->tv_nsec -= NS_PER_SEC;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static ssize_t logdSetPrune(struct android_log_logger_list* logger,
|
|||
static ssize_t logdGetStats(struct android_log_logger_list* logger,
|
||||
struct android_log_transport_context* transp, char* buf, size_t len);
|
||||
|
||||
LIBLOG_HIDDEN struct android_log_transport_read logdLoggerRead = {
|
||||
struct android_log_transport_read logdLoggerRead = {
|
||||
.node = {&logdLoggerRead.node, &logdLoggerRead.node},
|
||||
.name = "logd",
|
||||
.available = logdAvailable,
|
||||
|
|
@ -309,7 +309,7 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
LIBLOG_HIDDEN ssize_t __send_log_msg(char* buf, size_t buf_size) {
|
||||
ssize_t __send_log_msg(char* buf, size_t buf_size) {
|
||||
return send_log_msg(NULL, NULL, buf, buf_size);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,6 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
LIBLOG_HIDDEN ssize_t __send_log_msg(char* buf, size_t buf_size);
|
||||
ssize_t __send_log_msg(char* buf, size_t buf_size);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static int logdOpen();
|
|||
static void logdClose();
|
||||
static int logdWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr);
|
||||
|
||||
LIBLOG_HIDDEN struct android_log_transport_write logdLoggerWrite = {
|
||||
struct android_log_transport_write logdLoggerWrite = {
|
||||
.node = {&logdLoggerWrite.node, &logdLoggerWrite.node},
|
||||
.context.sock = -EBADF,
|
||||
.name = "logd",
|
||||
|
|
|
|||
|
|
@ -156,10 +156,10 @@ static inline uid_t __android_log_uid() {
|
|||
}
|
||||
#endif
|
||||
|
||||
LIBLOG_HIDDEN void __android_log_lock();
|
||||
LIBLOG_HIDDEN int __android_log_trylock();
|
||||
LIBLOG_HIDDEN void __android_log_unlock();
|
||||
void __android_log_lock();
|
||||
int __android_log_trylock();
|
||||
void __android_log_unlock();
|
||||
|
||||
extern LIBLOG_HIDDEN int __android_log_transport;
|
||||
extern int __android_log_transport;
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
|
||||
LIBLOG_HIDDEN void __android_log_lock() {
|
||||
void __android_log_lock() {
|
||||
#if !defined(_WIN32)
|
||||
/*
|
||||
* If we trigger a signal handler in the middle of locked activity and the
|
||||
|
|
@ -38,7 +38,7 @@ LIBLOG_HIDDEN void __android_log_lock() {
|
|||
#endif
|
||||
}
|
||||
|
||||
LIBLOG_HIDDEN int __android_log_trylock() {
|
||||
int __android_log_trylock() {
|
||||
#if !defined(_WIN32)
|
||||
return pthread_mutex_trylock(&log_init_lock);
|
||||
#else
|
||||
|
|
@ -46,7 +46,7 @@ LIBLOG_HIDDEN int __android_log_trylock() {
|
|||
#endif
|
||||
}
|
||||
|
||||
LIBLOG_HIDDEN void __android_log_unlock() {
|
||||
void __android_log_unlock() {
|
||||
#if !defined(_WIN32)
|
||||
pthread_mutex_unlock(&log_init_lock);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ static const char* LOG_NAME[LOG_ID_MAX] = {
|
|||
/* clang-format on */
|
||||
};
|
||||
|
||||
LIBLOG_ABI_PUBLIC const char* android_log_id_to_name(log_id_t log_id) {
|
||||
const char* android_log_id_to_name(log_id_t log_id) {
|
||||
if (log_id >= LOG_ID_MAX) {
|
||||
log_id = LOG_ID_MAIN;
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ LIBLOG_ABI_PUBLIC const char* android_log_id_to_name(log_id_t log_id) {
|
|||
static_assert(std::is_same<std::underlying_type<log_id_t>::type, uint32_t>::value,
|
||||
"log_id_t must be an unsigned int");
|
||||
|
||||
LIBLOG_ABI_PUBLIC log_id_t android_name_to_log_id(const char* logName) {
|
||||
log_id_t android_name_to_log_id(const char* logName) {
|
||||
const char* b;
|
||||
unsigned int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ static void android_logger_free(struct logger* logger) {
|
|||
/* android_logger_alloc unimplemented, no use case */
|
||||
|
||||
/* method for getting the associated sublog id */
|
||||
LIBLOG_ABI_PUBLIC log_id_t android_logger_get_id(struct logger* logger) {
|
||||
log_id_t android_logger_get_id(struct logger* logger) {
|
||||
return ((struct android_log_logger*)logger)->logId;
|
||||
}
|
||||
|
||||
|
|
@ -139,16 +139,16 @@ static int init_transport_context(struct android_log_logger_list* logger_list) {
|
|||
} \
|
||||
return ret
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_logger_clear(struct logger* logger) {
|
||||
int android_logger_clear(struct logger* logger) {
|
||||
LOGGER_FUNCTION(logger, -ENODEV, clear);
|
||||
}
|
||||
|
||||
/* returns the total size of the log's ring buffer */
|
||||
LIBLOG_ABI_PUBLIC long android_logger_get_log_size(struct logger* logger) {
|
||||
long android_logger_get_log_size(struct logger* logger) {
|
||||
LOGGER_FUNCTION(logger, -ENODEV, getSize);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_logger_set_log_size(struct logger* logger, unsigned long size) {
|
||||
int android_logger_set_log_size(struct logger* logger, unsigned long size) {
|
||||
LOGGER_FUNCTION(logger, -ENODEV, setSize, size);
|
||||
}
|
||||
|
||||
|
|
@ -156,14 +156,14 @@ LIBLOG_ABI_PUBLIC int android_logger_set_log_size(struct logger* logger, unsigne
|
|||
* returns the readable size of the log's ring buffer (that is, amount of the
|
||||
* log consumed)
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC long android_logger_get_log_readable_size(struct logger* logger) {
|
||||
long android_logger_get_log_readable_size(struct logger* logger) {
|
||||
LOGGER_FUNCTION(logger, -ENODEV, getReadableSize);
|
||||
}
|
||||
|
||||
/*
|
||||
* returns the logger version
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC int android_logger_get_log_version(struct logger* logger) {
|
||||
int android_logger_get_log_version(struct logger* logger) {
|
||||
LOGGER_FUNCTION(logger, 4, version);
|
||||
}
|
||||
|
||||
|
|
@ -191,23 +191,19 @@ LIBLOG_ABI_PUBLIC int android_logger_get_log_version(struct logger* logger) {
|
|||
/*
|
||||
* returns statistics
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC ssize_t android_logger_get_statistics(struct logger_list* logger_list, char* buf,
|
||||
size_t len) {
|
||||
ssize_t android_logger_get_statistics(struct logger_list* logger_list, char* buf, size_t len) {
|
||||
LOGGER_LIST_FUNCTION(logger_list, -ENODEV, getStats, buf, len);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC ssize_t android_logger_get_prune_list(struct logger_list* logger_list, char* buf,
|
||||
size_t len) {
|
||||
ssize_t android_logger_get_prune_list(struct logger_list* logger_list, char* buf, size_t len) {
|
||||
LOGGER_LIST_FUNCTION(logger_list, -ENODEV, getPrune, buf, len);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_logger_set_prune_list(struct logger_list* logger_list, char* buf,
|
||||
size_t len) {
|
||||
int android_logger_set_prune_list(struct logger_list* logger_list, char* buf, size_t len) {
|
||||
LOGGER_LIST_FUNCTION(logger_list, -ENODEV, setPrune, buf, len);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC struct logger_list* android_logger_list_alloc(int mode, unsigned int tail,
|
||||
pid_t pid) {
|
||||
struct logger_list* android_logger_list_alloc(int mode, unsigned int tail, pid_t pid) {
|
||||
struct android_log_logger_list* logger_list;
|
||||
|
||||
logger_list = static_cast<android_log_logger_list*>(calloc(1, sizeof(*logger_list)));
|
||||
|
|
@ -224,8 +220,7 @@ LIBLOG_ABI_PUBLIC struct logger_list* android_logger_list_alloc(int mode, unsign
|
|||
return (struct logger_list*)logger_list;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC struct logger_list* android_logger_list_alloc_time(int mode, log_time start,
|
||||
pid_t pid) {
|
||||
struct logger_list* android_logger_list_alloc_time(int mode, log_time start, pid_t pid) {
|
||||
struct android_log_logger_list* logger_list;
|
||||
|
||||
logger_list = static_cast<android_log_logger_list*>(calloc(1, sizeof(*logger_list)));
|
||||
|
|
@ -246,8 +241,7 @@ LIBLOG_ABI_PUBLIC struct logger_list* android_logger_list_alloc_time(int mode, l
|
|||
/* android_logger_list_unregister unimplemented, no use case */
|
||||
|
||||
/* Open the named log and add it to the logger list */
|
||||
LIBLOG_ABI_PUBLIC struct logger* android_logger_open(struct logger_list* logger_list,
|
||||
log_id_t logId) {
|
||||
struct logger* android_logger_open(struct logger_list* logger_list, log_id_t logId) {
|
||||
struct android_log_logger_list* logger_list_internal =
|
||||
(struct android_log_logger_list*)logger_list;
|
||||
struct android_log_logger* logger;
|
||||
|
|
@ -289,8 +283,8 @@ ok:
|
|||
}
|
||||
|
||||
/* Open the single named log and make it part of a new logger list */
|
||||
LIBLOG_ABI_PUBLIC struct logger_list* android_logger_list_open(log_id_t logId, int mode,
|
||||
unsigned int tail, pid_t pid) {
|
||||
struct logger_list* android_logger_list_open(log_id_t logId, int mode, unsigned int tail,
|
||||
pid_t pid) {
|
||||
struct logger_list* logger_list = android_logger_list_alloc(mode, tail, pid);
|
||||
|
||||
if (!logger_list) {
|
||||
|
|
@ -345,8 +339,7 @@ static int android_transport_read(struct android_log_logger_list* logger_list,
|
|||
}
|
||||
|
||||
/* Read from the selected logs */
|
||||
LIBLOG_ABI_PUBLIC int android_logger_list_read(struct logger_list* logger_list,
|
||||
struct log_msg* log_msg) {
|
||||
int android_logger_list_read(struct logger_list* logger_list, struct log_msg* log_msg) {
|
||||
struct android_log_transport_context* transp;
|
||||
struct android_log_logger_list* logger_list_internal =
|
||||
(struct android_log_logger_list*)logger_list;
|
||||
|
|
@ -437,7 +430,7 @@ LIBLOG_ABI_PUBLIC int android_logger_list_read(struct logger_list* logger_list,
|
|||
}
|
||||
|
||||
/* Close all the logs */
|
||||
LIBLOG_ABI_PUBLIC void android_logger_list_free(struct logger_list* logger_list) {
|
||||
void android_logger_list_free(struct logger_list* logger_list) {
|
||||
struct android_log_logger_list* logger_list_internal =
|
||||
(struct android_log_logger_list*)logger_list;
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ static void __android_log_cache_available(struct android_log_transport_write* no
|
|||
}
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC extern "C" int __android_log_dev_available() {
|
||||
extern "C" int __android_log_dev_available() {
|
||||
struct android_log_transport_write* node;
|
||||
|
||||
if (list_empty(&__android_log_transport_write)) {
|
||||
|
|
@ -128,7 +128,7 @@ static atomic_uintptr_t tagMap;
|
|||
/*
|
||||
* Release any logger resources. A new log write will immediately re-acquire.
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC void __android_log_close() {
|
||||
void __android_log_close() {
|
||||
struct android_log_transport_write* transport;
|
||||
#if defined(__ANDROID__)
|
||||
EventTagMap* m;
|
||||
|
|
@ -402,12 +402,11 @@ static int __write_to_log_init(log_id_t log_id, struct iovec* vec, size_t nr) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_write(int prio, const char* tag, const char* msg) {
|
||||
int __android_log_write(int prio, const char* tag, const char* msg) {
|
||||
return __android_log_buf_write(LOG_ID_MAIN, prio, tag, msg);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_buf_write(int bufID, int prio, const char* tag,
|
||||
const char* msg) {
|
||||
int __android_log_buf_write(int bufID, int prio, const char* tag, const char* msg) {
|
||||
struct iovec vec[3];
|
||||
char tmp_tag[32];
|
||||
|
||||
|
|
@ -472,7 +471,7 @@ LIBLOG_ABI_PUBLIC int __android_log_buf_write(int bufID, int prio, const char* t
|
|||
return write_to_log(static_cast<log_id_t>(bufID), vec, 3);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) {
|
||||
int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) {
|
||||
char buf[LOG_BUF_SIZE];
|
||||
|
||||
vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
|
||||
|
|
@ -480,7 +479,7 @@ LIBLOG_ABI_PUBLIC int __android_log_vprint(int prio, const char* tag, const char
|
|||
return __android_log_write(prio, tag, buf);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_print(int prio, const char* tag, const char* fmt, ...) {
|
||||
int __android_log_print(int prio, const char* tag, const char* fmt, ...) {
|
||||
va_list ap;
|
||||
char buf[LOG_BUF_SIZE];
|
||||
|
||||
|
|
@ -491,8 +490,7 @@ LIBLOG_ABI_PUBLIC int __android_log_print(int prio, const char* tag, const char*
|
|||
return __android_log_write(prio, tag, buf);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fmt,
|
||||
...) {
|
||||
int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fmt, ...) {
|
||||
va_list ap;
|
||||
char buf[LOG_BUF_SIZE];
|
||||
|
||||
|
|
@ -503,8 +501,7 @@ LIBLOG_ABI_PUBLIC int __android_log_buf_print(int bufID, int prio, const char* t
|
|||
return __android_log_buf_write(bufID, prio, tag, buf);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC void __android_log_assert(const char* cond, const char* tag, const char* fmt,
|
||||
...) {
|
||||
void __android_log_assert(const char* cond, const char* tag, const char* fmt, ...) {
|
||||
char buf[LOG_BUF_SIZE];
|
||||
|
||||
if (fmt) {
|
||||
|
|
@ -533,7 +530,7 @@ LIBLOG_ABI_PUBLIC void __android_log_assert(const char* cond, const char* tag, c
|
|||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_bwrite(int32_t tag, const void* payload, size_t len) {
|
||||
int __android_log_bwrite(int32_t tag, const void* payload, size_t len) {
|
||||
struct iovec vec[2];
|
||||
|
||||
vec[0].iov_base = &tag;
|
||||
|
|
@ -544,7 +541,7 @@ LIBLOG_ABI_PUBLIC int __android_log_bwrite(int32_t tag, const void* payload, siz
|
|||
return write_to_log(LOG_ID_EVENTS, vec, 2);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_stats_bwrite(int32_t tag, const void* payload, size_t len) {
|
||||
int __android_log_stats_bwrite(int32_t tag, const void* payload, size_t len) {
|
||||
struct iovec vec[2];
|
||||
|
||||
vec[0].iov_base = &tag;
|
||||
|
|
@ -555,7 +552,7 @@ LIBLOG_ABI_PUBLIC int __android_log_stats_bwrite(int32_t tag, const void* payloa
|
|||
return write_to_log(LOG_ID_STATS, vec, 2);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_security_bwrite(int32_t tag, const void* payload, size_t len) {
|
||||
int __android_log_security_bwrite(int32_t tag, const void* payload, size_t len) {
|
||||
struct iovec vec[2];
|
||||
|
||||
vec[0].iov_base = &tag;
|
||||
|
|
@ -571,8 +568,7 @@ LIBLOG_ABI_PUBLIC int __android_log_security_bwrite(int32_t tag, const void* pay
|
|||
* for the general case where we're generating lists of stuff, but very
|
||||
* handy if we just want to dump an integer into the log.
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC int __android_log_btwrite(int32_t tag, char type, const void* payload,
|
||||
size_t len) {
|
||||
int __android_log_btwrite(int32_t tag, char type, const void* payload, size_t len) {
|
||||
struct iovec vec[3];
|
||||
|
||||
vec[0].iov_base = &tag;
|
||||
|
|
@ -589,7 +585,7 @@ LIBLOG_ABI_PUBLIC int __android_log_btwrite(int32_t tag, char type, const void*
|
|||
* Like __android_log_bwrite, but used for writing strings to the
|
||||
* event log.
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC int __android_log_bswrite(int32_t tag, const char* payload) {
|
||||
int __android_log_bswrite(int32_t tag, const char* payload) {
|
||||
struct iovec vec[4];
|
||||
char type = EVENT_TYPE_STRING;
|
||||
uint32_t len = strlen(payload);
|
||||
|
|
@ -610,7 +606,7 @@ LIBLOG_ABI_PUBLIC int __android_log_bswrite(int32_t tag, const char* payload) {
|
|||
* Like __android_log_security_bwrite, but used for writing strings to the
|
||||
* security log.
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC int __android_log_security_bswrite(int32_t tag, const char* payload) {
|
||||
int __android_log_security_bswrite(int32_t tag, const char* payload) {
|
||||
struct iovec vec[4];
|
||||
char type = EVENT_TYPE_STRING;
|
||||
uint32_t len = strlen(payload);
|
||||
|
|
@ -645,9 +641,9 @@ 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_transport;
|
||||
int __android_log_transport;
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_set_log_transport(int transport_flag) {
|
||||
int android_set_log_transport(int transport_flag) {
|
||||
int retval;
|
||||
|
||||
if (transport_flag < 0) {
|
||||
|
|
@ -688,7 +684,7 @@ LIBLOG_ABI_PUBLIC int android_set_log_transport(int transport_flag) {
|
|||
return retval;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_get_log_transport() {
|
||||
int android_get_log_transport() {
|
||||
int ret = LOGGER_DEFAULT;
|
||||
|
||||
__android_log_lock();
|
||||
|
|
|
|||
|
|
@ -195,12 +195,12 @@ static android_LogPriority filterPriForTag(AndroidLogFormat* p_format, const cha
|
|||
* returns 1 if this log line should be printed based on its priority
|
||||
* and tag, and 0 if it should not
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC int android_log_shouldPrintLine(AndroidLogFormat* p_format, const char* tag,
|
||||
android_LogPriority pri) {
|
||||
int android_log_shouldPrintLine(AndroidLogFormat* p_format, const char* tag,
|
||||
android_LogPriority pri) {
|
||||
return pri >= filterPriForTag(p_format, tag);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC AndroidLogFormat* android_log_format_new() {
|
||||
AndroidLogFormat* android_log_format_new() {
|
||||
AndroidLogFormat* p_ret;
|
||||
|
||||
p_ret = static_cast<AndroidLogFormat*>(calloc(1, sizeof(AndroidLogFormat)));
|
||||
|
|
@ -228,7 +228,7 @@ LIBLOG_ABI_PUBLIC AndroidLogFormat* android_log_format_new() {
|
|||
|
||||
static list_declare(convertHead);
|
||||
|
||||
LIBLOG_ABI_PUBLIC void android_log_format_free(AndroidLogFormat* p_format) {
|
||||
void android_log_format_free(AndroidLogFormat* p_format) {
|
||||
FilterInfo *p_info, *p_info_old;
|
||||
|
||||
p_info = p_format->filters;
|
||||
|
|
@ -251,8 +251,7 @@ LIBLOG_ABI_PUBLIC void android_log_format_free(AndroidLogFormat* p_format) {
|
|||
}
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_setPrintFormat(AndroidLogFormat* p_format,
|
||||
AndroidLogPrintFormat format) {
|
||||
int android_log_setPrintFormat(AndroidLogFormat* p_format, AndroidLogPrintFormat format) {
|
||||
switch (format) {
|
||||
case FORMAT_MODIFIER_COLOR:
|
||||
p_format->colored_output = true;
|
||||
|
|
@ -298,7 +297,7 @@ static const char utc[] = "UTC";
|
|||
/**
|
||||
* Returns FORMAT_OFF on invalid string
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC AndroidLogPrintFormat android_log_formatFromString(const char* formatString) {
|
||||
AndroidLogPrintFormat android_log_formatFromString(const char* formatString) {
|
||||
static AndroidLogPrintFormat format;
|
||||
|
||||
/* clang-format off */
|
||||
|
|
@ -367,8 +366,7 @@ LIBLOG_ABI_PUBLIC AndroidLogPrintFormat android_log_formatFromString(const char*
|
|||
* Assumes single threaded execution
|
||||
*/
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_addFilterRule(AndroidLogFormat* p_format,
|
||||
const char* filterExpression) {
|
||||
int android_log_addFilterRule(AndroidLogFormat* p_format, const char* filterExpression) {
|
||||
size_t tagNameLength;
|
||||
android_LogPriority pri = ANDROID_LOG_DEFAULT;
|
||||
|
||||
|
|
@ -463,8 +461,7 @@ static char* strsep(char** stringp, const char* delim) {
|
|||
* Assumes single threaded execution
|
||||
*
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC int android_log_addFilterString(AndroidLogFormat* p_format,
|
||||
const char* filterString) {
|
||||
int android_log_addFilterString(AndroidLogFormat* p_format, const char* filterString) {
|
||||
char* filterStringCopy = strdup(filterString);
|
||||
char* p_cur = filterStringCopy;
|
||||
char* p_ret;
|
||||
|
|
@ -496,8 +493,7 @@ error:
|
|||
* Returns 0 on success and -1 on invalid wire format (entry will be
|
||||
* in unspecified state)
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC int android_log_processLogBuffer(struct logger_entry* buf,
|
||||
AndroidLogEntry* entry) {
|
||||
int android_log_processLogBuffer(struct logger_entry* buf, AndroidLogEntry* entry) {
|
||||
entry->message = NULL;
|
||||
entry->messageLen = 0;
|
||||
|
||||
|
|
@ -997,7 +993,7 @@ no_room:
|
|||
* it however we choose, which means we can't really use a fixed-size buffer
|
||||
* here.
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC int android_log_processBinaryLogBuffer(
|
||||
int android_log_processBinaryLogBuffer(
|
||||
struct logger_entry* buf, AndroidLogEntry* entry,
|
||||
[[maybe_unused]] const EventTagMap* map, /* only on !__ANDROID__ */
|
||||
char* messageBuf, int messageBufLen) {
|
||||
|
|
@ -1525,10 +1521,9 @@ static void convertMonotonic(struct timespec* result, const AndroidLogEntry* ent
|
|||
* Returns NULL on malloc error
|
||||
*/
|
||||
|
||||
LIBLOG_ABI_PUBLIC char* android_log_formatLogLine(AndroidLogFormat* p_format, char* defaultBuffer,
|
||||
size_t defaultBufferSize,
|
||||
const AndroidLogEntry* entry,
|
||||
size_t* p_outLength) {
|
||||
char* android_log_formatLogLine(AndroidLogFormat* p_format, char* defaultBuffer,
|
||||
size_t defaultBufferSize, const AndroidLogEntry* entry,
|
||||
size_t* p_outLength) {
|
||||
#if !defined(_WIN32)
|
||||
struct tm tmBuf;
|
||||
#endif
|
||||
|
|
@ -1819,8 +1814,7 @@ LIBLOG_ABI_PUBLIC char* android_log_formatLogLine(AndroidLogFormat* p_format, ch
|
|||
* Returns count bytes written
|
||||
*/
|
||||
|
||||
LIBLOG_ABI_PUBLIC int android_log_printLogLine(AndroidLogFormat* p_format, int fd,
|
||||
const AndroidLogEntry* entry) {
|
||||
int android_log_printLogLine(AndroidLogFormat* p_format, int fd, const AndroidLogEntry* entry) {
|
||||
int ret;
|
||||
char defaultBuffer[512];
|
||||
char* outBuffer = NULL;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ static void pmsgClose(struct android_log_logger_list* logger_list,
|
|||
static int pmsgClear(struct android_log_logger* logger,
|
||||
struct android_log_transport_context* transp);
|
||||
|
||||
LIBLOG_HIDDEN struct android_log_transport_read pmsgLoggerRead = {
|
||||
struct android_log_transport_read pmsgLoggerRead = {
|
||||
.node = {&pmsgLoggerRead.node, &pmsgLoggerRead.node},
|
||||
.name = "pmsg",
|
||||
.available = pmsgAvailable,
|
||||
|
|
@ -270,10 +270,8 @@ static void* realloc_or_free(void* ptr, size_t new_size) {
|
|||
return result;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PRIVATE ssize_t __android_log_pmsg_file_read(log_id_t logId, char prio,
|
||||
const char* prefix,
|
||||
__android_log_pmsg_file_read_fn fn,
|
||||
void* arg) {
|
||||
ssize_t __android_log_pmsg_file_read(log_id_t logId, char prio, const char* prefix,
|
||||
__android_log_pmsg_file_read_fn fn, void* arg) {
|
||||
ssize_t ret;
|
||||
struct android_log_logger_list logger_list;
|
||||
struct android_log_transport_context transp;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ static void pmsgClose();
|
|||
static int pmsgAvailable(log_id_t logId);
|
||||
static int pmsgWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr);
|
||||
|
||||
LIBLOG_HIDDEN struct android_log_transport_write pmsgLoggerWrite = {
|
||||
struct android_log_transport_write pmsgLoggerWrite = {
|
||||
.node = {&pmsgLoggerWrite.node, &pmsgLoggerWrite.node},
|
||||
.context.fd = -1,
|
||||
.name = "pmsg",
|
||||
|
|
@ -200,9 +200,8 @@ static inline const char* strnrchr(const char* buf, size_t len, char c) {
|
|||
}
|
||||
|
||||
/* Write a buffer as filename references (tag = <basedir>:<basename>) */
|
||||
LIBLOG_ABI_PRIVATE ssize_t __android_log_pmsg_file_write(log_id_t logId, char prio,
|
||||
const char* filename, const char* buf,
|
||||
size_t len) {
|
||||
ssize_t __android_log_pmsg_file_write(log_id_t logId, char prio, const char* filename,
|
||||
const char* buf, size_t len) {
|
||||
bool weOpened;
|
||||
size_t length, packet_len;
|
||||
const char* tag;
|
||||
|
|
|
|||
|
|
@ -264,18 +264,17 @@ static int __android_log_level(const char* tag, size_t len, int default_prio) {
|
|||
return default_prio;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_is_loggable_len(int prio, const char* tag, size_t len,
|
||||
int default_prio) {
|
||||
int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int default_prio) {
|
||||
int logLevel = __android_log_level(tag, len, default_prio);
|
||||
return logLevel >= 0 && prio >= logLevel;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio, const char* tag, int default_prio) {
|
||||
int __android_log_is_loggable(int prio, const char* tag, int default_prio) {
|
||||
int logLevel = __android_log_level(tag, (tag && *tag) ? strlen(tag) : 0, default_prio);
|
||||
return logLevel >= 0 && prio >= logLevel;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_is_debuggable() {
|
||||
int __android_log_is_debuggable() {
|
||||
static uint32_t serial;
|
||||
static struct cache_char tag_cache;
|
||||
static const char key[] = "ro.debuggable";
|
||||
|
|
@ -361,7 +360,7 @@ static unsigned char evaluate_persist_ro(const struct cache2_char* self) {
|
|||
* Timestamp state generally remains constant, but can change at any time
|
||||
* to handle developer requirements.
|
||||
*/
|
||||
LIBLOG_ABI_PUBLIC clockid_t android_log_clockid() {
|
||||
clockid_t android_log_clockid() {
|
||||
static struct cache2_char clockid = {PTHREAD_MUTEX_INITIALIZER, 0,
|
||||
"persist.logd.timestamp", {{NULL, 0xFFFFFFFF}, '\0'},
|
||||
"ro.logd.timestamp", {{NULL, 0xFFFFFFFF}, '\0'},
|
||||
|
|
@ -380,7 +379,7 @@ static unsigned char evaluate_security(const struct cache2_char* self) {
|
|||
return (c != BOOLEAN_FALSE) && c && (self->cache_persist.c == BOOLEAN_TRUE);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PUBLIC int __android_log_security() {
|
||||
int __android_log_security() {
|
||||
static struct cache2_char security = {
|
||||
PTHREAD_MUTEX_INITIALIZER, 0,
|
||||
"persist.logd.security", {{NULL, 0xFFFFFFFF}, BOOLEAN_FALSE},
|
||||
|
|
@ -428,7 +427,7 @@ static void refresh_cache_property(struct cache_property* cache, const char* key
|
|||
}
|
||||
|
||||
/* get boolean with the logger twist that supports eng adjustments */
|
||||
LIBLOG_ABI_PRIVATE bool __android_logger_property_get_bool(const char* key, int flag) {
|
||||
bool __android_logger_property_get_bool(const char* key, int flag) {
|
||||
struct cache_property property = {{NULL, 0xFFFFFFFF}, {0}};
|
||||
if (flag & BOOL_DEFAULT_FLAG_PERSIST) {
|
||||
char newkey[strlen("persist.") + strlen(key) + 1];
|
||||
|
|
@ -478,7 +477,7 @@ LIBLOG_ABI_PRIVATE bool __android_logger_property_get_bool(const char* key, int
|
|||
return (flag & BOOL_DEFAULT_FLAG_TRUE_FALSE) != BOOL_DEFAULT_FALSE;
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PRIVATE bool __android_logger_valid_buffer_size(unsigned long value) {
|
||||
bool __android_logger_valid_buffer_size(unsigned long value) {
|
||||
static long pages, pagesize;
|
||||
unsigned long maximum;
|
||||
|
||||
|
|
@ -583,7 +582,7 @@ static unsigned long evaluate_property_get_size(const struct cache2_property_siz
|
|||
return property_get_size_from_cache(&self->cache_ro);
|
||||
}
|
||||
|
||||
LIBLOG_ABI_PRIVATE unsigned long __android_logger_get_buffer_size(log_id_t logId) {
|
||||
unsigned long __android_logger_get_buffer_size(log_id_t logId) {
|
||||
static const char global_tunable[] = "persist.logd.size"; /* Settings App */
|
||||
static const char global_default[] = "ro.logd.size"; /* BoardConfig.mk */
|
||||
static struct cache2_property_size global = {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ struct stderrContext {
|
|||
#endif
|
||||
};
|
||||
|
||||
LIBLOG_HIDDEN struct android_log_transport_write stderrLoggerWrite = {
|
||||
struct android_log_transport_write stderrLoggerWrite = {
|
||||
.node = {&stderrLoggerWrite.node, &stderrLoggerWrite.node},
|
||||
.context.priv = NULL,
|
||||
.name = "stderr",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue