@@ -220,6 +220,29 @@ struct syscall_metadata *syscall_nr_to_meta(int nr)
220
220
return syscalls_metadata [nr ];
221
221
}
222
222
223
+ int syscall_name_to_nr (char * name )
224
+ {
225
+ int i ;
226
+
227
+ if (!syscalls_metadata )
228
+ return -1 ;
229
+ for (i = 0 ; i < NR_syscalls ; i ++ )
230
+ if (syscalls_metadata [i ])
231
+ if (!strcmp (syscalls_metadata [i ]-> name , name ))
232
+ return i ;
233
+ return -1 ;
234
+ }
235
+
236
+ void set_syscall_enter_id (int num , int id )
237
+ {
238
+ syscalls_metadata [num ]-> enter_id = id ;
239
+ }
240
+
241
+ void set_syscall_exit_id (int num , int id )
242
+ {
243
+ syscalls_metadata [num ]-> exit_id = id ;
244
+ }
245
+
223
246
static struct syscall_metadata * find_syscall_meta (unsigned long syscall )
224
247
{
225
248
struct syscall_metadata * start ;
@@ -237,24 +260,19 @@ static struct syscall_metadata *find_syscall_meta(unsigned long syscall)
237
260
return NULL ;
238
261
}
239
262
240
- void arch_init_ftrace_syscalls (void )
263
+ static int __init arch_init_ftrace_syscalls (void )
241
264
{
242
265
struct syscall_metadata * meta ;
243
266
int i ;
244
- static atomic_t refs ;
245
-
246
- if (atomic_inc_return (& refs ) != 1 )
247
- goto out ;
248
267
syscalls_metadata = kzalloc (sizeof (* syscalls_metadata ) * NR_syscalls ,
249
268
GFP_KERNEL );
250
269
if (!syscalls_metadata )
251
- goto out ;
270
+ return - ENOMEM ;
252
271
for (i = 0 ; i < NR_syscalls ; i ++ ) {
253
272
meta = find_syscall_meta ((unsigned long )sys_call_table [i ]);
254
273
syscalls_metadata [i ] = meta ;
255
274
}
256
- return ;
257
- out :
258
- atomic_dec (& refs );
275
+ return 0 ;
259
276
}
277
+ arch_initcall (arch_init_ftrace_syscalls );
260
278
#endif
0 commit comments