scripts: Get soft core ulimit from the template

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I6794886832ec641ec18b72621f21264970d805d5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7118
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
This commit is contained in:
Michal Berger 2021-03-29 12:46:08 +02:00 committed by Tomasz Zawadzki
parent 0a3a9f4285
commit 5247e10a06
2 changed files with 4 additions and 12 deletions

View File

@ -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

View File

@ -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