6#include <bitcoin-build-config.h>
21#ifdef HAVE_MALLOPT_ARENA_MAX
39 std::string escaped = arg;
41 return "'" + escaped +
"'";
46void runCommand(
const std::string& strCommand)
48 if (strCommand.empty())
return;
50 int nErr = ::system(strCommand.c_str());
52 int nErr = ::_wsystem(std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,
wchar_t>().from_bytes(strCommand).c_str());
55 LogPrintf(
"runCommand error: system(%s) returned %d\n", strCommand, nErr);
61#ifdef HAVE_MALLOPT_ARENA_MAX
67 if (
sizeof(
void*) == 4) {
68 mallopt(M_ARENA_MAX, 1);
73#if !defined(WIN32) && !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
76 }
catch (
const std::runtime_error&) {
77 setenv(
"LC_ALL",
"C.UTF-8", 1);
81 SetConsoleCP(CP_UTF8);
82 SetConsoleOutputCP(CP_UTF8);
86 constexpr mode_t private_umask = 0077;
96 int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
97 if (
ret != NO_ERROR || LOBYTE(wsadata.wVersion ) != 2 || HIBYTE(wsadata.wVersion) != 2)
105 return std::thread::hardware_concurrency();
const int64_t nStartupTime
int GetNumCores()
Return the number of cores available on the current system.
std::string ShellEscape(const std::string &arg)
void ReplaceAll(std::string &in_out, const std::string &search, const std::string &substitute)
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.