Plan 9 from Bell Labs’s /usr/web/sources/contrib/cinap_lenrek/old/linuxemu.old/systab.awk

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/^#/ { 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");
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.