Bitcoin Core  21.99.0
P2P Digital Currency
system.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2020 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
10 #ifndef BITCOIN_UTIL_SYSTEM_H
11 #define BITCOIN_UTIL_SYSTEM_H
12 
13 #if defined(HAVE_CONFIG_H)
14 #include <config/bitcoin-config.h>
15 #endif
16 
17 #include <attributes.h>
18 #include <compat.h>
19 #include <compat/assumptions.h>
20 #include <fs.h>
21 #include <logging.h>
22 #include <sync.h>
23 #include <tinyformat.h>
24 #include <util/settings.h>
25 #include <util/threadnames.h>
26 #include <util/time.h>
27 
28 #include <any>
29 #include <exception>
30 #include <map>
31 #include <optional>
32 #include <set>
33 #include <stdint.h>
34 #include <string>
35 #include <utility>
36 #include <vector>
37 
38 class UniValue;
39 
40 // Application startup time (used for uptime calculation)
41 int64_t GetStartupTime();
42 
43 extern const char * const BITCOIN_CONF_FILENAME;
44 extern const char * const BITCOIN_SETTINGS_FILENAME;
45 
46 void SetupEnvironment();
47 bool SetupNetworking();
48 
49 template<typename... Args>
50 bool error(const char* fmt, const Args&... args)
51 {
52  LogPrintf("ERROR: %s\n", tfm::format(fmt, args...));
53  return false;
54 }
55 
56 void PrintExceptionContinue(const std::exception *pex, const char* pszThread);
57 
62 bool FileCommit(FILE *file);
63 
68 void DirectoryCommit(const fs::path &dirname);
69 
70 bool TruncateFile(FILE *file, unsigned int length);
71 int RaiseFileDescriptorLimit(int nMinFD);
72 void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length);
73 [[nodiscard]] bool RenameOver(fs::path src, fs::path dest);
74 bool LockDirectory(const fs::path& directory, const std::string lockfile_name, bool probe_only=false);
75 void UnlockDirectory(const fs::path& directory, const std::string& lockfile_name);
76 bool DirIsWritable(const fs::path& directory);
77 bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes = 0);
78 
85 std::streampos GetFileSize(const char* path, std::streamsize max = std::numeric_limits<std::streamsize>::max());
86 
91 
92 bool TryCreateDirectories(const fs::path& p);
93 fs::path GetDefaultDataDir();
94 // The blocks directory is always net specific.
95 const fs::path &GetBlocksDir();
96 const fs::path &GetDataDir(bool fNetSpecific = true);
97 // Return true if -datadir option points to a valid directory or is not specified.
98 bool CheckDataDirOption();
100 void ClearDatadirCache();
101 fs::path GetConfigFile(const std::string& confPath);
102 #ifdef WIN32
103 fs::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
104 #endif
105 #ifndef WIN32
106 std::string ShellEscape(const std::string& arg);
107 #endif
108 #if HAVE_SYSTEM
109 void runCommand(const std::string& strCommand);
110 #endif
111 #ifdef ENABLE_EXTERNAL_SIGNER
112 
119 UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in="");
120 #endif // ENABLE_EXTERNAL_SIGNER
121 
130 fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific = true);
131 
132 inline bool IsSwitchChar(char c)
133 {
134 #ifdef WIN32
135  return c == '-' || c == '/';
136 #else
137  return c == '-';
138 #endif
139 }
140 
141 enum class OptionsCategory {
142  OPTIONS,
143  CONNECTION,
144  WALLET,
146  ZMQ,
147  DEBUG_TEST,
148  CHAINPARAMS,
149  NODE_RELAY,
151  RPC,
152  GUI,
153  COMMANDS,
155 
156  HIDDEN // Always the last option to avoid printing these in the help
157 };
158 
160 {
161  std::string m_name;
162  std::string m_file;
163  int m_line;
164 };
165 
167 {
168 public:
169  enum Flags : uint32_t {
170  // Boolean options can accept negation syntax -noOPTION or -noOPTION=1
171  ALLOW_BOOL = 0x01,
172  ALLOW_INT = 0x02,
173  ALLOW_STRING = 0x04,
175  DEBUG_ONLY = 0x100,
176  /* Some options would cause cross-contamination if values for
177  * mainnet were used while running on regtest/testnet (or vice-versa).
178  * Setting them as NETWORK_ONLY ensures that sharing a config file
179  * between mainnet and regtest/testnet won't cause problems due to these
180  * parameters by accident. */
181  NETWORK_ONLY = 0x200,
182  // This argument's value is sensitive (such as a password).
183  SENSITIVE = 0x400,
184  COMMAND = 0x800,
185  };
186 
187 protected:
188  struct Arg
189  {
190  std::string m_help_param;
191  std::string m_help_text;
192  unsigned int m_flags;
193  };
194 
196  util::Settings m_settings GUARDED_BY(cs_args);
197  std::vector<std::string> m_command GUARDED_BY(cs_args);
198  std::string m_network GUARDED_BY(cs_args);
199  std::set<std::string> m_network_only_args GUARDED_BY(cs_args);
200  std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args);
201  bool m_accept_any_command GUARDED_BY(cs_args){true};
202  std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args);
203 
204  [[nodiscard]] bool ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys = false);
205 
211  bool UseDefaultSection(const std::string& arg) const EXCLUSIVE_LOCKS_REQUIRED(cs_args);
212 
220  util::SettingsValue GetSetting(const std::string& arg) const;
221 
225  std::vector<util::SettingsValue> GetSettingsList(const std::string& arg) const;
226 
227 public:
228  ArgsManager();
229  ~ArgsManager();
230 
234  void SelectConfigNetwork(const std::string& network);
235 
236  [[nodiscard]] bool ParseParameters(int argc, const char* const argv[], std::string& error);
237  [[nodiscard]] bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false);
238 
245  const std::set<std::string> GetUnsuitableSectionOnlyArgs() const;
246 
250  const std::list<SectionInfo> GetUnrecognizedSections() const;
251 
252  struct Command {
254  std::string command;
259  std::vector<std::string> args;
260  };
264  std::optional<const Command> GetCommand() const;
265 
272  std::vector<std::string> GetArgs(const std::string& strArg) const;
273 
280  bool IsArgSet(const std::string& strArg) const;
281 
289  bool IsArgNegated(const std::string& strArg) const;
290 
298  std::string GetArg(const std::string& strArg, const std::string& strDefault) const;
299 
307  int64_t GetArg(const std::string& strArg, int64_t nDefault) const;
308 
316  bool GetBoolArg(const std::string& strArg, bool fDefault) const;
317 
325  bool SoftSetArg(const std::string& strArg, const std::string& strValue);
326 
334  bool SoftSetBoolArg(const std::string& strArg, bool fValue);
335 
336  // Forces an arg setting. Called by SoftSetArg() if the arg hasn't already
337  // been set. Also called directly in testing.
338  void ForceSetArg(const std::string& strArg, const std::string& strValue);
339 
344  std::string GetChainName() const;
345 
349  void AddArg(const std::string& name, const std::string& help, unsigned int flags, const OptionsCategory& cat);
350 
354  void AddCommand(const std::string& cmd, const std::string& help, const OptionsCategory& cat);
355 
359  void AddHiddenArgs(const std::vector<std::string>& args);
360 
364  void ClearArgs() {
365  LOCK(cs_args);
366  m_available_args.clear();
367  m_network_only_args.clear();
368  }
369 
373  std::string GetHelpMessage() const;
374 
379  std::optional<unsigned int> GetArgFlags(const std::string& name) const;
380 
386  bool InitSettings(std::string& error);
387 
392  bool GetSettingsPath(fs::path* filepath = nullptr, bool temp = false) const;
393 
397  bool ReadSettingsFile(std::vector<std::string>* errors = nullptr);
398 
402  bool WriteSettingsFile(std::vector<std::string>* errors = nullptr) const;
403 
407  template <typename Fn>
408  void LockSettings(Fn&& fn)
409  {
410  LOCK(cs_args);
411  fn(m_settings);
412  }
413 
418  void LogArgs() const;
419 
420 private:
421  // Helper function for LogArgs().
422  void logArgsPrefix(
423  const std::string& prefix,
424  const std::string& section,
425  const std::map<std::string, std::vector<util::SettingsValue>>& args) const;
426 };
427 
428 extern ArgsManager gArgs;
429 
433 bool HelpRequested(const ArgsManager& args);
434 
436 void SetupHelpOptions(ArgsManager& args);
437 
444 std::string HelpMessageGroup(const std::string& message);
445 
453 std::string HelpMessageOpt(const std::string& option, const std::string& message);
454 
459 int GetNumCores();
460 
464 template <typename Callable> void TraceThread(const char* name, Callable func)
465 {
467  try
468  {
469  LogPrintf("%s thread start\n", name);
470  func();
471  LogPrintf("%s thread exit\n", name);
472  }
473  catch (const std::exception& e) {
475  throw;
476  }
477  catch (...) {
478  PrintExceptionContinue(nullptr, name);
479  throw;
480  }
481 }
482 
483 std::string CopyrightHolders(const std::string& strPrefix);
484 
490 void ScheduleBatchPriority();
491 
492 namespace util {
493 
495 template <typename Tdst, typename Tsrc>
496 inline void insert(Tdst& dst, const Tsrc& src) {
497  dst.insert(dst.begin(), src.begin(), src.end());
498 }
499 template <typename TsetT, typename Tsrc>
500 inline void insert(std::set<TsetT>& dst, const Tsrc& src) {
501  dst.insert(src.begin(), src.end());
502 }
503 
509 template<typename T>
510 T* AnyPtr(const std::any& any) noexcept
511 {
512  T* const* ptr = std::any_cast<T*>(&any);
513  return ptr ? *ptr : nullptr;
514 }
515 
516 #ifdef WIN32
517 class WinCmdLineArgs
518 {
519 public:
520  WinCmdLineArgs();
521  ~WinCmdLineArgs();
522  std::pair<int, char**> get();
523 
524 private:
525  int argc;
526  char** argv;
527  std::vector<std::string> args;
528 };
529 #endif
530 
531 } // namespace util
532 
533 #endif // BITCOIN_UTIL_SYSTEM_H
RenameOver
bool RenameOver(fs::path src, fs::path dest)
Definition: system.cpp:1058
ArgsManager::LogArgs
void LogArgs() const
Log the config file options and the command line arguments, useful for troubleshooting.
Definition: system.cpp:1046
SetupEnvironment
void SetupEnvironment()
Definition: system.cpp:1287
ArgsManager::GetBoolArg
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: system.cpp:515
DirectoryCommit
void DirectoryCommit(const fs::path &dirname)
Sync directory contents.
Definition: system.cpp:1119
ArgsManager::AddHiddenArgs
void AddHiddenArgs(const std::vector< std::string > &args)
Add many hidden arguments.
Definition: system.cpp:576
LockDirectory
bool LockDirectory(const fs::path &directory, const std::string lockfile_name, bool probe_only=false)
Definition: system.cpp:90
HelpRequested
bool HelpRequested(const ArgsManager &args)
Definition: system.cpp:652
tinyformat::format
void format(std::ostream &out, const char *fmt, const Args &... args)
Format list of arguments to the stream according to given format string.
Definition: tinyformat.h:1062
ArgsManager::GetArgFlags
std::optional< unsigned int > GetArgFlags(const std::string &name) const
Return Flags for known arg.
Definition: system.cpp:366
util::Settings
Stored settings.
Definition: settings.h:31
fs.h
ArgsManager::Command::args
std::vector< std::string > args
If command is non-empty: Any args that followed it If command is empty: The unregistered command and ...
Definition: system.h:259
OptionsCategory::RPC
@ RPC
GetFileSize
std::streampos GetFileSize(const char *path, std::streamsize max=std::numeric_limits< std::streamsize >::max())
Get the size of a file by scanning it.
Definition: system.cpp:147
flags
int flags
Definition: bitcoin-tx.cpp:512
ArgsManager::GetSetting
util::SettingsValue GetSetting(const std::string &arg) const
Get setting value.
Definition: system.cpp:1016
ArgsManager::UseDefaultSection
bool UseDefaultSection(const std::string &arg) const EXCLUSIVE_LOCKS_REQUIRED(cs_args)
Returns true if settings values from the default section should be used, depending on the current net...
Definition: system.cpp:1011
ArgsManager::SoftSetBoolArg
bool SoftSetBoolArg(const std::string &strArg, bool fValue)
Set a boolean argument if it doesn't already have a value.
Definition: system.cpp:529
help
static RPCHelpMan help()
Definition: server.cpp:133
GetDataDir
const fs::path & GetDataDir(bool fNetSpecific=true)
Definition: system.cpp:770
BITCOIN_SETTINGS_FILENAME
const char *const BITCOIN_SETTINGS_FILENAME
Definition: system.cpp:77
sync.h
ArgsManager::GetHelpMessage
std::string GetHelpMessage() const
Get the help string.
Definition: system.cpp:583
gArgs
ArgsManager gArgs
Definition: system.cpp:79
ArgsManager::GUARDED_BY
bool m_accept_any_command GUARDED_BY(cs_args)
Definition: system.h:201
ArgsManager::ALLOW_ANY
@ ALLOW_ANY
Definition: system.h:174
ArgsManager::GetChainName
std::string GetChainName() const
Returns the appropriate chain name from the program arguments.
Definition: system.cpp:982
ArgsManager::IsArgSet
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
Definition: system.cpp:407
HelpMessageGroup
std::string HelpMessageGroup(const std::string &message)
Format a string to be used as group of options in help messages.
Definition: system.cpp:667
ClearDatadirCache
void ClearDatadirCache()
Tests only.
Definition: system.cpp:807
AllocateFileRange
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length)
this function tries to make a particular range of a file allocated (corresponding to disk space) it i...
Definition: system.cpp:1165
AnnotatedMixin< std::recursive_mutex >
ArgsManager::InitSettings
bool InitSettings(std::string &error)
Read and update settings file with saved settings.
Definition: system.cpp:412
OptionsCategory::CONNECTION
@ CONNECTION
SectionInfo::m_file
std::string m_file
Definition: system.h:162
bitcoin-config.h
TryCreateDirectories
bool TryCreateDirectories(const fs::path &p)
Ignores exceptions thrown by Boost's create_directories if the requested directory exists.
Definition: system.cpp:1074
ArgsManager::AddCommand
void AddCommand(const std::string &cmd, const std::string &help, const OptionsCategory &cat)
Add subcommand.
Definition: system.cpp:543
ArgsManager::DEBUG_ONLY
@ DEBUG_ONLY
Definition: system.h:175
CheckDataDirOption
bool CheckDataDirOption()
Definition: system.cpp:801
UniValue
Definition: univalue.h:19
FileCommit
bool FileCommit(FILE *file)
Ensure file contents are fully committed to disk, using a platform-specific feature analogous to fsyn...
Definition: system.cpp:1088
ArgsManager::ALLOW_INT
@ ALLOW_INT
Definition: system.h:172
tinyformat.h
ArgsManager::~ArgsManager
~ArgsManager()
Definition: system.cpp:242
UnlockDirectory
void UnlockDirectory(const fs::path &directory, const std::string &lockfile_name)
Definition: system.cpp:114
ArgsManager::Arg
Definition: system.h:188
prefix
const char * prefix
Definition: rest.cpp:682
ArgsManager::Arg::m_flags
unsigned int m_flags
Definition: system.h:192
GetDefaultDataDir
fs::path GetDefaultDataDir()
Definition: system.cpp:701
ArgsManager::cs_args
RecursiveMutex cs_args
Definition: system.h:195
AbsPathForConfigVal
fs::path AbsPathForConfigVal(const fs::path &path, bool net_specific=true)
Most paths passed as configuration arguments are treated as relative to the datadir if they are not a...
Definition: system.cpp:1359
settings.h
TraceThread
void TraceThread(const char *name, Callable func)
Definition: system.h:464
ArgsManager::GetSettingsPath
bool GetSettingsPath(fs::path *filepath=nullptr, bool temp=false) const
Get settings file path, or return false if read-write settings were disabled with -nosettings.
Definition: system.cpp:430
CheckDiskSpace
bool CheckDiskSpace(const fs::path &dir, uint64_t additional_bytes=0)
Definition: system.cpp:139
GetConfigFile
fs::path GetConfigFile(const std::string &confPath)
Definition: system.cpp:816
OptionsCategory::HIDDEN
@ HIDDEN
OptionsCategory::NODE_RELAY
@ NODE_RELAY
RaiseFileDescriptorLimit
int RaiseFileDescriptorLimit(int nMinFD)
this function tries to raise the file descriptor limit to the requested number.
Definition: system.cpp:1142
ArgsManager::ALLOW_STRING
@ ALLOW_STRING
Definition: system.h:173
ArgsManager::SoftSetArg
bool SoftSetArg(const std::string &strArg, const std::string &strValue)
Set an argument if it doesn't already have a value.
Definition: system.cpp:521
compat.h
ArgsManager::AddArg
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
Definition: system.cpp:555
util::ThreadRename
void ThreadRename(std::string &&)
Rename a thread both in terms of an internal (in-memory) name as well as its system thread name.
Definition: threadnames.cpp:57
HelpMessageOpt
std::string HelpMessageOpt(const std::string &option, const std::string &message)
Format a string to be used as option description in help messages.
Definition: system.cpp:671
ArgsManager::WriteSettingsFile
bool WriteSettingsFile(std::vector< std::string > *errors=nullptr) const
Write settings file.
Definition: system.cpp:478
IsSwitchChar
bool IsSwitchChar(char c)
Definition: system.h:132
time.h
DirIsWritable
bool DirIsWritable(const fs::path &directory)
Definition: system.cpp:126
ArgsManager::GetUnsuitableSectionOnlyArgs
const std::set< std::string > GetUnsuitableSectionOnlyArgs() const
Log warnings for options in m_section_only_args when they are specified in the default section but no...
Definition: system.cpp:244
ArgsManager::ForceSetArg
void ForceSetArg(const std::string &strArg, const std::string &strValue)
Definition: system.cpp:537
ArgsManager::GetArg
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Definition: system.cpp:503
LogPrintf
#define LogPrintf(...)
Definition: logging.h:183
OptionsCategory::OPTIONS
@ OPTIONS
ArgsManager::Command::command
std::string command
The command (if one has been registered with AddCommand), or empty.
Definition: system.h:254
ArgsManager::ArgsManager
ArgsManager()
Definition: system.cpp:241
ArgsManager::Arg::m_help_param
std::string m_help_param
Definition: system.h:190
ArgsManager::ParseParameters
bool ParseParameters(int argc, const char *const argv[], std::string &error)
Definition: system.cpp:286
ArgsManager::GUARDED_BY
util::Settings m_settings GUARDED_BY(cs_args)
ArgsManager::ReadConfigFiles
bool ReadConfigFiles(std::string &error, bool ignore_invalid_keys=false)
Definition: system.cpp:895
ScheduleBatchPriority
void ScheduleBatchPriority()
On platforms that support it, tell the kernel the calling thread is CPU-intensive and non-interactive...
Definition: system.cpp:1367
CopyrightHolders
std::string CopyrightHolders(const std::string &strPrefix)
Definition: system.cpp:1341
ArgsManager::ReadConfigStream
bool ReadConfigStream(std::istream &stream, const std::string &filepath, std::string &error, bool ignore_invalid_keys=false)
Definition: system.cpp:866
ArgsManager::SENSITIVE
@ SENSITIVE
Definition: system.h:183
ArgsManager::Flags
Flags
Definition: system.h:169
SectionInfo::m_name
std::string m_name
Definition: system.h:161
GetBlocksDir
const fs::path & GetBlocksDir()
Definition: system.cpp:744
OptionsCategory
OptionsCategory
Definition: system.h:141
assumptions.h
OptionsCategory::ZMQ
@ ZMQ
attributes.h
SetupHelpOptions
void SetupHelpOptions(ArgsManager &args)
Add help options to the args manager.
Definition: system.cpp:657
name
const char * name
Definition: rest.cpp:43
OptionsCategory::BLOCK_CREATION
@ BLOCK_CREATION
ArgsManager::ReadSettingsFile
bool ReadSettingsFile(std::vector< std::string > *errors=nullptr)
Read settings file.
Definition: system.cpp:453
ArgsManager::SelectConfigNetwork
void SelectConfigNetwork(const std::string &network)
Select the network in use.
Definition: system.cpp:280
ArgsManager::LockSettings
void LockSettings(Fn &&fn)
Access settings with lock held.
Definition: system.h:408
ArgsManager::GetSettingsList
std::vector< util::SettingsValue > GetSettingsList(const std::string &arg) const
Get list of setting values.
Definition: system.cpp:1023
ArgsManager::IsArgNegated
bool IsArgNegated(const std::string &strArg) const
Return true if the argument was originally passed as a negated option, i.e.
Definition: system.cpp:498
SectionInfo
Definition: system.h:159
ArgsManager::COMMAND
@ COMMAND
Definition: system.h:184
ArgsManager
Definition: system.h:166
ArgsManager::Command
Definition: system.h:252
OptionsCategory::WALLET_DEBUG_TEST
@ WALLET_DEBUG_TEST
EXCLUSIVE_LOCKS_REQUIRED
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:49
LOCK
#define LOCK(cs)
Definition: sync.h:232
GetStartupTime
int64_t GetStartupTime()
Definition: system.cpp:1354
ArgsManager::logArgsPrefix
void logArgsPrefix(const std::string &prefix, const std::string &section, const std::map< std::string, std::vector< util::SettingsValue >> &args) const
Definition: system.cpp:1029
OptionsCategory::WALLET
@ WALLET
util::insert
void insert(Tdst &dst, const Tsrc &src)
Simplification of std insertion.
Definition: system.h:496
logging.h
ArgsManager::GetUnrecognizedSections
const std::list< SectionInfo > GetUnrecognizedSections() const
Log warnings for unrecognized section names in the config file.
Definition: system.cpp:264
SetupNetworking
bool SetupNetworking()
Definition: system.cpp:1324
ArgsManager::ClearArgs
void ClearArgs()
Clear available arguments.
Definition: system.h:364
SectionInfo::m_line
int m_line
Definition: system.h:163
OptionsCategory::DEBUG_TEST
@ DEBUG_TEST
ArgsManager::GetCommand
std::optional< const Command > GetCommand() const
Get the command and command args (returns std::nullopt if no command provided)
Definition: system.cpp:378
m_command
CRPCCommand m_command
Definition: interfaces.cpp:425
OptionsCategory::COMMANDS
@ COMMANDS
util::AnyPtr
T * AnyPtr(const std::any &any) noexcept
Helper function to access the contained object of a std::any instance.
Definition: system.h:510
ArgsManager::ALLOW_BOOL
@ ALLOW_BOOL
Definition: system.h:171
ArgsManager::Arg::m_help_text
std::string m_help_text
Definition: system.h:191
OptionsCategory::REGISTER_COMMANDS
@ REGISTER_COMMANDS
ArgsManager::GetArgs
std::vector< std::string > GetArgs(const std::string &strArg) const
Return a vector of strings of the given argument.
Definition: system.cpp:398
ReleaseDirectoryLocks
void ReleaseDirectoryLocks()
Release all directory locks.
Definition: system.cpp:120
error
bool error(const char *fmt, const Args &... args)
Definition: system.h:50
OptionsCategory::CHAINPARAMS
@ CHAINPARAMS
BITCOIN_CONF_FILENAME
const char *const BITCOIN_CONF_FILENAME
Definition: system.cpp:76
OptionsCategory::GUI
@ GUI
RunCommandParseJSON
UniValue RunCommandParseJSON(const std::string &str_command, const std::string &str_std_in="")
Execute a command which returns JSON, and parse the result.
Definition: system.cpp:1251
threadnames.h
TruncateFile
bool TruncateFile(FILE *file, unsigned int length)
Definition: system.cpp:1130
util
Definition: settings.cpp:10
ShellEscape
std::string ShellEscape(const std::string &arg)
Definition: system.cpp:1228
GetNumCores
int GetNumCores()
Return the number of cores available on the current system.
Definition: system.cpp:1336
ArgsManager::NETWORK_ONLY
@ NETWORK_ONLY
Definition: system.h:181
PrintExceptionContinue
void PrintExceptionContinue(const std::exception *pex, const char *pszThread)
Definition: system.cpp:694