Advertisement
Guest User

Untitled

a guest
Apr 4th, 2015
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.57 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. # use as: $0 <PID>
  4.  
  5. use warnings;
  6. use strict;
  7. use bignum;
  8. use Config;
  9.  
  10. defined $Config{sig_name} or die "Cannot find signal names in Config";
  11. my @sigs = map { "SIG$_" } split(/ /, $Config{sig_name});  
  12.  
  13. my $statfile = "/proc/$ARGV[0]/status";
  14.  
  15. open(S, "<", $statfile) or die "Cannot open status file $statfile";
  16.  
  17. while(<S>) {
  18.   chomp;
  19.   if (/^Sig(Blk|Ign|Cgt):\s+(\S+)/) {
  20.     if (my @list = grep { oct("0x$2") & (1 << ($_ - 1)) } (1..64) ) {
  21.       print "$1: " . join(", ", map { "$sigs[$_] ($_)" } @list) . "\n";
  22.     }
  23.   }
  24. }
  25.  
  26. close(S);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement