From 72a6be961669d9f3dd32807dbb9b0c79f48362f5 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Mon, 29 Mar 2021 12:46:08 +0200 Subject: [PATCH] scripts: Get soft core ulimit from the template Signed-off-by: Michal Berger Change-Id: I6794886832ec641ec18b72621f21264970d805d5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7118 Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Reviewed-by: Karol Latecki --- autotest.sh | 2 +- scripts/core-collector.sh | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/autotest.sh b/autotest.sh index d8faef387..a2929325d 100755 --- a/autotest.sh +++ b/autotest.sh @@ -32,7 +32,7 @@ if [ $(uname -s) = Linux ]; then old_core_pattern=$(< /proc/sys/kernel/core_pattern) mkdir -p "$output_dir/coredumps" # set core_pattern to a known value to avoid ABRT, systemd-coredump, etc. - echo "|$rootdir/scripts/core-collector.sh %P %s %t $output_dir/coredumps" > /proc/sys/kernel/core_pattern + echo "|$rootdir/scripts/core-collector.sh %P %s %t %c $output_dir/coredumps" > /proc/sys/kernel/core_pattern echo 2 > /proc/sys/kernel/core_pipe_limit # make sure nbd (network block device) driver is loaded if it is available diff --git a/scripts/core-collector.sh b/scripts/core-collector.sh index 55125b12e..681ac8872 100755 --- a/scripts/core-collector.sh +++ b/scripts/core-collector.sh @@ -3,15 +3,7 @@ # can include whitespaces or other funny characters, and working # with those on the cmdline would be a nightmare. Use procfs for # the remaining pieces we want to gather: -# |$rootdir/scripts/core-collector.sh %P %s %t $output_dir - -get_rlimit() { - local limit - - while read -ra limit; do - [[ ${limit[1]} == core ]] && echo "${limit[4]}" # soft - done < "/proc/$core_pid/limits" -} +# |$rootdir/scripts/core-collector.sh %P %s %t %c $output_dir core_meta() { jq . <<- CORE @@ -38,6 +30,7 @@ stderr() { args+=(core_pid) args+=(core_sig) args+=(core_ts) +args+=(rlimit) args+=(output_dir) read -r "${args[@]}" <<< "$*" @@ -58,8 +51,7 @@ stderr # process to see if we need to make any adjustments. max_core=$((1024 * 1024 * 1024 * 2)) -rlimit=$(get_rlimit) -if [[ $rlimit == unlimited ]] || ((rlimit > max_core)); then +if ((rlimit == 0xffffffffffffffff || rlimit > max_core)); then rlimit=$max_core fi