File 0188-Try-to-use-NONBLOCK-for-erl_child_setup.patch of Package erlang
From e0a1799aaaa4bfee44c8cdcf4f30bc2282520a70 Mon Sep 17 00:00:00 2001
From: Calvin Buckley <calvin@cmpct.info>
Date: Sat, 26 Jan 2019 12:31:50 -0500
Subject: [PATCH 08/12] Try to use NONBLOCK for erl_child_setup
---
erts/emulator/sys/unix/erl_child_setup.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/erts/emulator/sys/unix/erl_child_setup.c b/erts/emulator/sys/unix/erl_child_setup.c
index f3662f94c6..9241660069 100644
--- a/erts/emulator/sys/unix/erl_child_setup.c
+++ b/erts/emulator/sys/unix/erl_child_setup.c
@@ -75,6 +75,10 @@
#define SHELL "/bin/sh"
#endif /* __ANDROID__ */
+#if !defined(MSG_DONTWAIT) && defined(MSG_NONBLOCK)
+#define MSG_DONTWAIT MSG_NONBLOCK
+#endif
+
//#define HARD_DEBUG
#ifdef HARD_DEBUG
#define DEBUG_PRINT(fmt, ...) fprintf(stderr, "%d:" fmt "\r\n", getpid(), ##__VA_ARGS__)
@@ -491,12 +495,7 @@ main(int argc, char *argv[])
ErtsSysForkerProto proto;
errno = 0;
if ((res = sys_uds_read(uds_fd, (char*)&proto, sizeof(proto),
-#if defined(MSG_DONTWAIT)
pipes, 3, MSG_DONTWAIT)) < 0) {
-#else
- /* XXX: a workaround here? */
- pipes, 3, 0)) < 0) {
-#endif
if (errno == EINTR)
continue;
DEBUG_PRINT("erl_child_setup failed to read from uds: %d, %d", res, errno);
--
2.16.4