1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 #ifndef BITCOIN_COMPAT_H
7 #define BITCOIN_COMPAT_H
13 #define _WIN32_WINNT 0x0501
14 #ifndef WIN32_LEAN_AND_MEAN
15 #define WIN32_LEAN_AND_MEAN 1
21 #undef FD_SETSIZE // prevent redefinition compiler warning
23 #define FD_SETSIZE 1024 // max number of fds in fd_set
25 #include <winsock2.h> // Must be included before mswsock.h and windows.h
31 #include <sys/fcntl.h>
33 #include <sys/socket.h>
34 #include <sys/types.h>
36 #include <netinet/in.h>
37 #include <arpa/inet.h>
45 #define MSG_DONTWAIT 0
49 #define WSAGetLastError() errno
50 #define WSAEINVAL EINVAL
51 #define WSAEALREADY EALREADY
52 #define WSAEWOULDBLOCK EWOULDBLOCK
53 #define WSAEMSGSIZE EMSGSIZE
54 #define WSAEINTR EINTR
55 #define WSAEINPROGRESS EINPROGRESS
56 #define WSAEADDRINUSE EADDRINUSE
57 #define WSAENOTSOCK EBADF
58 #define INVALID_SOCKET (SOCKET)(~0)
59 #define SOCKET_ERROR -1
71 // As Solaris does not have the MSG_NOSIGNAL flag for send(2) syscall, it is defined as 0
72 #if !defined(HAVE_MSG_NOSIGNAL) && !defined(MSG_NOSIGNAL)
73 #define MSG_NOSIGNAL 0
77 // PRIO_MAX is not defined on Solaris
81 #define THREAD_PRIORITY_LOWEST PRIO_MAX
82 #define THREAD_PRIORITY_BELOW_NORMAL 2
83 #define THREAD_PRIORITY_NORMAL 0
84 #define THREAD_PRIORITY_ABOVE_NORMAL (-2)
87 #endif // BITCOIN_COMPAT_H