• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/include/trace/events/
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM signal
3
4#if !defined(_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SIGNAL_H
6
7#include <linux/signal.h>
8#include <linux/sched.h>
9#include <linux/tracepoint.h>
10
11#define TP_STORE_SIGINFO(__entry, info)				\
12	do {							\
13		if (info == SEND_SIG_NOINFO ||			\
14		    info == SEND_SIG_FORCED) {			\
15			__entry->errno	= 0;			\
16			__entry->code	= SI_USER;		\
17		} else if (info == SEND_SIG_PRIV) {		\
18			__entry->errno	= 0;			\
19			__entry->code	= SI_KERNEL;		\
20		} else {					\
21			__entry->errno	= info->si_errno;	\
22			__entry->code	= info->si_code;	\
23		}						\
24	} while (0)
25
26/**
27 * signal_generate - called when a signal is generated
28 * @sig: signal number
29 * @info: pointer to struct siginfo
30 * @task: pointer to struct task_struct
31 *
32 * Current process sends a 'sig' signal to 'task' process with
33 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
34 * 'info' is not a pointer and you can't access its field. Instead,
35 * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
36 * means that si_code is SI_KERNEL.
37 */
38TRACE_EVENT(signal_generate,
39
40	TP_PROTO(int sig, struct siginfo *info, struct task_struct *task),
41
42	TP_ARGS(sig, info, task),
43
44	TP_STRUCT__entry(
45		__field(	int,	sig			)
46		__field(	int,	errno			)
47		__field(	int,	code			)
48		__array(	char,	comm,	TASK_COMM_LEN	)
49		__field(	pid_t,	pid			)
50	),
51
52	TP_fast_assign(
53		__entry->sig	= sig;
54		TP_STORE_SIGINFO(__entry, info);
55		memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
56		__entry->pid	= task->pid;
57	),
58
59	TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d",
60		  __entry->sig, __entry->errno, __entry->code,
61		  __entry->comm, __entry->pid)
62);
63
64/**
65 * signal_deliver - called when a signal is delivered
66 * @sig: signal number
67 * @info: pointer to struct siginfo
68 * @ka: pointer to struct k_sigaction
69 *
70 * A 'sig' signal is delivered to current process with 'info' siginfo,
71 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
72 * SIG_DFL.
73 * Note that some signals reported by signal_generate tracepoint can be
74 * lost, ignored or modified (by debugger) before hitting this tracepoint.
75 * This means, this can show which signals are actually delivered, but
76 * matching generated signals and delivered signals may not be correct.
77 */
78TRACE_EVENT(signal_deliver,
79
80	TP_PROTO(int sig, struct siginfo *info, struct k_sigaction *ka),
81
82	TP_ARGS(sig, info, ka),
83
84	TP_STRUCT__entry(
85		__field(	int,		sig		)
86		__field(	int,		errno		)
87		__field(	int,		code		)
88		__field(	unsigned long,	sa_handler	)
89		__field(	unsigned long,	sa_flags	)
90	),
91
92	TP_fast_assign(
93		__entry->sig	= sig;
94		TP_STORE_SIGINFO(__entry, info);
95		__entry->sa_handler	= (unsigned long)ka->sa.sa_handler;
96		__entry->sa_flags	= ka->sa.sa_flags;
97	),
98
99	TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx",
100		  __entry->sig, __entry->errno, __entry->code,
101		  __entry->sa_handler, __entry->sa_flags)
102);
103
104DECLARE_EVENT_CLASS(signal_queue_overflow,
105
106	TP_PROTO(int sig, int group, struct siginfo *info),
107
108	TP_ARGS(sig, group, info),
109
110	TP_STRUCT__entry(
111		__field(	int,	sig	)
112		__field(	int,	group	)
113		__field(	int,	errno	)
114		__field(	int,	code	)
115	),
116
117	TP_fast_assign(
118		__entry->sig	= sig;
119		__entry->group	= group;
120		TP_STORE_SIGINFO(__entry, info);
121	),
122
123	TP_printk("sig=%d group=%d errno=%d code=%d",
124		  __entry->sig, __entry->group, __entry->errno, __entry->code)
125);
126
127/**
128 * signal_overflow_fail - called when signal queue is overflow
129 * @sig: signal number
130 * @group: signal to process group or not (bool)
131 * @info: pointer to struct siginfo
132 *
133 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
134 * siginfo queue is overflow, and the signal is dropped.
135 * 'group' is not 0 if the signal will be sent to a process group.
136 * 'sig' is always one of RT signals.
137 */
138DEFINE_EVENT(signal_queue_overflow, signal_overflow_fail,
139
140	TP_PROTO(int sig, int group, struct siginfo *info),
141
142	TP_ARGS(sig, group, info)
143);
144
145/**
146 * signal_lose_info - called when siginfo is lost
147 * @sig: signal number
148 * @group: signal to process group or not (bool)
149 * @info: pointer to struct siginfo
150 *
151 * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo
152 * queue is overflow.
153 * 'group' is not 0 if the signal will be sent to a process group.
154 * 'sig' is always one of non-RT signals.
155 */
156DEFINE_EVENT(signal_queue_overflow, signal_lose_info,
157
158	TP_PROTO(int sig, int group, struct siginfo *info),
159
160	TP_ARGS(sig, group, info)
161);
162
163#endif /* _TRACE_SIGNAL_H */
164
165/* This part must be outside protection */
166#include <trace/define_trace.h>
167