1
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM signal
4
5 #if !defined(_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_SIGNAL_H
7
8 #include <linux/signal.h>
9 #include <linux/sched.h>
10 #include <linux/tracepoint.h>
11
12 #define TP_STORE_SIGINFO(__entry, info) \
13 do { \
14 if (info == SEND_SIG_NOINFO) { \
15 __entry->errno = 0; \
16 __entry->code = SI_USER; \
17 } else if (info == SEND_SIG_PRIV) { \
18 __entry->errno = 0; \
19 __entry->code = SI_KERNEL; \
20 } else { \
21 __entry->errno = info->si_errno; \
22 __entry->code = info->si_code; \
23 } \
24 } while (0)
25
26 #ifndef TRACE_HEADER_MULTI_READ
27 enum {
28 TRACE_SIGNAL_DELIVERED,
29 TRACE_SIGNAL_IGNORED,
30 TRACE_SIGNAL_ALREADY_PENDING,
31 TRACE_SIGNAL_OVERFLOW_FAIL,
32 TRACE_SIGNAL_LOSE_INFO,
33 };
34 #endif
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 TRACE_EVENT(signal_generate,
51
52 TP_PROTO(int sig, struct kernel_siginfo *info, struct task_struct *task,
53 int group, int result),
54
55 TP_ARGS(sig, info, task, group, result),
56
57 TP_STRUCT__entry(
58 __field( int, sig )
59 __field( int, errno )
60 __field( int, code )
61 __array( char, comm, TASK_COMM_LEN )
62 __field( pid_t, pid )
63 __field( int, group )
64 __field( int, result )
65 ),
66
67 TP_fast_assign(
68 __entry->sig = sig;
69 TP_STORE_SIGINFO(__entry, info);
70 memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
71 __entry->pid = task->pid;
72 __entry->group = group;
73 __entry->result = result;
74 ),
75
76 TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d grp=%d res=%d",
77 __entry->sig, __entry->errno, __entry->code,
78 __entry->comm, __entry->pid, __entry->group,
79 __entry->result)
80 );
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 TRACE_EVENT(signal_deliver,
97
98 TP_PROTO(int sig, struct kernel_siginfo *info, struct k_sigaction *ka),
99
100 TP_ARGS(sig, info, ka),
101
102 TP_STRUCT__entry(
103 __field( int, sig )
104 __field( int, errno )
105 __field( int, code )
106 __field( unsigned long, sa_handler )
107 __field( unsigned long, sa_flags )
108 ),
109
110 TP_fast_assign(
111 __entry->sig = sig;
112 TP_STORE_SIGINFO(__entry, info);
113 __entry->sa_handler = (unsigned long)ka->sa.sa_handler;
114 __entry->sa_flags = ka->sa.sa_flags;
115 ),
116
117 TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx",
118 __entry->sig, __entry->errno, __entry->code,
119 __entry->sa_handler, __entry->sa_flags)
120 );
121
122 #endif
123
124
125 #include <trace/define_trace.h>