2 #define TRACE_SYSTEM signal
4 #if !defined(_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_SIGNAL_H
7 #include <linux/tracepoint.h>
9 #ifndef _TRACE_SIGNAL_DEF
10 #define _TRACE_SIGNAL_DEF
11 #include <linux/signal.h>
12 #include <linux/sched.h>
13 #define TP_STORE_SIGINFO(info) \
15 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED || info == SEND_SIG_PRIV) ? \
19 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED) ? \
21 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
22 #endif /* _TRACE_SIGNAL_DEF */
25 * signal_generate - called when a signal is generated
27 * @info: pointer to struct siginfo
28 * @task: pointer to struct task_struct
30 * Current process sends a 'sig' signal to 'task' process with
31 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
32 * 'info' is not a pointer and you can't access its field. Instead,
33 * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
34 * means that si_code is SI_KERNEL.
36 TRACE_EVENT(signal_generate
,
38 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
),
40 TP_ARGS(sig
, info
, task
),
46 __array( char, comm
, TASK_COMM_LEN
)
52 TP_STORE_SIGINFO(info
)
53 tp_memcpy(comm
, task
->comm
, TASK_COMM_LEN
)
54 tp_assign(pid
, task
->pid
)
57 TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d",
58 __entry
->sig
, __entry
->errno
, __entry
->code
,
59 __entry
->comm
, __entry
->pid
)
63 * signal_deliver - called when a signal is delivered
65 * @info: pointer to struct siginfo
66 * @ka: pointer to struct k_sigaction
68 * A 'sig' signal is delivered to current process with 'info' siginfo,
69 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
71 * Note that some signals reported by signal_generate tracepoint can be
72 * lost, ignored or modified (by debugger) before hitting this tracepoint.
73 * This means, this can show which signals are actually delivered, but
74 * matching generated signals and delivered signals may not be correct.
76 TRACE_EVENT(signal_deliver
,
78 TP_PROTO(int sig
, struct siginfo
*info
, struct k_sigaction
*ka
),
80 TP_ARGS(sig
, info
, ka
),
86 __field( unsigned long, sa_handler
)
87 __field( unsigned long, sa_flags
)
92 TP_STORE_SIGINFO(info
)
93 tp_assign(sa_handler
, (unsigned long)ka
->sa
.sa_handler
)
94 tp_assign(sa_flags
, ka
->sa
.sa_flags
)
97 TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx",
98 __entry
->sig
, __entry
->errno
, __entry
->code
,
99 __entry
->sa_handler
, __entry
->sa_flags
)
102 DECLARE_EVENT_CLASS(signal_queue_overflow
,
104 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
106 TP_ARGS(sig
, group
, info
),
110 __field( int, group
)
111 __field( int, errno
)
117 tp_assign(group
, group
)
118 TP_STORE_SIGINFO(info
)
121 TP_printk("sig=%d group=%d errno=%d code=%d",
122 __entry
->sig
, __entry
->group
, __entry
->errno
, __entry
->code
)
126 * signal_overflow_fail - called when signal queue is overflow
127 * @sig: signal number
128 * @group: signal to process group or not (bool)
129 * @info: pointer to struct siginfo
131 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
132 * siginfo queue is overflow, and the signal is dropped.
133 * 'group' is not 0 if the signal will be sent to a process group.
134 * 'sig' is always one of RT signals.
136 DEFINE_EVENT(signal_queue_overflow
, signal_overflow_fail
,
138 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
140 TP_ARGS(sig
, group
, info
)
144 * signal_lose_info - called when siginfo is lost
145 * @sig: signal number
146 * @group: signal to process group or not (bool)
147 * @info: pointer to struct siginfo
149 * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo
151 * 'group' is not 0 if the signal will be sent to a process group.
152 * 'sig' is always one of non-RT signals.
154 DEFINE_EVENT(signal_queue_overflow
, signal_lose_info
,
156 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
158 TP_ARGS(sig
, group
, info
)
161 #endif /* _TRACE_SIGNAL_H */
163 /* This part must be outside protection */
164 #include "../../../probes/define_trace.h"
This page took 0.033913 seconds and 5 git commands to generate.