...
Text file
src/syscall/mksysnum_netbsd.pl
Documentation: syscall
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
9use strict;
10
11my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV);
12
13print <<EOF;
14// $command
15// Code generated by the command above; DO NOT EDIT.
16
17package syscall
18
19const (
20EOF
21
22my $line = '';
23while(<>){
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
49print <<EOF;
50)
51EOF
View as plain text