diff options
| author | Mark Salyzyn <salyzyn@google.com> | 2016-11-11 09:48:56 -0800 |
|---|---|---|
| committer | Mark Salyzyn <salyzyn@google.com> | 2016-11-21 11:13:02 -0800 |
| commit | 1179eb8048f5861bf92b29441230381526d30e5d (patch) | |
| tree | 25a8ac14c4919e692e7c20ec612805d657eb1ea2 | |
| parent | b6552f376ca2903d987faa9b05808d72952af858 (diff) | |
| download | system_core-1179eb8048f5861bf92b29441230381526d30e5d.tar.gz system_core-1179eb8048f5861bf92b29441230381526d30e5d.tar.bz2 system_core-1179eb8048f5861bf92b29441230381526d30e5d.zip | |
system/core: replace EVENT_TAG_MAP_FILE with NULL
NULL represents system default. In the future, NULL could represent
static and dynamic tags, which can come from multiple files based on
implementation details in the liblog library.
Test: gTest logd-unit-tests & liblog-unit-tests
Bug: 31456426
Change-Id: I0e3d296de81ca299ae63d7b83781639ee67ec298
| -rw-r--r-- | debuggerd/tombstone.cpp | 2 | ||||
| -rw-r--r-- | liblog/event_tag_map.c | 9 | ||||
| -rw-r--r-- | liblog/logger_write.c | 2 | ||||
| -rw-r--r-- | logcat/logcat.cpp | 2 | ||||
| -rw-r--r-- | logd/main.cpp | 2 |
5 files changed, 9 insertions, 8 deletions
diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp index 1e474834e..b9fbe0782 100644 --- a/debuggerd/tombstone.cpp +++ b/debuggerd/tombstone.cpp @@ -571,7 +571,7 @@ static void dump_log_file( if (log_entry.id() == LOG_ID_EVENTS) { if (!g_eventTagMap) { - g_eventTagMap = android_openEventTagMap(EVENT_TAG_MAP_FILE); + g_eventTagMap = android_openEventTagMap(NULL); } AndroidLogEntry e; char buf[512]; diff --git a/liblog/event_tag_map.c b/liblog/event_tag_map.c index f9cad9997..e8e0335e8 100644 --- a/liblog/event_tag_map.c +++ b/liblog/event_tag_map.c @@ -73,12 +73,13 @@ LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName) EventTagMap* newTagMap; off_t end; int save_errno; + const char* tagfile = fileName ? fileName : EVENT_TAG_MAP_FILE; - int fd = open(fileName, O_RDONLY | O_CLOEXEC); + int fd = open(tagfile, O_RDONLY | O_CLOEXEC); if (fd < 0) { save_errno = errno; fprintf(stderr, "%s: unable to open map '%s': %s\n", - OUT_TAG, fileName, strerror(save_errno)); + OUT_TAG, tagfile, strerror(save_errno)); goto fail_errno; } @@ -87,7 +88,7 @@ LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName) (void) lseek(fd, 0L, SEEK_SET); if (end < 0) { fprintf(stderr, "%s: unable to seek map '%s' %s\n", - OUT_TAG, fileName, strerror(save_errno)); + OUT_TAG, tagfile, strerror(save_errno)); goto fail_close; } @@ -103,7 +104,7 @@ LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName) fd = -1; if ((newTagMap->mapAddr == MAP_FAILED) || (newTagMap->mapAddr == NULL)) { fprintf(stderr, "%s: mmap(%s) failed: %s\n", - OUT_TAG, fileName, strerror(save_errno)); + OUT_TAG, tagfile, strerror(save_errno)); goto fail_free; } diff --git a/liblog/logger_write.c b/liblog/logger_write.c index 157bd88a1..170c8d1f9 100644 --- a/liblog/logger_write.c +++ b/liblog/logger_write.c @@ -293,7 +293,7 @@ static int __write_to_log_daemon(log_id_t log_id, struct iovec *vec, size_t nr) ret = __android_log_trylock(); m = (EventTagMap *)atomic_load(&tagMap); /* trylock flush cache */ if (!m) { - m = android_openEventTagMap(EVENT_TAG_MAP_FILE); + m = android_openEventTagMap(NULL); if (ret) { /* trylock failed, use local copy, mark for close */ f = m; } else { diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp index 41f228009..94b8691a3 100644 --- a/logcat/logcat.cpp +++ b/logcat/logcat.cpp @@ -177,7 +177,7 @@ static void processBuffer(log_device_t* dev, struct log_msg *buf) static EventTagMap *eventTagMap = NULL; if (!eventTagMap && !hasOpenedEventTagMap) { - eventTagMap = android_openEventTagMap(EVENT_TAG_MAP_FILE); + eventTagMap = android_openEventTagMap(NULL); hasOpenedEventTagMap = true; } err = android_log_processBinaryLogBuffer(&buf->entry_v1, &entry, diff --git a/logd/main.cpp b/logd/main.cpp index 7550c41a5..c3343d785 100644 --- a/logd/main.cpp +++ b/logd/main.cpp @@ -311,7 +311,7 @@ const char *android::tagToName(size_t *len, uint32_t tag) { if (!map) { sem_wait(&sem_name); if (!map) { - map = android_openEventTagMap(EVENT_TAG_MAP_FILE); + map = android_openEventTagMap(NULL); } sem_post(&sem_name); if (!map) { |
