# io_submit __________________________________________________
# long compat_sys_io_submit(aio_context_t ctx_id, int nr, u32 __user *iocb)
# long sys_io_submit(aio_context_t ctx_id, long nr, struct iocb __user * __user *iocbpp)
#

@define _SYSCALL_IO_SUBMIT_NAME
%(
	name = "io_submit"
%)

@define _SYSCALL_IO_SUBMIT_ARGSTR
%(
	argstr = sprintf("%u, %d, %p", ctx_id, nr, iocbpp_uaddr)
%)

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

# dw_io_submit _____________________________________________________

probe dw_syscall.io_submit = __syscall.io_submit,
	kernel.function("compat_sys_io_submit").call ?
{
	@_SYSCALL_IO_SUBMIT_NAME
	ctx_id = @__compat_ulong($ctx_id)
	nr = @__compat_long($nr)
	iocbpp_uaddr = @choose_defined($iocbpp, $iocb)
	@_SYSCALL_IO_SUBMIT_ARGSTR
}
probe __syscall.io_submit = kernel.function("sys_io_submit").call
{
	@__syscall_gate(@const("__NR_io_submit"))
}
probe dw_syscall.io_submit.return = __syscall.io_submit.return,
	kernel.function("compat_sys_io_submit").return ?
{
	@_SYSCALL_IO_SUBMIT_NAME
	retstr = return_str(1, $return)
}
probe __syscall.io_submit.return = kernel.function("sys_io_submit").return
{
	@__syscall_gate(@const("__NR_io_submit"))
}

# nd_io_submit _____________________________________________________

probe nd_syscall.io_submit = __nd_syscall.io_submit,
	kprobe.function("compat_sys_io_submit") ?
{
	@_SYSCALL_IO_SUBMIT_NAME
	asmlinkage()
	ctx_id = ulong_arg(1)
	nr = long_arg(2)
	iocbpp_uaddr = pointer_arg(3)
	@_SYSCALL_IO_SUBMIT_ARGSTR
}
probe __nd_syscall.io_submit = kprobe.function("sys_io_submit") ?
{
	@__syscall_gate(@const("__NR_io_submit"))
}
probe nd_syscall.io_submit.return = __nd_syscall.io_submit.return,
	kprobe.function("compat_sys_io_submit").return ?
{
	@_SYSCALL_IO_SUBMIT_NAME
	retstr = returnstr(1)
}
probe __nd_syscall.io_submit.return = kprobe.function("sys_io_submit").return ?
{
	@__syscall_gate(@const("__NR_io_submit"))
}
