The exit status of a killed command should be the signal number plus 128. So you can use the exit status to find out which signal killed you process.
I tested it like this on Linux in the shell:
print_exit_status_for_signal () {
(
sleep 1000
echo Exit staus $? = signal $(( $? - 128 ))
) &
sleep 1
killall "${1:+-$1}" sleep
}
print_exit_status_for_signal
print_exit_status_for_signal 15
print_exit_status_for_signal 9
print_exit_status_for_signal KILL
print_exit_status_for_signal TERM
EDIT: Note that a program can decide to exit with any¹ value (so you have to decide how far you trust the exit status to be the effect of a signal):
for i in $(seq 256); do
sh -c "exit $i"
echo Program exited with $?
done
Footnote 1: On my systems exit codes are represented as unsigned 8-bit numbers so they wrap at 256=0.
status
of the child process viawait(2)
or something.-a entry,always -F arch=b64 -S kill -k kill_signals