2 ($arch, $file) = @ARGV;
4 if (!open(FILE, "< $file")) {
5 print STDERR "$file: $!\n";
9 while ( defined($line = <FILE>) ) {
11 $line =~ s/\s*\#.*$//; # Strip comments and trailing blanks
14 if ( $line =~ /^\s*(\<[^\>]+\>\s+|)([^\(\<\>]+[^\@\:A-Za-z0-9_])([A-Za-z0-9_]+)(|\@[A-Za-z0-9_]+)(|\:\:[A-Za-z0-9_]+)\s*\(([^\:\)]*)\)\s*$/ ) {
24 die "$0: Internal error"
25 unless ( $archs =~ /^\<(|\!)([^\>\!]+)\>/ );
29 $doit = ($not eq '') ? 0 : 1;
31 @list = split(/,/, $list);
32 foreach $a ( @list ) {
34 $doit = ($not eq '') ? 1 : 0;
51 @args = split(/\s*\,\s*/, $argv);
53 open(OUT, "> syscalls/${fname}.c")
54 or die "$0: Cannot open syscalls/${fname}.c\n";
56 if ( $fname eq "rt_sigaction") {
57 print OUT "#ifdef __x86_64__\n\n";
58 print OUT "struct sigaction;\n\n";
59 print OUT "#endif\n\n"
62 print OUT "#include \"syscommon.h\"\n\n";
64 if ( $fname ne $sname ) {
65 print OUT "#undef __NR_${fname}\n";
66 print OUT "#define __NR_${fname} __NR_${sname}\n\n";
69 print OUT "_syscall", scalar(@args), $stype, "(", $type, ',', $fname;
72 foreach $arg ( @args ) {
73 print OUT ",", $arg, ",a",$i++;
78 print STDERR "$file:$.: Could not parse input\n";