# getpgid ____________________________________________________
# long sys_getpgid(pid_t pid)

@define _SYSCALL_GETPGID_NAME
%(
	name = "getpgid"
%)

@define _SYSCALL_GETPGID_ARGSTR
%(
	argstr = sprintf("%d", pid)
%)

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

# dw_getpgid _____________________________________________________

probe dw_syscall.getpgid = kernel.function("sys_getpgid").call
{
	@__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid"))
	@_SYSCALL_GETPGID_NAME
	pid = __int32($pid)
	@_SYSCALL_GETPGID_ARGSTR
}
probe dw_syscall.getpgid.return = kernel.function("sys_getpgid").return
{
	@__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid"))
	@_SYSCALL_GETPGID_NAME
	retstr = return_str(1, $return)
}

# nd_getpgid _____________________________________________________

probe nd_syscall.getpgid = kprobe.function("sys_getpgid") ?
{
	@__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid"))
	@_SYSCALL_GETPGID_NAME
	asmlinkage()
	pid = int_arg(1)
	@_SYSCALL_GETPGID_ARGSTR
}
probe nd_syscall.getpgid.return = kprobe.function("sys_getpgid").return ?
{
	@__syscall_compat_gate(@const("__NR_getpgid"), @const("__NR_compat_getpgid"))
	@_SYSCALL_GETPGID_NAME
	retstr = returnstr(1)
}
