Merge branch 'maint-0.4.6'
[tor.git] / scripts / codegen / gen_linux_syscalls.pl
blobf985bad6c99d8df5f3a09270a6abad369df5b1e9
1 #!/usr/bin/perl -w
3 use strict;
4 my %syscalls = ();
6 while (<>) {
7 if (/^#define (__NR_\w+) /) {
8 $syscalls{$1} = 1;
12 print <<EOL;
13 /* Automatically generated with
14 gen_linux_syscalls.pl /usr/include/asm/unistd*.h
15 Do not edit.
17 static const struct {
18 int syscall_num; const char *syscall_name;
19 } SYSCALLS_BY_NUMBER[] = {
20 EOL
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
33 print <<EOL
34 {0, NULL}
37 EOL