...

Text file src/syscall/mksysnum_openbsd.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_openbsd.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
    22while(<>){
    23	if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?(\{ \S+\s+\*?(\w+).*)$/){
    24		my $num = $1;
    25		my $proto = $3;
    26		my $name = $4;
    27		$name =~ y/a-z/A-Z/;
    28
    29		# There are multiple entries for enosys and nosys, so comment them out.
    30		if($name =~ /^SYS_E?NOSYS$/){
    31			$name = "// $name";
    32		}
    33		if($name eq 'SYS_SYS_EXIT'){
    34			$name = 'SYS_EXIT';
    35		}
    36
    37		print "	$name = $num;  // $proto\n";
    38	}
    39}
    40
    41print <<EOF;
    42)
    43EOF

View as plain text