[OpenWrt-Devel] [PATCH][procd] fix generating syscall-names.h

Hauke Mehrtens hauke at hauke-m.de
Sat Aug 15 12:17:33 EDT 2015


Sometimes the syscall number is not defined with a number but with an
offset to an other syscall and then make_syscall_h.sh created some
broken header file.

For example the bit/syscall.h from musl for i386 has this:

  #define __NR_timer_create     259
  #define __NR_timer_settime    (__NR_timer_create+1)

With this patch the resulting array looks like this:

 [259] = "timer_create",
 [(__NR_timer_create+1)] = "timer_settime",

This fixes this bug from OpenWrt:
https://dev.openwrt.org/ticket/20195

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 make_syscall_h.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/make_syscall_h.sh b/make_syscall_h.sh
index 57333fd..3363bc7 100755
--- a/make_syscall_h.sh
+++ b/make_syscall_h.sh
@@ -14,5 +14,5 @@ CC=$1
 echo "#include <asm/unistd.h>"
 echo "static const char *syscall_names[] = {"
 echo "#include <sys/syscall.h>" | ${CC} -E -dM - | grep '^#define __NR_' | \
-	LC_ALL=C sed -r -n -e 's/^\#define[ \t]+__NR_([a-z0-9_]+)[ \t]+([ ()+0-9NR_Linux]+)(.*)/ [\2] = "\1",/p'
+	LC_ALL=C sed -r -n -e 's/^\#define[ \t]+__NR_([a-z0-9_]+)[ \t]+([ ()+0-9a-zNR_Linux]+)(.*)/ [\2] = "\1",/p'
 echo "};"
-- 
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list