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 #define LTTNG_FIELDS_SIGINFO(info) \
18 ctf_integer(int, errno, \
19 (info == SEND_SIG_NOINFO || info == SEND_SIG_PRIV) ? \
22 ctf_integer(int, code, \
23 (info == SEND_SIG_NOINFO) ? \
25 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
26 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) */
27 #define LTTNG_FIELDS_SIGINFO(info) \
28 ctf_integer(int, errno, \
29 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED || info == SEND_SIG_PRIV) ? \
32 ctf_integer(int, code, \
33 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED) ? \
35 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
36 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) */
37 #endif /* _TRACE_SIGNAL_DEF */
40 * signal_generate - called when a signal is generated
42 * @info: pointer to struct siginfo
43 * @task: pointer to struct task_struct
45 * Current process sends a 'sig' signal to 'task' process with
46 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
47 * 'info' is not a pointer and you can't access its field. Instead,
48 * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
49 * means that si_code is SI_KERNEL.
51 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0))
52 LTTNG_TRACEPOINT_EVENT(signal_generate
,
54 TP_PROTO(int sig
, struct kernel_siginfo
*info
, struct task_struct
*task
,
55 int group
, int result
),
57 TP_ARGS(sig
, info
, task
, group
, result
),
60 ctf_integer(int, sig
, sig
)
61 LTTNG_FIELDS_SIGINFO(info
)
62 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
63 ctf_integer(pid_t
, pid
, task
->pid
)
64 ctf_integer(int, group
, group
)
65 ctf_integer(int, result
, result
)
68 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
69 LTTNG_TRACEPOINT_EVENT(signal_generate
,
71 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
,
72 int group
, int result
),
74 TP_ARGS(sig
, info
, task
, group
, result
),
77 ctf_integer(int, sig
, sig
)
78 LTTNG_FIELDS_SIGINFO(info
)
79 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
80 ctf_integer(pid_t
, pid
, task
->pid
)
81 ctf_integer(int, group
, group
)
82 ctf_integer(int, result
, result
)
86 LTTNG_TRACEPOINT_EVENT(signal_generate
,
88 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
),
90 TP_ARGS(sig
, info
, task
),
93 ctf_integer(int, sig
, sig
)
94 LTTNG_FIELDS_SIGINFO(info
)
95 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
96 ctf_integer(pid_t
, pid
, task
->pid
)
102 * signal_deliver - called when a signal is delivered
103 * @sig: signal number
104 * @info: pointer to struct siginfo
105 * @ka: pointer to struct k_sigaction
107 * A 'sig' signal is delivered to current process with 'info' siginfo,
108 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
110 * Note that some signals reported by signal_generate tracepoint can be
111 * lost, ignored or modified (by debugger) before hitting this tracepoint.
112 * This means, this can show which signals are actually delivered, but
113 * matching generated signals and delivered signals may not be correct.
115 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0))
116 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
118 TP_PROTO(int sig
, struct kernel_siginfo
*info
, struct k_sigaction
*ka
),
120 TP_ARGS(sig
, info
, ka
),
123 ctf_integer(int, sig
, sig
)
124 LTTNG_FIELDS_SIGINFO(info
)
125 ctf_integer(unsigned long, sa_handler
, (unsigned long) ka
->sa
.sa_handler
)
126 ctf_integer(unsigned long, sa_flags
, ka
->sa
.sa_flags
)
130 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
132 TP_PROTO(int sig
, struct siginfo
*info
, struct k_sigaction
*ka
),
134 TP_ARGS(sig
, info
, ka
),
137 ctf_integer(int, sig
, sig
)
138 LTTNG_FIELDS_SIGINFO(info
)
139 ctf_integer(unsigned long, sa_handler
, (unsigned long) ka
->sa
.sa_handler
)
140 ctf_integer(unsigned long, sa_flags
, ka
->sa
.sa_flags
)
145 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
146 LTTNG_TRACEPOINT_EVENT_CLASS(signal_queue_overflow
,
148 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
150 TP_ARGS(sig
, group
, info
),
153 ctf_integer(int, sig
, sig
)
154 ctf_integer(int, group
, group
)
155 LTTNG_FIELDS_SIGINFO(info
)
160 * signal_overflow_fail - called when signal queue is overflow
161 * @sig: signal number
162 * @group: signal to process group or not (bool)
163 * @info: pointer to struct siginfo
165 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
166 * siginfo queue is overflow, and the signal is dropped.
167 * 'group' is not 0 if the signal will be sent to a process group.
168 * 'sig' is always one of RT signals.
170 LTTNG_TRACEPOINT_EVENT_INSTANCE(signal_queue_overflow
, signal_overflow_fail
,
172 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
174 TP_ARGS(sig
, group
, info
)
178 * signal_lose_info - called when siginfo is lost
179 * @sig: signal number
180 * @group: signal to process group or not (bool)
181 * @info: pointer to struct siginfo
183 * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo
185 * 'group' is not 0 if the signal will be sent to a process group.
186 * 'sig' is always one of non-RT signals.
188 LTTNG_TRACEPOINT_EVENT_INSTANCE(signal_queue_overflow
, signal_lose_info
,
190 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
192 TP_ARGS(sig
, group
, info
)
196 #endif /* LTTNG_TRACE_SIGNAL_H */
198 /* This part must be outside protection */
199 #include <probes/define_trace.h>
This page took 0.033347 seconds and 4 git commands to generate.