c7d4114ed8a133c21f1e926f4b5be2a32373898c
1 // SPDX-FileCopyrightText: 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 // SPDX-License-Identifier: GPL-2.0-only
6 #define TRACE_SYSTEM signal
8 #if !defined(LTTNG_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define LTTNG_TRACE_SIGNAL_H
11 #include <lttng/tracepoint-event.h>
12 #include <lttng/kernel-version.h>
14 #ifndef _TRACE_SIGNAL_DEF
15 #define _TRACE_SIGNAL_DEF
16 #include <linux/signal.h>
17 #include <linux/sched.h>
18 #undef LTTNG_FIELDS_SIGINFO
19 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,20,0) || \
20 LTTNG_RHEL_KERNEL_RANGE(4,18,0,147,0,0, 4,19,0,0,0,0))
21 #define LTTNG_FIELDS_SIGINFO(info) \
22 ctf_integer(int, errno, \
23 (info == SEND_SIG_NOINFO || info == SEND_SIG_PRIV) ? \
26 ctf_integer(int, code, \
27 (info == SEND_SIG_NOINFO) ? \
29 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
30 #else /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,20,0) */
31 #define LTTNG_FIELDS_SIGINFO(info) \
32 ctf_integer(int, errno, \
33 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED || info == SEND_SIG_PRIV) ? \
36 ctf_integer(int, code, \
37 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED) ? \
39 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
40 #endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,20,0) */
41 #endif /* _TRACE_SIGNAL_DEF */
44 * signal_generate - called when a signal is generated
46 * @info: pointer to struct siginfo
47 * @task: pointer to struct task_struct
49 * Current process sends a 'sig' signal to 'task' process with
50 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
51 * 'info' is not a pointer and you can't access its field. Instead,
52 * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
53 * means that si_code is SI_KERNEL.
55 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,20,0) || \
56 LTTNG_RHEL_KERNEL_RANGE(4,18,0,147,0,0, 4,19,0,0,0,0))
57 LTTNG_TRACEPOINT_EVENT(signal_generate
,
59 TP_PROTO(int sig
, struct kernel_siginfo
*info
, struct task_struct
*task
,
60 int group
, int result
),
62 TP_ARGS(sig
, info
, task
, group
, result
),
65 ctf_integer(int, sig
, sig
)
66 LTTNG_FIELDS_SIGINFO(info
)
67 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
68 ctf_integer(pid_t
, pid
, task
->pid
)
69 ctf_integer(int, group
, group
)
70 ctf_integer(int, result
, result
)
73 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,4,0))
74 LTTNG_TRACEPOINT_EVENT(signal_generate
,
76 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
,
77 int group
, int result
),
79 TP_ARGS(sig
, info
, task
, group
, result
),
82 ctf_integer(int, sig
, sig
)
83 LTTNG_FIELDS_SIGINFO(info
)
84 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
85 ctf_integer(pid_t
, pid
, task
->pid
)
86 ctf_integer(int, group
, group
)
87 ctf_integer(int, result
, result
)
91 LTTNG_TRACEPOINT_EVENT(signal_generate
,
93 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
),
95 TP_ARGS(sig
, info
, task
),
98 ctf_integer(int, sig
, sig
)
99 LTTNG_FIELDS_SIGINFO(info
)
100 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
101 ctf_integer(pid_t
, pid
, task
->pid
)
107 * signal_deliver - called when a signal is delivered
108 * @sig: signal number
109 * @info: pointer to struct siginfo
110 * @ka: pointer to struct k_sigaction
112 * A 'sig' signal is delivered to current process with 'info' siginfo,
113 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
115 * Note that some signals reported by signal_generate tracepoint can be
116 * lost, ignored or modified (by debugger) before hitting this tracepoint.
117 * This means, this can show which signals are actually delivered, but
118 * matching generated signals and delivered signals may not be correct.
120 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,20,0) || \
121 LTTNG_RHEL_KERNEL_RANGE(4,18,0,147,0,0, 4,19,0,0,0,0))
122 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
124 TP_PROTO(int sig
, struct kernel_siginfo
*info
, struct k_sigaction
*ka
),
126 TP_ARGS(sig
, info
, ka
),
129 ctf_integer(int, sig
, sig
)
130 LTTNG_FIELDS_SIGINFO(info
)
131 ctf_integer(unsigned long, sa_handler
, (unsigned long) ka
->sa
.sa_handler
)
132 ctf_integer(unsigned long, sa_flags
, ka
->sa
.sa_flags
)
136 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
138 TP_PROTO(int sig
, struct siginfo
*info
, struct k_sigaction
*ka
),
140 TP_ARGS(sig
, info
, ka
),
143 ctf_integer(int, sig
, sig
)
144 LTTNG_FIELDS_SIGINFO(info
)
145 ctf_integer(unsigned long, sa_handler
, (unsigned long) ka
->sa
.sa_handler
)
146 ctf_integer(unsigned long, sa_flags
, ka
->sa
.sa_flags
)
151 #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(3,4,0))
152 LTTNG_TRACEPOINT_EVENT_CLASS(signal_queue_overflow
,
154 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
156 TP_ARGS(sig
, group
, info
),
159 ctf_integer(int, sig
, sig
)
160 ctf_integer(int, group
, group
)
161 LTTNG_FIELDS_SIGINFO(info
)
166 * signal_overflow_fail - called when signal queue is overflow
167 * @sig: signal number
168 * @group: signal to process group or not (bool)
169 * @info: pointer to struct siginfo
171 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
172 * siginfo queue is overflow, and the signal is dropped.
173 * 'group' is not 0 if the signal will be sent to a process group.
174 * 'sig' is always one of RT signals.
176 LTTNG_TRACEPOINT_EVENT_INSTANCE(signal_queue_overflow
, signal_overflow_fail
,
178 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
180 TP_ARGS(sig
, group
, info
)
184 * signal_lose_info - called when siginfo is lost
185 * @sig: signal number
186 * @group: signal to process group or not (bool)
187 * @info: pointer to struct siginfo
189 * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo
191 * 'group' is not 0 if the signal will be sent to a process group.
192 * 'sig' is always one of non-RT signals.
194 LTTNG_TRACEPOINT_EVENT_INSTANCE(signal_queue_overflow
, signal_lose_info
,
196 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
198 TP_ARGS(sig
, group
, info
)
202 #endif /* LTTNG_TRACE_SIGNAL_H */
204 /* This part must be outside protection */
205 #include <lttng/define_trace.h>
This page took 0.034879 seconds and 5 git commands to generate.