From: Edgar Kaziakhmedov Date: Sat, 5 Aug 2017 01:57:35 +0000 (+0300) Subject: Move sysent shorthand notations to separate files X-Git-Tag: v4.19~168 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d565ef25a653674ac28003ad747a7e0b42639e5;p=strace Move sysent shorthand notations to separate files Avoid proliferation of exactly the same definitions of shorthand notations for macros defined in sysent.h by moving definitions and undefs of these shorthand notations to separate files. * sysent_shorthand_defs.h: New file. * sysent_shorthand_undefs.h: Likewise. * Makefile.am (strace_SOURCES): Add them. * syscall.c: Use them. Signed-off-by: Edgar Kaziakhmedov Signed-off-by: Dmitry V. Levin --- diff --git a/Makefile.am b/Makefile.am index aeda527b..5b2b93a0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -273,6 +273,8 @@ strace_SOURCES = \ syscall.c \ sysctl.c \ sysent.h \ + sysent_shorthand_defs.h \ + sysent_shorthand_undefs.h \ sysinfo.c \ syslog.c \ sysmips.c \ diff --git a/syscall.c b/syscall.c index f21a1467..a0c649ea 100644 --- a/syscall.c +++ b/syscall.c @@ -70,25 +70,7 @@ #include "syscall.h" /* Define these shorthand notations to simplify the syscallent files. */ -#define TD TRACE_DESC -#define TF TRACE_FILE -#define TI TRACE_IPC -#define TN TRACE_NETWORK -#define TP TRACE_PROCESS -#define TS TRACE_SIGNAL -#define TM TRACE_MEMORY -#define TST TRACE_STAT -#define TLST TRACE_LSTAT -#define TFST TRACE_FSTAT -#define TSTA TRACE_STAT_LIKE -#define TSF TRACE_STATFS -#define TFSF TRACE_FSTATFS -#define TSFA TRACE_STATFS_LIKE -#define NF SYSCALL_NEVER_FAILS -#define MA MAX_ARGS -#define SI STACKTRACE_INVALIDATE_CACHE -#define SE STACKTRACE_CAPTURE_ON_ENTER -#define CST COMPAT_SYSCALL_TYPES +#include "sysent_shorthand_defs.h" #define SEN(syscall_name) SEN_ ## syscall_name, SYS_FUNC_NAME(sys_ ## syscall_name) @@ -111,26 +93,7 @@ static const struct_sysent sysent2[] = { #endif /* Now undef them since short defines cause wicked namespace pollution. */ -#undef SEN -#undef TD -#undef TF -#undef TI -#undef TN -#undef TP -#undef TS -#undef TM -#undef TST -#undef TLST -#undef TFST -#undef TSTA -#undef TSF -#undef TFSF -#undef TSFA -#undef NF -#undef MA -#undef SI -#undef SE -#undef CST +#include "sysent_shorthand_undefs.h" /* * `ioctlent[012].h' files are automatically generated by the auxiliary diff --git a/sysent_shorthand_defs.h b/sysent_shorthand_defs.h new file mode 100644 index 00000000..52b591c3 --- /dev/null +++ b/sysent_shorthand_defs.h @@ -0,0 +1,19 @@ +#define TD TRACE_DESC +#define TF TRACE_FILE +#define TI TRACE_IPC +#define TN TRACE_NETWORK +#define TP TRACE_PROCESS +#define TS TRACE_SIGNAL +#define TM TRACE_MEMORY +#define TST TRACE_STAT +#define TLST TRACE_LSTAT +#define TFST TRACE_FSTAT +#define TSTA TRACE_STAT_LIKE +#define TSF TRACE_STATFS +#define TFSF TRACE_FSTATFS +#define TSFA TRACE_STATFS_LIKE +#define NF SYSCALL_NEVER_FAILS +#define MA MAX_ARGS +#define SI STACKTRACE_INVALIDATE_CACHE +#define SE STACKTRACE_CAPTURE_ON_ENTER +#define CST COMPAT_SYSCALL_TYPES diff --git a/sysent_shorthand_undefs.h b/sysent_shorthand_undefs.h new file mode 100644 index 00000000..d44dc88c --- /dev/null +++ b/sysent_shorthand_undefs.h @@ -0,0 +1,20 @@ +#undef SEN +#undef TD +#undef TF +#undef TI +#undef TN +#undef TP +#undef TS +#undef TM +#undef TST +#undef TLST +#undef TFST +#undef TSTA +#undef TSF +#undef TFSF +#undef TSFA +#undef NF +#undef MA +#undef SI +#undef SE +#undef CST