# getresuid __________________________________________________
# long sys_getresuid(uid_t __user *ruid,
#		uid_t __user *euid,
#		uid_t __user *suid)

@define _SYSCALL_GETRESUID_NAME
%(
	name = "getresuid"
%)

@define _SYSCALL_GETRESUID_ARGSTR
%(
	argstr = sprintf("%p, %p, %p", ruid_uaddr, euid_uaddr, suid_uaddr)
%)

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

# dw_getresuid _____________________________________________________

probe dw_syscall.getresuid = kernel.function("sys_getresuid16").call ?,
                          kernel.function("sys_getresuid").call
{
	@_SYSCALL_GETRESUID_NAME
	ruid_uaddr = @choose_defined($ruidp, $ruid)
	euid_uaddr = @choose_defined($euidp, $euid)
	suid_uaddr = @choose_defined($suidp, $suid)
	@_SYSCALL_GETRESUID_ARGSTR
}
probe dw_syscall.getresuid.return = kernel.function("sys_getresuid16").return ?,
                                 kernel.function("sys_getresuid").return
{
	@_SYSCALL_GETRESUID_NAME
	retstr = return_str(1, $return)
}

# nd_getresuid _____________________________________________________

probe nd_syscall.getresuid = kprobe.function("sys_getresuid16") ?,
                             kprobe.function("sys_getresuid") ?
{
	@_SYSCALL_GETRESUID_NAME
	asmlinkage()
	ruid_uaddr = pointer_arg(1)
	euid_uaddr = pointer_arg(2)
	suid_uaddr = pointer_arg(3)
	@_SYSCALL_GETRESUID_ARGSTR
}
probe nd_syscall.getresuid.return = kprobe.function("sys_getresuid16").return ?,
                                    kprobe.function("sys_getresuid").return ?
{
	@_SYSCALL_GETRESUID_NAME
	retstr = returnstr(1)
}
