#!/bin/sh1#2# gensyscalls.sh3# Usage: ./gensyscalls.sh < syscalls.h4#5# Parses the kernel's syscalls.h into the body of syscalls.S6#78# tabs to spaces, just in case9tr '\t' ' ' |\10awk '11# Do not read the parts of the file that are not between the markers.12/^\/\*CALLBEGIN\*\// { look=1; }13/^\/\*CALLEND\*\// { look=0; }1415# And, do not read lines that do not match the approximate right pattern.16look && /^#define SYS_/ && NF==3 {17sub("^SYS_", "", $2);18# print the name of the call and the number.19print $2, $3;20}21' | awk '{22# output something simple that will work in syscalls.S.23printf "SYSCALL(%s, %s)\n", $1, $2;24}'25262728