]> Git Repo - VerusCoin.git/blob - src/compat.h
Merge pull request #5237
[VerusCoin.git] / src / compat.h
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.
5
6 #ifndef BITCOIN_COMPAT_H
7 #define BITCOIN_COMPAT_H
8
9 #ifdef WIN32
10 #ifdef _WIN32_WINNT
11 #undef _WIN32_WINNT
12 #endif
13 #define _WIN32_WINNT 0x0501
14 #ifndef WIN32_LEAN_AND_MEAN
15 #define WIN32_LEAN_AND_MEAN 1
16 #endif
17 #ifndef NOMINMAX
18 #define NOMINMAX
19 #endif
20 #ifdef FD_SETSIZE
21 #undef FD_SETSIZE // prevent redefinition compiler warning
22 #endif
23 #define FD_SETSIZE 1024 // max number of fds in fd_set
24
25 #include <winsock2.h>     // Must be included before mswsock.h and windows.h
26
27 #include <mswsock.h>
28 #include <windows.h>
29 #include <ws2tcpip.h>
30 #else
31 #include <sys/fcntl.h>
32 #include <sys/mman.h>
33 #include <sys/socket.h>
34 #include <sys/types.h>
35 #include <net/if.h>
36 #include <netinet/in.h>
37 #include <arpa/inet.h>
38 #include <ifaddrs.h>
39 #include <limits.h>
40 #include <netdb.h>
41 #include <unistd.h>
42 #endif
43
44 #ifdef WIN32
45 #define MSG_DONTWAIT        0
46 #else
47 typedef u_int SOCKET;
48 #include "errno.h"
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
60 #endif
61
62 #ifdef WIN32
63 #ifndef S_IRUSR
64 #define S_IRUSR             0400
65 #define S_IWUSR             0200
66 #endif
67 #else
68 #define MAX_PATH            1024
69 #endif
70
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
74 #endif
75
76 #ifndef WIN32
77 // PRIO_MAX is not defined on Solaris
78 #ifndef PRIO_MAX
79 #define PRIO_MAX 20
80 #endif
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)
85 #endif
86
87 #endif // BITCOIN_COMPAT_H
This page took 0.038173 seconds and 4 git commands to generate.