Loading core/jni/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -185,7 +185,6 @@ cc_library_shared { "android/opengl/poly_clip.cpp", // TODO: .arm "android/opengl/util.cpp", "android_server_NetworkManagementSocketTagger.cpp", "android_server_Watchdog.cpp", "android_ddm_DdmHandleNativeHeap.cpp", "android_backup_BackupDataInput.cpp", "android_backup_BackupDataOutput.cpp", Loading core/jni/android_server_Watchdog.cppdeleted 100644 → 0 +0 −112 Original line number Diff line number Diff line /* ** Copyright 2010, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #define LOG_TAG "Watchdog_N" #include <utils/Log.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <dirent.h> #include <string.h> #include <errno.h> #include "jni.h" #include <nativehelper/JNIHelp.h> #include "core_jni_helpers.h" static void dumpOneStack(int tid, int outFd) { char buf[64]; snprintf(buf, sizeof(buf), "/proc/%d/stack", tid); int stackFd = open(buf, O_RDONLY); if (stackFd >= 0) { // header for readability strncat(buf, ":\n", sizeof(buf) - strlen(buf) - 1); write(outFd, buf, strlen(buf)); // copy the stack dump text int nBytes; while ((nBytes = read(stackFd, buf, sizeof(buf))) > 0) { write(outFd, buf, nBytes); } // footer and done write(outFd, "\n", 1); close(stackFd); } else { ALOGE("Unable to open stack of tid %d : %d (%s)", tid, errno, strerror(errno)); } } static void dumpKernelStacks(JNIEnv* env, jobject clazz, jstring pathStr) { char buf[128]; DIR* taskdir; ALOGI("dumpKernelStacks"); if (!pathStr) { jniThrowException(env, "java/lang/IllegalArgumentException", "Null path"); return; } const char *path = env->GetStringUTFChars(pathStr, NULL); int outFd = open(path, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); if (outFd < 0) { ALOGE("Unable to open stack dump file: %d (%s)", errno, strerror(errno)); goto done; } snprintf(buf, sizeof(buf), "\n----- begin pid %d kernel stacks -----\n", getpid()); write(outFd, buf, strlen(buf)); // look up the list of all threads in this process snprintf(buf, sizeof(buf), "/proc/%d/task", getpid()); taskdir = opendir(buf); if (taskdir != NULL) { struct dirent * ent; while ((ent = readdir(taskdir)) != NULL) { int tid = atoi(ent->d_name); if (tid > 0 && tid <= 65535) { // dump each stack trace dumpOneStack(tid, outFd); } } closedir(taskdir); } snprintf(buf, sizeof(buf), "----- end pid %d kernel stacks -----\n", getpid()); write(outFd, buf, strlen(buf)); close(outFd); done: env->ReleaseStringUTFChars(pathStr, path); } // ---------------------------------------- namespace android { static const JNINativeMethod g_methods[] = { { "native_dumpKernelStacks", "(Ljava/lang/String;)V", (void*)dumpKernelStacks }, }; int register_android_server_Watchdog(JNIEnv* env) { return RegisterMethodsOrDie(env, "com/android/server/Watchdog", g_methods, NELEM(g_methods)); } } services/core/java/com/android/server/Watchdog.java +0 −20 Original line number Diff line number Diff line Loading @@ -60,9 +60,6 @@ public class Watchdog extends Thread { // Set this to true to use debug default values. static final boolean DB = false; // Set this to true to have the watchdog record kernel thread stacks when it fires static final boolean RECORD_KERNEL_THREADS = true; // Note 1: Do not lower this value below thirty seconds without tightening the invoke-with // timeout in com.android.internal.os.ZygoteConnection, or wrapped applications // can trigger the watchdog. Loading Loading @@ -509,11 +506,6 @@ public class Watchdog extends Thread { // The system's been hanging for a minute, another second or two won't hurt much. SystemClock.sleep(2000); // Pull our own kernel thread stacks as well if we're configured for that if (RECORD_KERNEL_THREADS) { dumpKernelStackTraces(); } // Trigger the kernel to dump all blocked threads, and backtraces on all CPUs to the kernel log doSysRq('w'); doSysRq('l'); Loading Loading @@ -591,18 +583,6 @@ public class Watchdog extends Thread { } } private File dumpKernelStackTraces() { String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null); if (tracesPath == null || tracesPath.length() == 0) { return null; } native_dumpKernelStacks(tracesPath); return new File(tracesPath); } private native void native_dumpKernelStacks(String tracesPath); public static final class OpenFdMonitor { /** * Number of FDs below the soft limit that we trigger a runtime restart at. This was Loading services/core/jni/onload.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,6 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */) register_android_server_tv_TvUinputBridge(env); register_android_server_tv_TvInputHal(env); register_android_server_PersistentDataBlockService(env); register_android_server_Watchdog(env); register_android_server_HardwarePropertiesManagerService(env); register_android_server_storage_AppFuse(env); register_android_server_SyntheticPasswordManager(env); Loading Loading
core/jni/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -185,7 +185,6 @@ cc_library_shared { "android/opengl/poly_clip.cpp", // TODO: .arm "android/opengl/util.cpp", "android_server_NetworkManagementSocketTagger.cpp", "android_server_Watchdog.cpp", "android_ddm_DdmHandleNativeHeap.cpp", "android_backup_BackupDataInput.cpp", "android_backup_BackupDataOutput.cpp", Loading
core/jni/android_server_Watchdog.cppdeleted 100644 → 0 +0 −112 Original line number Diff line number Diff line /* ** Copyright 2010, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #define LOG_TAG "Watchdog_N" #include <utils/Log.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <dirent.h> #include <string.h> #include <errno.h> #include "jni.h" #include <nativehelper/JNIHelp.h> #include "core_jni_helpers.h" static void dumpOneStack(int tid, int outFd) { char buf[64]; snprintf(buf, sizeof(buf), "/proc/%d/stack", tid); int stackFd = open(buf, O_RDONLY); if (stackFd >= 0) { // header for readability strncat(buf, ":\n", sizeof(buf) - strlen(buf) - 1); write(outFd, buf, strlen(buf)); // copy the stack dump text int nBytes; while ((nBytes = read(stackFd, buf, sizeof(buf))) > 0) { write(outFd, buf, nBytes); } // footer and done write(outFd, "\n", 1); close(stackFd); } else { ALOGE("Unable to open stack of tid %d : %d (%s)", tid, errno, strerror(errno)); } } static void dumpKernelStacks(JNIEnv* env, jobject clazz, jstring pathStr) { char buf[128]; DIR* taskdir; ALOGI("dumpKernelStacks"); if (!pathStr) { jniThrowException(env, "java/lang/IllegalArgumentException", "Null path"); return; } const char *path = env->GetStringUTFChars(pathStr, NULL); int outFd = open(path, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); if (outFd < 0) { ALOGE("Unable to open stack dump file: %d (%s)", errno, strerror(errno)); goto done; } snprintf(buf, sizeof(buf), "\n----- begin pid %d kernel stacks -----\n", getpid()); write(outFd, buf, strlen(buf)); // look up the list of all threads in this process snprintf(buf, sizeof(buf), "/proc/%d/task", getpid()); taskdir = opendir(buf); if (taskdir != NULL) { struct dirent * ent; while ((ent = readdir(taskdir)) != NULL) { int tid = atoi(ent->d_name); if (tid > 0 && tid <= 65535) { // dump each stack trace dumpOneStack(tid, outFd); } } closedir(taskdir); } snprintf(buf, sizeof(buf), "----- end pid %d kernel stacks -----\n", getpid()); write(outFd, buf, strlen(buf)); close(outFd); done: env->ReleaseStringUTFChars(pathStr, path); } // ---------------------------------------- namespace android { static const JNINativeMethod g_methods[] = { { "native_dumpKernelStacks", "(Ljava/lang/String;)V", (void*)dumpKernelStacks }, }; int register_android_server_Watchdog(JNIEnv* env) { return RegisterMethodsOrDie(env, "com/android/server/Watchdog", g_methods, NELEM(g_methods)); } }
services/core/java/com/android/server/Watchdog.java +0 −20 Original line number Diff line number Diff line Loading @@ -60,9 +60,6 @@ public class Watchdog extends Thread { // Set this to true to use debug default values. static final boolean DB = false; // Set this to true to have the watchdog record kernel thread stacks when it fires static final boolean RECORD_KERNEL_THREADS = true; // Note 1: Do not lower this value below thirty seconds without tightening the invoke-with // timeout in com.android.internal.os.ZygoteConnection, or wrapped applications // can trigger the watchdog. Loading Loading @@ -509,11 +506,6 @@ public class Watchdog extends Thread { // The system's been hanging for a minute, another second or two won't hurt much. SystemClock.sleep(2000); // Pull our own kernel thread stacks as well if we're configured for that if (RECORD_KERNEL_THREADS) { dumpKernelStackTraces(); } // Trigger the kernel to dump all blocked threads, and backtraces on all CPUs to the kernel log doSysRq('w'); doSysRq('l'); Loading Loading @@ -591,18 +583,6 @@ public class Watchdog extends Thread { } } private File dumpKernelStackTraces() { String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null); if (tracesPath == null || tracesPath.length() == 0) { return null; } native_dumpKernelStacks(tracesPath); return new File(tracesPath); } private native void native_dumpKernelStacks(String tracesPath); public static final class OpenFdMonitor { /** * Number of FDs below the soft limit that we trigger a runtime restart at. This was Loading
services/core/jni/onload.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,6 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */) register_android_server_tv_TvUinputBridge(env); register_android_server_tv_TvInputHal(env); register_android_server_PersistentDataBlockService(env); register_android_server_Watchdog(env); register_android_server_HardwarePropertiesManagerService(env); register_android_server_storage_AppFuse(env); register_android_server_SyntheticPasswordManager(env); Loading