mksyscallent revision c53309ef99c205a2e9ae7ccbdf6557adcd52d24e
1#!/usr/bin/awk -f 2 3# hack expression to generate arch/syscallent.h from <asm/unistd.h> 4# It reads from stdin and writes to stdout 5# It should work OK on i386,m68k,arm,ia64 6# It does NOT work in mips, s390 7# It is untested in other architectures 8 9BEGIN { 10 max=0; 11 FS="[ \t\n()+]+"; 12} 13 14{ 15 #debug 16 #printf("/%s/%s/%s/%s/\n", $1, $2, $3, $4); 17 if (($1 ~ /^#define$/) && ($2 ~ /^__NR_/)) { 18 #ia64 syscalls are > 1000 (lower for x86 compat) 19 if (($3>=0) && ($3<=2000)) { 20 SYSCALL[$3]=substr($2,6); 21 if ($3 > max) { 22 max=$3; 23 } 24 } else if (($3 ~ /^__NR_SYSCALL_BASE$/) && ($4>=0) && ($4<=1000)) { 25 SYSCALL[$4]=substr($2,6); 26 if ($4 > max) { 27 max=$4; 28 } 29 } 30 } 31} 32 33END { 34 for(i=0; i<=max; i++) { 35 if (!SYSCALL[i]) { 36 SYSCALL[i] = i; 37 } 38 pad = 32 - length(SYSCALL[i]); 39 if (pad<1) { 40 pad=1; 41 } 42 printf("\t\"%s\",%*s/* %d */\n", SYSCALL[i], pad, "", i); 43 } 44} 45 46