#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # # NAME # failcmd.sh - run a command with injecting slab/page allocation failures # # SYNOPSIS # failcmd.sh --help # failcmd.sh [<options>] command [arguments] # # DESCRIPTION # Run command with injecting slab/page allocation failures by fault # injection. # # NOTE: you need to run this script as root. #
OPTIONS
-p percent
--probability=percent
likelihood of failure injection, in percent.
Default value is 1
-t value
--times=value
specifies how many times failures may happen at most.
Default value is 1
--oom-kill-allocating-task=value
set /proc/sys/vm/oom_kill_allocating_task to specified value
before running the command.
Default value is 1
-h, --help
Display a usage message and exit
--interval=value, --space=value, --verbose=value, --task-filter=value,
--stacktrace-depth=value, --require-start=value, --require-end=value,
--reject-start=value, --reject-end=value, --ignore-gfp-wait=value
See Documentation/fault-injection/fault-injection.rst for more
information
If FAILCMD_TYPE is not defined, then failslab is used.
EOF
}
exit_if_not_hex() {
local value="$1" if ! [[ $value =~ ^0x[0-9a-fA-F]+$ ]]; then echo"Error: The provided value '$value' is not a valid hexadecimal number." >&2
exit 1 fi
}
if [ $UID != 0 ]; then echo must be run as root >&2
exit 1 fi
if [ $FAILCMD_TYPE = failslab ]; then
LONGOPTS=$LONGOPTS,ignore-gfp-wait:,cache-filter: elif [ $FAILCMD_TYPE = fail_page_alloc ]; then
LONGOPTS=$LONGOPTS,ignore-gfp-wait:,ignore-gfp-highmem:,min-order: fi
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.