# timerfd_create _____________________________________________
#
# SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)

@define _SYSCALL_TIMERFD_CREATE_NAME
%(
	name = "timerfd_create"
%)

@define _SYSCALL_TIMERFD_CREATE_ARGSTR
%(
	argstr = sprintf("%s, %s", clockid_str, flags_str)
%)

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

# dw_timerfd_create _____________________________________________________

probe dw_syscall.timerfd_create = kernel.function("sys_timerfd_create").call ?
{
	@_SYSCALL_TIMERFD_CREATE_NAME
	clockid = __int32($clockid)
	clockid_str = _get_wc_str(clockid)
	flags = __int32($flags)
	flags_str = _stp_timerfd_flags_str(flags)
	@_SYSCALL_TIMERFD_CREATE_ARGSTR
}
probe dw_syscall.timerfd_create.return =
	kernel.function("sys_timerfd_create").return ?
{
	@_SYSCALL_TIMERFD_CREATE_NAME
	retstr = return_str(1, $return)
}

# nd_timerfd_create _____________________________________________________

probe nd_syscall.timerfd_create = kprobe.function("sys_timerfd_create").call ?
{
	@_SYSCALL_TIMERFD_CREATE_NAME
	asmlinkage()
	clockid = int_arg(1)
	clockid_str = _get_wc_str(clockid)
	flags = int_arg(2)
	flags_str = _stp_timerfd_flags_str(flags)
	@_SYSCALL_TIMERFD_CREATE_ARGSTR
}
probe nd_syscall.timerfd_create.return =
	kprobe.function("sys_timerfd_create").return ?
{
	@_SYSCALL_TIMERFD_CREATE_NAME
	retstr = returnstr(1)
}
