1 #!/bin/bash
   2 
   3 cat << EOF > trinity_smatch.h
   4 
   5 #pragma once
   6 
   7 /* Syscalls from arch/x86/syscalls/syscall_64.tbl */
   8 
   9 #include "sanitise.h"
  10 #include "syscall.h"
  11 #include "syscalls/syscalls.h"
  12 
  13 EOF
  14 
  15 cat smatch_trinity_* >> trinity_smatch.c
  16 
  17 
  18 for i in $(grep syscallentry smatch_trinity_*  | cut -d ' ' -f 3) ; do
  19     echo "extern struct syscallentry $i;" >> trinity_smatch.h
  20 done
  21 
  22 echo "" >> trinity_smatch.h
  23 echo "struct syscalltable syscalls_smatch[] = {" >> trinity_smatch.h
  24 
  25 for i in $(grep syscallentry smatch_trinity_*  | cut -d ' ' -f 3) ; do
  26     echo "{ .entry = &$i },"  >> trinity_smatch.h
  27 done
  28 
  29 echo "};" >> trinity_smatch.h