Skip to content

Instantly share code, notes, and snippets.

@jhunt
Created September 30, 2015 00:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhunt/594b265f491799818173 to your computer and use it in GitHub Desktop.
Save jhunt/594b265f491799818173 to your computer and use it in GitHub Desktop.
Decoding Sig* fields from /proc/<PID>/status
#!/usr/bin/perl
@sigs = qw(
SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP
SIGABRT SIGBUS SIGFPE SIGKILL SIGUSR1
SIGSEGV SIGUSR2 SIGPIPE SIGALRM SIGTERM
SIGSTKFLT SIGCHLD SIGCONT SIGSTOP SIGTSTP
SIGTTIN SIGTTOU SIGURG SIGXCPU SIGXFSZ
SIGVTALRM SIGPROF SIGWINCH SIGIO SIGPWR
SIGSYS
);
for (map hex, @ARGV) {
printf "%x:\n", $_;
for (my $i = 0; $i < @sigs; $i++) {
next if $_ & (1 << $i);
printf " - %s (%i)\n", $sigs[$i], $i+1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment