mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
0d59e4d5f8
0164b0f5cf80cd00a4914d9fea0bcb9508cb7607 build: Remove WINVER pre define in Makefile.leveldb.inlcude (Chun Kuan Lee)
d0522ec94ebbaa564f5f6b31236d4df032664411 Drop defunct Windows compat fixes (Ben Woosley)
d8a299206780b38959d732cbe40ba1dd25834f0e windows: Call SetProcessDEPPolicy directly (Chun Kuan Lee)
1bd9ffdd44000b208d29d35451f4dc9f1ac9318f windows: Set _WIN32_WINNT to 0x0601 (Windows 7) (Chun Kuan Lee)
Pull request description:
The current minimum support Windows version is Vista. So set it to 0x0600
5a88def8ad/mingw-w64-headers/include/sdkddkver.h (L19)
Tree-SHA512: 38e2afc79426ae547131c8ad3db2e0a7f54a95512f341cfa0c06e4b2fe79521ae67d2795ef96b0192e683e4f1ba6183c010d7b4b8d6b3e68b9bf48c374c59e7d
116 lines
2.6 KiB
C
116 lines
2.6 KiB
C
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_COMPAT_H
|
|
#define BITCOIN_COMPAT_H
|
|
|
|
#if defined(HAVE_CONFIG_H)
|
|
#include <config/dash-config.h>
|
|
#endif
|
|
|
|
#ifdef WIN32
|
|
#ifndef WIN32_LEAN_AND_MEAN
|
|
#define WIN32_LEAN_AND_MEAN 1
|
|
#endif
|
|
#ifndef NOMINMAX
|
|
#define NOMINMAX
|
|
#endif
|
|
#ifdef FD_SETSIZE
|
|
#undef FD_SETSIZE // prevent redefinition compiler warning
|
|
#endif
|
|
#define FD_SETSIZE 1024 // max number of fds in fd_set
|
|
|
|
#include <winsock2.h> // Must be included before mswsock.h and windows.h
|
|
|
|
#include <mswsock.h>
|
|
#include <windows.h>
|
|
#include <ws2tcpip.h>
|
|
#include <stdint.h>
|
|
#else
|
|
#include <fcntl.h>
|
|
#include <sys/mman.h>
|
|
#include <sys/select.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/types.h>
|
|
#include <net/if.h>
|
|
#include <netinet/in.h>
|
|
#include <netinet/tcp.h>
|
|
#include <arpa/inet.h>
|
|
#include <ifaddrs.h>
|
|
#include <limits.h>
|
|
#include <netdb.h>
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
#ifndef WIN32
|
|
typedef unsigned int SOCKET;
|
|
#include <errno.h>
|
|
#define WSAGetLastError() errno
|
|
#define WSAEINVAL EINVAL
|
|
#define WSAEALREADY EALREADY
|
|
#define WSAEWOULDBLOCK EWOULDBLOCK
|
|
#define WSAEMSGSIZE EMSGSIZE
|
|
#define WSAEINTR EINTR
|
|
#define WSAEINPROGRESS EINPROGRESS
|
|
#define WSAEADDRINUSE EADDRINUSE
|
|
#define WSAENOTSOCK EBADF
|
|
#define INVALID_SOCKET (SOCKET)(~0)
|
|
#define SOCKET_ERROR -1
|
|
#define SD_SEND SHUT_WR
|
|
#endif
|
|
|
|
#ifdef WIN32
|
|
#ifndef S_IRUSR
|
|
#define S_IRUSR 0400
|
|
#define S_IWUSR 0200
|
|
#endif
|
|
#else
|
|
#define MAX_PATH 1024
|
|
#endif
|
|
#ifdef _MSC_VER
|
|
#if !defined(ssize_t)
|
|
#ifdef _WIN64
|
|
typedef int64_t ssize_t;
|
|
#else
|
|
typedef int32_t ssize_t;
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
#if HAVE_DECL_STRNLEN == 0
|
|
size_t strnlen( const char *start, size_t max_len);
|
|
#endif // HAVE_DECL_STRNLEN
|
|
|
|
#ifndef WIN32
|
|
typedef void* sockopt_arg_type;
|
|
#else
|
|
typedef char* sockopt_arg_type;
|
|
#endif
|
|
|
|
// Note these both should work with the current usage of poll, but best to be safe
|
|
// WIN32 poll is broken https://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/
|
|
// __APPLE__ poll is broke https://github.com/bitcoin/bitcoin/pull/14336#issuecomment-437384408
|
|
#if defined(__linux__) || defined(__FreeBSD__)
|
|
#define USE_POLL
|
|
#endif
|
|
|
|
#if defined(__linux__)
|
|
#define USE_EPOLL
|
|
#endif
|
|
|
|
#if defined(__FreeBSD__) || defined(__APPLE__)
|
|
#define USE_KQUEUE
|
|
#endif
|
|
|
|
bool static inline IsSelectableSocket(const SOCKET& s) {
|
|
#if defined(USE_POLL) || defined(WIN32)
|
|
return true;
|
|
#else
|
|
return (s < FD_SETSIZE);
|
|
#endif
|
|
}
|
|
|
|
#endif // BITCOIN_COMPAT_H
|