[REORG] build: move syscall redefinition to specific places
Some older libc don't define splice() and and don't define _syscall*()
either, which causes build errors if splicing is enabled.
To solve this, we now split the syscall redefinition into two layers :
- one file per syscall (epoll, splice)
- one common file to declare the _syscall*() macros
The code is cleaner because files using the syscalls just have to include
their respective file. It's not adviced to merge multiple syscall families
into a same file if all are not intended to be used simultaneously, because
defining unused static functions causes warnings to be emitted during build.
As a result, the new USE_MY_SPLICE parameter was added in order to be able
to define the splice() syscall separately.
diff --git a/Makefile b/Makefile
index cd6aac9..587b4e0 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,7 @@
# USE_GETSOCKNAME : enable getsockname() on Linux 2.2. Automatic.
# USE_KQUEUE : enable kqueue() on BSD. Automatic.
# USE_MY_EPOLL : redefine epoll_* syscalls. Automatic.
+# USE_MY_SPLICE : redefine the splice syscall if build fails without.
# USE_NETFILTER : enable netfilter on Linux. Automatic.
# USE_PCRE : enable use of libpcre for regex. Recommended.
# USE_POLL : enable poll(). Automatic.
@@ -397,6 +398,11 @@
BUILD_OPTIONS += $(call ignore_implicit,USE_VSYSCALL)
endif
+ifneq ($(USE_MY_SPLICE),)
+OPTIONS_CFLAGS += -DUSE_MY_SPLICE
+BUILD_OPTIONS += $(call ignore_implicit,USE_MY_SPLICE)
+endif
+
ifneq ($(USE_NETFILTER),)
OPTIONS_CFLAGS += -DNETFILTER
BUILD_OPTIONS += $(call ignore_implicit,USE_NETFILTER)