Debian Codegraph @

tapset/linux/sysc_ioprio_get.stp

raw
1 # ioprio_get _________________________________________________
2 # long sys_ioprio_get(int which, int who)
3 #
4
5 @define _SYSCALL_IOPRIO_GET_NAME
6 %(
7 name = "ioprio_get"
8 %)
9
10 @define _SYSCALL_IOPRIO_GET_ARGSTR
11 %(
12 argstr = sprintf("%s, %d", which_str, who)
13 %)
14
15 @define _SYSCALL_IOPRIO_GET_REGARGS
16 %(
17 which = int_arg(1)
18 which_str = _stp_ioprio_which_str(which)
19 who = int_arg(2)
20 %)
21
22 @define _SYSCALL_IOPRIO_GET_REGARGS_STORE
23 %(
24 if (@probewrite(which))
25 set_int_arg(1, which)
26
27 if (@probewrite(who))
28 set_int_arg(2, who)
29 %)
30
31 probe syscall.ioprio_get = dw_syscall.ioprio_get !, nd_syscall.ioprio_get ? {}
32 probe syscall.ioprio_get.return = dw_syscall.ioprio_get.return !,
33 nd_syscall.ioprio_get.return ? {}
34
35 # dw_ioprio_get _____________________________________________________
36
37 probe dw_syscall.ioprio_get = kernel.function("sys_ioprio_get").call ?
38 {
39 @_SYSCALL_IOPRIO_GET_NAME
40 which = __int32($which)
41 which_str = _stp_ioprio_which_str(__int32($which))
42 who = __int32($who)
43 @_SYSCALL_IOPRIO_GET_ARGSTR
44 }
45 probe dw_syscall.ioprio_get.return = kernel.function("sys_ioprio_get").return ?
46 {
47 @_SYSCALL_IOPRIO_GET_NAME
48 @SYSC_RETVALSTR($return)
49 }
50
51 # nd_ioprio_get _____________________________________________________
52
53 probe nd_syscall.ioprio_get = nd1_syscall.ioprio_get!, nd2_syscall.ioprio_get!, tp_syscall.ioprio_get
54 { }
55
56 probe nd1_syscall.ioprio_get = kprobe.function("sys_ioprio_get") ?
57 {
58 @_SYSCALL_IOPRIO_GET_NAME
59 asmlinkage()
60 @_SYSCALL_IOPRIO_GET_REGARGS
61 @_SYSCALL_IOPRIO_GET_ARGSTR
62 }
63
64 /* kernel 4.17+ */
65 probe nd2_syscall.ioprio_get = kprobe.function(@arch_syscall_prefix "sys_ioprio_get") ?
66 {
67 __set_syscall_pt_regs(pointer_arg(1))
68 @_SYSCALL_IOPRIO_GET_NAME
69 @_SYSCALL_IOPRIO_GET_REGARGS
70 @_SYSCALL_IOPRIO_GET_ARGSTR
71 },
72 {
73 %( @_IS_SREG_KERNEL %? @_SYSCALL_IOPRIO_GET_REGARGS_STORE %)
74 }
75
76 /* kernel 3.5+, but undesirable because it affects all syscalls */
77 probe tp_syscall.ioprio_get = kernel.trace("sys_enter")
78 {
79 __set_syscall_pt_regs($regs)
80 @__syscall_compat_gate(@const("__NR_ioprio_get"), @const("__NR_compat_ioprio_get"))
81 @_SYSCALL_IOPRIO_GET_NAME
82 @_SYSCALL_IOPRIO_GET_REGARGS
83 @_SYSCALL_IOPRIO_GET_ARGSTR
84 },
85 {
86 %( @_IS_SREG_KERNEL %? @_SYSCALL_IOPRIO_GET_REGARGS_STORE %)
87 }
88
89 probe nd_syscall.ioprio_get.return = nd1_syscall.ioprio_get.return!, nd2_syscall.ioprio_get.return!, tp_syscall.ioprio_get.return
90 { }
91
92 probe nd1_syscall.ioprio_get.return = kprobe.function("sys_ioprio_get").return ?
93 {
94 @_SYSCALL_IOPRIO_GET_NAME
95 @SYSC_RETVALSTR(returnval())
96 }
97
98 /* kernel 4.17+ */
99 probe nd2_syscall.ioprio_get.return = kprobe.function(@arch_syscall_prefix "sys_ioprio_get").return ?
100 {
101 @_SYSCALL_IOPRIO_GET_NAME
102 @SYSC_RETVALSTR(returnval())
103 }
104
105 /* kernel 3.5+, but undesirable because it affects all syscalls */
106 probe tp_syscall.ioprio_get.return = kernel.trace("sys_exit")
107 {
108 __set_syscall_pt_regs($regs)
109 @__syscall_compat_gate(@const("__NR_ioprio_get"), @const("__NR_compat_ioprio_get"))
110 @_SYSCALL_IOPRIO_GET_NAME
111 @SYSC_RETVALSTR($ret)
112 }