Created
October 29, 2020 01:27
-
-
Save tachang/9e7e8e4f6357fbbb5bce5dbe67704687 to your computer and use it in GitHub Desktop.
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
sigparse () { | |
i=0 | |
# bits="$(printf "16i 2o %X p" "0x$1" | dc)" # variant for busybox | |
bits="$(printf "ibase=16; obase=2; %X\n" "0x$1" | bc)" | |
while [ -n "$bits" ] ; do | |
i="$(expr "$i" + 1)" | |
case "$bits" in | |
*1) printf " %s(%s)" "$(kill -l "$i")" "$i" ;; | |
esac | |
bits="${bits%?}" | |
done | |
} | |
grep "^Sig...:" "/proc/$1/status" | while read a b ; do | |
printf "%s%s\n" "$a" "$(sigparse "$b")" | |
done # | fmt -t # uncomment for pretty-printing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment