MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SetupEnvironment

Function SetupEnvironment

src/common/system.cpp:64–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62#endif
63
64void SetupEnvironment()
65{
66#ifdef HAVE_MALLOPT_ARENA_MAX
67 // glibc-specific: On 32-bit systems set the number of arenas to 1.
68 // By default, since glibc 2.10, the C library will create up to two heap
69 // arenas per core. This is known to cause excessive virtual address space
70 // usage in our usage. Work around it by setting the maximum number of
71 // arenas to 1.
72 if (sizeof(void*) == 4) {
73 mallopt(M_ARENA_MAX, 1);
74 }
75#endif
76 // On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
77 // may be invalid, in which case the "C.UTF-8" locale is used as fallback.
78#if !defined(WIN32) && !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
79 try {
80 std::locale(""); // Raises a runtime error if current locale is invalid
81 } catch (const std::runtime_error&) {
82 setenv("LC_ALL", "C.UTF-8", 1);
83 }
84#elif defined(WIN32)
85 assert(GetACP() == CP_UTF8);
86 // Set the default input/output charset is utf-8
87 SetConsoleCP(CP_UTF8);
88 SetConsoleOutputCP(CP_UTF8);
89#endif
90
91#ifndef WIN32
92 constexpr mode_t private_umask = 0077;
93 umask(private_umask);
94#endif
95}
96
97bool SetupNetworking()
98{

Callers 8

mainFunction · 0.85
bitcoin-tx.cppFile · 0.85
bitcoin-cli.cppFile · 0.85
bitcoin-util.cppFile · 0.85
bitcoind.cppFile · 0.85
bitcoin-wallet.cppFile · 0.85
BasicTestingSetupMethod · 0.85
GuiMainFunction · 0.85

Calls

no outgoing calls

Tested by 1

BasicTestingSetupMethod · 0.68