![]() |
Bitcoin Core
24.1.0
P2P Digital Currency
|
#include <compat/compat.h>#include <compat/assumptions.h>#include <fs.h>#include <logging.h>#include <sync.h>#include <tinyformat.h>#include <util/settings.h>#include <util/time.h>#include <any>#include <exception>#include <map>#include <optional>#include <set>#include <stdint.h>#include <string>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| struct | SectionInfo |
| class | ArgsManager |
| struct | ArgsManager::Arg |
| struct | ArgsManager::Command |
Namespaces | |
| util | |
Functions | |
| int64_t | GetStartupTime () |
| void | SetupEnvironment () |
| bool | SetupNetworking () |
| template<typename... Args> | |
| bool | error (const char *fmt, const Args &... args) |
| void | PrintExceptionContinue (const std::exception *pex, std::string_view thread_name) |
| bool | FileCommit (FILE *file) |
| Ensure file contents are fully committed to disk, using a platform-specific feature analogous to fsync(). More... | |
| void | DirectoryCommit (const fs::path &dirname) |
| Sync directory contents. More... | |
| bool | TruncateFile (FILE *file, unsigned int length) |
| int | RaiseFileDescriptorLimit (int nMinFD) |
| this function tries to raise the file descriptor limit to the requested number. More... | |
| 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 is advisory, and the range specified in the arguments will never contain live data More... | |
| bool | RenameOver (fs::path src, fs::path dest) |
| Rename src to dest. More... | |
| bool | LockDirectory (const fs::path &directory, const fs::path &lockfile_name, bool probe_only=false) |
| void | UnlockDirectory (const fs::path &directory, const fs::path &lockfile_name) |
| bool | DirIsWritable (const fs::path &directory) |
| bool | CheckDiskSpace (const fs::path &dir, uint64_t additional_bytes=0) |
| std::streampos | GetFileSize (const char *path, std::streamsize max=std::numeric_limits< std::streamsize >::max()) |
| Get the size of a file by scanning it. More... | |
| void | ReleaseDirectoryLocks () |
| Release all directory locks. More... | |
| bool | TryCreateDirectories (const fs::path &p) |
| Ignores exceptions thrown by create_directories if the requested directory exists. More... | |
| fs::path | GetDefaultDataDir () |
| bool | CheckDataDirOption () |
| fs::path | GetConfigFile (const fs::path &configuration_file_path) |
| std::string | ShellEscape (const std::string &arg) |
| UniValue | RunCommandParseJSON (const std::string &str_command, const std::string &str_std_in="") |
| Execute a command which returns JSON, and parse the result. More... | |
| 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 absolute. More... | |
| bool | IsSwitchChar (char c) |
| std::string | SettingToString (const util::SettingsValue &, const std::string &) |
| std::optional< std::string > | SettingToString (const util::SettingsValue &) |
| int64_t | SettingToInt (const util::SettingsValue &, int64_t) |
| std::optional< int64_t > | SettingToInt (const util::SettingsValue &) |
| bool | SettingToBool (const util::SettingsValue &, bool) |
| std::optional< bool > | SettingToBool (const util::SettingsValue &) |
| bool | HelpRequested (const ArgsManager &args) |
| void | SetupHelpOptions (ArgsManager &args) |
| Add help options to the args manager. More... | |
| std::string | HelpMessageGroup (const std::string &message) |
| Format a string to be used as group of options in help messages. More... | |
| std::string | HelpMessageOpt (const std::string &option, const std::string &message) |
| Format a string to be used as option description in help messages. More... | |
| int | GetNumCores () |
| Return the number of cores available on the current system. More... | |
| void | ScheduleBatchPriority () |
| On platforms that support it, tell the kernel the calling thread is CPU-intensive and non-interactive. More... | |
| template<typename Tdst , typename Tsrc > | |
| void | util::insert (Tdst &dst, const Tsrc &src) |
| Simplification of std insertion. More... | |
| template<typename TsetT , typename Tsrc > | |
| void | util::insert (std::set< TsetT > &dst, const Tsrc &src) |
| template<typename T > | |
| T * | util::AnyPtr (const std::any &any) noexcept |
| Helper function to access the contained object of a std::any instance. More... | |
Variables | |
| const char *const | BITCOIN_CONF_FILENAME |
| const char *const | BITCOIN_SETTINGS_FILENAME |
| ArgsManager | gArgs |
|
strong |
Most paths passed as configuration arguments are treated as relative to the datadir if they are not absolute.
| path | The path to be conditionally prefixed with datadir. |
| net_specific | Use network specific datadir variant |
Definition at line 1424 of file system.cpp.
| 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 is advisory, and the range specified in the arguments will never contain live data
Definition at line 1250 of file system.cpp.
| bool CheckDataDirOption | ( | ) |
Definition at line 882 of file system.cpp.
| bool CheckDiskSpace | ( | const fs::path & | dir, |
| uint64_t | additional_bytes = 0 |
||
| ) |
| void DirectoryCommit | ( | const fs::path & | dirname | ) |
Sync directory contents.
This is required on some environments to ensure that newly created files are committed to disk.
Definition at line 1204 of file system.cpp.
| bool DirIsWritable | ( | const fs::path & | directory | ) |
Definition at line 133 of file system.cpp.
| bool error | ( | const char * | fmt, |
| const Args &... | args | ||
| ) |
| bool FileCommit | ( | FILE * | file | ) |
Ensure file contents are fully committed to disk, using a platform-specific feature analogous to fsync().
Definition at line 1173 of file system.cpp.
Definition at line 888 of file system.cpp.
| fs::path GetDefaultDataDir | ( | ) |
| std::streampos GetFileSize | ( | const char * | path, |
| std::streamsize | max = std::numeric_limits< std::streamsize >::max() |
||
| ) |
Get the size of a file by scanning it.
| [in] | path | The file path |
| [in] | max | Stop seeking beyond this limit |
Definition at line 154 of file system.cpp.
| int GetNumCores | ( | ) |
Return the number of cores available on the current system.
Definition at line 1413 of file system.cpp.
| int64_t GetStartupTime | ( | ) |
| std::string HelpMessageGroup | ( | const std::string & | message | ) |
Format a string to be used as group of options in help messages.
| message | Group name (e.g. "RPC server options:") |
Definition at line 823 of file system.cpp.
| std::string HelpMessageOpt | ( | const std::string & | option, |
| const std::string & | message | ||
| ) |
Format a string to be used as option description in help messages.
| option | Option message (e.g. "-rpcuser=<user>") |
| message | Option description (e.g. "Username for JSON-RPC connections") |
Definition at line 827 of file system.cpp.
| bool HelpRequested | ( | const ArgsManager & | args | ) |
Definition at line 808 of file system.cpp.
|
inline |
| bool LockDirectory | ( | const fs::path & | directory, |
| const fs::path & | lockfile_name, | ||
| bool | probe_only = false |
||
| ) |
Definition at line 97 of file system.cpp.
| void PrintExceptionContinue | ( | const std::exception * | pex, |
| std::string_view | thread_name | ||
| ) |
Definition at line 850 of file system.cpp.
| int RaiseFileDescriptorLimit | ( | int | nMinFD | ) |
this function tries to raise the file descriptor limit to the requested number.
It returns the actual file descriptor limit (which may be more or less than nMinFD)
Definition at line 1227 of file system.cpp.
| void ReleaseDirectoryLocks | ( | ) |
Release all directory locks.
This is used for unit testing only, at runtime the global destructor will take care of the locks.
Definition at line 127 of file system.cpp.
Rename src to dest.
Definition at line 1136 of file system.cpp.
| UniValue RunCommandParseJSON | ( | const std::string & | str_command, |
| const std::string & | str_std_in = "" |
||
| ) |
Execute a command which returns JSON, and parse the result.
| str_command | The command to execute, including any arguments |
| str_std_in | string to pass to stdin |
Definition at line 1335 of file system.cpp.
| void ScheduleBatchPriority | ( | ) |
On platforms that support it, tell the kernel the calling thread is CPU-intensive and non-interactive.
See SCHED_BATCH in sched(7) for details.
Definition at line 1432 of file system.cpp.
| bool SettingToBool | ( | const util::SettingsValue & | , |
| bool | |||
| ) |
| std::optional<bool> SettingToBool | ( | const util::SettingsValue & | ) |
Definition at line 665 of file system.cpp.
| int64_t SettingToInt | ( | const util::SettingsValue & | , |
| int64_t | |||
| ) |
| std::optional<int64_t> SettingToInt | ( | const util::SettingsValue & | ) |
Definition at line 640 of file system.cpp.
| std::string SettingToString | ( | const util::SettingsValue & | , |
| const std::string & | |||
| ) |
| std::optional<std::string> SettingToString | ( | const util::SettingsValue & | ) |
Definition at line 615 of file system.cpp.
| void SetupEnvironment | ( | ) |
Definition at line 1374 of file system.cpp.
| void SetupHelpOptions | ( | ArgsManager & | args | ) |
Add help options to the args manager.
Definition at line 813 of file system.cpp.
| bool SetupNetworking | ( | ) |
| std::string ShellEscape | ( | const std::string & | arg | ) |
Definition at line 1313 of file system.cpp.
| bool TruncateFile | ( | FILE * | file, |
| unsigned int | length | ||
| ) |
| bool TryCreateDirectories | ( | const fs::path & | p | ) |
Ignores exceptions thrown by create_directories if the requested directory exists.
Specifically handles case where path p exists, but it wasn't possible for the user to write to the parent directory.
Definition at line 1159 of file system.cpp.
Definition at line 121 of file system.cpp.
| const char* const BITCOIN_CONF_FILENAME |
Definition at line 83 of file system.cpp.
| const char* const BITCOIN_SETTINGS_FILENAME |
Definition at line 84 of file system.cpp.
| ArgsManager gArgs |
Definition at line 86 of file system.cpp.
1.8.14