# tgkill _____________________________________________________
#
# asmlinkage long
# sys_tgkill(int tgid,
#            int pid,
#            int sig)
#

@define _SYSCALL_TGKILL_NAME
%(
	name = "tgkill"
%)

@define _SYSCALL_TGKILL_ARGSTR
%(
	argstr = sprintf("%d, %d, %s", tgid, pid, sig_str)
%)

probe syscall.tgkill = dw_syscall.tgkill !, nd_syscall.tgkill ? {}
probe syscall.tgkill.return = dw_syscall.tgkill.return !,
                              nd_syscall.tgkill.return ? {}

# dw_tgkill _____________________________________________________

probe dw_syscall.tgkill = kernel.function("sys_tgkill").call
{
	@_SYSCALL_TGKILL_NAME
	tgid = __int32($tgid)
	pid = __int32($pid)
	sig = __int32($sig)
	sig_str = _signal_name(sig)
	@_SYSCALL_TGKILL_ARGSTR
}
probe dw_syscall.tgkill.return = kernel.function("sys_tgkill").return
{
	@_SYSCALL_TGKILL_NAME
	retstr = return_str(1, $return)
}

# nd_tgkill _____________________________________________________

probe nd_syscall.tgkill = kprobe.function("sys_tgkill") ?
{
	@_SYSCALL_TGKILL_NAME
	asmlinkage()
	tgid = int_arg(1)
	pid = int_arg(2)
	sig = int_arg(3)
	sig_str = _signal_name(sig)
	@_SYSCALL_TGKILL_ARGSTR
}
probe nd_syscall.tgkill.return = kprobe.function("sys_tgkill").return ?
{
	@_SYSCALL_TGKILL_NAME
	retstr = returnstr(1)
}
