mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
merge bitcoin#25493: document code in compat.h
This commit is contained in:
parent
3f143096c8
commit
bbb0cceb7a
@ -163,9 +163,9 @@ BITCOIN_CORE_H = \
|
|||||||
coinjoin/util.h \
|
coinjoin/util.h \
|
||||||
coins.h \
|
coins.h \
|
||||||
common/bloom.h \
|
common/bloom.h \
|
||||||
compat.h \
|
|
||||||
compat/assumptions.h \
|
compat/assumptions.h \
|
||||||
compat/byteswap.h \
|
compat/byteswap.h \
|
||||||
|
compat/compat.h \
|
||||||
compat/cpuid.h \
|
compat/cpuid.h \
|
||||||
compat/endian.h \
|
compat/endian.h \
|
||||||
compressor.h \
|
compressor.h \
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <chainparamsbase.h>
|
#include <chainparamsbase.h>
|
||||||
#include <clientversion.h>
|
#include <clientversion.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <compat/stdin.h>
|
#include <compat/stdin.h>
|
||||||
#include <policy/feerate.h>
|
#include <policy/feerate.h>
|
||||||
#include <rpc/client.h>
|
#include <rpc/client.h>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <clientversion.h>
|
#include <clientversion.h>
|
||||||
#include <coins.h>
|
#include <coins.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <consensus/consensus.h>
|
#include <consensus/consensus.h>
|
||||||
#include <core_io.h>
|
#include <core_io.h>
|
||||||
#include <key_io.h>
|
#include <key_io.h>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <chainparamsbase.h>
|
#include <chainparamsbase.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
#include <util/strencodings.h>
|
#include <util/strencodings.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <clientversion.h>
|
#include <clientversion.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <interfaces/chain.h>
|
#include <interfaces/chain.h>
|
||||||
#include <interfaces/init.h>
|
#include <interfaces/init.h>
|
||||||
|
@ -3,21 +3,24 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#ifndef BITCOIN_COMPAT_H
|
#ifndef BITCOIN_COMPAT_COMPAT_H
|
||||||
#define BITCOIN_COMPAT_H
|
#define BITCOIN_COMPAT_COMPAT_H
|
||||||
|
|
||||||
#if defined(HAVE_CONFIG_H)
|
#if defined(HAVE_CONFIG_H)
|
||||||
#include <config/bitcoin-config.h>
|
#include <config/bitcoin-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Windows defines FD_SETSIZE to 64 (see _fd_types.h in mingw-w64),
|
||||||
|
// which is too small for our usage, but allows us to redefine it safely.
|
||||||
|
// We redefine it to be 1024, to match glibc, see typesizes.h.
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#ifdef FD_SETSIZE
|
#ifdef FD_SETSIZE
|
||||||
#undef FD_SETSIZE // prevent redefinition compiler warning
|
#undef FD_SETSIZE
|
||||||
#endif
|
#endif
|
||||||
#define FD_SETSIZE 1024 // max number of fds in fd_set
|
#define FD_SETSIZE 1024
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
#else
|
#else
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
@ -34,50 +37,55 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// We map Linux / BSD error functions and codes, to the equivalent
|
||||||
|
// Windows definitions, and use the WSA* names throughout our code.
|
||||||
|
// Note that glibc defines EWOULDBLOCK as EAGAIN (see errno.h).
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
typedef unsigned int SOCKET;
|
typedef unsigned int SOCKET;
|
||||||
#include <errno.h>
|
#include <cerrno>
|
||||||
#define WSAGetLastError() errno
|
#define WSAGetLastError() errno
|
||||||
#define WSAEINVAL EINVAL
|
#define WSAEINVAL EINVAL
|
||||||
#define WSAEALREADY EALREADY
|
|
||||||
#define WSAEWOULDBLOCK EWOULDBLOCK
|
#define WSAEWOULDBLOCK EWOULDBLOCK
|
||||||
#define WSAEAGAIN EAGAIN
|
#define WSAEAGAIN EAGAIN
|
||||||
#define WSAEMSGSIZE EMSGSIZE
|
#define WSAEMSGSIZE EMSGSIZE
|
||||||
#define WSAEINTR EINTR
|
#define WSAEINTR EINTR
|
||||||
#define WSAEINPROGRESS EINPROGRESS
|
#define WSAEINPROGRESS EINPROGRESS
|
||||||
#define WSAEADDRINUSE EADDRINUSE
|
#define WSAEADDRINUSE EADDRINUSE
|
||||||
#define WSAENOTSOCK EBADF
|
|
||||||
#define INVALID_SOCKET (SOCKET)(~0)
|
#define INVALID_SOCKET (SOCKET)(~0)
|
||||||
#define SOCKET_ERROR -1
|
#define SOCKET_ERROR -1
|
||||||
#define SD_SEND SHUT_WR
|
#define SD_SEND SHUT_WR
|
||||||
#else
|
#else
|
||||||
#ifndef WSAEAGAIN
|
// WSAEAGAIN doesn't exist on Windows
|
||||||
#ifdef EAGAIN
|
#ifdef EAGAIN
|
||||||
#define WSAEAGAIN EAGAIN
|
#define WSAEAGAIN EAGAIN
|
||||||
#else
|
#else
|
||||||
#define WSAEAGAIN WSAEWOULDBLOCK
|
#define WSAEAGAIN WSAEWOULDBLOCK
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
// Windows doesn't define S_IRUSR or S_IWUSR. We define both
|
||||||
|
// here, with the same values as glibc (see stat.h).
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#ifndef S_IRUSR
|
#ifndef S_IRUSR
|
||||||
#define S_IRUSR 0400
|
#define S_IRUSR 0400
|
||||||
#define S_IWUSR 0200
|
#define S_IWUSR 0200
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
|
||||||
|
// Windows defines MAX_PATH as it's maximum path length.
|
||||||
|
// We define MAX_PATH for use on non-Windows systems.
|
||||||
|
#ifndef WIN32
|
||||||
|
#define MAX_PATH 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ssize_t is POSIX, and not present when using MSVC.
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <BaseTsd.h>
|
||||||
|
typedef SSIZE_T ssize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// The type of the option value passed to getsockopt & setsockopt
|
||||||
|
// differs between Windows and non-Windows.
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
typedef void* sockopt_arg_type;
|
typedef void* sockopt_arg_type;
|
||||||
#else
|
#else
|
||||||
@ -128,4 +136,4 @@ bool static inline IsSelectableSocket(const SOCKET& s) {
|
|||||||
#define MSG_DONTWAIT 0
|
#define MSG_DONTWAIT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // BITCOIN_COMPAT_H
|
#endif // BITCOIN_COMPAT_COMPAT_H
|
@ -3,7 +3,7 @@
|
|||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <compat/endian.h>
|
#include <compat/endian.h>
|
||||||
#include <crypto/sha256.h>
|
#include <crypto/sha256.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#ifndef BITCOIN_I2P_H
|
#ifndef BITCOIN_I2P_H
|
||||||
#define BITCOIN_I2P_H
|
#define BITCOIN_I2P_H
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <netaddress.h>
|
#include <netaddress.h>
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <util/thread.h>
|
#include <util/thread.h>
|
||||||
|
|
||||||
#ifdef USE_NATPMP
|
#ifdef USE_NATPMP
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <natpmp.h>
|
#include <natpmp.h>
|
||||||
#endif // USE_NATPMP
|
#endif // USE_NATPMP
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include <addrman.h>
|
#include <addrman.h>
|
||||||
#include <banman.h>
|
#include <banman.h>
|
||||||
#include <clientversion.h>
|
#include <clientversion.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <consensus/consensus.h>
|
#include <consensus/consensus.h>
|
||||||
#include <crypto/sha256.h>
|
#include <crypto/sha256.h>
|
||||||
#include <node/eviction.h>
|
#include <node/eviction.h>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <bip324.h>
|
#include <bip324.h>
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <common/bloom.h>
|
#include <common/bloom.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <consensus/amount.h>
|
#include <consensus/amount.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <crypto/siphash.h>
|
#include <crypto/siphash.h>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <attributes.h>
|
#include <attributes.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <crypto/siphash.h>
|
#include <crypto/siphash.h>
|
||||||
#include <prevector.h>
|
#include <prevector.h>
|
||||||
#include <random.h>
|
#include <random.h>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
#include <util/sock.h>
|
#include <util/sock.h>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <config/bitcoin-config.h>
|
#include <config/bitcoin-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <netaddress.h>
|
#include <netaddress.h>
|
||||||
#include <serialize.h>
|
#include <serialize.h>
|
||||||
#include <util/sock.h>
|
#include <util/sock.h>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include <qt/bitcoin.h>
|
#include <qt/bitcoin.h>
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <util/translation.h>
|
#include <util/translation.h>
|
||||||
#include <util/url.h>
|
#include <util/url.h>
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <crypto/sha512.h>
|
#include <crypto/sha512.h>
|
||||||
#include <support/cleanse.h>
|
#include <support/cleanse.h>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <compat.h> // for Windows API
|
#include <compat/compat.h>
|
||||||
#include <wincrypt.h>
|
#include <wincrypt.h>
|
||||||
#endif
|
#endif
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <support/cleanse.h>
|
#include <support/cleanse.h>
|
||||||
#include <util/time.h> // for GetTime()
|
#include <util/time.h> // for GetTime()
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <compat.h> // for Windows API
|
#include <compat/compat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#ifndef BITCOIN_STATS_RAWSENDER_H
|
#ifndef BITCOIN_STATS_RAWSENDER_H
|
||||||
#define BITCOIN_STATS_RAWSENDER_H
|
#define BITCOIN_STATS_RAWSENDER_H
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
#include <threadinterrupt.h>
|
#include <threadinterrupt.h>
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <attributes.h>
|
#include <attributes.h>
|
||||||
#include <chainparamsbase.h>
|
#include <chainparamsbase.h>
|
||||||
#include <coins.h>
|
#include <coins.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <consensus/amount.h>
|
#include <consensus/amount.h>
|
||||||
#include <consensus/consensus.h>
|
#include <consensus/consensus.h>
|
||||||
#include <key.h>
|
#include <key.h>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <netaddress.h>
|
#include <netaddress.h>
|
||||||
#include <test/fuzz/FuzzedDataProvider.h>
|
#include <test/fuzz/FuzzedDataProvider.h>
|
||||||
#include <util/strencodings.h>
|
#include <util/strencodings.h>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <net_processing.h>
|
#include <net_processing.h>
|
||||||
#include <netaddress.h>
|
#include <netaddress.h>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <clientversion.h>
|
#include <clientversion.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <net_processing.h>
|
#include <net_processing.h>
|
||||||
#include <netaddress.h>
|
#include <netaddress.h>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <test/util/setup_common.h>
|
#include <test/util/setup_common.h>
|
||||||
#include <threadinterrupt.h>
|
#include <threadinterrupt.h>
|
||||||
#include <util/sock.h>
|
#include <util/sock.h>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#ifndef BITCOIN_TEST_UTIL_NET_H
|
#ifndef BITCOIN_TEST_UTIL_NET_H
|
||||||
#define BITCOIN_TEST_UTIL_NET_H
|
#define BITCOIN_TEST_UTIL_NET_H
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <net_permissions.h>
|
#include <net_permissions.h>
|
||||||
#include <net_processing.h>
|
#include <net_processing.h>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <chainparamsbase.h>
|
#include <chainparamsbase.h>
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <crypto/hmac_sha256.h>
|
#include <crypto/hmac_sha256.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <netaddress.h>
|
#include <netaddress.h>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#ifndef BITCOIN_UTIL_EDGE_H
|
#ifndef BITCOIN_UTIL_EDGE_H
|
||||||
#define BITCOIN_UTIL_EDGE_H
|
#define BITCOIN_UTIL_EDGE_H
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
#include <threadinterrupt.h>
|
#include <threadinterrupt.h>
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#ifndef BITCOIN_UTIL_SOCK_H
|
#ifndef BITCOIN_UTIL_SOCK_H
|
||||||
#define BITCOIN_UTIL_SOCK_H
|
#define BITCOIN_UTIL_SOCK_H
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <threadinterrupt.h>
|
#include <threadinterrupt.h>
|
||||||
#include <util/time.h>
|
#include <util/time.h>
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <attributes.h>
|
#include <attributes.h>
|
||||||
#include <compat.h>
|
|
||||||
#include <compat/assumptions.h>
|
#include <compat/assumptions.h>
|
||||||
|
#include <compat/compat.h>
|
||||||
#include <consensus/amount.h>
|
#include <consensus/amount.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <config/bitcoin-config.h>
|
#include <config/bitcoin-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
#include <util/time.h>
|
#include <util/time.h>
|
||||||
|
|
||||||
#include <util/check.h>
|
#include <util/check.h>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#ifndef BITCOIN_UTIL_TIME_H
|
#ifndef BITCOIN_UTIL_TIME_H
|
||||||
#define BITCOIN_UTIL_TIME_H
|
#define BITCOIN_UTIL_TIME_H
|
||||||
|
|
||||||
#include <compat.h>
|
#include <compat/compat.h>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#include <compat/compat.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <wallet/bdb.h>
|
#include <wallet/bdb.h>
|
||||||
#include <wallet/db.h>
|
#include <wallet/db.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user