diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-06 12:00:33 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-06 12:00:33 -0500 |
commit | 3d14b5beba35250c548d3851a2b84fce742d8311 (patch) | |
tree | 065e3d93c3fcbc5ee4c44fa78662393cddbdf6de /include/linux/syscalls.h | |
parent | 0719dc341389882cc834ed18fc9b7fc6006b2b85 (diff) | |
parent | 1bf8e6219552d5dd27012d567ec8c4bb9c2d86b4 (diff) |
Merge branch 'sa1100' into devel
Diffstat (limited to 'include/linux/syscalls.h')
-rw-r--r-- | include/linux/syscalls.h | 77 |
1 files changed, 14 insertions, 63 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index a990ace1a838..e79e2f3ccc51 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -99,37 +99,16 @@ struct perf_event_attr; | |||
99 | #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) | 99 | #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) |
100 | 100 | ||
101 | #ifdef CONFIG_EVENT_PROFILE | 101 | #ifdef CONFIG_EVENT_PROFILE |
102 | #define TRACE_SYS_ENTER_PROFILE(sname) \ | ||
103 | static int prof_sysenter_enable_##sname(void) \ | ||
104 | { \ | ||
105 | return reg_prof_syscall_enter("sys"#sname); \ | ||
106 | } \ | ||
107 | \ | ||
108 | static void prof_sysenter_disable_##sname(void) \ | ||
109 | { \ | ||
110 | unreg_prof_syscall_enter("sys"#sname); \ | ||
111 | } | ||
112 | |||
113 | #define TRACE_SYS_EXIT_PROFILE(sname) \ | ||
114 | static int prof_sysexit_enable_##sname(void) \ | ||
115 | { \ | ||
116 | return reg_prof_syscall_exit("sys"#sname); \ | ||
117 | } \ | ||
118 | \ | ||
119 | static void prof_sysexit_disable_##sname(void) \ | ||
120 | { \ | ||
121 | unreg_prof_syscall_exit("sys"#sname); \ | ||
122 | } | ||
123 | 102 | ||
124 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) \ | 103 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) \ |
125 | .profile_count = ATOMIC_INIT(-1), \ | 104 | .profile_count = ATOMIC_INIT(-1), \ |
126 | .profile_enable = prof_sysenter_enable_##sname, \ | 105 | .profile_enable = prof_sysenter_enable, \ |
127 | .profile_disable = prof_sysenter_disable_##sname, | 106 | .profile_disable = prof_sysenter_disable, |
128 | 107 | ||
129 | #define TRACE_SYS_EXIT_PROFILE_INIT(sname) \ | 108 | #define TRACE_SYS_EXIT_PROFILE_INIT(sname) \ |
130 | .profile_count = ATOMIC_INIT(-1), \ | 109 | .profile_count = ATOMIC_INIT(-1), \ |
131 | .profile_enable = prof_sysexit_enable_##sname, \ | 110 | .profile_enable = prof_sysexit_enable, \ |
132 | .profile_disable = prof_sysexit_disable_##sname, | 111 | .profile_disable = prof_sysexit_disable, |
133 | #else | 112 | #else |
134 | #define TRACE_SYS_ENTER_PROFILE(sname) | 113 | #define TRACE_SYS_ENTER_PROFILE(sname) |
135 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) | 114 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) |
@@ -153,74 +132,46 @@ static void prof_sysexit_disable_##sname(void) \ | |||
153 | #define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) | 132 | #define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) |
154 | 133 | ||
155 | #define SYSCALL_TRACE_ENTER_EVENT(sname) \ | 134 | #define SYSCALL_TRACE_ENTER_EVENT(sname) \ |
135 | static const struct syscall_metadata __syscall_meta_##sname; \ | ||
156 | static struct ftrace_event_call event_enter_##sname; \ | 136 | static struct ftrace_event_call event_enter_##sname; \ |
157 | struct trace_event enter_syscall_print_##sname = { \ | 137 | static struct trace_event enter_syscall_print_##sname = { \ |
158 | .trace = print_syscall_enter, \ | 138 | .trace = print_syscall_enter, \ |
159 | }; \ | 139 | }; \ |
160 | static int init_enter_##sname(void) \ | ||
161 | { \ | ||
162 | int num, id; \ | ||
163 | num = syscall_name_to_nr("sys"#sname); \ | ||
164 | if (num < 0) \ | ||
165 | return -ENOSYS; \ | ||
166 | id = register_ftrace_event(&enter_syscall_print_##sname);\ | ||
167 | if (!id) \ | ||
168 | return -ENODEV; \ | ||
169 | event_enter_##sname.id = id; \ | ||
170 | set_syscall_enter_id(num, id); \ | ||
171 | INIT_LIST_HEAD(&event_enter_##sname.fields); \ | ||
172 | return 0; \ | ||
173 | } \ | ||
174 | TRACE_SYS_ENTER_PROFILE(sname); \ | ||
175 | static struct ftrace_event_call __used \ | 140 | static struct ftrace_event_call __used \ |
176 | __attribute__((__aligned__(4))) \ | 141 | __attribute__((__aligned__(4))) \ |
177 | __attribute__((section("_ftrace_events"))) \ | 142 | __attribute__((section("_ftrace_events"))) \ |
178 | event_enter_##sname = { \ | 143 | event_enter_##sname = { \ |
179 | .name = "sys_enter"#sname, \ | 144 | .name = "sys_enter"#sname, \ |
180 | .system = "syscalls", \ | 145 | .system = "syscalls", \ |
181 | .event = &event_syscall_enter, \ | 146 | .event = &enter_syscall_print_##sname, \ |
182 | .raw_init = init_enter_##sname, \ | 147 | .raw_init = init_syscall_trace, \ |
183 | .show_format = syscall_enter_format, \ | 148 | .show_format = syscall_enter_format, \ |
184 | .define_fields = syscall_enter_define_fields, \ | 149 | .define_fields = syscall_enter_define_fields, \ |
185 | .regfunc = reg_event_syscall_enter, \ | 150 | .regfunc = reg_event_syscall_enter, \ |
186 | .unregfunc = unreg_event_syscall_enter, \ | 151 | .unregfunc = unreg_event_syscall_enter, \ |
187 | .data = "sys"#sname, \ | 152 | .data = (void *)&__syscall_meta_##sname,\ |
188 | TRACE_SYS_ENTER_PROFILE_INIT(sname) \ | 153 | TRACE_SYS_ENTER_PROFILE_INIT(sname) \ |
189 | } | 154 | } |
190 | 155 | ||
191 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ | 156 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ |
157 | static const struct syscall_metadata __syscall_meta_##sname; \ | ||
192 | static struct ftrace_event_call event_exit_##sname; \ | 158 | static struct ftrace_event_call event_exit_##sname; \ |
193 | struct trace_event exit_syscall_print_##sname = { \ | 159 | static struct trace_event exit_syscall_print_##sname = { \ |
194 | .trace = print_syscall_exit, \ | 160 | .trace = print_syscall_exit, \ |
195 | }; \ | 161 | }; \ |
196 | static int init_exit_##sname(void) \ | ||
197 | { \ | ||
198 | int num, id; \ | ||
199 | num = syscall_name_to_nr("sys"#sname); \ | ||
200 | if (num < 0) \ | ||
201 | return -ENOSYS; \ | ||
202 | id = register_ftrace_event(&exit_syscall_print_##sname);\ | ||
203 | if (!id) \ | ||
204 | return -ENODEV; \ | ||
205 | event_exit_##sname.id = id; \ | ||
206 | set_syscall_exit_id(num, id); \ | ||
207 | INIT_LIST_HEAD(&event_exit_##sname.fields); \ | ||
208 | return 0; \ | ||
209 | } \ | ||
210 | TRACE_SYS_EXIT_PROFILE(sname); \ | ||
211 | static struct ftrace_event_call __used \ | 162 | static struct ftrace_event_call __used \ |
212 | __attribute__((__aligned__(4))) \ | 163 | __attribute__((__aligned__(4))) \ |
213 | __attribute__((section("_ftrace_events"))) \ | 164 | __attribute__((section("_ftrace_events"))) \ |
214 | event_exit_##sname = { \ | 165 | event_exit_##sname = { \ |
215 | .name = "sys_exit"#sname, \ | 166 | .name = "sys_exit"#sname, \ |
216 | .system = "syscalls", \ | 167 | .system = "syscalls", \ |
217 | .event = &event_syscall_exit, \ | 168 | .event = &exit_syscall_print_##sname, \ |
218 | .raw_init = init_exit_##sname, \ | 169 | .raw_init = init_syscall_trace, \ |
219 | .show_format = syscall_exit_format, \ | 170 | .show_format = syscall_exit_format, \ |
220 | .define_fields = syscall_exit_define_fields, \ | 171 | .define_fields = syscall_exit_define_fields, \ |
221 | .regfunc = reg_event_syscall_exit, \ | 172 | .regfunc = reg_event_syscall_exit, \ |
222 | .unregfunc = unreg_event_syscall_exit, \ | 173 | .unregfunc = unreg_event_syscall_exit, \ |
223 | .data = "sys"#sname, \ | 174 | .data = (void *)&__syscall_meta_##sname,\ |
224 | TRACE_SYS_EXIT_PROFILE_INIT(sname) \ | 175 | TRACE_SYS_EXIT_PROFILE_INIT(sname) \ |
225 | } | 176 | } |
226 | 177 | ||