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 <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8503
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2024-09-22 18:32:21 +02:00
parent 595bb965b7
commit 116e9553d1
1 changed files with 1 additions and 1 deletions

View File

@ -435,7 +435,7 @@ AS_CASE([$host],
# In case enable_buspirate=auto, make sure it will not be built. # In case enable_buspirate=auto, make sure it will not be built.
enable_buspirate=no 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*], [ [*darwin*], [
is_darwin=yes is_darwin=yes