Skip to content

Commit 7c3df5e

Browse files
committed
compat: document FD_SETSIZE redefinition for WIN32
1 parent cc7b2fd commit 7c3df5e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/compat/compat.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@
1010
#include <config/bitcoin-config.h>
1111
#endif
1212

13+
// Windows defines FD_SETSIZE to 64 (see _fd_types.h in mingw-w64),
14+
// which is too small for our usage, but allows us to redefine it safely.
15+
// We redefine it to be 1024, to match glibc, see typesizes.h.
1316
#ifdef WIN32
1417
#ifdef FD_SETSIZE
15-
#undef FD_SETSIZE // prevent redefinition compiler warning
18+
#undef FD_SETSIZE
1619
#endif
17-
#define FD_SETSIZE 1024 // max number of fds in fd_set
20+
#define FD_SETSIZE 1024
1821
#include <winsock2.h>
1922
#include <ws2tcpip.h>
20-
#include <stdint.h>
23+
#include <cstdint>
2124
#else
2225
#include <fcntl.h>
2326
#include <sys/mman.h>

0 commit comments

Comments
 (0)