BVB Source Codes

goreplay Show mksysnum_freebsd.pl Source code

Return Download goreplay: download mksysnum_freebsd.pl Source code - Download goreplay Source code - Type:.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 FreeBSD from master list
  7. # (for example, /usr/src/sys/kern/syscalls.master).
  8.  
  9. use strict;
  10.  
  11. if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
  12.         print STDERR "GOARCH or GOOS not defined in environment\n";
  13.         exit 1;
  14. }
  15.  
  16. my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
  17.  
  18. print <<EOF;
  19. // $command
  20. // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
  21.  
  22. // +build $ENV{'GOARCH'},$ENV{'GOOS'}
  23.  
  24. package unix
  25.  
  26. const (
  27. EOF
  28.  
  29. while(<>){
  30.         if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){
  31.                 my $num = $1;
  32.                 my $proto = $2;
  33.                 my $name = "SYS_$3";
  34.                 $name =~ y/a-z/A-Z/;
  35.  
  36.                 # There are multiple entries for enosys and nosys, so comment them out.
  37.                 if($name =~ /^SYS_E?NOSYS$/){
  38.                         $name = "// $name";
  39.                 }
  40.                 if($name eq 'SYS_SYS_EXIT'){
  41.                         $name = 'SYS_EXIT';
  42.                 }
  43.                 if($name =~ /^SYS_CAP_+/ || $name =~ /^SYS___CAP_+/){
  44.                         next
  45.                 }
  46.  
  47.                 print " $name = $num;  // $proto\n";
  48.  
  49.                 # We keep Capsicum syscall numbers for FreeBSD
  50.                 # 9-STABLE here because we are not sure whether they
  51.                 # are mature and stable.
  52.                 if($num == 513){
  53.                         print " SYS_CAP_NEW = 514 // { int cap_new(int fd, uint64_t rights); }\n";
  54.                         print " SYS_CAP_GETRIGHTS = 515 // { int cap_getrights(int fd, \\\n";
  55.                         print " SYS_CAP_ENTER = 516 // { int cap_enter(void); }\n";
  56.                         print " SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); }\n";
  57.                 }
  58.         }
  59. }
  60.  
  61. print <<EOF;
  62. )
  63. EOF
  64.  
downloadmksysnum_freebsd.pl Source code - Download goreplay Source code
Related Source Codes/Software:
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10
django-rest-framework - Web APIs for Django. http:/... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10

 Back to top