Fix SYS_FUNC and SEN macros for musl

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.
This commit is contained in:
Szabolcs Nagy 2015-12-15 18:32:17 +00:00 committed by Dmitry V. Levin
parent b6b38fa73b
commit 34683e3926
3 changed files with 4 additions and 6 deletions

4
defs.h
View File

@ -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)

View 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.

View File

@ -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