2 #define TRACE_SYSTEM signal
4 #if !defined(_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_SIGNAL_H
7 #include <linux/tracepoint.h>
9 #ifndef _TRACE_SIGNAL_DEF
10 #define _TRACE_SIGNAL_DEF
11 #include <linux/signal.h>
12 #include <linux/sched.h>
13 #undef TP_STORE_SIGINFO
14 #define TP_STORE_SIGINFO(info) \
16 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED || info == SEND_SIG_PRIV) ? \
20 (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED) ? \
22 ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code))
23 #endif /* _TRACE_SIGNAL_DEF */
26 * signal_generate - called when a signal is generated
28 * @info: pointer to struct siginfo
29 * @task: pointer to struct task_struct
31 * Current process sends a 'sig' signal to 'task' process with
32 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
33 * 'info' is not a pointer and you can't access its field. Instead,
34 * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
35 * means that si_code is SI_KERNEL.
37 TRACE_EVENT(signal_generate
,
39 TP_PROTO(int sig
, struct siginfo
*info
, struct task_struct
*task
),
41 TP_ARGS(sig
, info
, task
),
47 __array( char, comm
, TASK_COMM_LEN
)
53 TP_STORE_SIGINFO(info
)
54 tp_memcpy(comm
, task
->comm
, TASK_COMM_LEN
)
55 tp_assign(pid
, task
->pid
)
58 TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d",
59 __entry
->sig
, __entry
->errno
, __entry
->code
,
60 __entry
->comm
, __entry
->pid
)
64 * signal_deliver - called when a signal is delivered
66 * @info: pointer to struct siginfo
67 * @ka: pointer to struct k_sigaction
69 * A 'sig' signal is delivered to current process with 'info' siginfo,
70 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
72 * Note that some signals reported by signal_generate tracepoint can be
73 * lost, ignored or modified (by debugger) before hitting this tracepoint.
74 * This means, this can show which signals are actually delivered, but
75 * matching generated signals and delivered signals may not be correct.
77 TRACE_EVENT(signal_deliver
,
79 TP_PROTO(int sig
, struct siginfo
*info
, struct k_sigaction
*ka
),
81 TP_ARGS(sig
, info
, ka
),
87 __field( unsigned long, sa_handler
)
88 __field( unsigned long, sa_flags
)
93 TP_STORE_SIGINFO(info
)
94 tp_assign(sa_handler
, (unsigned long)ka
->sa
.sa_handler
)
95 tp_assign(sa_flags
, ka
->sa
.sa_flags
)
98 TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx",
99 __entry
->sig
, __entry
->errno
, __entry
->code
,
100 __entry
->sa_handler
, __entry
->sa_flags
)
103 DECLARE_EVENT_CLASS(signal_queue_overflow
,
105 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
107 TP_ARGS(sig
, group
, info
),
111 __field( int, group
)
112 __field( int, errno
)
118 tp_assign(group
, group
)
119 TP_STORE_SIGINFO(info
)
122 TP_printk("sig=%d group=%d errno=%d code=%d",
123 __entry
->sig
, __entry
->group
, __entry
->errno
, __entry
->code
)
127 * signal_overflow_fail - called when signal queue is overflow
128 * @sig: signal number
129 * @group: signal to process group or not (bool)
130 * @info: pointer to struct siginfo
132 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
133 * siginfo queue is overflow, and the signal is dropped.
134 * 'group' is not 0 if the signal will be sent to a process group.
135 * 'sig' is always one of RT signals.
137 DEFINE_EVENT(signal_queue_overflow
, signal_overflow_fail
,
139 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
141 TP_ARGS(sig
, group
, info
)
145 * signal_lose_info - called when siginfo is lost
146 * @sig: signal number
147 * @group: signal to process group or not (bool)
148 * @info: pointer to struct siginfo
150 * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo
152 * 'group' is not 0 if the signal will be sent to a process group.
153 * 'sig' is always one of non-RT signals.
155 DEFINE_EVENT(signal_queue_overflow
, signal_lose_info
,
157 TP_PROTO(int sig
, int group
, struct siginfo
*info
),
159 TP_ARGS(sig
, group
, info
)
162 #endif /* _TRACE_SIGNAL_H */
164 /* This part must be outside protection */
165 #include "../../../probes/define_trace.h"
This page took 0.033381 seconds and 5 git commands to generate.