xref: /freebsd/cddl/usr.sbin/dwatch/libexec/kill (revision 06c3fb27)
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#
8############################################################ DESCRIPTION
9#
10# Print arguments being passed to kill(2) [or similar]
11#
12############################################################ PROBE
13
14: ${PROBE:=syscall::$PROFILE:entry}
15
16############################################################ ACTIONS
17
18exec 9<<EOF
19this int	sig;
20this pid_t	pid;
21
22$PROBE /* probe ID $ID */
23{${TRACE:+
24	printf("<$ID>");}
25	this->pid = (pid_t)arg0;
26	this->sig = (int)arg1;
27}
28EOF
29ACTIONS=$( cat <&9 )
30ID=$(( $ID + 1 ))
31
32############################################################ EVENT DETAILS
33
34if [ ! "$CUSTOM_DETAILS" ]; then
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 )
42fi
43
44################################################################################
45# END
46################################################################################
47