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