mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Move code-generation scripts to scripts/codegen
Now that we have a scripts/* directory, let's put the scripts we use for generating C there.
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
my %syscalls = ();
|
||||
|
||||
while (<>) {
|
||||
if (/^#define (__NR_\w+) /) {
|
||||
$syscalls{$1} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOL;
|
||||
/* Automatically generated with
|
||||
gen_linux_syscalls.pl /usr/include/asm/unistd*.h
|
||||
Do not edit.
|
||||
*/
|
||||
static const struct {
|
||||
int syscall_num; const char *syscall_name;
|
||||
} SYSCALLS_BY_NUMBER[] = {
|
||||
EOL
|
||||
|
||||
for my $k (sort keys %syscalls) {
|
||||
my $name = $k;
|
||||
$name =~ s/^__NR_//;
|
||||
print <<EOL;
|
||||
#ifdef $k
|
||||
{ $k, "$name" },
|
||||
#endif
|
||||
EOL
|
||||
|
||||
}
|
||||
|
||||
print <<EOL
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
EOL
|
||||
Reference in New Issue
Block a user