...

Text file src/syscall/mksysnum_netbsd.pl

     1	#!/usr/bin/env perl
     2	# Copyright 2009 The Go Authors. All rights reserved.
     3	# Use of this source code is governed by a BSD-style
     4	# license that can be found in the LICENSE file.
     5	#
     6	# Generate system call table for OpenBSD from master list
     7	# (for example, /usr/src/sys/kern/syscalls.master).
     8	
     9	use strict;
    10	
    11	my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV);
    12	
    13	print <<EOF;
    14	// $command
    15	// Code generated by the command above; DO NOT EDIT.
    16	
    17	package syscall
    18	
    19	const (
    20	EOF
    21	
    22	my $line = '';
    23	while(<>){
    24		if($line =~ /^(.*)\\$/) {
    25			# Handle continuation
    26			$line = $1;
    27			$_ =~ s/^\s+//;
    28			$line .= $_;
    29		} else {
    30			# New line
    31			$line = $_;
    32		}
    33		next if $line =~ /\\$/;
    34		if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) {
    35			my $num = $1;
    36			my $proto = $6;
    37			my $compat = $8;
    38			my $name = "$7_$9";
    39	
    40			$name = "$7_$11" if $11 ne '';
    41			$name =~ y/a-z/A-Z/;
    42	
    43			if($compat eq '' || $compat eq '30' || $compat eq '50') {
    44				print "	$name = $num;  // $proto\n";
    45			}
    46		}
    47	}
    48	
    49	print <<EOF;
    50	)
    51	EOF

View as plain text