![]() |
Bitcoin ABC
0.22.12
P2P Digital Currency
|
#include <attributes.h>
#include <compat.h>
#include <compat/assumptions.h>
#include <fs.h>
#include <logging.h>
#include <sync.h>
#include <tinyformat.h>
#include <util/settings.h>
#include <util/threadnames.h>
#include <util/time.h>
#include <boost/thread/condition_variable.hpp>
#include <cstdint>
#include <exception>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
Go to the source code of this file.
Classes | |
struct | SectionInfo |
class | ArgsManager |
struct | ArgsManager::Arg |
Namespaces | |
util | |
Functions | |
int64_t | GetStartupTime () |
Server/client environment: argument handling, config file parsing, thread wrappers, startup time. More... | |
void | SetupEnvironment () |
bool | SetupNetworking () |
template<typename... Args> | |
bool | error (const char *fmt, const Args &... args) |
void | PrintExceptionContinue (const std::exception *pex, const char *pszThread) |
bool | FileCommit (FILE *file) |
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) |
bool | LockDirectory (const fs::path &directory, const std::string lockfile_name, bool probe_only=false) |
void | UnlockDirectory (const fs::path &directory, const std::string &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 Boost's create_directories if the requested directory exists. More... | |
fs::path | GetDefaultDataDir () |
const fs::path & | GetBlocksDir () |
const fs::path & | GetDataDir (bool fNetSpecific=true) |
bool | CheckDataDirOption () |
void | ClearDatadirCache () |
Tests only. More... | |
fs::path | GetConfigFile (const std::string &confPath) |
std::string | ShellEscape (const std::string &arg) |
NODISCARD bool | ParseKeyValue (std::string &key, std::string &val) |
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) |
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... | |
template<typename Callable > | |
void | TraceThread (const char *name, Callable func) |
std::string | CopyrightHolders (const std::string &strPrefix) |
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) |
Variables | |
const char *const | BITCOIN_CONF_FILENAME |
const char *const | BITCOIN_SETTINGS_FILENAME |
ArgsManager | gArgs |
|
strong |
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.
path | The path to be conditionally prefixed with datadir. |
net_specific | Forwarded to GetDataDir(). |
Definition at line 1352 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 1195 of file system.cpp.
bool CheckDataDirOption | ( | ) |
Definition at line 799 of file system.cpp.
bool CheckDiskSpace | ( | const fs::path & | dir, |
uint64_t | additional_bytes = 0 |
||
) |
void ClearDatadirCache | ( | ) |
std::string CopyrightHolders | ( | const std::string & | strPrefix | ) |
Definition at line 1342 of file system.cpp.
bool DirIsWritable | ( | const fs::path & | directory | ) |
Definition at line 127 of file system.cpp.
bool error | ( | const char * | fmt, |
const Args &... | args | ||
) |
bool FileCommit | ( | FILE * | file | ) |
Definition at line 1120 of file system.cpp.
const fs::path& GetBlocksDir | ( | ) |
Definition at line 734 of file system.cpp.
fs::path GetConfigFile | ( | const std::string & | confPath | ) |
Definition at line 812 of file system.cpp.
const fs::path& GetDataDir | ( | bool | fNetSpecific = true | ) |
Definition at line 760 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 149 of file system.cpp.
int GetNumCores | ( | ) |
Return the number of cores available on the current system.
Definition at line 1338 of file system.cpp.
int64_t GetStartupTime | ( | ) |
Server/client environment: argument handling, config file parsing, thread wrappers, startup time.
Definition at line 1348 of file system.cpp.
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 667 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 671 of file system.cpp.
bool HelpRequested | ( | const ArgsManager & | args | ) |
Definition at line 652 of file system.cpp.
|
inline |
bool LockDirectory | ( | const fs::path & | directory, |
const std::string | lockfile_name, | ||
bool | probe_only = false |
||
) |
Definition at line 88 of file system.cpp.
NODISCARD bool ParseKeyValue | ( | std::string & | key, |
std::string & | val | ||
) |
Definition at line 294 of file system.cpp.
void PrintExceptionContinue | ( | const std::exception * | pex, |
const char * | pszThread | ||
) |
Definition at line 697 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 1169 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 122 of file system.cpp.
bool RenameOver | ( | fs::path | src, |
fs::path | dest | ||
) |
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 1359 of file system.cpp.
void SetupEnvironment | ( | ) |
void SetupHelpOptions | ( | ArgsManager & | args | ) |
Add help options to the args manager.
Definition at line 657 of file system.cpp.
bool SetupNetworking | ( | ) |
std::string ShellEscape | ( | const std::string & | arg | ) |
Definition at line 1260 of file system.cpp.
void TraceThread | ( | const char * | name, |
Callable | func | ||
) |
bool TruncateFile | ( | FILE * | file, |
unsigned int | length | ||
) |
bool TryCreateDirectories | ( | const fs::path & | p | ) |
Ignores exceptions thrown by Boost's 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 1106 of file system.cpp.
void UnlockDirectory | ( | const fs::path & | directory, |
const std::string & | lockfile_name | ||
) |
const char* const BITCOIN_CONF_FILENAME |
Definition at line 73 of file system.cpp.
const char* const BITCOIN_SETTINGS_FILENAME |
Definition at line 74 of file system.cpp.
ArgsManager gArgs |
Definition at line 76 of file system.cpp.