killsnoop(8)
π NAME π
Okay bestie, meet killsnoop(8) from the System Manager's Manual π
. It traces signals sent with the kill() syscall, and it runs on Linux using eBPF/bcc β¨.
π¦ SYNOPSIS π¦
killsnoop [-h] [-x] [-p PID] [-T PID] [-s SIGNAL]
π DESCRIPTION π
So killsnoop watches the kill() syscall and shows you every signal that gets sent that way π. This is lowkey perfect when an app is failing and you have no clue what's sending it signals π.
It works by tracing the kernel sys_kill() function with dynamic tracing. Because of that, it'll need updating whenever that function changes π οΈ.
It uses a Linux 4.4 feature, bpf_perf_event_output(). If your kernel is older than 4.4, check out the version under tools/old, which uses an older mechanism πΈ.
Also, since this runs on BPF, only the root user can use this tool π₯. No cap.
π REQUIREMENTS π
You need CONFIG_BPF and bcc β¨.
β¨ OPTIONS β¨
-hβ Shows the usage message π.-xβ Only showskill()syscalls that failed π.-p PIDβ Only traces this process ID, the one sending the signal. It gets filtered in-kernel π§.-T PIDβ Only traces this target process ID, the one receiving the signal. It also gets filtered in-kernel π―.-s SIGNALβ Only traces this signal. It gets filtered in-kernel too π.
π«Ά EXAMPLES π«Ά
Trace all kill() syscalls:
# killsnoop
Trace only the kill() syscalls that failed:
# killsnoop -x
Trace PID 181 only:
# killsnoop -p 181
Trace target PID 189 only:
# killsnoop -T 189
Trace signal 9 only:
# killsnoop -s 9
π§ FIELDS π§
TIMEβ When the kill call happened β°.PIDβ The source process ID πͺͺ.COMMβ The source process name π.SIGβ The signal number. Check out signal(7) for the details π.TPIDβ The target process ID π―.RESβ The result.0means success. A negative value (the error code) means it failed π.
β³ OVERHEAD β³
This traces the kernel kill function and prints output for every event. The rate is usually expected to be low (< 100/s), so the overhead should be negligible π·. But if your app is calling kill() at a super high rate for some reason, test and understand the overhead before you use it π¬.
π SOURCE π
This comes from bcc π. Source: https://github.com/iovisor/bcc
Also look in the bcc distribution for a companion _examples.txt file. It has example usage, output, and commentary for this tool π.
π» OS π»
Linux π§.
π§ͺ STABILITY π§ͺ
Unstable, still in development π§.
π AUTHOR π
Brendan Gregg, the legend himself π.
π SEE ALSO π
opensnoop(8), funccount(8) π«Ά.
Okay that's the tea, bestie π π. This page is from the USER COMMANDS section and was last updated on 2015-08-20 πΈ. Stay iconic and keep tracing those signals π¦β¨.
π¦ where this page comes from
- alpine 3.24: bcc-doc 0.36.1-r1 Β· Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms