From 116e9553d12193faa08e668b3d9504ef995bd21f Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sun, 22 Sep 2024 18:32:21 +0200 Subject: [PATCH] openocd: build: allow more socket connections on Windows Cross compiling OpenOCD for Windows forces the maximum number of open files (including sockets) to 64. See in include file psdk_inc/_fd_types.h: #ifndef FD_SETSIZE #define FD_SETSIZE 64 #endif This limit is far lower than the default value 1024 used by Linux. In pull request #644 [1] in risc-v fork it's reported that: - each socket server of OpenOCD (GDB, telnet, ...) uses one FD; - each active connection to a socket server uses another FD; - multi-core devices with 32 or more cores, each having a GDB connection, already saturates the 64 available FD at the 26th GDB connection. The patch [2] proposed and merged in risc-v fork adds the compile flag -DFD_SETSIZE=128 to all the host types. While this looks fine for Windows, it reduces the default value for Linux and other OS. Add the compile flag FD_SETSIZE only to cross compile for Windows. Link: [1] https://github.com/riscv-collab/riscv-openocd/pull/644 Link: [2] https://github.com/riscv-collab/riscv-openocd/pull/644/commits/1bab4cfbc4f4 Change-Id: Ie43a792ac11a5e63e0407b68e3f270efea0c87be Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/8503 Tested-by: jenkins --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b7aed245e..07e06551f 100644 --- a/configure.ac +++ b/configure.ac @@ -435,7 +435,7 @@ AS_CASE([$host], # In case enable_buspirate=auto, make sure it will not be built. enable_buspirate=no - AC_SUBST([HOST_CPPFLAGS], [-D__USE_MINGW_ANSI_STDIO]) + AC_SUBST([HOST_CPPFLAGS], ["-D__USE_MINGW_ANSI_STDIO -DFD_SETSIZE=128"]) ], [*darwin*], [ is_darwin=yes