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 
77 [[nodiscard]] bool RenameOver(fs::path src, fs::path dest);
78 
79 bool LockDirectory(const fs::path& directory, const std::string lockfile_name, bool probe_only=false);
80 void UnlockDirectory(const fs::path& directory, const std::string& lockfile_name);
81 bool DirIsWritable(const fs::path& directory);
82 bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes = 0);
83 
90 std::streampos GetFileSize(const char* path, std::streamsize max = std::numeric_limits<std::streamsize>::max());
91 
96 
97 bool TryCreateDirectories(const fs::path& p);
99 // Return true if -datadir option points to a valid directory or is not specified.
100 bool CheckDataDirOption();
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 
118 UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in="");
119 
128 fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific = true);
129 
130 inline bool IsSwitchChar(char c)
131 {
132 #ifdef WIN32
133  return c == '-' || c == '/';
134 #else
135  return c == '-';
136 #endif
137 }
138 
139 enum class OptionsCategory {
140  OPTIONS,
141  CONNECTION,
142  WALLET,
144  ZMQ,
145  DEBUG_TEST,
146  CHAINPARAMS,
147  NODE_RELAY,
149  RPC,
150  GUI,
151  COMMANDS,
153 
154  HIDDEN // Always the last option to avoid printing these in the help
155 };
156 
158 {
159  std::string m_name;
160  std::string m_file;
161  int m_line;
162 };
163 
165 {
166 public:
171  enum Flags : uint32_t {
172  ALLOW_ANY = 0x01,
173  // ALLOW_BOOL = 0x02, //!< unimplemented, draft implementation in #16545
174  // ALLOW_INT = 0x04, //!< unimplemented, draft implementation in #16545
175  // ALLOW_STRING = 0x08, //!< unimplemented, draft implementation in #16545
176  // ALLOW_LIST = 0x10, //!< unimplemented, draft implementation in #16545
178 
179  DEBUG_ONLY = 0x100,
180  /* Some options would cause cross-contamination if values for
181  * mainnet were used while running on regtest/testnet (or vice-versa).
182  * Setting them as NETWORK_ONLY ensures that sharing a config file
183  * between mainnet and regtest/testnet won't cause problems due to these
184  * parameters by accident. */
185  NETWORK_ONLY = 0x200,
186  // This argument's value is sensitive (such as a password).
187  SENSITIVE = 0x400,
188  COMMAND = 0x800,
189  };
190 
191 protected:
192  struct Arg
193  {
194  std::string m_help_param;
195  std::string m_help_text;
196  unsigned int m_flags;
197  };
198 
200  util::Settings m_settings GUARDED_BY(cs_args);
201  std::vector<std::string> m_command GUARDED_BY(cs_args);
202  std::string m_network GUARDED_BY(cs_args);
203  std::set<std::string> m_network_only_args GUARDED_BY(cs_args);
204  std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args);
205  bool m_accept_any_command GUARDED_BY(cs_args){true};
206  std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args);
207  mutable fs::path m_cached_blocks_path GUARDED_BY(cs_args);
208  mutable fs::path m_cached_datadir_path GUARDED_BY(cs_args);
209  mutable fs::path m_cached_network_datadir_path GUARDED_BY(cs_args);
210 
211  [[nodiscard]] bool ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys = false);
212 
218  bool UseDefaultSection(const std::string& arg) const EXCLUSIVE_LOCKS_REQUIRED(cs_args);
219 
220  public:
228  util::SettingsValue GetSetting(const std::string& arg) const;
229 
233  std::vector<util::SettingsValue> GetSettingsList(const std::string& arg) const;
234 
235  ArgsManager();
236  ~ArgsManager();
237 
241  void SelectConfigNetwork(const std::string& network);
242 
243  [[nodiscard]] bool ParseParameters(int argc, const char* const argv[], std::string& error);
244  [[nodiscard]] bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false);
245 
252  const std::set<std::string> GetUnsuitableSectionOnlyArgs() const;
253 
257  const std::list<SectionInfo> GetUnrecognizedSections() const;
258 
259  struct Command {
261  std::string command;
266  std::vector<std::string> args;
267  };
271  std::optional<const Command> GetCommand() const;
272 
281  fs::path GetPathArg(std::string pathlike_arg) const;
282 
288  const fs::path& GetBlocksDirPath() const;
289 
296  const fs::path& GetDataDirBase() const { return GetDataDir(false); }
297 
304  const fs::path& GetDataDirNet() const { return GetDataDir(true); }
305 
309  void ClearPathCache();
310 
317  std::vector<std::string> GetArgs(const std::string& strArg) const;
318 
325  bool IsArgSet(const std::string& strArg) const;
326 
334  bool IsArgNegated(const std::string& strArg) const;
335 
343  std::string GetArg(const std::string& strArg, const std::string& strDefault) const;
344 
352  int64_t GetIntArg(const std::string& strArg, int64_t nDefault) const;
353 
361  bool GetBoolArg(const std::string& strArg, bool fDefault) const;
362 
370  bool SoftSetArg(const std::string& strArg, const std::string& strValue);
371 
379  bool SoftSetBoolArg(const std::string& strArg, bool fValue);
380 
381  // Forces an arg setting. Called by SoftSetArg() if the arg hasn't already
382  // been set. Also called directly in testing.
383  void ForceSetArg(const std::string& strArg, const std::string& strValue);
384 
389  std::string GetChainName() const;
390 
394  void AddArg(const std::string& name, const std::string& help, unsigned int flags, const OptionsCategory& cat);
395 
399  void AddCommand(const std::string& cmd, const std::string& help);
400 
404  void AddHiddenArgs(const std::vector<std::string>& args);
405 
409  void ClearArgs() {
410  LOCK(cs_args);
411  m_available_args.clear();
412  m_network_only_args.clear();
413  }
414 
418  std::string GetHelpMessage() const;
419 
424  std::optional<unsigned int> GetArgFlags(const std::string& name) const;
425 
431  bool InitSettings(std::string& error);
432 
437  bool GetSettingsPath(fs::path* filepath = nullptr, bool temp = false) const;
438 
442  bool ReadSettingsFile(std::vector<std::string>* errors = nullptr);
443 
447  bool WriteSettingsFile(std::vector<std::string>* errors = nullptr) const;
448 
452  template <typename Fn>
453  void LockSettings(Fn&& fn)
454  {
455  LOCK(cs_args);
456  fn(m_settings);
457  }
458 
463  void LogArgs() const;
464 
465 private:
473  const fs::path& GetDataDir(bool net_specific) const;
474 
475  // Helper function for LogArgs().
476  void logArgsPrefix(
477  const std::string& prefix,
478  const std::string& section,
479  const std::map<std::string, std::vector<util::SettingsValue>>& args) const;
480 };
481 
482 extern ArgsManager gArgs;
483 
487 bool HelpRequested(const ArgsManager& args);
488 
491 
498 std::string HelpMessageGroup(const std::string& message);
499 
507 std::string HelpMessageOpt(const std::string& option, const std::string& message);
508 
513 int GetNumCores();
514 
515 std::string CopyrightHolders(const std::string& strPrefix);
516 
522 void ScheduleBatchPriority();
523 
524 namespace util {
525 
527 template <typename Tdst, typename Tsrc>
528 inline void insert(Tdst& dst, const Tsrc& src) {
529  dst.insert(dst.begin(), src.begin(), src.end());
530 }
531 template <typename TsetT, typename Tsrc>
532 inline void insert(std::set<TsetT>& dst, const Tsrc& src) {
533  dst.insert(src.begin(), src.end());
534 }
535 
541 template<typename T>
542 T* AnyPtr(const std::any& any) noexcept
543 {
544  T* const* ptr = std::any_cast<T*>(&any);
545  return ptr ? *ptr : nullptr;
546 }
547 
548 #ifdef WIN32
549 class WinCmdLineArgs
550 {
551 public:
552  WinCmdLineArgs();
553  ~WinCmdLineArgs();
554  std::pair<int, char**> get();
555 
556 private:
557  int argc;
558  char** argv;
559  std::vector<std::string> args;
560 };
561 #endif
562 
563 } // namespace util
564 
565 #endif // BITCOIN_UTIL_SYSTEM_H
RenameOver
bool RenameOver(fs::path src, fs::path dest)
Rename src to dest.
Definition: system.cpp:1063
ArgsManager::LogArgs
void LogArgs() const
Log the config file options and the command line arguments, useful for troubleshooting.
Definition: system.cpp:1051
SetupEnvironment
void SetupEnvironment()
Definition: system.cpp:1301
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:1131
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:456
LockDirectory
bool LockDirectory(const fs::path &directory, const std::string lockfile_name, bool probe_only=false)
Definition: system.cpp:98
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:378
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:266
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:155
flags
int flags
Definition: bitcoin-tx.cpp:529
ArgsManager::GetSetting
util::SettingsValue GetSetting(const std::string &arg) const
Get setting value.
Definition: system.cpp:1021
ArgsManager::GetDataDirNet
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
Definition: system.h:304
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:1016
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
help
static RPCHelpMan help()
Definition: server.cpp:133
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:85
sync.h
ArgsManager::GetPathArg
fs::path GetPathArg(std::string pathlike_arg) const
Get a normalized path from a specified pathlike argument.
Definition: system.cpp:390
ArgsManager::GetHelpMessage
std::string GetHelpMessage() const
Get the help string.
Definition: system.cpp:668
gArgs
ArgsManager gArgs
Definition: system.cpp:87
ArgsManager::GUARDED_BY
bool m_accept_any_command GUARDED_BY(cs_args)
Definition: system.h:205
ArgsManager::ALLOW_ANY
@ ALLOW_ANY
disable validation
Definition: system.h:172
ArgsManager::DISALLOW_NEGATION
@ DISALLOW_NEGATION
disallow -nofoo syntax
Definition: system.h:177
ArgsManager::GetChainName
std::string GetChainName() const
Returns the appropriate chain name from the program arguments.
Definition: system.cpp:987
ArgsManager::IsArgSet
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
Definition: system.cpp:494
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:1177
AnnotatedMixin< std::recursive_mutex >
ArgsManager::InitSettings
bool InitSettings(std::string &error)
Read and update settings file with saved settings.
Definition: system.cpp:499
OptionsCategory::CONNECTION
@ CONNECTION
SectionInfo::m_file
std::string m_file
Definition: system.h:160
bitcoin-config.h
TryCreateDirectories
bool TryCreateDirectories(const fs::path &p)
Ignores exceptions thrown by create_directories if the requested directory exists.
Definition: system.cpp:1086
ArgsManager::DEBUG_ONLY
@ DEBUG_ONLY
Definition: system.h:179
CheckDataDirOption
bool CheckDataDirOption()
Definition: system.cpp:811
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:1100
tinyformat.h
ArgsManager::~ArgsManager
~ArgsManager()
Definition: system.cpp:253
UnlockDirectory
void UnlockDirectory(const fs::path &directory, const std::string &lockfile_name)
Definition: system.cpp:122
ArgsManager::Arg
Definition: system.h:192
prefix
const char * prefix
Definition: rest.cpp:926
ArgsManager::GetDataDirBase
const fs::path & GetDataDirBase() const
Get data directory path.
Definition: system.h:296
ArgsManager::Arg::m_flags
unsigned int m_flags
Definition: system.h:196
GetDefaultDataDir
fs::path GetDefaultDataDir()
Definition: system.cpp:786
ArgsManager::cs_args
RecursiveMutex cs_args
Definition: system.h:199
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:517
CheckDiskSpace
bool CheckDiskSpace(const fs::path &dir, uint64_t additional_bytes=0)
Definition: system.cpp:147
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:1154
fs::path
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
Definition: fs.h:29
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:130
time.h
DirIsWritable
bool DirIsWritable(const fs::path &directory)
Definition: system.cpp:134
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:255
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:188
OptionsCategory::OPTIONS
@ OPTIONS
ArgsManager::Command::command
std::string command
The command (if one has been registered with AddCommand), or empty.
Definition: system.h:261
ArgsManager::ArgsManager
ArgsManager()
Definition: system.cpp:252
ArgsManager::Arg::m_help_param
std::string m_help_param
Definition: system.h:194
ArgsManager::ParseParameters
bool ParseParameters(int argc, const char *const argv[], std::string &error)
Definition: system.cpp:297
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: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:867
ArgsManager::SENSITIVE
@ SENSITIVE
Definition: system.h:187
ArgsManager::Flags
Flags
Flags controlling how config and command line arguments are validated and interpreted.
Definition: system.h:171
SectionInfo::m_name
std::string m_name
Definition: system.h:159
OptionsCategory
OptionsCategory
Definition: system.h:139
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:52
OptionsCategory::BLOCK_CREATION
@ BLOCK_CREATION
ArgsManager::ReadSettingsFile
bool ReadSettingsFile(std::vector< std::string > *errors=nullptr)
Read settings file.
Definition: system.cpp:540
ArgsManager::SelectConfigNetwork
void SelectConfigNetwork(const std::string &network)
Select the network in use.
Definition: system.cpp:291
ArgsManager::LockSettings
void LockSettings(Fn &&fn)
Access settings with lock held.
Definition: system.h:453
ArgsManager::GetSettingsList
std::vector< util::SettingsValue > GetSettingsList(const std::string &arg) const
Get list of setting values.
Definition: system.cpp:1028
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:157
ArgsManager::COMMAND
@ COMMAND
Definition: system.h:188
ArgsManager
Definition: system.h:164
ArgsManager::Command
Definition: system.h:259
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:1034
OptionsCategory::WALLET
@ WALLET
util::insert
void insert(Tdst &dst, const Tsrc &src)
Simplification of std insertion.
Definition: system.h:528
ArgsManager::GetUnrecognizedSections
const std::list< SectionInfo > GetUnrecognizedSections() const
Log warnings for unrecognized section names in the config file.
Definition: system.cpp:275
SetupNetworking
bool SetupNetworking()
Definition: system.cpp:1328
ArgsManager::ClearArgs
void ClearArgs()
Clear available arguments.
Definition: system.h:409
SectionInfo::m_line
int m_line
Definition: system.h:161
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:465
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:542
ArgsManager::Arg::m_help_text
std::string m_help_text
Definition: system.h:195
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:485
ReleaseDirectoryLocks
void ReleaseDirectoryLocks()
Release all directory locks.
Definition: system.cpp:128
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:84
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:1262
ArgsManager::GetIntArg
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
Definition: system.cpp:594
TruncateFile
bool TruncateFile(FILE *file, unsigned int length)
Definition: system.cpp:1142
util
Definition: overloaded.h:8
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:1240
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:185
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:779
args
ArgsManager args
Definition: notifications.cpp:36