summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-10-29 15:02:53 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-10-29 15:02:53 -0400
commit8e312e8160ef0cae569b6127591ee72c70bfda41 (patch)
treeeb4d0c6cf04ee6c62b6e7f92cffbcbab751df7da /core
parentb575e4dffe123dc7c8c579dc9cf6130eae6a4abe (diff)
parenta5109a878eeff22e32ee5ce1b1cd15e8daad5234 (diff)
downloadframeworks_base-8e312e8160ef0cae569b6127591ee72c70bfda41.zip
frameworks_base-8e312e8160ef0cae569b6127591ee72c70bfda41.tar.gz
frameworks_base-8e312e8160ef0cae569b6127591ee72c70bfda41.tar.bz2
Merge change Ia5109a87 into eclair
* changes: process: Add debug code to log process group transitions
Diffstat (limited to 'core')
-rw-r--r--core/jni/android_util_Process.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index 5b6c7ea..7c627c1 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -51,6 +51,8 @@ pid_t gettid() { return syscall(__NR_gettid);}
#undef __KERNEL__
#endif
+#define POLICY_DEBUG 1
+
using namespace android;
static void signalExceptionForPriorityError(JNIEnv* env, jobject obj, int err)
@@ -212,6 +214,26 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin
return;
}
+#if POLICY_DEBUG
+ char cmdline[32];
+ int fd;
+
+ strcpy(cmdline, "unknown");
+
+ sprintf(proc_path, "/proc/%d/cmdline", pid);
+ fd = open(proc_path, O_RDONLY);
+ if (fd >= 0) {
+ int rc = read(fd, cmdline, sizeof(cmdline)-1);
+ cmdline[rc] = 0;
+ close(fd);
+ }
+
+ if (grp == ANDROID_TGROUP_BG_NONINTERACT) {
+ LOGD("setProcessGroup: vvv pid %d (%s)", pid, cmdline);
+ } else {
+ LOGD("setProcessGroup: ^^^ pid %d (%s)", pid, cmdline);
+ }
+#endif
sprintf(proc_path, "/proc/%d/task", pid);
if (!(d = opendir(proc_path))) {
// If the process exited on us, don't generate an exception