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 #define LTTNG_FIELDS_SIGINFO(info) \
17 ctf_integer(int, errno, \
18 (info == SEND_SIG_NOINFO || info == SEND_SIG_PRIV) ? \
21 ctf_integer(int, code, \
22 (info == SEND_SIG_NOINFO) ? \
24 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
25 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) */
26 #define LTTNG_FIELDS_SIGINFO(info) \
27 ctf_integer(int, errno, \
28 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED || info == SEND_SIG_PRIV) ? \
31 ctf_integer(int, code, \
32 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED) ? \
34 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
35 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) */
36 #endif /* _TRACE_SIGNAL_DEF */
39 * signal_generate - called when a signal is generated
41 * @info: pointer to struct siginfo
42 * @task: pointer to struct task_struct
44 * Current process sends a 'sig' signal to 'task' process with
45 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
46 * 'info' is not a pointer and you can't access its field. Instead,
47 * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
48 * means that si_code is SI_KERNEL.
50 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0))
51 LTTNG_TRACEPOINT_EVENT(signal_generate
,
53 TP_PROTO(int sig
, struct kernel_siginfo
*info
, struct task_struct
*task
,
54 int group
, int result
),
56 TP_ARGS(sig
, info
, task
, group
, result
),
59 ctf_integer(int, sig
, sig
)
60 LTTNG_FIELDS_SIGINFO(info
)
61 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
62 ctf_integer(pid_t
, pid
, task
->pid
)
63 ctf_integer(int, group
, group
)
64 ctf_integer(int, result
, result
)
67 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
68 LTTNG_TRACEPOINT_EVENT(signal_generate
,
70 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
,
71 int group
, int result
),
73 TP_ARGS(sig
, info
, task
, group
, result
),
76 ctf_integer(int, sig
, sig
)
77 LTTNG_FIELDS_SIGINFO(info
)
78 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
79 ctf_integer(pid_t
, pid
, task
->pid
)
80 ctf_integer(int, group
, group
)
81 ctf_integer(int, result
, result
)
85 LTTNG_TRACEPOINT_EVENT(signal_generate
,
87 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
),
89 TP_ARGS(sig
, info
, task
),
92 ctf_integer(int, sig
, sig
)
93 LTTNG_FIELDS_SIGINFO(info
)
94 ctf_array_text(char, comm
, task
->comm
, TASK_COMM_LEN
)
95 ctf_integer(pid_t
, pid
, task
->pid
)
101 * signal_deliver - called when a signal is delivered
102 * @sig: signal number
103 * @info: pointer to struct siginfo
104 * @ka: pointer to struct k_sigaction
106 * A 'sig' signal is delivered to current process with 'info' siginfo,
107 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
109 * Note that some signals reported by signal_generate tracepoint can be
110 * lost, ignored or modified (by debugger) before hitting this tracepoint.
111 * This means, this can show which signals are actually delivered, but
112 * matching generated signals and delivered signals may not be correct.
114 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0))
115 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
117 TP_PROTO(int sig
, struct kernel_siginfo
*info
, struct k_sigaction
*ka
),
119 TP_ARGS(sig
, info
, ka
),
122 ctf_integer(int, sig
, sig
)
123 LTTNG_FIELDS_SIGINFO(info
)
124 ctf_integer(unsigned long, sa_handler
, (unsigned long) ka
->sa
.sa_handler
)
125 ctf_integer(unsigned long, sa_flags
, ka
->sa
.sa_flags
)
129 LTTNG_TRACEPOINT_EVENT(signal_deliver
,
131 TP_PROTO(int sig
, struct siginfo
*info
, struct k_sigaction
*ka
),
133 TP_ARGS(sig
, info
, ka
),
136 ctf_integer(int, sig
, sig
)
137 LTTNG_FIELDS_SIGINFO(info
)
138 ctf_integer(unsigned long, sa_handler
, (unsigned long) ka
->sa
.sa_handler
)
139 ctf_integer(unsigned long, sa_flags
, ka
->sa
.sa_flags
)
144 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
145 LTTNG_TRACEPOINT_EVENT_CLASS(signal_queue_overflow
,
147 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
149 TP_ARGS(sig
, group
, info
),
152 ctf_integer(int, sig
, sig
)
153 ctf_integer(int, group
, group
)
154 LTTNG_FIELDS_SIGINFO(info
)
159 * signal_overflow_fail - called when signal queue is overflow
160 * @sig: signal number
161 * @group: signal to process group or not (bool)
162 * @info: pointer to struct siginfo
164 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
165 * siginfo queue is overflow, and the signal is dropped.
166 * 'group' is not 0 if the signal will be sent to a process group.
167 * 'sig' is always one of RT signals.
169 LTTNG_TRACEPOINT_EVENT_INSTANCE(signal_queue_overflow
, signal_overflow_fail
,
171 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
173 TP_ARGS(sig
, group
, info
)
177 * signal_lose_info - called when siginfo is lost
178 * @sig: signal number
179 * @group: signal to process group or not (bool)
180 * @info: pointer to struct siginfo
182 * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo
184 * 'group' is not 0 if the signal will be sent to a process group.
185 * 'sig' is always one of non-RT signals.
187 LTTNG_TRACEPOINT_EVENT_INSTANCE(signal_queue_overflow
, signal_lose_info
,
189 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
191 TP_ARGS(sig
, group
, info
)
195 #endif /* LTTNG_TRACE_SIGNAL_H */
197 /* This part must be outside protection */
198 #include <probes/define_trace.h>
This page took 0.0359 seconds and 4 git commands to generate.