aboutsummaryrefslogtreecommitdiff
path: root/src/compat
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-06-28 14:53:28 +0100
committerfanquake <fanquake@gmail.com>2022-07-20 10:34:46 +0100
commit7c3df5e548ee3404d1ad5b47410dd7b6f77258d3 (patch)
treebf975c0f1d213ddab9262094fc94a66351feb1b3 /src/compat
parentcc7b2fdd70da439c3cf8daef3bb79cf593f1cef3 (diff)
downloadbitcoin-7c3df5e548ee3404d1ad5b47410dd7b6f77258d3.tar.xz
compat: document FD_SETSIZE redefinition for WIN32
Diffstat (limited to 'src/compat')
-rw-r--r--src/compat/compat.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h
index 51ed03eef4..75f47bc700 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -10,14 +10,17 @@
#include <config/bitcoin-config.h>
#endif
+// Windows defines FD_SETSIZE to 64 (see _fd_types.h in mingw-w64),
+// which is too small for our usage, but allows us to redefine it safely.
+// We redefine it to be 1024, to match glibc, see typesizes.h.
#ifdef WIN32
#ifdef FD_SETSIZE
-#undef FD_SETSIZE // prevent redefinition compiler warning
+#undef FD_SETSIZE
#endif
-#define FD_SETSIZE 1024 // max number of fds in fd_set
+#define FD_SETSIZE 1024
#include <winsock2.h>
#include <ws2tcpip.h>
-#include <stdint.h>
+#include <cstdint>
#else
#include <fcntl.h>
#include <sys/mman.h>