Debian Codegraph @

tapset/linux/sysc_nice.stp

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