6 #ifndef BITCOIN_COMPAT_H
7 #define BITCOIN_COMPAT_H
9 #if defined(HAVE_CONFIG_H)
10 #include <config/bitcoin-config.h>
20 #define FD_SETSIZE 1024
24 #include <arpa/inet.h>
29 #include <netinet/in.h>
30 #include <netinet/tcp.h>
31 #include <sys/fcntl.h>
33 #include <sys/select.h>
34 #include <sys/socket.h>
35 #include <sys/types.h>
42 #define WSAGetLastError() errno
43 #define WSAEINVAL EINVAL
44 #define WSAEALREADY EALREADY
45 #define WSAEWOULDBLOCK EWOULDBLOCK
46 #define WSAEAGAIN EAGAIN
47 #define WSAEMSGSIZE EMSGSIZE
48 #define WSAEINTR EINTR
49 #define WSAEINPROGRESS EINPROGRESS
50 #define WSAEADDRINUSE EADDRINUSE
51 #define WSAENOTSOCK EBADF
52 #define INVALID_SOCKET (SOCKET)(~0)
53 #define SOCKET_ERROR -1
57 #define WSAEAGAIN EAGAIN
59 #define WSAEAGAIN WSAEWOULDBLOCK
75 typedef int64_t ssize_t;
77 typedef int32_t ssize_t;
82 #if HAVE_DECL_STRNLEN == 0
83 size_t strnlen(
const char *start,
size_t max_len);
98 #if defined(__linux__)
103 #if defined(USE_POLL) || defined(WIN32)
106 return (s < FD_SETSIZE);
112 #if !defined(MSG_NOSIGNAL)
113 #define MSG_NOSIGNAL 0
118 #if !defined(MSG_DONTWAIT)
119 #define MSG_DONTWAIT 0
size_t strnlen(const char *start, size_t max_len)
static bool IsSelectableSocket(const SOCKET &s)