Masami Hiramatsu | d1eb650 | 2009-11-24 16:56:45 -0500 | [diff] [blame^] | 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 | __entry->errno = 0; \ |
| 15 | __entry->code = SI_USER; \ |
| 16 | } else if (info == SEND_SIG_PRIV) { \ |
| 17 | __entry->errno = 0; \ |
| 18 | __entry->code = SI_KERNEL; \ |
| 19 | } else { \ |
| 20 | __entry->errno = info->si_errno; \ |
| 21 | __entry->code = info->si_code; \ |
| 22 | } \ |
| 23 | } while (0) |
| 24 | |
| 25 | /** |
| 26 | * signal_generate - called when a signal is generated |
| 27 | * @sig: signal number |
| 28 | * @info: pointer to struct siginfo |
| 29 | * @task: pointer to struct task_struct |
| 30 | * |
| 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. |
| 36 | */ |
| 37 | TRACE_EVENT(signal_generate, |
| 38 | |
| 39 | TP_PROTO(int sig, struct siginfo *info, struct task_struct *task), |
| 40 | |
| 41 | TP_ARGS(sig, info, task), |
| 42 | |
| 43 | TP_STRUCT__entry( |
| 44 | __field( int, sig ) |
| 45 | __field( int, errno ) |
| 46 | __field( int, code ) |
| 47 | __array( char, comm, TASK_COMM_LEN ) |
| 48 | __field( pid_t, pid ) |
| 49 | ), |
| 50 | |
| 51 | TP_fast_assign( |
| 52 | __entry->sig = sig; |
| 53 | TP_STORE_SIGINFO(__entry, info); |
| 54 | memcpy(__entry->comm, task->comm, TASK_COMM_LEN); |
| 55 | __entry->pid = task->pid; |
| 56 | ), |
| 57 | |
| 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) |
| 61 | ); |
| 62 | |
| 63 | #endif /* _TRACE_SIGNAL_H */ |
| 64 | |
| 65 | /* This part must be outside protection */ |
| 66 | #include <trace/define_trace.h> |