Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
0ec73ddc MD |
2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM signal | |
4 | ||
3bc29f0a MD |
5 | #if !defined(LTTNG_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ) |
6 | #define LTTNG_TRACE_SIGNAL_H | |
0ec73ddc | 7 | |
6ec43db8 | 8 | #include <probes/lttng-tracepoint-event.h> |
0ec73ddc MD |
9 | |
10 | #ifndef _TRACE_SIGNAL_DEF | |
11 | #define _TRACE_SIGNAL_DEF | |
12 | #include <linux/signal.h> | |
13 | #include <linux/sched.h> | |
f127e61e | 14 | #undef LTTNG_FIELDS_SIGINFO |
cef5d79e MJ |
15 | #define LTTNG_FIELDS_SIGINFO(info) \ |
16 | ctf_integer(int, errno, \ | |
17 | (info == SEND_SIG_NOINFO || info == SEND_SIG_PRIV) ? \ | |
18 | 0 : \ | |
19 | info->si_errno) \ | |
20 | ctf_integer(int, code, \ | |
21 | (info == SEND_SIG_NOINFO) ? \ | |
22 | SI_USER : \ | |
23 | ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code)) | |
0ec73ddc MD |
24 | #endif /* _TRACE_SIGNAL_DEF */ |
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 | */ | |
3bc29f0a | 38 | LTTNG_TRACEPOINT_EVENT(signal_generate, |
0ec73ddc | 39 | |
b90a7f30 MJ |
40 | TP_PROTO(int sig, struct kernel_siginfo *info, struct task_struct *task, |
41 | int group, int result), | |
0ec73ddc | 42 | |
b90a7f30 | 43 | TP_ARGS(sig, info, task, group, result), |
0ec73ddc | 44 | |
f127e61e MD |
45 | TP_FIELDS( |
46 | ctf_integer(int, sig, sig) | |
47 | LTTNG_FIELDS_SIGINFO(info) | |
48 | ctf_array_text(char, comm, task->comm, TASK_COMM_LEN) | |
49 | ctf_integer(pid_t, pid, task->pid) | |
b90a7f30 MJ |
50 | ctf_integer(int, group, group) |
51 | ctf_integer(int, result, result) | |
f127e61e | 52 | ) |
0ec73ddc MD |
53 | ) |
54 | ||
55 | /** | |
56 | * signal_deliver - called when a signal is delivered | |
57 | * @sig: signal number | |
58 | * @info: pointer to struct siginfo | |
59 | * @ka: pointer to struct k_sigaction | |
60 | * | |
61 | * A 'sig' signal is delivered to current process with 'info' siginfo, | |
62 | * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or | |
63 | * SIG_DFL. | |
64 | * Note that some signals reported by signal_generate tracepoint can be | |
65 | * lost, ignored or modified (by debugger) before hitting this tracepoint. | |
66 | * This means, this can show which signals are actually delivered, but | |
67 | * matching generated signals and delivered signals may not be correct. | |
68 | */ | |
b90a7f30 MJ |
69 | LTTNG_TRACEPOINT_EVENT(signal_deliver, |
70 | ||
71 | TP_PROTO(int sig, struct kernel_siginfo *info, struct k_sigaction *ka), | |
72 | ||
73 | TP_ARGS(sig, info, ka), | |
74 | ||
75 | TP_FIELDS( | |
76 | ctf_integer(int, sig, sig) | |
77 | LTTNG_FIELDS_SIGINFO(info) | |
78 | ctf_integer(unsigned long, sa_handler, (unsigned long) ka->sa.sa_handler) | |
79 | ctf_integer(unsigned long, sa_flags, ka->sa.sa_flags) | |
80 | ) | |
81 | ) | |
0ec73ddc | 82 | |
3bc29f0a | 83 | #endif /* LTTNG_TRACE_SIGNAL_H */ |
0ec73ddc MD |
84 | |
85 | /* This part must be outside protection */ | |
6ec43db8 | 86 | #include <probes/define_trace.h> |