| 1 |
/* variant of autoconf_utrace_via_tracepoints.c post |
| 2 |
kernel commit 3e816361e94a0e79b1aabf44abec552e9698b196 |
| 3 |
adding group_dead argument to sched_process_exit */ |
| 4 |
|
| 5 |
#include <linux/mm.h> |
| 6 |
#include <trace/events/sched.h> |
| 7 |
#include <trace/events/syscalls.h> |
| 8 |
#include <linux/task_work.h> |
| 9 |
|
| 10 |
// The utrace-less task_finder needs 5 specific tracepoints and |
| 11 |
// <linux/task_work.h>. |
| 12 |
|
| 13 |
// NB: in kernels which do have the requisite pieces, just unconfigured, then |
| 14 |
// everything below will compile just fine, only returning ENOSYS at runtime. |
| 15 |
// To get the compile-time error that autoconf needs, check it directly: |
| 16 |
#ifndef CONFIG_TRACEPOINTS |
| 17 |
#error "CONFIG_TRACEPOINTS is not enabled" |
| 18 |
#endif |
| 19 |
|
| 20 |
void __sched_process_fork(void *cb_data __attribute__((unused)), |
| 21 |
struct task_struct *parent __attribute__((unused)), |
| 22 |
struct task_struct *child __attribute__((unused))); |
| 23 |
|
| 24 |
void __sched_process_fork(void *cb_data __attribute__((unused)), |
| 25 |
struct task_struct *parent __attribute__((unused)), |
| 26 |
struct task_struct *child __attribute__((unused))) |
| 27 |
{ |
| 28 |
return; |
| 29 |
} |
| 30 |
|
| 31 |
void __sched_process_exit(void *cb_data __attribute__((unused)), |
| 32 |
struct task_struct *task __attribute__((unused)), |
| 33 |
bool group_dead __attribute__((unused))); |
| 34 |
void __sched_process_exit(void *cb_data __attribute__((unused)), |
| 35 |
struct task_struct *task __attribute__((unused)), |
| 36 |
bool group_dead __attribute__((unused))) |
| 37 |
{ |
| 38 |
return; |
| 39 |
} |
| 40 |
|
| 41 |
void __sched_process_exec(void *cb_data __attribute__ ((unused)), |
| 42 |
struct task_struct *task __attribute__((unused)), |
| 43 |
pid_t old_pid __attribute__((unused)), |
| 44 |
struct linux_binprm *bprm __attribute__((unused))); |
| 45 |
void __sched_process_exec(void *cb_data __attribute__ ((unused)), |
| 46 |
struct task_struct *task __attribute__((unused)), |
| 47 |
pid_t old_pid __attribute__((unused)), |
| 48 |
struct linux_binprm *bprm __attribute__((unused))) |
| 49 |
{ |
| 50 |
return; |
| 51 |
} |
| 52 |
|
| 53 |
void __sys_enter(void *cb_data __attribute__ ((unused)), |
| 54 |
struct pt_regs *regs __attribute__((unused)), |
| 55 |
long id __attribute__((unused))); |
| 56 |
void __sys_enter(void *cb_data __attribute__ ((unused)), |
| 57 |
struct pt_regs *regs __attribute__((unused)), |
| 58 |
long id __attribute__((unused))) |
| 59 |
{ |
| 60 |
return; |
| 61 |
} |
| 62 |
|
| 63 |
void __sys_exit(void *cb_data __attribute__ ((unused)), |
| 64 |
struct pt_regs *regs __attribute__((unused)), |
| 65 |
long ret __attribute__((unused))); |
| 66 |
void __sys_exit(void *cb_data __attribute__ ((unused)), |
| 67 |
struct pt_regs *regs __attribute__((unused)), |
| 68 |
long ret __attribute__((unused))) |
| 69 |
{ |
| 70 |
return; |
| 71 |
} |
| 72 |
|
| 73 |
void __autoconf_func(void); |
| 74 |
void __autoconf_func(void) |
| 75 |
{ |
| 76 |
(void) register_trace_sched_process_fork(__sched_process_fork, NULL); |
| 77 |
(void) register_trace_sched_process_exit(__sched_process_exit, NULL); |
| 78 |
(void) register_trace_sched_process_exec(__sched_process_exec, NULL); |
| 79 |
(void) register_trace_sys_enter(__sys_enter, NULL); |
| 80 |
(void) register_trace_sys_exit(__sys_exit, NULL); |
| 81 |
} |