]> granicus.if.org Git - strace/commitdiff
Move sysent shorthand notations to separate files
authorEdgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
Sat, 5 Aug 2017 01:57:35 +0000 (04:57 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 7 Aug 2017 12:49:44 +0000 (12:49 +0000)
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 <edgar.kaziakhmedov@virtuozzo.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Makefile.am
syscall.c
sysent_shorthand_defs.h [new file with mode: 0644]
sysent_shorthand_undefs.h [new file with mode: 0644]

index aeda527b99d69594f6803e649ca7ae20af65e726..5b2b93a06f90fbbd96fa2d37627aecccda018fc5 100644 (file)
@@ -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       \
index f21a1467fee3211f43b328d79c2c228c0e1019d8..a0c649ea55d791a0432fd2fcffcbe5ed74c63a97 100644 (file)
--- a/syscall.c
+++ b/syscall.c
 #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 (file)
index 0000000..52b591c
--- /dev/null
@@ -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 (file)
index 0000000..d44dc88
--- /dev/null
@@ -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