From: Martin Cermak Date: Fri, 23 Dec 2016 14:01:28 +0000 (+0100) Subject: PR20333/getdents X-Git-Tag: release-3.1~448 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=ef781f4501c818df24e28a98fbecc615bd54eb65;p=systemtap.git PR20333/getdents --- diff --git a/tapset/linux/nd_syscalls.stp b/tapset/linux/nd_syscalls.stp index 77f2ac6b7..8541cc8bb 100644 --- a/tapset/linux/nd_syscalls.stp +++ b/tapset/linux/nd_syscalls.stp @@ -1,31 +1,4 @@ -# getdents ___________________________________________________ -# long sys_getdents(unsigned int fd, struct linux_dirent __user * dirent, unsigned int count) -# long compat_sys_getdents(unsigned int fd, struct compat_linux_dirent __user *dirent, unsigned int count) -# long sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count) -# long compat_sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count) -# -probe nd_syscall.getdents = kprobe.function("sys_getdents") ?, - kprobe.function("sys_getdents64") ?, - kprobe.function("compat_sys_getdents") ?, - kprobe.function("compat_sys_getdents64") ? -{ - name = "getdents" - asmlinkage() - fd = int_arg(1) - dirp_uaddr = pointer_arg(2) - count = uint_arg(3) - argstr = sprintf("%d, %p, %d", fd, dirp_uaddr, count) -} -probe nd_syscall.getdents.return = kprobe.function("sys_getdents").return ?, - kprobe.function("sys_getdents64").return ?, - kprobe.function("compat_sys_getdents").return ?, - kprobe.function("compat_sys_getdents64").return ? -{ - name = "getdents" - retstr = returnstr(1) -} - # getegid ____________________________________________________ # long sys_getegid(void) # long sys_getegid16(void) diff --git a/tapset/linux/sysc_getdents.stp b/tapset/linux/sysc_getdents.stp new file mode 100644 index 000000000..ece948d14 --- /dev/null +++ b/tapset/linux/sysc_getdents.stp @@ -0,0 +1,64 @@ +# getdents ___________________________________________________ +# long sys_getdents(unsigned int fd, struct linux_dirent __user * dirent, unsigned int count) +# long compat_sys_getdents(unsigned int fd, struct compat_linux_dirent __user *dirent, unsigned int count) +# long sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count) +# long compat_sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count) +# + +@define _SYSCALL_GETDENTS_NAME +%( + name = "getdents" +%) + +@define _SYSCALL_GETDENTS_ARGSTR +%( + argstr = sprintf("%d, %p, %d", fd, dirp_uaddr, count) +%) + +probe syscall.getdents = dw_syscall.getdents !, nd_syscall.getdents {} +probe syscall.getdents.return = dw_syscall.getdents.return !, nd_syscall.getdents.return {} + +# dw_getdents _____________________________________________________ + +probe dw_syscall.getdents = kernel.function("sys_getdents").call ?, + kernel.function("sys_getdents64").call ?, + kernel.function("compat_sys_getdents").call ?, + kernel.function("compat_sys_getdents64").call ? +{ + @_SYSCALL_GETDENTS_NAME + fd = __int32($fd) + dirp_uaddr = $dirent + count = __uint32($count) + @_SYSCALL_GETDENTS_ARGSTR +} +probe dw_syscall.getdents.return = kernel.function("sys_getdents").return ?, + kernel.function("sys_getdents64").return ?, + kernel.function("compat_sys_getdents").return ?, + kernel.function("compat_sys_getdents64").return ? +{ + @_SYSCALL_GETDENTS_NAME + retstr = return_str(1, $return) +} + +# nd_getdents _____________________________________________________ + +probe nd_syscall.getdents = kprobe.function("sys_getdents") ?, + kprobe.function("sys_getdents64") ?, + kprobe.function("compat_sys_getdents") ?, + kprobe.function("compat_sys_getdents64") ? +{ + @_SYSCALL_GETDENTS_NAME + asmlinkage() + fd = int_arg(1) + dirp_uaddr = pointer_arg(2) + count = uint_arg(3) + @_SYSCALL_GETDENTS_ARGSTR +} +probe nd_syscall.getdents.return = kprobe.function("sys_getdents").return ?, + kprobe.function("sys_getdents64").return ?, + kprobe.function("compat_sys_getdents").return ?, + kprobe.function("compat_sys_getdents64").return ? +{ + @_SYSCALL_GETDENTS_NAME + retstr = returnstr(1) +} diff --git a/tapset/linux/syscalls.stp b/tapset/linux/syscalls.stp index 14ab2854b..ab39c08a9 100644 --- a/tapset/linux/syscalls.stp +++ b/tapset/linux/syscalls.stp @@ -1,30 +1,4 @@ -# getdents ___________________________________________________ -# long sys_getdents(unsigned int fd, struct linux_dirent __user * dirent, unsigned int count) -# long compat_sys_getdents(unsigned int fd, struct compat_linux_dirent __user *dirent, unsigned int count) -# long sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count) -# long compat_sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count) -# -probe syscall.getdents = kernel.function("sys_getdents").call ?, - kernel.function("sys_getdents64").call ?, - kernel.function("compat_sys_getdents").call ?, - kernel.function("compat_sys_getdents64").call ? -{ - name = "getdents" - fd = __int32($fd) - dirp_uaddr = $dirent - count = __uint32($count) - argstr = sprintf("%d, %p, %u", fd, $dirent, count) -} -probe syscall.getdents.return = kernel.function("sys_getdents").return ?, - kernel.function("sys_getdents64").return ?, - kernel.function("compat_sys_getdents").return ?, - kernel.function("compat_sys_getdents64").return ? -{ - name = "getdents" - retstr = return_str(1, $return) -} - # getegid ____________________________________________________ # long sys_getegid(void) # long sys_getegid16(void)