1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM signal
5 #if !defined(LTTNG_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_SIGNAL_H
8 #include <probes/lttng-tracepoint-event.h>
9 #include <linux/version.h>
11 #ifndef _TRACE_SIGNAL_DEF
12 #define _TRACE_SIGNAL_DEF
13 #include <linux/signal.h>
14 #include <linux/sched.h>
15 #undef LTTNG_FIELDS_SIGINFO
16 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) || \
17 LTTNG_RHEL_KERNEL_RANGE(4,18,0,147,0,0, 4,19,0,0,0,0))
18 #define LTTNG_FIELDS_SIGINFO(info) \
19 ctf_integer(int, errno, \
20 (info == SEND_SIG_NOINFO || info == SEND_SIG_PRIV) ? \
23 ctf_integer(int, code, \
24 (info == SEND_SIG_NOINFO) ? \
26 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
27 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) */
28 #define LTTNG_FIELDS_SIGINFO(info) \
29 ctf_integer(int, errno, \
30 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED || info == SEND_SIG_PRIV) ? \
33 ctf_integer(int, code, \
34 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED) ? \
36 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
37 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) */
38 #endif /* _TRACE_SIGNAL_DEF */
41 * signal_generate - called when a signal is generated
43 * @info: pointer to struct siginfo
44 * @task: pointer to struct task_struct
46 * Current process sends a 'sig' signal to 'task' process with
47 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
48 * 'info' is not a pointer and you can't access its field. Instead,
49 * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
50 * means that si_code is SI_KERNEL.
52 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) || \
53 LTTNG_RHEL_KERNEL_RANGE(4,18,0,147,0,0, 4,19,0,0,0,0))
54 LTTNG_TRACEPOINT_EVENT(signal_generate
,
56 TP_PROTO(int sig
, struct kernel_siginfo
*info
, struct task_struct
*task
,
57 int group
, int result
),
59 TP_ARGS(sig
, info
, task
, group
, result
),
62 ctf_integer(int, sig
, sig
)
63 LTTNG_FIELDS_SIGINFO(info
)
64 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
65 ctf_integer(pid_t
, pid
, task
->pid
)
66 ctf_integer(int, group
, group
)
67 ctf_integer(int, result
, result
)
70 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
71 LTTNG_TRACEPOINT_EVENT(signal_generate
,
73 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
,
74 int group
, int result
),
76 TP_ARGS(sig
, info
, task
, group
, result
),
79 ctf_integer(int, sig
, sig
)
80 LTTNG_FIELDS_SIGINFO(info
)
81 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
82 ctf_integer(pid_t
, pid
, task
->pid
)
83 ctf_integer(int, group
, group
)
84 ctf_integer(int, result
, result
)
88 LTTNG_TRACEPOINT_EVENT(signal_generate
,
90 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
),
92 TP_ARGS(sig
, info
, task
),
95 ctf_integer(int, sig
, sig
)
96 LTTNG_FIELDS_SIGINFO(info
)
97 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
98 ctf_integer(pid_t
, pid
, task
->pid
)
104 * signal_deliver - called when a signal is delivered
105 * @sig: signal number
106 * @info: pointer to struct siginfo
107 * @ka: pointer to struct k_sigaction
109 * A 'sig' signal is delivered to current process with 'info' siginfo,
110 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
112 * Note that some signals reported by signal_generate tracepoint can be
113 * lost, ignored or modified (by debugger) before hitting this tracepoint.
114 * This means, this can show which signals are actually delivered, but
115 * matching generated signals and delivered signals may not be correct.
117 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) || \
118 LTTNG_RHEL_KERNEL_RANGE(4,18,0,147,0,0, 4,19,0,0,0,0))
119 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
121 TP_PROTO(int sig
, struct kernel_siginfo
*info
, struct k_sigaction
*ka
),
123 TP_ARGS(sig
, info
, ka
),
126 ctf_integer(int, sig
, sig
)
127 LTTNG_FIELDS_SIGINFO(info
)
128 ctf_integer(unsigned long, sa_handler
, (unsigned long) ka
->sa
.sa_handler
)
129 ctf_integer(unsigned long, sa_flags
, ka
->sa
.sa_flags
)
133 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
135 TP_PROTO(int sig
, struct siginfo
*info
, struct k_sigaction
*ka
),
137 TP_ARGS(sig
, info
, ka
),
140 ctf_integer(int, sig
, sig
)
141 LTTNG_FIELDS_SIGINFO(info
)
142 ctf_integer(unsigned long, sa_handler
, (unsigned long) ka
->sa
.sa_handler
)
143 ctf_integer(unsigned long, sa_flags
, ka
->sa
.sa_flags
)
148 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
149 LTTNG_TRACEPOINT_EVENT_CLASS(signal_queue_overflow
,
151 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
153 TP_ARGS(sig
, group
, info
),
156 ctf_integer(int, sig
, sig
)
157 ctf_integer(int, group
, group
)
158 LTTNG_FIELDS_SIGINFO(info
)
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.032883 seconds and 4 git commands to generate.