Last active
August 29, 2015 14:11
-
-
Save akash0x53/23f1218f163c9d2c4280 to your computer and use it in GitHub Desktop.
check processes for futex_wait
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TRUE=0 | |
FALSE=1 | |
held_futex(){ | |
tot=`ps -eo "%p %u %a"|awk '{ print ($2=="user") ? $0: ""}'|grep -c -i '[p]rocess'` | |
i=0 | |
for pid in `ps -eo "%p %u %a"|awk '{ print ($2=="user") ? $0: ""}'|grep -i '[p]rocess'|awk '{ print $1 }'` | |
do | |
cnt=`cat /proc/${pid}/wchan|grep -c -i 'futex_wait_'` | |
if [ $cnt -gt 0 ];then | |
i=$((i+=1)) | |
fi | |
done | |
[ $i -eq $tot ] && return $TRUE || return $FALSE | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment