On ppc64le, __NR_select is defined at compile time, so test_mkfds -W
lists "select" as available. However, the kernel returns ENOSYS at
runtime. The helper process prints its PID, then calls select() which
fails immediately with ENOSYS. This creates a race where the bash
script's kill -0 liveness check can succeed while the process is
still dying, causing lsfd to run against a dead process and produce
wrong output.
Exit with EXIT_ENOSYS (23) instead of EXIT_FAILURE when the
multiplexer syscall returns ENOSYS. This applies to both
DEFUN_WAIT_EVENT_SELECT and DEFUN_WAIT_EVENT_POLL macros.
In the bash test, check the wait exit code for 23 after the coproc
finishes and skip the subtest cleanly.
Signed-off-by: Karel Zak <kzak@redhat.com>
#define EXIT_EPROTONOSUPPORT 20
#define EXIT_EACCES 21
#define EXIT_ENOENT 22
-#define EXIT_ENOSYS 23
+/* EXIT_ENOSYS also defined in test_mkfds.h */
#define EXIT_EADDRNOTAVAIL 24
#define EXIT_ENODEV 25
SETUP_SIG_HANDLER \
\
if (SYSCALL_INVOCATION < 0 \
- && errno != EINTR) \
+ && errno != EINTR) { \
+ if (errno == ENOSYS) \
+ errx(EXIT_ENOSYS, "no syscall: " SYSCALL); \
err(EXIT_FAILURE, "failed in " SYSCALL); \
+ } \
}
DEFUN_WAIT_EVENT_SELECT(default,
#include <stdbool.h>
#include <stddef.h>
+#define EXIT_ENOSYS 23
+
enum multiplexing_mode {
MX_READ = 1 << 0,
MX_WRITE = 1 << 1,
SETUP_SIG_HANDLER \
\
if (SYSCALL_INVOCATION < 0 \
- && errno != EINTR) \
+ && errno != EINTR) { \
+ if (errno == ENOSYS) \
+ errx(EXIT_ENOSYS, "no syscall: " SYSCALL); \
err(EXIT_FAILURE, "failed in " SYSCALL); \
+ } \
free(pfds); \
}
fi
wait "$MKFDS_CPID"
+ if [ $? -eq 23 ]; then
+ ts_skip "the $multiplexer syscall is not available (ENOSYS)"
+ fi
ts_finalize_subtest
done