| 1 |
#! /usr/bin/env stap |
| 2 |
|
| 3 |
# Copyright (C) 2006 IBM Corp. |
| 4 |
# |
| 5 |
# This file is part of systemtap, and is free software. You can |
| 6 |
# redistribute it and/or modify it under the terms of the GNU General |
| 7 |
# Public License (GPL); either version 2, or (at your option) any |
| 8 |
# later version. |
| 9 |
|
| 10 |
# |
| 11 |
# Track when a specific process ID receives a specific signal. For example, |
| 12 |
# when process ID 31994 receives a SIGKILL signal. |
| 13 |
# |
| 14 |
# Example command line: |
| 15 |
# |
| 16 |
# stap -x 31994 sigmon.stp SIGKILL |
| 17 |
# |
| 18 |
# Example output: |
| 19 |
# |
| 20 |
# SPID SNAME RPID RNAME SIGNUM SIGNAME |
| 21 |
# 5609 bash 31994 find 9 SIGKILL |
| 22 |
# |
| 23 |
|
| 24 |
probe begin |
| 25 |
{ |
| 26 |
printf("%-8s %-16s %-5s %-16s %6s %-16s\n", |
| 27 |
"SPID", "SNAME", "RPID", "RNAME", "SIGNUM", "SIGNAME") |
| 28 |
} |
| 29 |
|
| 30 |
probe signal.send |
| 31 |
{ |
| 32 |
if (sig_name == @1 && sig_pid == target()) |
| 33 |
printf("%-8d %-16s %-5d %-16s %-6d %-16s\n", |
| 34 |
pid(), execname(), sig_pid, pid_name, sig, sig_name) |
| 35 |
} |