2 #define TRACE_SYSTEM signal
4 #if !defined(LTTNG_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_SIGNAL_H
7 #include "../../../probes/lttng-tracepoint-event.h"
8 #include <linux/version.h>
10 #ifndef _TRACE_SIGNAL_DEF
11 #define _TRACE_SIGNAL_DEF
12 #include <linux/signal.h>
13 #include <linux/sched.h>
14 #undef TP_STORE_SIGINFO
15 #define TP_STORE_SIGINFO(info) \
17 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED || info == SEND_SIG_PRIV) ? \
21 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED) ? \
23 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
24 #endif /* _TRACE_SIGNAL_DEF */
27 * signal_generate - called when a signal is generated
29 * @info: pointer to struct siginfo
30 * @task: pointer to struct task_struct
32 * Current process sends a 'sig' signal to 'task' process with
33 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
34 * 'info' is not a pointer and you can't access its field. Instead,
35 * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
36 * means that si_code is SI_KERNEL.
38 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
39 LTTNG_TRACEPOINT_EVENT(signal_generate
,
41 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
),
43 TP_ARGS(sig
, info
, task
),
49 __array_text( char, comm
, TASK_COMM_LEN
)
55 TP_STORE_SIGINFO(info
)
56 tp_memcpy(comm
, task
->comm
, TASK_COMM_LEN
)
57 tp_assign(pid
, task
->pid
)
60 TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d",
61 __entry
->sig
, __entry
->errno
, __entry
->code
,
62 __entry
->comm
, __entry
->pid
)
65 LTTNG_TRACEPOINT_EVENT(signal_generate
,
67 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
,
68 int group
, int result
),
70 TP_ARGS(sig
, info
, task
, group
, result
),
76 __array_text( char, comm
, TASK_COMM_LEN
)
79 __field( int, result
)
84 TP_STORE_SIGINFO(info
)
85 tp_memcpy(comm
, task
->comm
, TASK_COMM_LEN
)
86 tp_assign(pid
, task
->pid
)
87 tp_assign(group
, group
)
88 tp_assign(result
, result
)
91 TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d grp=%d res=%d",
92 __entry
->sig
, __entry
->errno
, __entry
->code
,
93 __entry
->comm
, __entry
->pid
, __entry
->group
,
99 * signal_deliver - called when a signal is delivered
100 * @sig: signal number
101 * @info: pointer to struct siginfo
102 * @ka: pointer to struct k_sigaction
104 * A 'sig' signal is delivered to current process with 'info' siginfo,
105 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
107 * Note that some signals reported by signal_generate tracepoint can be
108 * lost, ignored or modified (by debugger) before hitting this tracepoint.
109 * This means, this can show which signals are actually delivered, but
110 * matching generated signals and delivered signals may not be correct.
112 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
114 TP_PROTO(int sig
, struct siginfo
*info
, struct k_sigaction
*ka
),
116 TP_ARGS(sig
, info
, ka
),
120 __field( int, errno
)
122 __field( unsigned long, sa_handler
)
123 __field( unsigned long, sa_flags
)
128 TP_STORE_SIGINFO(info
)
129 tp_assign(sa_handler
, (unsigned long)ka
->sa
.sa_handler
)
130 tp_assign(sa_flags
, ka
->sa
.sa_flags
)
133 TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx",
134 __entry
->sig
, __entry
->errno
, __entry
->code
,
135 __entry
->sa_handler
, __entry
->sa_flags
)
138 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
139 LTTNG_TRACEPOINT_EVENT_CLASS(signal_queue_overflow
,
141 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
143 TP_ARGS(sig
, group
, info
),
147 __field( int, group
)
148 __field( int, errno
)
154 tp_assign(group
, group
)
155 TP_STORE_SIGINFO(info
)
158 TP_printk("sig=%d group=%d errno=%d code=%d",
159 __entry
->sig
, __entry
->group
, __entry
->errno
, __entry
->code
)
163 * signal_overflow_fail - called when signal queue is overflow
164 * @sig: signal number
165 * @group: signal to process group or not (bool)
166 * @info: pointer to struct siginfo
168 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
169 * siginfo queue is overflow, and the signal is dropped.
170 * 'group' is not 0 if the signal will be sent to a process group.
171 * 'sig' is always one of RT signals.
173 LTTNG_TRACEPOINT_EVENT_INSTANCE(signal_queue_overflow
, signal_overflow_fail
,
175 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
177 TP_ARGS(sig
, group
, info
)
181 * signal_lose_info - called when siginfo is lost
182 * @sig: signal number
183 * @group: signal to process group or not (bool)
184 * @info: pointer to struct siginfo
186 * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo
188 * 'group' is not 0 if the signal will be sent to a process group.
189 * 'sig' is always one of non-RT signals.
191 LTTNG_TRACEPOINT_EVENT_INSTANCE(signal_queue_overflow
, signal_lose_info
,
193 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
195 TP_ARGS(sig
, group
, info
)
199 #endif /* LTTNG_TRACE_SIGNAL_H */
201 /* This part must be outside protection */
202 #include "../../../probes/define_trace.h"
This page took 0.032605 seconds and 4 git commands to generate.