diff options
Diffstat (limited to 'src/fsec-print/syscall_list.c')
-rw-r--r-- | src/fsec-print/syscall_list.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/fsec-print/syscall_list.c b/src/fsec-print/syscall_list.c new file mode 100644 index 000000000..410956de5 --- /dev/null +++ b/src/fsec-print/syscall_list.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014-2017 Firejail Authors | ||
3 | * | ||
4 | * This file is part of firejail project | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | #include "fsec_print.h" | ||
21 | #include <sys/syscall.h> | ||
22 | |||
23 | typedef struct { | ||
24 | const char * const name; | ||
25 | int nr; | ||
26 | } SyscallEntry; | ||
27 | |||
28 | static const SyscallEntry syslist[] = { | ||
29 | // | ||
30 | // code generated using tools/extract-syscall | ||
31 | // | ||
32 | #include "../include/syscall.h" | ||
33 | // | ||
34 | // end of generated code | ||
35 | // | ||
36 | }; // end of syslist | ||
37 | |||
38 | const char *syscall_find_nr(int nr) { | ||
39 | int i; | ||
40 | int elems = sizeof(syslist) / sizeof(syslist[0]); | ||
41 | for (i = 0; i < elems; i++) { | ||
42 | if (nr == syslist[i].nr) | ||
43 | return syslist[i].name; | ||
44 | } | ||
45 | |||
46 | return NULL; | ||
47 | } | ||