]> git.ipfire.org Git - thirdparty/util-linux.git/blame - tests/ts/kill/kill_functions.sh
cleanup: Remove some spurious spaces
[thirdparty/util-linux.git] / tests / ts / kill / kill_functions.sh
CommitLineData
1e29f37d
SK
1# kill tests, or command, will not when /proc is missing.
2test -d /proc || ts_skip "/proc not available"
8d4d36e2 3
7a1c980c
KZ
4# The test_sigreceive is ready when signal process mask contains SIGHUP
5function check_test_sigreceive {
6 local rc=0
7 local pid=$1
8
9 for i in 0.01 0.1 1 1 1 1; do
1e29f37d
SK
10 if [ ! -f /proc/$pid/status ]; then
11 # The /proc exists, but not status file. Because the
12 # process already started it is unlikely the file would
13 # appear after any amount of waiting. Try to sleep for
14 # moment and hopefully test_sigreceive is ready to be
15 # killed.
16 echo "kill_functions.sh: /proc/$pid/status: No such file or directory"
17 sleep 2
18 rc=1
19 break
20 fi
21 sigmask=$((16#$( awk '/SigCgt/ { print $2}' /proc/$pid/status) ))
22 if [ $(( $sigmask & 1 )) == 1 ]; then
23 rc=1
7a1c980c 24 break
1e29f37d 25 fi
7a1c980c
KZ
26 sleep $i
27 done
28 return $rc
2bb3aa36 29}