2 #define TRACE_SYSTEM signal
4 #if !defined(_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_SIGNAL_H
7 #include <linux/signal.h>
8 #include <linux/sched.h>
9 #include <linux/tracepoint.h>
11 #define TP_STORE_SIGINFO(__entry, info) \
13 if (info == SEND_SIG_NOINFO || \
14 info == SEND_SIG_FORCED) { \
16 __entry->code = SI_USER; \
17 } else if (info == SEND_SIG_PRIV) { \
19 __entry->code = SI_KERNEL; \
21 __entry->errno = info->si_errno; \
22 __entry->code = info->si_code; \
26 #ifndef TRACE_HEADER_MULTI_READ
28 TRACE_SIGNAL_DELIVERED,
30 TRACE_SIGNAL_ALREADY_PENDING,
31 TRACE_SIGNAL_OVERFLOW_FAIL,
32 TRACE_SIGNAL_LOSE_INFO,
37 * signal_generate - called when a signal is generated
39 * @info: pointer to struct siginfo
40 * @task: pointer to struct task_struct
41 * @group: shared or private
42 * @result: TRACE_SIGNAL_*
44 * Current process sends a 'sig' signal to 'task' process with
45 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
46 * 'info' is not a pointer and you can't access its field. Instead,
47 * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
48 * means that si_code is SI_KERNEL.
50 TRACE_EVENT(signal_generate,
52 TP_PROTO(int sig, struct siginfo *info, struct task_struct *task,
53 int group, int result),
55 TP_ARGS(sig, info, task, group, result),
61 __array( char, comm, TASK_COMM_LEN )
64 __field( int, result )
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;
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,
83 * signal_deliver - called when a signal is delivered
85 * @info: pointer to struct siginfo
86 * @ka: pointer to struct k_sigaction
88 * A 'sig' signal is delivered to current process with 'info' siginfo,
89 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
91 * Note that some signals reported by signal_generate tracepoint can be
92 * lost, ignored or modified (by debugger) before hitting this tracepoint.
93 * This means, this can show which signals are actually delivered, but
94 * matching generated signals and delivered signals may not be correct.
96 TRACE_EVENT(signal_deliver,
98 TP_PROTO(int sig, struct siginfo *info, struct k_sigaction *ka),
100 TP_ARGS(sig, info, ka),
104 __field( int, errno )
106 __field( unsigned long, sa_handler )
107 __field( unsigned long, sa_flags )
112 TP_STORE_SIGINFO(__entry, info);
113 __entry->sa_handler = (unsigned long)ka->sa.sa_handler;
114 __entry->sa_flags = ka->sa.sa_flags;
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)
122 #endif /* _TRACE_SIGNAL_H */
124 /* This part must be outside protection */
125 #include <trace/define_trace.h>