xref: /freebsd/cddl/usr.sbin/dwatch/libexec/kill (revision 5bf5ca772c6de2d53344a78cf461447cc322ccea)
1# -*- tab-width: 4 -*- ;; Emacs
2# vi: set filetype=sh tabstop=8 shiftwidth=8 noexpandtab :: Vi/ViM
3############################################################ IDENT(1)
4#
5# $Title: dwatch(8) module for kill(2) [or similar] entry $
6# $Copyright: 2014-2018 Devin Teske. All rights reserved. $
7# $FreeBSD$
8#
9############################################################ DESCRIPTION
10#
11# Print arguments being passed to kill(2) [or similar]
12#
13############################################################ PROBE
14
15: ${PROBE:=syscall::$PROFILE:entry}
16
17############################################################ ACTIONS
18
19exec 9<<EOF
20this int	sig;
21this pid_t	pid;
22
23$PROBE /* probe ID $ID */
24{${TRACE:+
25	printf("<$ID>");}
26	this->pid = (pid_t)arg0;
27	this->sig = (int)arg1;
28}
29EOF
30ACTIONS=$( cat <&9 )
31ID=$(( $ID + 1 ))
32
33############################################################ EVENT DETAILS
34
35exec 9<<EOF
36	/*
37	 * Print signal/pid details
38	 */
39	printf("signal %i to pid %d", this->sig, this->pid);
40EOF
41EVENT_DETAILS=$( cat <&9 )
42
43################################################################################
44# END
45################################################################################
46