Loading logd/Android.mk +2 −3 Original line number Diff line number Diff line Loading @@ -4,8 +4,6 @@ include $(CLEAR_VARS) LOCAL_MODULE:= logd LOCAL_INIT_RC := logd.rc LOCAL_SRC_FILES := \ main.cpp \ LogCommand.cpp \ Loading @@ -27,7 +25,8 @@ LOCAL_SHARED_LIBRARIES := \ libsysutils \ liblog \ libcutils \ libbase libbase \ libpackagelistparser # This is what we want to do: # event_logtags = $(shell \ Loading logd/main.cpp +17 −25 Original line number Diff line number Diff line Loading @@ -33,12 +33,14 @@ #include <syslog.h> #include <unistd.h> #include <cstdbool> #include <memory> #include <cutils/properties.h> #include <cutils/sched_policy.h> #include <cutils/sockets.h> #include <log/event_tag_map.h> #include <packagelistparser/packagelistparser.h> #include <private/android_filesystem_config.h> #include <utils/threads.h> Loading Loading @@ -166,6 +168,19 @@ static sem_t reinit; static bool reinit_running = false; static LogBuffer *logBuf = NULL; static bool package_list_parser_cb(pkg_info *info, void * /* userdata */) { bool rc = true; if (info->uid == uid) { name = strdup(info->name); // false to stop processing rc = false; } packagelist_free(info); return rc; } static void *reinit_thread_start(void * /*obj*/) { prctl(PR_SET_NAME, "logd.daemon"); set_sched_policy(0, SP_BACKGROUND); Loading @@ -180,31 +195,8 @@ static void *reinit_thread_start(void * /*obj*/) { if (uid) { name = NULL; FILE *fp = fopen("/data/system/packages.list", "r"); if (fp) { // This simple parser is sensitive to format changes in // frameworks/base/services/core/java/com/android/server/pm/Settings.java // A dependency note has been added to that file to correct // this parser. char *buffer = NULL; size_t len; while (getline(&buffer, &len, fp) > 0) { char *userId = strchr(buffer, ' '); if (!userId) { continue; } *userId = '\0'; unsigned long value = strtoul(userId + 1, NULL, 10); if (value != uid) { continue; } name = strdup(buffer); break; } free(buffer); fclose(fp); } packagelist_parse(package_list_parser_cb, NULL); uid = 0; sem_post(&uidName); continue; Loading Loading
logd/Android.mk +2 −3 Original line number Diff line number Diff line Loading @@ -4,8 +4,6 @@ include $(CLEAR_VARS) LOCAL_MODULE:= logd LOCAL_INIT_RC := logd.rc LOCAL_SRC_FILES := \ main.cpp \ LogCommand.cpp \ Loading @@ -27,7 +25,8 @@ LOCAL_SHARED_LIBRARIES := \ libsysutils \ liblog \ libcutils \ libbase libbase \ libpackagelistparser # This is what we want to do: # event_logtags = $(shell \ Loading
logd/main.cpp +17 −25 Original line number Diff line number Diff line Loading @@ -33,12 +33,14 @@ #include <syslog.h> #include <unistd.h> #include <cstdbool> #include <memory> #include <cutils/properties.h> #include <cutils/sched_policy.h> #include <cutils/sockets.h> #include <log/event_tag_map.h> #include <packagelistparser/packagelistparser.h> #include <private/android_filesystem_config.h> #include <utils/threads.h> Loading Loading @@ -166,6 +168,19 @@ static sem_t reinit; static bool reinit_running = false; static LogBuffer *logBuf = NULL; static bool package_list_parser_cb(pkg_info *info, void * /* userdata */) { bool rc = true; if (info->uid == uid) { name = strdup(info->name); // false to stop processing rc = false; } packagelist_free(info); return rc; } static void *reinit_thread_start(void * /*obj*/) { prctl(PR_SET_NAME, "logd.daemon"); set_sched_policy(0, SP_BACKGROUND); Loading @@ -180,31 +195,8 @@ static void *reinit_thread_start(void * /*obj*/) { if (uid) { name = NULL; FILE *fp = fopen("/data/system/packages.list", "r"); if (fp) { // This simple parser is sensitive to format changes in // frameworks/base/services/core/java/com/android/server/pm/Settings.java // A dependency note has been added to that file to correct // this parser. char *buffer = NULL; size_t len; while (getline(&buffer, &len, fp) > 0) { char *userId = strchr(buffer, ' '); if (!userId) { continue; } *userId = '\0'; unsigned long value = strtoul(userId + 1, NULL, 10); if (value != uid) { continue; } name = strdup(buffer); break; } free(buffer); fclose(fp); } packagelist_parse(package_list_parser_cb, NULL); uid = 0; sem_post(&uidName); continue; Loading