1#!/bin/bash
2
3cat << 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
13EOF
14
15cat smatch_trinity_* >> trinity_smatch.c
16
17
18for i in $(grep syscallentry smatch_trinity_*  | cut -d ' ' -f 3) ; do
19    echo "extern struct syscallentry $i;" >> trinity_smatch.h
20done
21
22echo "" >> trinity_smatch.h
23echo "struct syscalltable syscalls_smatch[] = {" >> trinity_smatch.h
24
25for i in $(grep syscallentry smatch_trinity_*  | cut -d ' ' -f 3) ; do
26    echo "{ .entry = &$i },"  >> trinity_smatch.h
27done
28
29echo "};" >> trinity_smatch.h
30