# times ______________________________________________________
#
# long sys_times(struct tms __user * tbuf)
# long compat_sys_times(struct compat_tms __user *tbuf)

@define _SYSCALL_TIMES_NAME
%(
	name = "times"
%)

@define _SYSCALL_TIMES_ARGSTR
%(
	argstr = sprintf("%s", buf_str)
%)

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

# dw_times _____________________________________________________

probe dw_syscall.times = kernel.function("compat_sys_times").call ?,
                      kernel.function("sys_times").call ?
{
	@_SYSCALL_TIMES_NAME
	buf_uaddr = @__pointer($tbuf)
	buf_str = _struct_tms_u(buf_uaddr)
	@_SYSCALL_TIMES_ARGSTR
}
probe dw_syscall.times.return = kernel.function("compat_sys_times").return ?,
                             kernel.function("sys_times").return ?
{
	@_SYSCALL_TIMES_NAME
	retstr = return_str(1, $return)
}

# nd_times _____________________________________________________

probe nd_syscall.times = kprobe.function("compat_sys_times") ?,
                         kprobe.function("sys_times") ?
{
	@_SYSCALL_TIMES_NAME
	asmlinkage()
	buf_uaddr = pointer_arg(1)
	buf_str = _struct_tms_u(buf_uaddr)
	@_SYSCALL_TIMES_ARGSTR
}
probe nd_syscall.times.return = kprobe.function("compat_sys_times").return ?,
                                kprobe.function("sys_times").return ?
{
	@_SYSCALL_TIMES_NAME
	retstr = returnstr(1)
}
