summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2018-12-11 16:28:07 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-12-11 16:28:07 +0000
commita36a69a9e68e4e4397f426089f6e8cb0fe5e6634 (patch)
treea3b487a0089e18e11007d9b92b417fc03275d406
parent15152e7d95e5a485f3d2f08d11167bf96120b6fe (diff)
parent2b71ad0a26a7d30e99b9583acd75decfe0d2e4f8 (diff)
Merge "Add persist.zygote.core_dump property for coredumps"
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 7a3f49a3efac..01105ba04be3 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -273,15 +273,17 @@ static void EnableDebugger() {
}
}
- // We don't want core dumps, though, so set the soft limit on core dump size
- // to 0 without changing the hard limit.
- rlimit rl;
- if (getrlimit(RLIMIT_CORE, &rl) == -1) {
- ALOGE("getrlimit(RLIMIT_CORE) failed");
- } else {
- rl.rlim_cur = 0;
- if (setrlimit(RLIMIT_CORE, &rl) == -1) {
- ALOGE("setrlimit(RLIMIT_CORE) failed");
+ // Set the core dump size to zero unless wanted (see also coredump_setup in build/envsetup.sh).
+ if (!GetBoolProperty("persist.zygote.core_dump", false)) {
+ // Set the soft limit on core dump size to 0 without changing the hard limit.
+ rlimit rl;
+ if (getrlimit(RLIMIT_CORE, &rl) == -1) {
+ ALOGE("getrlimit(RLIMIT_CORE) failed");
+ } else {
+ rl.rlim_cur = 0;
+ if (setrlimit(RLIMIT_CORE, &rl) == -1) {
+ ALOGE("setrlimit(RLIMIT_CORE) failed");
+ }
}
}
}