Debian Codegraph @

tapset/linux/sysc_ioprio_set.stp

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