From 1c22fdf36037e9c65bad38ee36d346fe7691283b Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 2 May 2018 10:59:09 -0400 Subject: libuv: linux/sparc64: use fcntl to set and clear O_NONBLOCK Upstream libuv commits: * node-v0.6.0~28 (linux: use ioctl(FIONBIO) to set O_NONBLOCK, saves a syscall, 2011-10-29) * v1.11.0~11 (unix: use async-signal safe functions between fork and exec, 2016-12-12) left an asymmetry in the way O_NONBLOCK is set and cleared. Normally ioctl/FIONBIO is used for both. However, uv_spawn uses fcntl/O_NONBLOCK to clear O_NONBLOCK between fork and exec. This fails on Linux/sparc64 where setting via ioctl/FIONBIO actually sets two bits (in O_NDELAY) that cause clearing via fcntl/O_NONBLOCK to be silently ignored (though clearing via ioctl/FIONBIO or fcntl/O_NDELAY works). Since CMake commit v3.11.0-rc1~117^2 (CTest: Re-implement test process handling using libuv, 2017-12-10), CTest uses libuv. On Linux/sparc64 child processes have been started with non-blocking output pipes. This can lead to write errors or lost output from children not prepared to deal with `EAGAIN` on stdout or stderr. Fix this for now by switching libuv back to fcntl/O_NONBLOCK to set and clear O_NONBLOCK when compiled on Linux/sparc64. LibUV-Issue: 1830 Fixes: #17941 --- Utilities/cmlibuv/src/unix/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Utilities/cmlibuv') diff --git a/Utilities/cmlibuv/src/unix/internal.h b/Utilities/cmlibuv/src/unix/internal.h index 9cc87f0caa..668e57663b 100644 --- a/Utilities/cmlibuv/src/unix/internal.h +++ b/Utilities/cmlibuv/src/unix/internal.h @@ -184,7 +184,7 @@ struct uv__stream_queued_fds_s { defined(__DragonFly__) || \ defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || \ - defined(__linux__) || \ + (defined(__linux__) && !defined(__sparc__)) || \ defined(__OpenBSD__) || \ defined(__NetBSD__) #define uv__cloexec uv__cloexec_ioctl -- cgit v1.2.1