repo.or.cz
/
tor.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Merge branch 'fix-apt-syntax' into 'main'
[tor.git]
/
scripts
/
codegen
/
gen_linux_syscalls.pl
blob
f985bad6c99d8df5f3a09270a6abad369df5b1e9
1
#!/usr/bin/perl -w
2
3
use
strict
;
4
my
%syscalls
= ();
5
6
while
(<>) {
7
if
(
/^#define (__NR_\w+) /
) {
8
$syscalls
{
$1
} =
1
;
9
}
10
}
11
12
print
<<EOL;
13
/* Automatically generated with
14
gen_linux_syscalls.pl /usr/include/asm/unistd*.h
15
Do not edit.
16
*/
17
static const struct {
18
int syscall_num; const char *syscall_name;
19
} SYSCALLS_BY_NUMBER[] = {
20
EOL
21
22
for
my
$k
(
sort keys
%syscalls
) {
23
my
$name
=
$k
;
24
$name
=~
s/^__NR_//
;
25
print
<<EOL;
26
#ifdef
$k
27
{
$k
, "
$name
" },
28
#endif
29
EOL
30
31
}
32
33
print
<<EOL
34
{0, NULL}
35
};
36
37
EOL