Lines Matching +full:local +full:- +full:pid
2 # SPDX-License-Identifier: GPL-2.0
9 readonly KSFT_TEST="${MPTCP_LIB_KSFT_TEST:-$(basename "${0}" .sh)}"
11 # These variables are used in some selftests, read-only
12 declare -rx MPTCP_LIB_EVENT_CREATED=1 # MPTCP_EVENT_CREATED
13 declare -rx MPTCP_LIB_EVENT_ESTABLISHED=2 # MPTCP_EVENT_ESTABLISHED
14 declare -rx MPTCP_LIB_EVENT_CLOSED=3 # MPTCP_EVENT_CLOSED
15 declare -rx MPTCP_LIB_EVENT_ANNOUNCED=6 # MPTCP_EVENT_ANNOUNCED
16 declare -rx MPTCP_LIB_EVENT_REMOVED=7 # MPTCP_EVENT_REMOVED
17 declare -rx MPTCP_LIB_EVENT_SUB_ESTABLISHED=10 # MPTCP_EVENT_SUB_ESTABLISHED
18 declare -rx MPTCP_LIB_EVENT_SUB_CLOSED=11 # MPTCP_EVENT_SUB_CLOSED
19 declare -rx MPTCP_LIB_EVENT_SUB_PRIORITY=13 # MPTCP_EVENT_SUB_PRIORITY
20 declare -rx MPTCP_LIB_EVENT_LISTENER_CREATED=15 # MPTCP_EVENT_LISTENER_CREATED
21 declare -rx MPTCP_LIB_EVENT_LISTENER_CLOSED=16 # MPTCP_EVENT_LISTENER_CLOSED
23 declare -rx MPTCP_LIB_AF_INET=2
24 declare -rx MPTCP_LIB_AF_INET6=10
28 # only if supported (or forced) and not disabled, see no-color.org
29 if { [ -t 1 ] || [ "${SELFTESTS_MPTCP_LIB_COLOR_FORCE:-}" = "1" ]; } &&
30 [ "${NO_COLOR:-}" != "1" ]; then
46 echo -e "${MPTCP_LIB_START_PRINT:-}${*}${MPTCP_LIB_COLOR_RESET}"
69 [ "${SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES:-}" = "1" ]
84 local f="${1}"
86 if [ -f "${f}" ]; then
109 local sym="${1}"
113 grep -q " ${sym}" /proc/kallsyms
118 local sym="${1}"
129 local sym="${1}"
143 local exp_maj="${1%.*}"
144 local exp_min="${1#*.}"
145 local v maj min
148 if [ "${SELFTESTS_MPTCP_LIB_NO_KVERSION_CHECK:-}" = "1" ]; then
152 v=$(uname -r | cut -d'.' -f1,2)
156 if [ "${maj}" -gt "${exp_maj}" ] ||
157 { [ "${maj}" -eq "${exp_maj}" ] && [ "${min}" -ge "${exp_min}" ]; }; then
165 local result="${1}"
168 local id=$((${#MPTCP_LIB_SUBTESTS[@]} + 1))
170 MPTCP_LIB_SUBTESTS+=("${result} ${id} - ${KSFT_TEST}: ${*}")
190 local ret="${1}"
191 local name="${2}"
211 local subtest
213 if [ ${#MPTCP_LIB_SUBTESTS[@]} -eq 0 ] ||
214 [ "${SELFTESTS_MPTCP_LIB_NO_TAP:-}" = "1" ]; then
228 grep "${2}" | sed -n 's/.*\('"${1}"':\)\([0-9a-f:.]*\).*$/\2/p;q'
233 grep "${4:-}" "${2}" | mptcp_lib_get_info_value "${1}" "^type:${3:-1},"
236 # $1: PID
238 [ "${1}" -eq 0 ] && return 0
240 kill -SIGUSR1 "${1}" > /dev/null 2>&1
247 [ -z "${1##*:*}" ]
252 local ns="${1}"
253 local counter="${2}"
254 local count
256 count=$(ip netns exec "${ns}" nstat -asz "${counter}" |
258 if [ -z "${count}" ]; then
267 local ns="${1}"
268 local evts="${2}"
269 declare -n pid="${3}"
273 mptcp_lib_kill_wait "${pid:-0}"
275 pid=$!