]> mj.ucw.cz Git - moe.git/blobdiff - box/mk-syscall-table
Box: Let the 32-bit version refuse to run on 64-bit kernels
[moe.git] / box / mk-syscall-table
index c4b1e9eeb856d7246528324b3085635fc3577af4..ec16571a2d2710a9540dc81bc008905e1689a43f 100755 (executable)
@@ -1,9 +1,14 @@
 #!/bin/sh
 set -e
-(
 echo '/* Syscall table automatically generated by mk-syscall-table */'
 echo
-echo '#include <asm/unistd.h>' |
-       gcc -E -dM - |
-       sed 's/^#define __NR_\([^       ]\+\).*/[ __NR_\1 ] = "\1",/;t;d'
-)
+cat <<FOE |
+#if defined(CONFIG_BOX_KERNEL_AMD64) && !defined(CONFIG_BOX_USER_AMD64)
+#include <asm/unistd_32.h>
+#else
+#include <asm/unistd.h>
+#endif
+FOE
+       gcc -E -dM "$@" - |
+       sed '/__NR_madvise1/d; s/^#define __NR_\([^     ]\+\)[  ]\+\([0-9]\+\).*/\/* \2 *\/ [ __NR_\1 ] = "\1",/;t;d' |
+       sort -k2 -n