head 1.5; access; symbols pkgsrc-2026Q1:1.5.0.72 pkgsrc-2026Q1-base:1.5 pkgsrc-2025Q4:1.5.0.70 pkgsrc-2025Q4-base:1.5 pkgsrc-2025Q3:1.5.0.68 pkgsrc-2025Q3-base:1.5 pkgsrc-2025Q2:1.5.0.66 pkgsrc-2025Q2-base:1.5 pkgsrc-2025Q1:1.5.0.64 pkgsrc-2025Q1-base:1.5 pkgsrc-2024Q4:1.5.0.62 pkgsrc-2024Q4-base:1.5 pkgsrc-2024Q3:1.5.0.60 pkgsrc-2024Q3-base:1.5 pkgsrc-2024Q2:1.5.0.58 pkgsrc-2024Q2-base:1.5 pkgsrc-2024Q1:1.5.0.56 pkgsrc-2024Q1-base:1.5 pkgsrc-2023Q4:1.5.0.54 pkgsrc-2023Q4-base:1.5 pkgsrc-2023Q3:1.5.0.52 pkgsrc-2023Q3-base:1.5 pkgsrc-2023Q2:1.5.0.50 pkgsrc-2023Q2-base:1.5 pkgsrc-2023Q1:1.5.0.48 pkgsrc-2023Q1-base:1.5 pkgsrc-2022Q4:1.5.0.46 pkgsrc-2022Q4-base:1.5 pkgsrc-2022Q3:1.5.0.44 pkgsrc-2022Q3-base:1.5 pkgsrc-2022Q2:1.5.0.42 pkgsrc-2022Q2-base:1.5 pkgsrc-2022Q1:1.5.0.40 pkgsrc-2022Q1-base:1.5 pkgsrc-2021Q4:1.5.0.38 pkgsrc-2021Q4-base:1.5 pkgsrc-2021Q3:1.5.0.36 pkgsrc-2021Q3-base:1.5 pkgsrc-2021Q2:1.5.0.34 pkgsrc-2021Q2-base:1.5 pkgsrc-2021Q1:1.5.0.32 pkgsrc-2021Q1-base:1.5 pkgsrc-2020Q4:1.5.0.30 pkgsrc-2020Q4-base:1.5 pkgsrc-2020Q3:1.5.0.28 pkgsrc-2020Q3-base:1.5 pkgsrc-2020Q2:1.5.0.24 pkgsrc-2020Q2-base:1.5 pkgsrc-2020Q1:1.5.0.4 pkgsrc-2020Q1-base:1.5 pkgsrc-2019Q4:1.5.0.26 pkgsrc-2019Q4-base:1.5 pkgsrc-2019Q3:1.5.0.22 pkgsrc-2019Q3-base:1.5 pkgsrc-2019Q2:1.5.0.20 pkgsrc-2019Q2-base:1.5 pkgsrc-2019Q1:1.5.0.18 pkgsrc-2019Q1-base:1.5 pkgsrc-2018Q4:1.5.0.16 pkgsrc-2018Q4-base:1.5 pkgsrc-2018Q3:1.5.0.14 pkgsrc-2018Q3-base:1.5 pkgsrc-2018Q2:1.5.0.12 pkgsrc-2018Q2-base:1.5 pkgsrc-2018Q1:1.5.0.10 pkgsrc-2018Q1-base:1.5 pkgsrc-2017Q4:1.5.0.8 pkgsrc-2017Q4-base:1.5 pkgsrc-2017Q3:1.5.0.6 pkgsrc-2017Q3-base:1.5 pkgsrc-2017Q2:1.5.0.2 pkgsrc-2017Q2-base:1.5 pkgsrc-2017Q1:1.4.0.46 pkgsrc-2017Q1-base:1.4 pkgsrc-2016Q4:1.4.0.44 pkgsrc-2016Q4-base:1.4 pkgsrc-2016Q3:1.4.0.42 pkgsrc-2016Q3-base:1.4 pkgsrc-2016Q2:1.4.0.40 pkgsrc-2016Q2-base:1.4 pkgsrc-2016Q1:1.4.0.38 pkgsrc-2016Q1-base:1.4 pkgsrc-2015Q4:1.4.0.36 pkgsrc-2015Q4-base:1.4 pkgsrc-2015Q3:1.4.0.34 pkgsrc-2015Q3-base:1.4 pkgsrc-2015Q2:1.4.0.32 pkgsrc-2015Q2-base:1.4 pkgsrc-2015Q1:1.4.0.30 pkgsrc-2015Q1-base:1.4 pkgsrc-2014Q4:1.4.0.28 pkgsrc-2014Q4-base:1.4 pkgsrc-2014Q3:1.4.0.26 pkgsrc-2014Q3-base:1.4 pkgsrc-2014Q2:1.4.0.24 pkgsrc-2014Q2-base:1.4 pkgsrc-2014Q1:1.4.0.22 pkgsrc-2014Q1-base:1.4 pkgsrc-2013Q4:1.4.0.20 pkgsrc-2013Q4-base:1.4 pkgsrc-2013Q3:1.4.0.18 pkgsrc-2013Q3-base:1.4 pkgsrc-2013Q2:1.4.0.16 pkgsrc-2013Q2-base:1.4 pkgsrc-2013Q1:1.4.0.14 pkgsrc-2013Q1-base:1.4 pkgsrc-2012Q4:1.4.0.12 pkgsrc-2012Q4-base:1.4 pkgsrc-2012Q3:1.4.0.10 pkgsrc-2012Q3-base:1.4 pkgsrc-2012Q2:1.4.0.8 pkgsrc-2012Q2-base:1.4 pkgsrc-2012Q1:1.4.0.6 pkgsrc-2012Q1-base:1.4 pkgsrc-2011Q4:1.4.0.4 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q3:1.4.0.2 pkgsrc-2011Q3-base:1.4 pkgsrc-2011Q2:1.2.0.22 pkgsrc-2011Q2-base:1.2 pkgsrc-2011Q1:1.2.0.20 pkgsrc-2011Q1-base:1.2 pkgsrc-2010Q4:1.2.0.18 pkgsrc-2010Q4-base:1.2 pkgsrc-2010Q3:1.2.0.16 pkgsrc-2010Q3-base:1.2 pkgsrc-2010Q2:1.2.0.14 pkgsrc-2010Q2-base:1.2 pkgsrc-2010Q1:1.2.0.12 pkgsrc-2010Q1-base:1.2 pkgsrc-2009Q4:1.2.0.10 pkgsrc-2009Q4-base:1.2 pkgsrc-2009Q3:1.2.0.8 pkgsrc-2009Q3-base:1.2 pkgsrc-2009Q2:1.2.0.6 pkgsrc-2009Q2-base:1.2 pkgsrc-2009Q1:1.2.0.4 pkgsrc-2009Q1-base:1.2 pkgsrc-2008Q4:1.2.0.2 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.1.0.16 pkgsrc-2008Q3-base:1.1 cube-native-xorg:1.1.0.14 cube-native-xorg-base:1.1 pkgsrc-2008Q2:1.1.0.12 pkgsrc-2008Q2-base:1.1 cwrapper:1.1.0.10 pkgsrc-2008Q1:1.1.0.8 pkgsrc-2008Q1-base:1.1 pkgsrc-2007Q4:1.1.0.6 pkgsrc-2007Q4-base:1.1 pkgsrc-2007Q3:1.1.0.4 pkgsrc-2007Q3-base:1.1 pkgsrc-2007Q2:1.1.0.2 pkgsrc-2007Q2-base:1.1; locks; strict; comment @# @; 1.5 date 2017.06.29.06.32.41; author wiz; state Exp; branches; next 1.4; commitid Aw2rziqdVClPBeXz; 1.4 date 2011.09.01.13.00.49; author christos; state Exp; branches; next 1.3; 1.3 date 2011.08.30.10.43.11; author christos; state Exp; branches; next 1.2; 1.2 date 2008.10.30.17.12.44; author christos; state Exp; branches; next 1.1; 1.1 date 2007.04.27.19.45.02; author christos; state Exp; branches; next ; desc @@ 1.5 log @Remove RCS Id from patch context. @ text @$NetBSD: patch-av,v 1.4 2011/09/01 13:00:49 christos Exp $ --- /dev/null 2011-09-01 15:59:46.000000000 +0300 +++ syscalls.pl 2011-09-01 15:59:28.000000000 +0300 @@@@ -0,0 +1,183 @@@@ +#!/usr/pkg/bin/perl -w +# +# Copyright (c) 2000, Gaël Roualland +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +#/ + +# Buils syscall.h and syscallent.h from: +# - syscalls.cat containing lines of format: syscall catmask +# - syscalls.print containing lines of format: syscall [printfunction] +# if no printfunction is provided, sys_ is used. +# - syscalls.master in the FreeBSD kernel source tree (/usr/src/sys/kern) + +use strict; +use POSIX; + +use vars qw(%sysprint %syscat); + +sub usage() { + print STDERR + "usage: $0 syscalls.master [] []\n"; + exit 1; +} + +sub readprint ($) { + my($fprint) = @@_; + + open (PRINT, "< $fprint") || die "can't open $fprint: $!"; + while() { + chomp; + s/^\s*//; + s/\s+$//; + s/#.*$//; + my($sys, $func) = split(/\s+/); + if (defined($sys)) { + if (defined($func)) { + $sysprint{$sys} = $func; + } else { + $sysprint{$sys} = "sys_$sys"; + } + } + } + close(PRINT); +} + +sub readcat ($) { + my($fcat) = @@_; + + open (CAT, "< $fcat") || die "can't open $fcat: $!"; + while() { + chomp; + s/^\s*//; + s/\s+$//; + s/#.*$//; + my($sys, $cat) = split(/\s+/); + $syscat{$sys} = $cat if (defined($sys) && defined($cat)); + } + close(CAT); +} + + +usage if (!defined($ARGV[0]) || defined($ARGV[3])); + +%sysprint = (); +readprint $ARGV[1] if defined $ARGV[1]; + +%syscat = (); +readcat $ARGV[2] if defined $ARGV[2]; + +open(MASTER, "< $ARGV[0]") || die "can't open $ARGV[0]: $!"; + +open(SYSCALL, "> syscall.h") || die "can't create syscall.h: $!"; + +print SYSCALL "/*\n * Automatically generated by $0 on " . ctime(time()) . " */\n\n"; +print "/*\n * Automatically generated by $0 on " . ctime(time()) . " */\n\n"; + +my $sysnum = 0; + +while () { + chomp; + # join broken lines + while (/\\$/) { + my $line; + s/\\$//; + $line = ; + chomp($line); + $_ = "$_$line"; + } + + if (/^(\d+)\s+(\w+)\s+\{\s*([^}]+)\s*\}([^}]*)$/ || + /^(\d+)\s+(\w+)\s+\w+\s+\{\s*([^}]+)\s*\}([^}]*)$/) { + my($compat, $proto, $ext, $name, $nargs, @@args, $pfunc, $cat, $num); + my(@@fun, $xproto, $oldstyle); + $num = $1; + if ($2 eq 'OBSOL' || $2 eq 'UNIMPL') { + $sysnum++; + next; + } + + if ($3 eq "MPSAFE") { + $proto = $4; + $ext = $5; + } else { + $proto = $3; + $ext = $4; + } + + if ($num > $sysnum) { # syscall gap + while($sysnum < $num) { + print " { -1,\t0,\tprintargs,\t\"SYS_$sysnum\"\t}, /* $sysnum */\n"; + $sysnum++; + } + } elsif ($num < $sysnum) { + next if ($num == $sysnum - 1); # perhaps #ifdef + warn "error in master file: syscall $num found, expecting $sysnum."; + next; + } + + # int|sys||name(args); + @@fun = split(/\|/, $proto); + $oldstyle = @@fun; + if ($oldstyle == 1) { + $xproto = $proto; + } else { + $xproto = $fun[3]; + } + + if (($oldstyle == 1 && $xproto =~ /^[^\s]+\s+([^\s]+)\s*\(([^)]*)\);/) + || ($oldstyle != 1 && $xproto =~ /^(\w+)\(([^)]*)\); /)) { + my @@args = split(/,/, $2); + $nargs = @@args; + $name = $1; + if ($oldstyle == 1) { + $name = substr($name, 1) if (substr($name, 0, 1) eq "*"); + $name = substr($name, 4); + } else { + $name = "__" . $name . $fun[2] if ($fun[2] ne ""); + } + if (defined($sysprint{$name})) { + $pfunc = $sysprint{$name}; + print SYSCALL "int $pfunc();\n"; + } else { + $pfunc = "sys_$name"; + print SYSCALL "#define $pfunc printargs\n"; + } + if (defined($syscat{$name})) { + $cat = $syscat{$name}; + } else { + $cat = "0"; + } + print " { $nargs,\t$cat,\t$pfunc,\t\"$name\"\t}, /* $sysnum */\n"; + $sysnum++; + } else { + warn "bad syscall specification for $sysnum: >$xproto<"; + } + } else { + # warn "unregognized line $_"; + } +} +close(MASTER); +exit 0; @ 1.4 log @make syscalls generation code handle old style [5.x] syscalls.master @ text @d1 1 a1 1 $NetBSD: patch-av,v 1.3 2011/08/30 10:43:11 christos Exp $ d5 1 a5 1 @@@@ -0,0 +1,184 @@@@ a32 1 +# $Id: patch-av,v 1.2 2008/10/30 17:12:44 christos Exp $ @ 1.3 log @make it work for NetBSD-current @ text @d1 1 a1 1 $NetBSD: patch-av,v 1.2 2008/10/30 17:12:44 christos Exp $ d3 3 a5 3 --- syscalls.pl.orig 2011-08-30 13:27:50.000000000 +0300 +++ syscalls.pl 2011-08-30 12:41:16.000000000 +0300 @@@@ -0,0 +1,171 @@@@ d120 2 a121 1 + my($compat, $proto, $ext, $name, $nargs, @@fun, @@args, $pfunc, $cat, $num); d149 6 d156 2 a157 1 + if ($fun[3] =~ /^(\w+)\(([^)]*)\); /) { d161 6 a166 1 + $name = "__" . $name . $fun[2] if ($fun[2] ne ""); d182 1 a182 1 + warn "bad syscall specification for $sysnum: >$fun[3]<"; @ 1.2 log @don't print warnings for #ifdef'ed syscalls with the same number. @ text @d1 1 a1 1 $NetBSD$ d3 3 a5 3 --- syscalls.pl.orig 2008-10-30 11:38:04.000000000 -0400 +++ syscalls.pl 2008-10-30 11:53:07.000000000 -0400 @@@@ -0,0 +1,170 @@@@ d33 1 a33 1 +# $Id: patch-av,v 1.1 2007/04/27 19:45:02 christos Exp $ d120 1 a120 2 + my($compat, $proto, $ext, $name, $nargs, @@args, $pfunc, $cat, $num); + d145 3 d149 1 a149 1 + if ($proto =~ /^[^\s]+\s+([^\s]+)\s*\(([^)]*)\);/) { d153 1 a153 2 + $name = substr($name, 1) if (substr($name, 0, 1) eq "*"); + $name = substr($name, 4); d169 1 a169 1 + warn "bad syscall specification for $sysnum: $proto"; @ 1.1 log @- make this work again on NetBSD/i386 - make this compile on NetBSD/x86_64 [does not work yet] - completely automate the NetBSD header generation. This should make porting to other platforms easier. @ text @d3 3 a5 3 --- /dev/null 2007-04-26 23:20:40.000000000 -0400 +++ netbsd/syscalls.pl 2007-04-27 14:38:18.000000000 -0400 @@@@ -0,0 +1,167 @@@@ d33 1 a33 1 +# $Id: patch-ag,v 1.1 2006/03/05 08:17:49 christos Exp $ d142 2 a143 1 + warn "error in master file: syscall $1 found, expecting $sysnum."; d174 2 @