/^#/ { next; }
/^SYSCALL/ { syscall[nsyscall++] = $2; }
/^IOCTL/ {ioctl[nioctl++] = $2; }
END {
printf("/* this file mechanically generated; do not edit */\n");
printf("#include <u.h>\n");
printf("#include <libc.h>\n");
printf("#include \"linux.h\"\n");
printf("#include \"linuxsys.h\"\n");
printf("\n");
for(i=0; i<nsyscall; i++) {
printf("SYSCALL(sys_%s);\n", syscall[i]);
}
printf("\n");
printf("Syscall syscalltab[LMAXSYSCALL] = {\n");
for(i=0; i<nsyscall; i++) {
printf("[L%s] sys_%s,\n", syscall[i], syscall[i]);
}
printf("};\n");
printf("\n");
for(i=0; i<nioctl; i++) {
printf("IOCTL(ioctl_%s);\n", ioctl[i]);
}
printf("\n");
printf("Ioctl ioctltab[] = {\n");
for(i=0; i<nioctl; i++) {
printf("{%s, ioctl_%s},\n", ioctl[i], ioctl[i]);
}
printf("{0, 0},\n");
printf("};\n");
}
|