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-2021 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);
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:
165  enum Flags : uint32_t {
166  ALLOW_ANY = 0x01,
167  // ALLOW_BOOL = 0x02, //!< unimplemented, draft implementation in #16545
168  // ALLOW_INT = 0x04, //!< unimplemented, draft implementation in #16545
169  // ALLOW_STRING = 0x08, //!< unimplemented, draft implementation in #16545
170  // ALLOW_LIST = 0x10, //!< unimplemented, draft implementation in #16545
172 
173  DEBUG_ONLY = 0x100,
174  /* Some options would cause cross-contamination if values for
175  * mainnet were used while running on regtest/testnet (or vice-versa).
176  * Setting them as NETWORK_ONLY ensures that sharing a config file
177  * between mainnet and regtest/testnet won't cause problems due to these
178  * parameters by accident. */
179  NETWORK_ONLY = 0x200,
180  // This argument's value is sensitive (such as a password).
181  SENSITIVE = 0x400,
182  COMMAND = 0x800,
183  };
184 
185 protected:
186  struct Arg
187  {
188  std::string m_help_param;
189  std::string m_help_text;
190  unsigned int m_flags;
191  };
192 
194  util::Settings m_settings GUARDED_BY(cs_args);
195  std::vector<std::string> m_command GUARDED_BY(cs_args);
196  std::string m_network GUARDED_BY(cs_args);
197  std::set<std::string> m_network_only_args GUARDED_BY(cs_args);
198  std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args);
199  bool m_accept_any_command GUARDED_BY(cs_args){true};
200  std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args);
201  mutable fs::path m_cached_blocks_path GUARDED_BY(cs_args);
202  mutable fs::path m_cached_datadir_path GUARDED_BY(cs_args);
203  mutable fs::path m_cached_network_datadir_path GUARDED_BY(cs_args);
204 
205  [[nodiscard]] bool ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys = false);
206 
212  bool UseDefaultSection(const std::string& arg) const EXCLUSIVE_LOCKS_REQUIRED(cs_args);
213 
214  public:
222  util::SettingsValue GetSetting(const std::string& arg) const;
223 
227  std::vector<util::SettingsValue> GetSettingsList(const std::string& arg) const;
228 
229  ArgsManager();
230  ~ArgsManager();
231 
235  void SelectConfigNetwork(const std::string& network);
236 
237  [[nodiscard]] bool ParseParameters(int argc, const char* const argv[], std::string& error);
238  [[nodiscard]] bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false);
239 
246  const std::set<std::string> GetUnsuitableSectionOnlyArgs() const;
247 
251  const std::list<SectionInfo> GetUnrecognizedSections() const;
252 
253  struct Command {
255  std::string command;
260  std::vector<std::string> args;
261  };
265  std::optional<const Command> GetCommand() const;
266 
272  const fs::path& GetBlocksDirPath() const;
273 
280  const fs::path& GetDataDirBase() const { return GetDataDir(false); }
281 
288  const fs::path& GetDataDirNet() const { return GetDataDir(true); }
289 
293  void ClearPathCache();
294 
301  std::vector<std::string> GetArgs(const std::string& strArg) const;
302 
309  bool IsArgSet(const std::string& strArg) const;
310 
318  bool IsArgNegated(const std::string& strArg) const;
319 
327  std::string GetArg(const std::string& strArg, const std::string& strDefault) const;
328 
336  int64_t GetIntArg(const std::string& strArg, int64_t nDefault) const;
337 
345  bool GetBoolArg(const std::string& strArg, bool fDefault) const;
346 
354  bool SoftSetArg(const std::string& strArg, const std::string& strValue);
355 
363  bool SoftSetBoolArg(const std::string& strArg, bool fValue);
364 
365  // Forces an arg setting. Called by SoftSetArg() if the arg hasn't already
366  // been set. Also called directly in testing.
367  void ForceSetArg(const std::string& strArg, const std::string& strValue);
368 
373  std::string GetChainName() const;
374 
378  void AddArg(const std::string& name, const std::string& help, unsigned int flags, const OptionsCategory& cat);
379 
383  void AddCommand(const std::string& cmd, const std::string& help);
384 
388  void AddHiddenArgs(const std::vector<std::string>& args);
389 
393  void ClearArgs() {
394  LOCK(cs_args);
395  m_available_args.clear();
396  m_network_only_args.clear();
397  }
398 
402  std::string GetHelpMessage() const;
403 
408  std::optional<unsigned int> GetArgFlags(const std::string& name) const;
409 
415  bool InitSettings(std::string& error);
416 
421  bool GetSettingsPath(fs::path* filepath = nullptr, bool temp = false) const;
422 
426  bool ReadSettingsFile(std::vector<std::string>* errors = nullptr);
427 
431  bool WriteSettingsFile(std::vector<std::string>* errors = nullptr) const;
432 
436  template <typename Fn>
437  void LockSettings(Fn&& fn)
438  {
439  LOCK(cs_args);
440  fn(m_settings);
441  }
442 
447  void LogArgs() const;
448 
449 private:
457  const fs::path& GetDataDir(bool net_specific) const;
458 
459  // Helper function for LogArgs().
460  void logArgsPrefix(
461  const std::string& prefix,
462  const std::string& section,
463  const std::map<std::string, std::vector<util::SettingsValue>>& args) const;
464 };
465 
466 extern ArgsManager gArgs;
467 
471 bool HelpRequested(const ArgsManager& args);
472 
475 
482 std::string HelpMessageGroup(const std::string& message);
483 
491 std::string HelpMessageOpt(const std::string& option, const std::string& message);
492 
497 int GetNumCores();
498 
499 std::string CopyrightHolders(const std::string& strPrefix);
500 
506 void ScheduleBatchPriority();
507 
508 namespace util {
509 
511 template <typename Tdst, typename Tsrc>
512 inline void insert(Tdst& dst, const Tsrc& src) {
513  dst.insert(dst.begin(), src.begin(), src.end());
514 }
515 template <typename TsetT, typename Tsrc>
516 inline void insert(std::set<TsetT>& dst, const Tsrc& src) {
517  dst.insert(src.begin(), src.end());
518 }
519 
525 template<typename T>
526 T* AnyPtr(const std::any& any) noexcept
527 {
528  T* const* ptr = std::any_cast<T*>(&any);
529  return ptr ? *ptr : nullptr;
530 }
531 
532 #ifdef WIN32
533 class WinCmdLineArgs
534 {
535 public:
536  WinCmdLineArgs();
537  ~WinCmdLineArgs();
538  std::pair<int, char**> get();
539 
540 private:
541  int argc;
542  char** argv;
543  std::vector<std::string> args;
544 };
545 #endif
546 
547 } // namespace util
548 
549 #endif // BITCOIN_UTIL_SYSTEM_H
RenameOver
bool RenameOver(fs::path src, fs::path dest)
Definition: system.cpp:1060
ArgsManager::LogArgs
void LogArgs() const
Log the config file options and the command line arguments, useful for troubleshooting.
Definition: system.cpp:1048
SetupEnvironment
void SetupEnvironment()
Definition: system.cpp:1291
ArgsManager::GetBoolArg
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: system.cpp:597
DirectoryCommit
void DirectoryCommit(const fs::path &dirname)
Sync directory contents.
Definition: system.cpp:1121
ArgsManager::AddHiddenArgs
void AddHiddenArgs(const std::vector< std::string > &args)
Add many hidden arguments.
Definition: system.cpp:658
ArgsManager::ClearPathCache
void ClearPathCache()
Clear cached directory paths.
Definition: system.cpp:453
LockDirectory
bool LockDirectory(const fs::path &directory, const std::string lockfile_name, bool probe_only=false)
Definition: system.cpp:91
HelpRequested
bool HelpRequested(const ArgsManager &args)
Definition: system.cpp:734
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:384
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:260
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:148
flags
int flags
Definition: bitcoin-tx.cpp:525
ArgsManager::GetSetting
util::SettingsValue GetSetting(const std::string &arg) const
Get setting value.
Definition: system.cpp:1018
ArgsManager::GetDataDirNet
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
Definition: system.h:288
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:1013
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:611
help
static RPCHelpMan help()
Definition: server.cpp:133
ArgsManager::GetBlocksDirPath
const fs::path & GetBlocksDirPath() const
Get blocks directory path.
Definition: system.cpp:396
BITCOIN_SETTINGS_FILENAME
const char *const BITCOIN_SETTINGS_FILENAME
Definition: system.cpp:78
sync.h
ArgsManager::GetHelpMessage
std::string GetHelpMessage() const
Get the help string.
Definition: system.cpp:665
gArgs
ArgsManager gArgs
Definition: system.cpp:80
ArgsManager::GUARDED_BY
bool m_accept_any_command GUARDED_BY(cs_args)
Definition: system.h:199
ArgsManager::ALLOW_ANY
@ ALLOW_ANY
disable validation
Definition: system.h:166
ArgsManager::DISALLOW_NEGATION
@ DISALLOW_NEGATION
disallow -nofoo syntax
Definition: system.h:171
ArgsManager::GetChainName
std::string GetChainName() const
Returns the appropriate chain name from the program arguments.
Definition: system.cpp:984
ArgsManager::IsArgSet
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
Definition: system.cpp:491
HelpMessageGroup
std::string HelpMessageGroup(const std::string &message)
Format a string to be used as group of options in help messages.
Definition: system.cpp:749
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:1167
AnnotatedMixin< std::recursive_mutex >
ArgsManager::InitSettings
bool InitSettings(std::string &error)
Read and update settings file with saved settings.
Definition: system.cpp:496
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:1076
ArgsManager::DEBUG_ONLY
@ DEBUG_ONLY
Definition: system.h:173
CheckDataDirOption
bool CheckDataDirOption()
Definition: system.cpp:808
UniValue
Definition: univalue.h:17
FileCommit
bool FileCommit(FILE *file)
Ensure file contents are fully committed to disk, using a platform-specific feature analogous to fsyn...
Definition: system.cpp:1090
tinyformat.h
ArgsManager::~ArgsManager
~ArgsManager()
Definition: system.cpp:259
UnlockDirectory
void UnlockDirectory(const fs::path &directory, const std::string &lockfile_name)
Definition: system.cpp:115
ArgsManager::Arg
Definition: system.h:186
prefix
const char * prefix
Definition: rest.cpp:926
ArgsManager::GetDataDirBase
const fs::path & GetDataDirBase() const
Get data directory path.
Definition: system.h:280
ArgsManager::Arg::m_flags
unsigned int m_flags
Definition: system.h:190
GetDefaultDataDir
fs::path GetDefaultDataDir()
Definition: system.cpp:783
ArgsManager::cs_args
RecursiveMutex cs_args
Definition: system.h:193
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:1363
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:514
CheckDiskSpace
bool CheckDiskSpace(const fs::path &dir, uint64_t additional_bytes=0)
Definition: system.cpp:140
GetConfigFile
fs::path GetConfigFile(const std::string &confPath)
Definition: system.cpp:814
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:1144
fs::path
Path class wrapper to prepare application code for transition from boost::filesystem library to std::...
Definition: fs.h:33
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:603
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:637
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:753
ArgsManager::WriteSettingsFile
bool WriteSettingsFile(std::vector< std::string > *errors=nullptr) const
Write settings file.
Definition: system.cpp:560
IsSwitchChar
bool IsSwitchChar(char c)
Definition: system.h:124
time.h
DirIsWritable
bool DirIsWritable(const fs::path &directory)
Definition: system.cpp:127
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:261
ArgsManager::ForceSetArg
void ForceSetArg(const std::string &strArg, const std::string &strValue)
Definition: system.cpp:619
ArgsManager::GetArg
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Definition: system.cpp:585
LogPrintf
#define LogPrintf(...)
Definition: logging.h:187
OptionsCategory::OPTIONS
@ OPTIONS
ArgsManager::Command::command
std::string command
The command (if one has been registered with AddCommand), or empty.
Definition: system.h:255
ArgsManager::ArgsManager
ArgsManager()
Definition: system.cpp:258
ArgsManager::Arg::m_help_param
std::string m_help_param
Definition: system.h:188
ArgsManager::ParseParameters
bool ParseParameters(int argc, const char *const argv[], std::string &error)
Definition: system.cpp:303
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:892
ScheduleBatchPriority
void ScheduleBatchPriority()
On platforms that support it, tell the kernel the calling thread is CPU-intensive and non-interactive...
Definition: system.cpp:1371
CopyrightHolders
std::string CopyrightHolders(const std::string &strPrefix)
Definition: system.cpp:1345
ArgsManager::ReadConfigStream
bool ReadConfigStream(std::istream &stream, const std::string &filepath, std::string &error, bool ignore_invalid_keys=false)
Definition: system.cpp:864
ArgsManager::SENSITIVE
@ SENSITIVE
Definition: system.h:181
ArgsManager::Flags
Flags
Flags controlling how config and command line arguments are validated and interpreted.
Definition: system.h:165
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:739
name
const char * name
Definition: rest.cpp:52
OptionsCategory::BLOCK_CREATION
@ BLOCK_CREATION
ArgsManager::ReadSettingsFile
bool ReadSettingsFile(std::vector< std::string > *errors=nullptr)
Read settings file.
Definition: system.cpp:537
ArgsManager::SelectConfigNetwork
void SelectConfigNetwork(const std::string &network)
Select the network in use.
Definition: system.cpp:297
ArgsManager::LockSettings
void LockSettings(Fn &&fn)
Access settings with lock held.
Definition: system.h:437
ArgsManager::GetSettingsList
std::vector< util::SettingsValue > GetSettingsList(const std::string &arg) const
Get list of setting values.
Definition: system.cpp:1025
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:580
SectionInfo
Definition: system.h:151
ArgsManager::COMMAND
@ COMMAND
Definition: system.h:182
ArgsManager
Definition: system.h:158
ArgsManager::Command
Definition: system.h:253
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:1358
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:1031
OptionsCategory::WALLET
@ WALLET
util::insert
void insert(Tdst &dst, const Tsrc &src)
Simplification of std insertion.
Definition: system.h:512
ArgsManager::GetUnrecognizedSections
const std::list< SectionInfo > GetUnrecognizedSections() const
Log warnings for unrecognized section names in the config file.
Definition: system.cpp:281
SetupNetworking
bool SetupNetworking()
Definition: system.cpp:1328
ArgsManager::ClearArgs
void ClearArgs()
Clear available arguments.
Definition: system.h:393
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:462
m_command
CRPCCommand m_command
Definition: interfaces.cpp:448
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:526
ArgsManager::Arg::m_help_text
std::string m_help_text
Definition: system.h:189
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:482
ReleaseDirectoryLocks
void ReleaseDirectoryLocks()
Release all directory locks.
Definition: system.cpp:121
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:77
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:1252
ArgsManager::GetIntArg
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
Definition: system.cpp:591
TruncateFile
bool TruncateFile(FILE *file, unsigned int length)
Definition: system.cpp:1132
util
Definition: overloaded.h:8
ArgsManager::AddCommand
void AddCommand(const std::string &cmd, const std::string &help)
Add subcommand.
Definition: system.cpp:625
ShellEscape
std::string ShellEscape(const std::string &arg)
Definition: system.cpp:1230
GetNumCores
int GetNumCores()
Return the number of cores available on the current system.
Definition: system.cpp:1340
ArgsManager::NETWORK_ONLY
@ NETWORK_ONLY
Definition: system.h:179
ArgsManager::GetDataDir
const fs::path & GetDataDir(bool net_specific) const
Get data directory path.
Definition: system.cpp:422
PrintExceptionContinue
void PrintExceptionContinue(const std::exception *pex, const char *pszThread)
Definition: system.cpp:776
args
ArgsManager args
Definition: notifications.cpp:36