Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.cpp
Show First 20 Lines • Show All 1,161 Lines • ▼ Show 20 Lines | fs::path GetSpecialFolderPath(int nFolder, bool fCreate) { | ||||
} | } | ||||
LogPrintf( | LogPrintf( | ||||
"SHGetSpecialFolderPathW() failed, could not obtain requested path.\n"); | "SHGetSpecialFolderPathW() failed, could not obtain requested path.\n"); | ||||
return fs::path(""); | return fs::path(""); | ||||
} | } | ||||
#endif | #endif | ||||
#if defined(HAVE_SYSTEM) | |||||
void runCommand(const std::string &strCommand) { | void runCommand(const std::string &strCommand) { | ||||
if (strCommand.empty()) { | if (strCommand.empty()) { | ||||
return; | return; | ||||
} | } | ||||
#ifndef WIN32 | #ifndef WIN32 | ||||
int nErr = ::system(strCommand.c_str()); | int nErr = ::system(strCommand.c_str()); | ||||
#else | #else | ||||
int nErr = ::_wsystem( | int nErr = ::_wsystem( | ||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>() | std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>() | ||||
.from_bytes(strCommand) | .from_bytes(strCommand) | ||||
.c_str()); | .c_str()); | ||||
#endif | #endif | ||||
if (nErr) { | if (nErr) { | ||||
LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, | LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, | ||||
nErr); | nErr); | ||||
} | } | ||||
} | } | ||||
#endif | |||||
void SetupEnvironment() { | void SetupEnvironment() { | ||||
#ifdef HAVE_MALLOPT_ARENA_MAX | #ifdef HAVE_MALLOPT_ARENA_MAX | ||||
// glibc-specific: On 32-bit systems set the number of arenas to 1. By | // glibc-specific: On 32-bit systems set the number of arenas to 1. By | ||||
// default, since glibc 2.10, the C library will create up to two heap | // default, since glibc 2.10, the C library will create up to two heap | ||||
// arenas per core. This is known to cause excessive virtual address space | // arenas per core. This is known to cause excessive virtual address space | ||||
// usage in our usage. Work around it by setting the maximum number of | // usage in our usage. Work around it by setting the maximum number of | ||||
// arenas to 1. | // arenas to 1. | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |