summaryrefslogblamecommitdiffstats
path: root/tests/ts/kill/kill_functions.sh
blob: 73fff053d48a8cd0081e0276c4bccc4016982804 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
 


                                                       





                                                                       
                                        













                                                                 

# unfortunately we are using gawk features
type gawk >/dev/null 2>&1 || ts_skip "cannot find gawk"

# The test_sigreceive is ready when signal process mask contains SIGHUP
function check_test_sigreceive {
	local rc=0
	local pid=$1

	for i in 0.01 0.1 1 1 1 1; do
		gawk 'BEGIN { retval=1 }
		/^SigCgt/ {
			lbyte = strtonum("0x" substr($2, 16, 16))
			if (and(lbyte, 1)) {
				retval=0
			}
		} END {
			exit retval
		}' /proc/$pid/status &&
			rc=1 &&
			break
		sleep $i
	done
	return $rc
}