]> granicus.if.org Git - strace/commitdiff
Fix SYS_FUNC and SEN macros for musl
authorSzabolcs Nagy <nsz@port70.net>
Tue, 15 Dec 2015 18:32:17 +0000 (18:32 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 16 Dec 2015 00:06:59 +0000 (00:06 +0000)
The syscall_name argument was subject to macro expansion because
it was passed down to other macros before it was prefixed.

musl libc defines lfs64 names as macros (e.g. fstat64 as fstat)
so SYS_FUNC(fstat64) was expanded to sys_fstat.

This change adds the prefix before the name is passed to other macros,
i.e. the argument of SYS_FUNC_NAME is already prefixed with sys_.

* defs.h (SYS_FUNC): Add sys_ prefix to SYS_FUNC_NAME's argument.
(SYS_FUNC_NAME): Do not add sys_ prefix to MPERS_FUNC_NAME's argument.
* linux/ia64/syscallent.h (SYS_FUNC_NAME): Do not add sys_ prefix
to MPERS_FUNC_NAME's argument.
* syscall.c (SEN_NAME): Remove.
(SEN): Replace SEN_NAME call with its definition.  Add sys_ prefix
to SYS_FUNC_NAME's argument.

defs.h
linux/ia64/syscallent.h
syscall.c

diff --git a/defs.h b/defs.h
index 1aca4e2df918b892c598ffa55991519e57fedbe9..283ab1fe0ad9d2a5f5fd213c74e15ef3607a6a01 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -800,8 +800,8 @@ extern unsigned num_quals;
 #define MPERS_FUNC_NAME_(prefix, name) MPERS_FUNC_NAME__(prefix, name)
 #define MPERS_FUNC_NAME(name) MPERS_FUNC_NAME_(MPERS_PREFIX, name)
 
-#define SYS_FUNC_NAME(syscall_name) MPERS_FUNC_NAME(sys_ ## syscall_name)
+#define SYS_FUNC_NAME(syscall_name) MPERS_FUNC_NAME(syscall_name)
 
-#define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(syscall_name)(struct tcb *tcp)
+#define SYS_FUNC(syscall_name) int SYS_FUNC_NAME(sys_ ## syscall_name)(struct tcb *tcp)
 
 #define MPERS_PRINTER_DECL(type, name) type MPERS_FUNC_NAME(name)
index 3bfa3479ea687ee3afdeb693a33caa314774eabe..b34712c2cf14923837183192bb90eff83cc39add 100644 (file)
@@ -34,7 +34,7 @@
 #define SYS_FUNC_NAME(syscall_name) printargs
 #include "../i386/syscallent.h"
 #undef SYS_FUNC_NAME
-#define SYS_FUNC_NAME(syscall_name) MPERS_FUNC_NAME(sys_ ## syscall_name)
+#define SYS_FUNC_NAME(syscall_name) MPERS_FUNC_NAME(syscall_name)
 
 /* You must be careful to check ../i386/syscallent.h so that this table
    starts where that one leaves off.
index 66154f7e28f6083a1dadd041d137f57c92edeb74..8d81274a76f7f22055a36641b46cc608d6842cdd 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -82,8 +82,7 @@
 #define SI STACKTRACE_INVALIDATE_CACHE
 #define SE STACKTRACE_CAPTURE_ON_ENTER
 
-#define SEN_NAME(syscall_name) SEN_ ## syscall_name
-#define SEN(syscall_name) SEN_NAME(syscall_name), SYS_FUNC_NAME(syscall_name)
+#define SEN(syscall_name) SEN_ ## syscall_name, SYS_FUNC_NAME(sys_ ## syscall_name)
 
 const struct_sysent sysent0[] = {
 #include "syscallent.h"
@@ -105,7 +104,6 @@ static const struct_sysent sysent2[] = {
 
 /* Now undef them since short defines cause wicked namespace pollution. */
 #undef SEN
-#undef SEN_NAME
 #undef TD
 #undef TF
 #undef TI