Merged xmrig v6.23.0

This commit is contained in:
MoneroOcean 2025-06-16 18:23:10 -07:00
commit 3e84e504da
70 changed files with 7261 additions and 10636 deletions

View file

@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2024 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,6 +20,7 @@
#include "base/api/Api.h"
#include "3rdparty/rapidjson/writer.h"
#include "base/api/interfaces/IApiListener.h"
#include "base/api/requests/HttpApiRequest.h"
#include "base/crypto/keccak.h"
@ -31,7 +32,6 @@
#include "base/tools/Chrono.h"
#include "base/tools/Cvt.h"
#include "core/config/Config.h"
#include "core/Controller.h"
#include "version.h"
@ -46,6 +46,12 @@
namespace xmrig {
static_assert(
RAPIDJSON_WRITE_DEFAULT_FLAGS == (rapidjson::kWriteNanAndInfFlag | rapidjson::kWriteNanAndInfNullFlag),
"(rapidjson::kWriteNanAndInfFlag | rapidjson::kWriteNanAndInfNullFlag) required"
);
static rapidjson::Value getResources(rapidjson::Document &doc)
{
using namespace rapidjson;

View file

@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,7 +19,7 @@
#include <windows.h>
#ifdef __GNUC__
#if defined(__GNUC__) && !defined(__clang__)
# include <fcntl.h>
# include <sys/stat.h>
# include <ext/stdio_filebuf.h>
@ -39,7 +39,7 @@
namespace xmrig {
#if defined(_MSC_VER) || defined (__GNUC__)
#if defined(_MSC_VER) || defined(__GNUC__)
static std::wstring toUtf16(const char *str)
{
const int size = static_cast<int>(strlen(str));
@ -56,9 +56,9 @@ static std::wstring toUtf16(const char *str)
#endif
#if defined(_MSC_VER)
#if defined(_MSC_VER) || defined(_LIBCPP_HAS_OPEN_WITH_WCHAR)
# define OPEN_IFS(name) \
std::ifstream ifs(toUtf16(name), std::ios_base::in | std::ios_base::binary); \
std::ifstream ifs(toUtf16(name).c_str(), std::ios_base::in | std::ios_base::binary);\
if (!ifs.is_open()) { \
return false; \
}
@ -98,8 +98,8 @@ bool xmrig::Json::save(const char *fileName, const rapidjson::Document &doc)
using namespace rapidjson;
constexpr const std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary | std::ios_base::trunc;
# if defined(_MSC_VER)
std::ofstream ofs(toUtf16(fileName), mode);
# if defined(_MSC_VER) || defined(_LIBCPP_HAS_OPEN_WITH_WCHAR)
std::ofstream ofs(toUtf16(fileName).c_str(), mode);
if (!ofs.is_open()) {
return false;
}

View file

@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -53,13 +53,21 @@ char *xmrig::Platform::createUserAgent()
char *buf = new char[max]();
int length = snprintf(buf, max, "%s/%s (Windows NT %lu.%lu", APP_NAME, APP_VERSION, osver.dwMajorVersion, osver.dwMinorVersion);
# if defined(__x86_64__) || defined(_M_AMD64)
length += snprintf(buf + length, max - length, "; Win64; x64) libuv/%s", uv_version_string());
# if defined(XMRIG_64_BIT)
length += snprintf(buf + length, max - length, "; Win64; "
# if defined(XMRIG_ARM)
"arm64"
# else
"x64"
# endif
") libuv/%s", uv_version_string());
# else
length += snprintf(buf + length, max - length, ") libuv/%s", uv_version_string());
# endif
# ifdef __GNUC__
# ifdef __clang__
snprintf(buf + length, max - length, " clang/%d.%d.%d", __clang_major__, __clang_minor__, __clang_patchlevel__);
# elif defined(__GNUC__)
snprintf(buf + length, max - length, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
# elif _MSC_VER
snprintf(buf + length, max - length, " msvc/%d", MSVC_VERSION);

View file

@ -1,7 +1,7 @@
/* XMRig
* Copyright (c) 2014-2019 heapwolf <https://github.com/heapwolf>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "base/net/http/HttpData.h"
#include "3rdparty/llhttp/llhttp.h"
#include "3rdparty/rapidjson/document.h"
@ -29,76 +28,6 @@
#include <stdexcept>
/* Status Codes */
#define HTTP_STATUS_MAP(XX) \
XX(100, CONTINUE, Continue) \
XX(101, SWITCHING_PROTOCOLS, Switching Protocols) \
XX(102, PROCESSING, Processing) \
XX(200, OK, OK) \
XX(201, CREATED, Created) \
XX(202, ACCEPTED, Accepted) \
XX(203, NON_AUTHORITATIVE_INFORMATION, Non-Authoritative Information) \
XX(204, NO_CONTENT, No Content) \
XX(205, RESET_CONTENT, Reset Content) \
XX(206, PARTIAL_CONTENT, Partial Content) \
XX(207, MULTI_STATUS, Multi-Status) \
XX(208, ALREADY_REPORTED, Already Reported) \
XX(226, IM_USED, IM Used) \
XX(300, MULTIPLE_CHOICES, Multiple Choices) \
XX(301, MOVED_PERMANENTLY, Moved Permanently) \
XX(302, FOUND, Found) \
XX(303, SEE_OTHER, See Other) \
XX(304, NOT_MODIFIED, Not Modified) \
XX(305, USE_PROXY, Use Proxy) \
XX(307, TEMPORARY_REDIRECT, Temporary Redirect) \
XX(308, PERMANENT_REDIRECT, Permanent Redirect) \
XX(400, BAD_REQUEST, Bad Request) \
XX(401, UNAUTHORIZED, Unauthorized) \
XX(402, PAYMENT_REQUIRED, Payment Required) \
XX(403, FORBIDDEN, Forbidden) \
XX(404, NOT_FOUND, Not Found) \
XX(405, METHOD_NOT_ALLOWED, Method Not Allowed) \
XX(406, NOT_ACCEPTABLE, Not Acceptable) \
XX(407, PROXY_AUTHENTICATION_REQUIRED, Proxy Authentication Required) \
XX(408, REQUEST_TIMEOUT, Request Timeout) \
XX(409, CONFLICT, Conflict) \
XX(410, GONE, Gone) \
XX(411, LENGTH_REQUIRED, Length Required) \
XX(412, PRECONDITION_FAILED, Precondition Failed) \
XX(413, PAYLOAD_TOO_LARGE, Payload Too Large) \
XX(414, URI_TOO_LONG, URI Too Long) \
XX(415, UNSUPPORTED_MEDIA_TYPE, Unsupported Media Type) \
XX(416, RANGE_NOT_SATISFIABLE, Range Not Satisfiable) \
XX(417, EXPECTATION_FAILED, Expectation Failed) \
XX(421, MISDIRECTED_REQUEST, Misdirected Request) \
XX(422, UNPROCESSABLE_ENTITY, Unprocessable Entity) \
XX(423, LOCKED, Locked) \
XX(424, FAILED_DEPENDENCY, Failed Dependency) \
XX(426, UPGRADE_REQUIRED, Upgrade Required) \
XX(428, PRECONDITION_REQUIRED, Precondition Required) \
XX(429, TOO_MANY_REQUESTS, Too Many Requests) \
XX(431, REQUEST_HEADER_FIELDS_TOO_LARGE, Request Header Fields Too Large) \
XX(451, UNAVAILABLE_FOR_LEGAL_REASONS, Unavailable For Legal Reasons) \
XX(500, INTERNAL_SERVER_ERROR, Internal Server Error) \
XX(501, NOT_IMPLEMENTED, Not Implemented) \
XX(502, BAD_GATEWAY, Bad Gateway) \
XX(503, SERVICE_UNAVAILABLE, Service Unavailable) \
XX(504, GATEWAY_TIMEOUT, Gateway Timeout) \
XX(505, HTTP_VERSION_NOT_SUPPORTED, HTTP Version Not Supported) \
XX(506, VARIANT_ALSO_NEGOTIATES, Variant Also Negotiates) \
XX(507, INSUFFICIENT_STORAGE, Insufficient Storage) \
XX(508, LOOP_DETECTED, Loop Detected) \
XX(510, NOT_EXTENDED, Not Extended) \
XX(511, NETWORK_AUTHENTICATION_REQUIRED, Network Authentication Required) \
enum http_status
{
# define XX(num, name, string) HTTP_STATUS_##name = num,
HTTP_STATUS_MAP(XX)
# undef XX
};
namespace xmrig {
@ -108,17 +37,6 @@ const std::string HttpData::kContentTypeL = "content-type";
const std::string HttpData::kTextPlain = "text/plain";
static const char *http_status_str(enum http_status s)
{
switch (s) {
# define XX(num, name, string) case HTTP_STATUS_##name: return #string;
HTTP_STATUS_MAP(XX)
# undef XX
default: return "<unknown>";
}
}
} // namespace xmrig
@ -173,5 +91,5 @@ const char *xmrig::HttpData::statusName(int status)
return uv_strerror(status);
}
return http_status_str(static_cast<http_status>(status));
return llhttp_status_name(static_cast<llhttp_status>(status));
}

View file

@ -23,15 +23,22 @@
#pragma once
#include <cstdint>
#ifdef XMRIG_64_BIT
# ifdef _MSC_VER
#if defined(XMRIG_64_BIT)
# if defined(_MSC_VER)
# include <intrin.h>
# pragma intrinsic(_umul128)
# define __umul128 _umul128
# elif defined __GNUC__
# if defined(XMRIG_ARM)
#pragma intrinsic(__umulh)
static inline uint64_t __umul128(uint64_t a, uint64_t b, uint64_t *high) {
*high = __umulh(a, b);
return a * b;
}
# else
# pragma intrinsic(_umul128)
# define __umul128 _umul128
# endif
# elif defined(__GNUC__)
static inline uint64_t _umul128(uint64_t a, uint64_t b, uint64_t* hi)
{
unsigned __int128 r = (unsigned __int128) a * (unsigned __int128) b;