Bitcoin Core  22.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/time.h>
26 
27 #include <any>
28 #include <exception>
29 #include <map>
30 #include <optional>
31 #include <set>
32 #include <stdint.h>
33 #include <string>
34 #include <utility>
35 #include <vector>
36 
37 class UniValue;
38 
39 // Application startup time (used for uptime calculation)
40 int64_t GetStartupTime();
41 
42 extern const char * const BITCOIN_CONF_FILENAME;
43 extern const char * const BITCOIN_SETTINGS_FILENAME;
44 
45 void SetupEnvironment();
46 bool SetupNetworking();
47 
48 template<typename... Args>
49 bool error(const char* fmt, const Args&... args)
50 {
51  LogPrintf("ERROR: %s\n", tfm::format(fmt, args...));
52  return false;
53 }
54 
55 void PrintExceptionContinue(const std::exception *pex, const char* pszThread);
56 
61 bool FileCommit(FILE *file);
62 
67 void DirectoryCommit(const fs::path &dirname);
68 
69 bool TruncateFile(FILE *file, unsigned int length);
70 int RaiseFileDescriptorLimit(int nMinFD);
71 void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length);
72 [[nodiscard]] bool RenameOver(fs::path src, fs::path dest);
73 bool LockDirectory(const fs::path& directory, const std::string lockfile_name, bool probe_only=false);
74 void UnlockDirectory(const fs::path& directory, const std::string& lockfile_name);
75 bool DirIsWritable(const fs::path& directory);
76 bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes = 0);
77 
84 std::streampos GetFileSize(const char* path, std::streamsize max = std::numeric_limits<std::streamsize>::max());
85 
90 
91 bool TryCreateDirectories(const fs::path& p);
92 fs::path GetDefaultDataDir();
93 // Return true if -datadir option points to a valid directory or is not specified.
94 bool CheckDataDirOption();
95 fs::path GetConfigFile(const std::string& confPath);
96 #ifdef WIN32
97 fs::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
98 #endif
99 #ifndef WIN32
100 std::string ShellEscape(const std::string& arg);
101 #endif
102 #if HAVE_SYSTEM
103 void runCommand(const std::string& strCommand);
104 #endif
105 
112 UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in="");
113 
122 fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific = true);
123 
124 inline bool IsSwitchChar(char c)
125 {
126 #ifdef WIN32
127  return c == '-' || c == '/';
128 #else
129  return c == '-';
130 #endif
131 }
132 
133 enum class OptionsCategory {
134  OPTIONS,
135  CONNECTION,
136  WALLET,
138  ZMQ,
139  DEBUG_TEST,
140  CHAINPARAMS,
141  NODE_RELAY,
143  RPC,
144  GUI,
145  COMMANDS,
147 
148  HIDDEN // Always the last option to avoid printing these in the help
149 };
150 
152 {
153  std::string m_name;
154  std::string m_file;
155  int m_line;
156 };
157 
159 {
160 public:
161  enum Flags : uint32_t {
162  // Boolean options can accept negation syntax -noOPTION or -noOPTION=1
163  ALLOW_BOOL = 0x01,
164  ALLOW_INT = 0x02,
165  ALLOW_STRING = 0x04,
167  DEBUG_ONLY = 0x100,
168  /* Some options would cause cross-contamination if values for
169  * mainnet were used while running on regtest/testnet (or vice-versa).
170  * Setting them as NETWORK_ONLY ensures that sharing a config file
171  * between mainnet and regtest/testnet won't cause problems due to these
172  * parameters by accident. */
173  NETWORK_ONLY = 0x200,
174  // This argument's value is sensitive (such as a password).
175  SENSITIVE = 0x400,
176  COMMAND = 0x800,
177  };
178 
179 protected:
180  struct Arg
181  {
182  std::string m_help_param;
183  std::string m_help_text;
184  unsigned int m_flags;
185  };
186 
188  util::Settings m_settings GUARDED_BY(cs_args);
189  std::vector<std::string> m_command GUARDED_BY(cs_args);
190  std::string m_network GUARDED_BY(cs_args);
191  std::set<std::string> m_network_only_args GUARDED_BY(cs_args);
192  std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args);
193  bool m_accept_any_command GUARDED_BY(cs_args){true};
194  std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args);
195  mutable fs::path m_cached_blocks_path GUARDED_BY(cs_args);
196  mutable fs::path m_cached_datadir_path GUARDED_BY(cs_args);
197  mutable fs::path m_cached_network_datadir_path GUARDED_BY(cs_args);
198 
199  [[nodiscard]] bool ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys = false);
200 
206  bool UseDefaultSection(const std::string& arg) const EXCLUSIVE_LOCKS_REQUIRED(cs_args);
207 
208  public:
216  util::SettingsValue GetSetting(const std::string& arg) const;
217 
221  std::vector<util::SettingsValue> GetSettingsList(const std::string& arg) const;
222 
223  ArgsManager();
224  ~ArgsManager();
225 
229  void SelectConfigNetwork(const std::string& network);
230 
231  [[nodiscard]] bool ParseParameters(int argc, const char* const argv[], std::string& error);
232  [[nodiscard]] bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false);
233 
240  const std::set<std::string> GetUnsuitableSectionOnlyArgs() const;
241 
245  const std::list<SectionInfo> GetUnrecognizedSections() const;
246 
247  struct Command {
249  std::string command;
254  std::vector<std::string> args;
255  };
259  std::optional<const Command> GetCommand() const;
260 
266  const fs::path& GetBlocksDirPath() const;
267 
274  const fs::path& GetDataDirBase() const { return GetDataDir(false); }
275 
282  const fs::path& GetDataDirNet() const { return GetDataDir(true); }
283 
287  void ClearPathCache();
288 
295  std::vector<std::string> GetArgs(const std::string& strArg) const;
296 
303  bool IsArgSet(const std::string& strArg) const;
304 
312  bool IsArgNegated(const std::string& strArg) const;
313 
321  std::string GetArg(const std::string& strArg, const std::string& strDefault) const;
322 
330  int64_t GetArg(const std::string& strArg, int64_t nDefault) const;
331 
339  bool GetBoolArg(const std::string& strArg, bool fDefault) const;
340 
348  bool SoftSetArg(const std::string& strArg, const std::string& strValue);
349 
357  bool SoftSetBoolArg(const std::string& strArg, bool fValue);
358 
359  // Forces an arg setting. Called by SoftSetArg() if the arg hasn't already
360  // been set. Also called directly in testing.
361  void ForceSetArg(const std::string& strArg, const std::string& strValue);
362 
367  std::string GetChainName() const;
368 
372  void AddArg(const std::string& name, const std::string& help, unsigned int flags, const OptionsCategory& cat);
373 
377  void AddCommand(const std::string& cmd, const std::string& help);
378 
382  void AddHiddenArgs(const std::vector<std::string>& args);
383 
387  void ClearArgs() {
388  LOCK(cs_args);
389  m_available_args.clear();
390  m_network_only_args.clear();
391  }
392 
396  std::string GetHelpMessage() const;
397 
402  std::optional<unsigned int> GetArgFlags(const std::string& name) const;
403 
409  bool InitSettings(std::string& error);
410 
415  bool GetSettingsPath(fs::path* filepath = nullptr, bool temp = false) const;
416 
420  bool ReadSettingsFile(std::vector<std::string>* errors = nullptr);
421 
425  bool WriteSettingsFile(std::vector<std::string>* errors = nullptr) const;
426 
430  template <typename Fn>
431  void LockSettings(Fn&& fn)
432  {
433  LOCK(cs_args);
434  fn(m_settings);
435  }
436 
441  void LogArgs() const;
442 
443 private:
451  const fs::path& GetDataDir(bool net_specific) const;
452 
453  // Helper function for LogArgs().
454  void logArgsPrefix(
455  const std::string& prefix,
456  const std::string& section,
457  const std::map<std::string, std::vector<util::SettingsValue>>& args) const;
458 };
459 
460 extern ArgsManager gArgs;
461 
465 bool HelpRequested(const ArgsManager& args);
466 
468 void SetupHelpOptions(ArgsManager& args);
469 
476 std::string HelpMessageGroup(const std::string& message);
477 
485 std::string HelpMessageOpt(const std::string& option, const std::string& message);
486 
491 int GetNumCores();
492 
493 std::string CopyrightHolders(const std::string& strPrefix);
494 
500 void ScheduleBatchPriority();
501 
502 namespace util {
503 
505 template <typename Tdst, typename Tsrc>
506 inline void insert(Tdst& dst, const Tsrc& src) {
507  dst.insert(dst.begin(), src.begin(), src.end());
508 }
509 template <typename TsetT, typename Tsrc>
510 inline void insert(std::set<TsetT>& dst, const Tsrc& src) {
511  dst.insert(src.begin(), src.end());
512 }
513 
519 template<typename T>
520 T* AnyPtr(const std::any& any) noexcept
521 {
522  T* const* ptr = std::any_cast<T*>(&any);
523  return ptr ? *ptr : nullptr;
524 }
525 
526 #ifdef WIN32
527 class WinCmdLineArgs
528 {
529 public:
530  WinCmdLineArgs();
531  ~WinCmdLineArgs();
532  std::pair<int, char**> get();
533 
534 private:
535  int argc;
536  char** argv;
537  std::vector<std::string> args;
538 };
539 #endif
540 
541 } // namespace util
542 
543 #endif // BITCOIN_UTIL_SYSTEM_H
RenameOver
bool RenameOver(fs::path src, fs::path dest)
Definition: system.cpp:1064
ArgsManager::LogArgs
void LogArgs() const
Log the config file options and the command line arguments, useful for troubleshooting.
Definition: system.cpp:1052
SetupEnvironment
void SetupEnvironment()
Definition: system.cpp:1295
ArgsManager::GetBoolArg
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: system.cpp:600
DirectoryCommit
void DirectoryCommit(const fs::path &dirname)
Sync directory contents.
Definition: system.cpp:1125
ArgsManager::AddHiddenArgs
void AddHiddenArgs(const std::vector< std::string > &args)
Add many hidden arguments.
Definition: system.cpp:661
ArgsManager::ClearPathCache
void ClearPathCache()
Clear cached directory paths.
Definition: system.cpp:454
LockDirectory
bool LockDirectory(const fs::path &directory, const std::string lockfile_name, bool probe_only=false)
Definition: system.cpp:95
HelpRequested
bool HelpRequested(const ArgsManager &args)
Definition: system.cpp:737
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:385
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:254
OptionsCategory::RPC
@ RPC
help
void help(char **argv)
Definition: bench_ecmult.c:21
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:152
flags
int flags
Definition: bitcoin-tx.cpp:513
ArgsManager::GetSetting
util::SettingsValue GetSetting(const std::string &arg) const
Get setting value.
Definition: system.cpp:1022
ArgsManager::GetDataDirNet
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
Definition: system.h:282
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:1017
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:614
ArgsManager::GetBlocksDirPath
const fs::path & GetBlocksDirPath() const
Get blocks directory path.
Definition: system.cpp:397
BITCOIN_SETTINGS_FILENAME
const char *const BITCOIN_SETTINGS_FILENAME
Definition: system.cpp:82
sync.h
ArgsManager::GetHelpMessage
std::string GetHelpMessage() const
Get the help string.
Definition: system.cpp:668
gArgs
ArgsManager gArgs
Definition: system.cpp:84
ArgsManager::GUARDED_BY
bool m_accept_any_command GUARDED_BY(cs_args)
Definition: system.h:193
ArgsManager::ALLOW_ANY
@ ALLOW_ANY
Definition: system.h:166
ArgsManager::GetChainName
std::string GetChainName() const
Returns the appropriate chain name from the program arguments.
Definition: system.cpp:988
ArgsManager::IsArgSet
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
Definition: system.cpp:492
HelpMessageGroup
std::string HelpMessageGroup(const std::string &message)
Format a string to be used as group of options in help messages.
Definition: system.cpp:752
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:1171
AnnotatedMixin< std::recursive_mutex >
ArgsManager::InitSettings
bool InitSettings(std::string &error)
Read and update settings file with saved settings.
Definition: system.cpp:497
OptionsCategory::CONNECTION
@ CONNECTION
SectionInfo::m_file
std::string m_file
Definition: system.h:154
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:1080
ArgsManager::DEBUG_ONLY
@ DEBUG_ONLY
Definition: system.h:167
CheckDataDirOption
bool CheckDataDirOption()
Definition: system.cpp:811
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:1094
ArgsManager::ALLOW_INT
@ ALLOW_INT
Definition: system.h:164
tinyformat.h
ArgsManager::~ArgsManager
~ArgsManager()
Definition: system.cpp:260
UnlockDirectory
void UnlockDirectory(const fs::path &directory, const std::string &lockfile_name)
Definition: system.cpp:119
ArgsManager::Arg
Definition: system.h:180
prefix
const char * prefix
Definition: rest.cpp:712
ArgsManager::GetDataDirBase
const fs::path & GetDataDirBase() const
Get data directory path.
Definition: system.h:274
ArgsManager::Arg::m_flags
unsigned int m_flags
Definition: system.h:184
GetDefaultDataDir
fs::path GetDefaultDataDir()
Definition: system.cpp:786
ArgsManager::cs_args
RecursiveMutex cs_args
Definition: system.h:187
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:1367
settings.h
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:515
CheckDiskSpace
bool CheckDiskSpace(const fs::path &dir, uint64_t additional_bytes=0)
Definition: system.cpp:144
GetConfigFile
fs::path GetConfigFile(const std::string &confPath)
Definition: system.cpp:817
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:1148
ArgsManager::ALLOW_STRING
@ ALLOW_STRING
Definition: system.h:165
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:606
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:640
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:756
ArgsManager::WriteSettingsFile
bool WriteSettingsFile(std::vector< std::string > *errors=nullptr) const
Write settings file.
Definition: system.cpp:563
IsSwitchChar
bool IsSwitchChar(char c)
Definition: system.h:124
time.h
DirIsWritable
bool DirIsWritable(const fs::path &directory)
Definition: system.cpp:131
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:262
ArgsManager::ForceSetArg
void ForceSetArg(const std::string &strArg, const std::string &strValue)
Definition: system.cpp:622
ArgsManager::GetArg
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Definition: system.cpp:588
LogPrintf
#define LogPrintf(...)
Definition: logging.h:185
OptionsCategory::OPTIONS
@ OPTIONS
ArgsManager::Command::command
std::string command
The command (if one has been registered with AddCommand), or empty.
Definition: system.h:249
ArgsManager::ArgsManager
ArgsManager()
Definition: system.cpp:259
ArgsManager::Arg::m_help_param
std::string m_help_param
Definition: system.h:182
ArgsManager::ParseParameters
bool ParseParameters(int argc, const char *const argv[], std::string &error)
Definition: system.cpp:304
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:896
ScheduleBatchPriority
void ScheduleBatchPriority()
On platforms that support it, tell the kernel the calling thread is CPU-intensive and non-interactive...
Definition: system.cpp:1375
CopyrightHolders
std::string CopyrightHolders(const std::string &strPrefix)
Definition: system.cpp:1349
ArgsManager::ReadConfigStream
bool ReadConfigStream(std::istream &stream, const std::string &filepath, std::string &error, bool ignore_invalid_keys=false)
Definition: system.cpp:867
ArgsManager::SENSITIVE
@ SENSITIVE
Definition: system.h:175
ArgsManager::Flags
Flags
Definition: system.h:161
SectionInfo::m_name
std::string m_name
Definition: system.h:153
OptionsCategory
OptionsCategory
Definition: system.h:133
assumptions.h
OptionsCategory::ZMQ
@ ZMQ
attributes.h
SetupHelpOptions
void SetupHelpOptions(ArgsManager &args)
Add help options to the args manager.
Definition: system.cpp:742
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:538
ArgsManager::SelectConfigNetwork
void SelectConfigNetwork(const std::string &network)
Select the network in use.
Definition: system.cpp:298
ArgsManager::LockSettings
void LockSettings(Fn &&fn)
Access settings with lock held.
Definition: system.h:431
ArgsManager::GetSettingsList
std::vector< util::SettingsValue > GetSettingsList(const std::string &arg) const
Get list of setting values.
Definition: system.cpp:1029
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:583
SectionInfo
Definition: system.h:151
ArgsManager::COMMAND
@ COMMAND
Definition: system.h:176
ArgsManager
Definition: system.h:158
ArgsManager::Command
Definition: system.h:247
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:226
GetStartupTime
int64_t GetStartupTime()
Definition: system.cpp:1362
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:1035
OptionsCategory::WALLET
@ WALLET
util::insert
void insert(Tdst &dst, const Tsrc &src)
Simplification of std insertion.
Definition: system.h:506
ArgsManager::GetUnrecognizedSections
const std::list< SectionInfo > GetUnrecognizedSections() const
Log warnings for unrecognized section names in the config file.
Definition: system.cpp:282
SetupNetworking
bool SetupNetworking()
Definition: system.cpp:1332
ArgsManager::ClearArgs
void ClearArgs()
Clear available arguments.
Definition: system.h:387
SectionInfo::m_line
int m_line
Definition: system.h:155
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:463
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:520
ArgsManager::ALLOW_BOOL
@ ALLOW_BOOL
Definition: system.h:163
ArgsManager::Arg::m_help_text
std::string m_help_text
Definition: system.h:183
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:483
ReleaseDirectoryLocks
void ReleaseDirectoryLocks()
Release all directory locks.
Definition: system.cpp:125
error
bool error(const char *fmt, const Args &... args)
Definition: system.h:49
OptionsCategory::CHAINPARAMS
@ CHAINPARAMS
BITCOIN_CONF_FILENAME
const char *const BITCOIN_CONF_FILENAME
Definition: system.cpp:81
OptionsCategory::GUI
@ GUI
T
#define T(expected, seed, data)
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:1256
TruncateFile
bool TruncateFile(FILE *file, unsigned int length)
Definition: system.cpp:1136
util
Definition: settings.cpp:10
ArgsManager::AddCommand
void AddCommand(const std::string &cmd, const std::string &help)
Add subcommand.
Definition: system.cpp:628
ShellEscape
std::string ShellEscape(const std::string &arg)
Definition: system.cpp:1234
GetNumCores
int GetNumCores()
Return the number of cores available on the current system.
Definition: system.cpp:1344
ArgsManager::NETWORK_ONLY
@ NETWORK_ONLY
Definition: system.h:173
ArgsManager::GetDataDir
const fs::path & GetDataDir(bool net_specific) const
Get data directory path.
Definition: system.cpp:423
PrintExceptionContinue
void PrintExceptionContinue(const std::exception *pex, const char *pszThread)
Definition: system.cpp:779