diff options
author | William Roberts <wroberts@tresys.com> | 2013-10-29 15:20:03 -0700 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2014-01-17 00:19:50 -0800 |
commit | 9e32e7e27c85d4a2e4781e24fe97c02d2d623ade (patch) | |
tree | 1a0c2e30c22cb6ea9a0d1273358ab9de2d6a9018 | |
parent | bc4a6ac49f0aee1e20797388e2ec4f3fd1a0c518 (diff) | |
download | android_dalvik-9e32e7e27c85d4a2e4781e24fe97c02d2d623ade.tar.gz android_dalvik-9e32e7e27c85d4a2e4781e24fe97c02d2d623ade.tar.bz2 android_dalvik-9e32e7e27c85d4a2e4781e24fe97c02d2d623ade.zip |
Set Processes comm name to package name
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
-rw-r--r-- | vm/native/dalvik_system_Zygote.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/vm/native/dalvik_system_Zygote.cpp b/vm/native/dalvik_system_Zygote.cpp index 1848bdda8..6c8a2f851 100644 --- a/vm/native/dalvik_system_Zygote.cpp +++ b/vm/native/dalvik_system_Zygote.cpp @@ -18,6 +18,7 @@ * dalvik.system.Zygote */ #include "Dalvik.h" +#include "Thread.h" #include "native/InternalNativePriv.h" #include <selinux/android.h> @@ -717,6 +718,13 @@ 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 == NULL) { + dvmSetThreadName("system_server"); + } else { + dvmSetThreadName(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. |