Add unique syscall entry numbers (SENs)
* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sen.h.
(syscallent_names, syscallent_patterns, syscallent_files): New variables.
(sen.h): New rule.
* defs.h (struct sysent): Add sen field.
* generate_sen.sh: New file.
* linux/syscall.h: Include "sen.h".
* syscall.c (SEN_NAME): New temporary macro.
(SEN): Use it to prepend syscall entry number.
diff --git a/Makefile.am b/Makefile.am
index 4790f32..451a7da 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -163,6 +163,7 @@
debian/strace64.manpages \
debian/watch \
errnoent.sh \
+ generate_sen.sh \
ioctlsort.c \
linux/32/ioctls_inc.h \
linux/32/ioctls_inc_align32.h \
@@ -567,7 +568,7 @@
srpm: dist-xz
rpmbuild --define '%_srcrpmdir .' -ts $(distdir).tar.xz
-BUILT_SOURCES = .version sys_func.h
+BUILT_SOURCES = .version sys_func.h sen.h
$(srcdir)/.version:
$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
@@ -579,6 +580,15 @@
sed -n 's/^SYS_FUNC(.*/extern &;/p' $$f; \
done | sort -u > $@
+syscallent_names = subcall.h syscallent.h syscallent1.h \
+ syscallent-n32.h syscallent-n64.h syscallent-o32.h
+syscallent_patterns = $(patsubst %,\%/%,$(syscallent_names))
+syscallent_files = $(filter $(syscallent_patterns),$(EXTRA_DIST))
+
+sen.h: $(patsubst %,$(srcdir)/%,$(syscallent_files))
+ for f in $^; do cat -- $$f; done | \
+ $(srcdir)/generate_sen.sh > $@
+
dist-hook:
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
@@ -605,7 +615,7 @@
ioctls_inc_h = $(wildcard $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h)
ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_inc_h))
BUILT_SOURCES += $(ioctlent_h)
-CLEANFILES = sys_func.h $(ioctlent_h)
+CLEANFILES = sys_func.h sen.h $(ioctlent_h)
ioctlent%.h: ioctlsort%
./$< > $@
diff --git a/defs.h b/defs.h
index ede39b4..25e377a 100644
--- a/defs.h
+++ b/defs.h
@@ -249,6 +249,7 @@
typedef struct sysent {
unsigned nargs;
int sys_flags;
+ int sen;
int (*sys_func)();
const char *sys_name;
} struct_sysent;
diff --git a/generate_sen.sh b/generate_sen.sh
new file mode 100755
index 0000000..6c177ab
--- /dev/null
+++ b/generate_sen.sh
@@ -0,0 +1,8 @@
+#!/bin/sh -e
+
+echo 'enum {'
+echo 'SEN_printargs = 0,'
+ sed -n '/printargs/! s/.*SEN(\([^)]*\)).*/\1/p' |
+ sort -u |
+ sed 's/.*/SEN_&,/'
+echo '};'
diff --git a/linux/syscall.h b/linux/syscall.h
index bd70601..1b7cbc5 100644
--- a/linux/syscall.h
+++ b/linux/syscall.h
@@ -28,6 +28,7 @@
#include "dummy.h"
#include "sys_func.h"
+#include "sen.h"
#if NEED_UID16_PARSERS
extern SYS_FUNC(chown16);
diff --git a/syscall.c b/syscall.c
index b8f9f82..6753f2d 100644
--- a/syscall.c
+++ b/syscall.c
@@ -81,7 +81,8 @@
#define SI STACKTRACE_INVALIDATE_CACHE
#define SE STACKTRACE_CAPTURE_ON_ENTER
-#define SEN(syscall_name) SYS_FUNC_NAME(syscall_name)
+#define SEN_NAME(syscall_name) SEN_ ## syscall_name
+#define SEN(syscall_name) SEN_NAME(syscall_name), SYS_FUNC_NAME(syscall_name)
const struct_sysent sysent0[] = {
#include "syscallent.h"
@@ -101,6 +102,7 @@
/* Now undef them since short defines cause wicked namespace pollution. */
#undef SEN
+#undef SEN_NAME
#undef TD
#undef TF
#undef TI