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 LTTNG_FIELDS_SIGINFO
15 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) || \
16 LTTNG_RHEL_KERNEL_RANGE(4,18,0,147,0,0, 4,19,0,0,0,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_RHEL_KERNEL_RANGE(4,18,0,147,0,0, 4,19,0,0,0,0))
53 LTTNG_TRACEPOINT_EVENT(signal_generate
,
55 TP_PROTO(int sig
, struct kernel_siginfo
*info
, struct task_struct
*task
,
56 int group
, int result
),
58 TP_ARGS(sig
, info
, task
, group
, result
),
61 ctf_integer(int, sig
, sig
)
62 LTTNG_FIELDS_SIGINFO(info
)
63 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
64 ctf_integer(pid_t
, pid
, task
->pid
)
65 ctf_integer(int, group
, group
)
66 ctf_integer(int, result
, result
)
69 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
70 LTTNG_TRACEPOINT_EVENT(signal_generate
,
72 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
,
73 int group
, int result
),
75 TP_ARGS(sig
, info
, task
, group
, result
),
78 ctf_integer(int, sig
, sig
)
79 LTTNG_FIELDS_SIGINFO(info
)
80 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
81 ctf_integer(pid_t
, pid
, task
->pid
)
82 ctf_integer(int, group
, group
)
83 ctf_integer(int, result
, result
)
87 LTTNG_TRACEPOINT_EVENT(signal_generate
,
89 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
),
91 TP_ARGS(sig
, info
, task
),
94 ctf_integer(int, sig
, sig
)
95 LTTNG_FIELDS_SIGINFO(info
)
96 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
97 ctf_integer(pid_t
, pid
, task
->pid
)
103 * signal_deliver - called when a signal is delivered
104 * @sig: signal number
105 * @info: pointer to struct siginfo
106 * @ka: pointer to struct k_sigaction
108 * A 'sig' signal is delivered to current process with 'info' siginfo,
109 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
111 * Note that some signals reported by signal_generate tracepoint can be
112 * lost, ignored or modified (by debugger) before hitting this tracepoint.
113 * This means, this can show which signals are actually delivered, but
114 * matching generated signals and delivered signals may not be correct.
116 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) || \
117 LTTNG_RHEL_KERNEL_RANGE(4,18,0,147,0,0, 4,19,0,0,0,0))
118 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
120 TP_PROTO(int sig
, struct kernel_siginfo
*info
, struct k_sigaction
*ka
),
122 TP_ARGS(sig
, info
, ka
),
125 ctf_integer(int, sig
, sig
)
126 LTTNG_FIELDS_SIGINFO(info
)
127 ctf_integer(unsigned long, sa_handler
, (unsigned long) ka
->sa
.sa_handler
)
128 ctf_integer(unsigned long, sa_flags
, ka
->sa
.sa_flags
)
132 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
134 TP_PROTO(int sig
, struct siginfo
*info
, struct k_sigaction
*ka
),
136 TP_ARGS(sig
, info
, ka
),
139 ctf_integer(int, sig
, sig
)
140 LTTNG_FIELDS_SIGINFO(info
)
141 ctf_integer(unsigned long, sa_handler
, (unsigned long) ka
->sa
.sa_handler
)
142 ctf_integer(unsigned long, sa_flags
, ka
->sa
.sa_flags
)
147 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
148 LTTNG_TRACEPOINT_EVENT_CLASS(signal_queue_overflow
,
150 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
152 TP_ARGS(sig
, group
, info
),
155 ctf_integer(int, sig
, sig
)
156 ctf_integer(int, group
, group
)
157 LTTNG_FIELDS_SIGINFO(info
)
162 * signal_overflow_fail - called when signal queue is overflow
163 * @sig: signal number
164 * @group: signal to process group or not (bool)
165 * @info: pointer to struct siginfo
167 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
168 * siginfo queue is overflow, and the signal is dropped.
169 * 'group' is not 0 if the signal will be sent to a process group.
170 * 'sig' is always one of RT signals.
172 LTTNG_TRACEPOINT_EVENT_INSTANCE(signal_queue_overflow
, signal_overflow_fail
,
174 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
176 TP_ARGS(sig
, group
, info
)
180 * signal_lose_info - called when siginfo is lost
181 * @sig: signal number
182 * @group: signal to process group or not (bool)
183 * @info: pointer to struct siginfo
185 * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo
187 * 'group' is not 0 if the signal will be sent to a process group.
188 * 'sig' is always one of non-RT signals.
190 LTTNG_TRACEPOINT_EVENT_INSTANCE(signal_queue_overflow
, signal_lose_info
,
192 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
194 TP_ARGS(sig
, group
, info
)
198 #endif /* LTTNG_TRACE_SIGNAL_H */
200 /* This part must be outside protection */
201 #include <probes/define_trace.h>
This page took 0.034699 seconds and 4 git commands to generate.