[PATCH 2/3] Move shorthand notations to separate file
Edgar Kaziakhmedov
edgar.kaziakhmedov at virtuozzo.com
Sat Aug 5 01:57:35 UTC 2017
In order to allow usage shorthand notations of defines in sysent.h file
by other binaries in the strace package these defines should be moved to
separate file.
* Makefile.am (strace_SOURCES): Add shorthand_def.h.
* shorthand_def.h: New file.
* syscall.c: Use it.
Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov at virtuozzo.com>
---
Makefile.am | 1 +
shorthand_def.h | 42 ++++++++++++++++++++++++++++++++++++++++++
syscall.c | 43 ++++---------------------------------------
3 files changed, 47 insertions(+), 39 deletions(-)
create mode 100644 shorthand_def.h
diff --git a/Makefile.am b/Makefile.am
index 20708711..ae119a75 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -248,6 +248,7 @@ strace_SOURCES = \
scsi.c \
seccomp.c \
sendfile.c \
+ shorthand_def.h \
sg_io_v3.c \
sg_io_v4.c \
shutdown.c \
diff --git a/shorthand_def.h b/shorthand_def.h
new file mode 100644
index 00000000..70e4fd4a
--- /dev/null
+++ b/shorthand_def.h
@@ -0,0 +1,42 @@
+#ifdef DEFINE_SHORTHAND
+#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
+#else
+#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
+#endif
diff --git a/syscall.c b/syscall.c
index f21a1467..7884e00f 100644
--- a/syscall.c
+++ b/syscall.c
@@ -70,25 +70,8 @@
#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
+#define DEFINE_SHORTHAND
+#include "shorthand_def.h"
#define SEN(syscall_name) SEN_ ## syscall_name, SYS_FUNC_NAME(sys_ ## syscall_name)
@@ -111,26 +94,8 @@ 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
+#undef DEFINE_SHORTHAND
+#include "shorthand_def.h"
/*
* `ioctlent[012].h' files are automatically generated by the auxiliary
--
2.11.0
More information about the Strace-devel
mailing list