# msync ______________________________________________________
# long sys_msync(unsigned long start, size_t len, int flags)

@define _SYSCALL_MSYNC_NAME
%(
	name = "msync"
%)

@define _SYSCALL_MSYNC_ARGSTR
%(
	argstr = sprintf("%p, %u, %s", start, length, flags_str)
%)

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

# dw_msync _____________________________________________________

probe dw_syscall.msync = kernel.function("sys_msync").call ?
{
	@_SYSCALL_MSYNC_NAME
	start = $start
	length = __ulong($len)
	flags = __int32($flags)
	flags_str = _msync_flag_str(flags)
	@_SYSCALL_MSYNC_ARGSTR
}
probe dw_syscall.msync.return = kernel.function("sys_msync").return ?
{
	@_SYSCALL_MSYNC_NAME
	retstr = return_str(1, $return)
}

# nd_msync _____________________________________________________

probe nd_syscall.msync = kprobe.function("sys_msync") ?
{
	@_SYSCALL_MSYNC_NAME
	asmlinkage()
	start = ulong_arg(1)
	length = ulong_arg(2)
	flags = int_arg(3)
	flags_str = _msync_flag_str(flags)
	@_SYSCALL_MSYNC_ARGSTR
}
probe nd_syscall.msync.return = kprobe.function("sys_msync").return ?
{
	@_SYSCALL_MSYNC_NAME
	retstr = returnstr(1)
}
