mksysnum_openbsd.pl 870 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. use strict;
  9. my $command = "mksysnum_openbsd.pl " . join(' ', @ARGV);
  10. print <<EOF;
  11. // $command
  12. // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
  13. package unix
  14. const (
  15. EOF
  16. while(<>){
  17. if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){
  18. my $num = $1;
  19. my $proto = $3;
  20. my $name = $4;
  21. $name =~ y/a-z/A-Z/;
  22. # There are multiple entries for enosys and nosys, so comment them out.
  23. if($name =~ /^SYS_E?NOSYS$/){
  24. $name = "// $name";
  25. }
  26. if($name eq 'SYS_SYS_EXIT'){
  27. $name = 'SYS_EXIT';
  28. }
  29. print " $name = $num; // $proto\n";
  30. }
  31. }
  32. print <<EOF;
  33. )
  34. EOF