-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf trace: Move syscall table id <-> name routines to separate class
We're using libaudit for doing name to id and id to syscall name translations, but that makes 'perf trace' to have to wait for newer libaudit versions supporting recently added syscalls, such as "userfaultfd" at the time of this changeset. We have all the information right there, in the kernel sources, so move this code to a separate place, wrapped behind functions that will progressively use the kernel source files to extract the syscall table for use in 'perf trace'. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-i38opd09ow25mmyrvfwnbvkj@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Loading branch information
Arnaldo Carvalho de Melo
committed
Apr 8, 2016
1 parent
ba2f22c
commit fd0db10
Showing
4 changed files
with
71 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* System call table mapper | ||
* | ||
* (C) 2016 Arnaldo Carvalho de Melo <acme@redhat.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
*/ | ||
|
||
#include "syscalltbl.h" | ||
#include <string.h> | ||
#include <libaudit.h> | ||
|
||
|
||
struct syscalltbl *syscalltbl__new(void) | ||
{ | ||
struct syscalltbl *tbl = malloc(sizeof(*tbl)); | ||
if (tbl) { | ||
tbl->audit_machine = audit_detect_machine(); | ||
} | ||
return tbl; | ||
} | ||
|
||
void syscalltbl__delete(struct syscalltbl *tbl) | ||
{ | ||
free(tbl); | ||
} | ||
|
||
const char *syscalltbl__name(const struct syscalltbl *tbl, int id) | ||
{ | ||
return audit_syscall_to_name(id, tbl->audit_machine); | ||
} | ||
|
||
int syscalltbl__id(struct syscalltbl *tbl, const char *name) | ||
{ | ||
return audit_name_to_syscall(name, tbl->audit_machine); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef __PERF_SYSCALLTBL_H | ||
#define __PERF_SYSCALLTBL_H | ||
|
||
struct syscalltbl { | ||
union { | ||
int audit_machine; | ||
}; | ||
}; | ||
|
||
struct syscalltbl *syscalltbl__new(void); | ||
void syscalltbl__delete(struct syscalltbl *tbl); | ||
|
||
const char *syscalltbl__name(const struct syscalltbl *tbl, int id); | ||
int syscalltbl__id(struct syscalltbl *tbl, const char *name); | ||
|
||
#endif /* __PERF_SYSCALLTBL_H */ |