When debugging audit logs, it is often helpful to
have the packages name. Bear in mind that the
package name is the right most chars up to
TASK_COMM_LEN. Although a possibility of truncation
exists, it can be useful for narrowing down the
possibilities.

Change-Id: Ia735b03f64352d155f8b96e1d47f48e6519b1d4f
---
 vm/native/dalvik_system_Zygote.cpp |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/vm/native/dalvik_system_Zygote.cpp 
b/vm/native/dalvik_system_Zygote.cpp
index 237b85b..93c6d85 100644
--- a/vm/native/dalvik_system_Zygote.cpp
+++ b/vm/native/dalvik_system_Zygote.cpp
@@ -44,6 +44,8 @@
 # include <sys/prctl.h>
 #endif
 
+#include "Thread.h"
+
 #define ZYGOTE_LOG_TAG "Zygote"
 
 /* must match values in dalvik.system.Zygote */
@@ -670,6 +672,14 @@ static pid_t forkAndSpecializeCommon(const u4* args, bool 
isSystemServer)
             ALOGE("cannot set SELinux context: %s\n", strerror(errno));
             dvmAbort();
         }
+
+        /* Set the comm to a nicer name */
+        if (isSystemServer && !niceName) {
+            setThreadName("system_server");
+        }
+        else {
+            setThreadName(niceName);
+        }
         // These free(3) calls are safe because we know we're only ever forking
         // a single-threaded process, so we know no other thread held the heap
         // lock when we forked.
-- 
1.7.9.5


--
This message was distributed to subscribers of the seandroid-list mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe seandroid-list" without quotes as the message.

Reply via email to