Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bfd9f55 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "system/core: replace EVENT_TAG_MAP_FILE with NULL"

parents 5b21deb7 1179eb80
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -571,7 +571,7 @@ static void dump_log_file(


    if (log_entry.id() == LOG_ID_EVENTS) {
    if (log_entry.id() == LOG_ID_EVENTS) {
      if (!g_eventTagMap) {
      if (!g_eventTagMap) {
        g_eventTagMap = android_openEventTagMap(EVENT_TAG_MAP_FILE);
        g_eventTagMap = android_openEventTagMap(NULL);
      }
      }
      AndroidLogEntry e;
      AndroidLogEntry e;
      char buf[512];
      char buf[512];
+5 −4
Original line number Original line Diff line number Diff line
@@ -73,12 +73,13 @@ LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName)
    EventTagMap* newTagMap;
    EventTagMap* newTagMap;
    off_t end;
    off_t end;
    int save_errno;
    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) {
    if (fd < 0) {
        save_errno = errno;
        save_errno = errno;
        fprintf(stderr, "%s: unable to open map '%s': %s\n",
        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;
        goto fail_errno;
    }
    }


@@ -87,7 +88,7 @@ LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName)
    (void) lseek(fd, 0L, SEEK_SET);
    (void) lseek(fd, 0L, SEEK_SET);
    if (end < 0) {
    if (end < 0) {
        fprintf(stderr, "%s: unable to seek map '%s' %s\n",
        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;
        goto fail_close;
    }
    }


@@ -103,7 +104,7 @@ LIBLOG_ABI_PUBLIC EventTagMap* android_openEventTagMap(const char* fileName)
    fd = -1;
    fd = -1;
    if ((newTagMap->mapAddr == MAP_FAILED) || (newTagMap->mapAddr == NULL)) {
    if ((newTagMap->mapAddr == MAP_FAILED) || (newTagMap->mapAddr == NULL)) {
        fprintf(stderr, "%s: mmap(%s) failed: %s\n",
        fprintf(stderr, "%s: mmap(%s) failed: %s\n",
                OUT_TAG, fileName, strerror(save_errno));
                OUT_TAG, tagfile, strerror(save_errno));
        goto fail_free;
        goto fail_free;
    }
    }


+1 −1
Original line number Original line Diff line number Diff line
@@ -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();
            ret = __android_log_trylock();
            m = (EventTagMap *)atomic_load(&tagMap); /* trylock flush cache */
            m = (EventTagMap *)atomic_load(&tagMap); /* trylock flush cache */
            if (!m) {
            if (!m) {
                m = android_openEventTagMap(EVENT_TAG_MAP_FILE);
                m = android_openEventTagMap(NULL);
                if (ret) { /* trylock failed, use local copy, mark for close */
                if (ret) { /* trylock failed, use local copy, mark for close */
                    f = m;
                    f = m;
                } else {
                } else {
+1 −1
Original line number Original line Diff line number Diff line
@@ -177,7 +177,7 @@ static void processBuffer(log_device_t* dev, struct log_msg *buf)
        static EventTagMap *eventTagMap = NULL;
        static EventTagMap *eventTagMap = NULL;


        if (!eventTagMap && !hasOpenedEventTagMap) {
        if (!eventTagMap && !hasOpenedEventTagMap) {
            eventTagMap = android_openEventTagMap(EVENT_TAG_MAP_FILE);
            eventTagMap = android_openEventTagMap(NULL);
            hasOpenedEventTagMap = true;
            hasOpenedEventTagMap = true;
        }
        }
        err = android_log_processBinaryLogBuffer(&buf->entry_v1, &entry,
        err = android_log_processBinaryLogBuffer(&buf->entry_v1, &entry,
+1 −1
Original line number Original line Diff line number Diff line
@@ -311,7 +311,7 @@ const char *android::tagToName(size_t *len, uint32_t tag) {
    if (!map) {
    if (!map) {
        sem_wait(&sem_name);
        sem_wait(&sem_name);
        if (!map) {
        if (!map) {
            map = android_openEventTagMap(EVENT_TAG_MAP_FILE);
            map = android_openEventTagMap(NULL);
        }
        }
        sem_post(&sem_name);
        sem_post(&sem_name);
        if (!map) {
        if (!map) {