Don't rely on the header files for x86/x86_64/x32, check the syscall
source tables directly.

Signed-off-by: Paul Moore <pmo...@redhat.com>
---
 src/arch-syscall-validate |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/arch-syscall-validate b/src/arch-syscall-validate
index e765c35..740ab77 100755
--- a/src/arch-syscall-validate
+++ b/src/arch-syscall-validate
@@ -75,9 +75,9 @@ EOF
 #  Dump the architecture's syscall table to stdout.
 #
 function dump_sys_x86() {
-       cat $1/arch/x86/include/generated/uapi/asm/unistd_32.h | \
-               grep "^#define __NR_" | sort | \
-               sed -e 's/#define[ \t]\+__NR_\([^ \t]\+\)[ 
\t]\+\(.*\).*/\1\t\2/'
+       cat $1/arch/x86/syscalls/syscall_32.tbl | \
+               grep -v "^#" | awk '{ print $3"\t"$1 }' | sed '/^[ \t]*$/d' | \
+               sort
 }
 
 #
@@ -98,9 +98,9 @@ function dump_lib_x86() {
 #  Dump the architecture's syscall table to stdout.
 #
 function dump_sys_x86_64() {
-       cat $1/arch/x86/include/generated/uapi/asm/unistd_64.h | \
-               grep "^#define __NR_" | sort | \
-               sed -e 's/#define[ \t]\+__NR_\([^ \t]\+\)[ 
\t]\+\(.*\).*/\1\t\2/'
+       cat $1/arch/x86/syscalls/syscall_64.tbl | \
+               grep -v "^#" | awk '{ print $2,$3,$1 }' | sed -e '/^x32/d' | \
+               awk '{ print $2"\t"$3 }' | sed '/^[ \t]*$/d' | sort
 }
 
 #
@@ -121,9 +121,9 @@ function dump_lib_x86_64() {
 #  Dump the architecture's syscall table to stdout.
 #
 function dump_sys_x32() {
-       cat $1/arch/x86/include/generated/uapi/asm/unistd_x32.h | \
-               grep "^#define __NR_" | sort | \
-               sed -e 's/#define[ \t]\+__NR_\([^ \t]\+\)[ 
\t]\+(__X32_SYSCALL_BIT[ \t]*+[ \t]*\([0-9]\+\)).*/\1\t\2/'
+       cat $1/arch/x86/syscalls/syscall_64.tbl | \
+               grep -v "^#" | awk '{ print $2,$3,$1 }' | sed -e '/^64/d' | \
+               awk '{ print $2"\t"$3 }' | sed '/^[ \t]*$/d' | sort
 }
 
 #


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
libseccomp-discuss mailing list
libseccomp-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libseccomp-discuss

Reply via email to