Bitcoin
|
#include <attributes.h>
#include <compat.h>
#include <compat/assumptions.h>
#include <fs.h>
#include <logging.h>
#include <sync.h>
#include <tinyformat.h>
#include <util/memory.h>
#include <util/threadnames.h>
#include <util/time.h>
#include <exception>
#include <map>
#include <set>
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
#include <boost/thread/condition_variable.hpp>
Go to the source code of this file.
Classes | |
struct | SectionInfo |
class | ArgsManager |
struct | ArgsManager::Arg |
Namespaces | |
util | |
Functions | |
int64_t | GetStartupTime () |
std::string | _ (const char *psz) |
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) |
void | AllocateFileRange (FILE *file, unsigned int offset, unsigned int length) |
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) |
void | ReleaseDirectoryLocks () |
bool | TryCreateDirectories (const fs::path &p) |
fs::path | GetDefaultDataDir () |
const fs::path & | GetBlocksDir () |
const fs::path & | GetDataDir (bool fNetSpecific=true) |
void | ClearDatadirCache () |
fs::path | GetConfigFile (const std::string &confPath) |
fs::path | AbsPathForConfigVal (const fs::path &path, bool net_specific=true) |
bool | IsSwitchChar (char c) |
bool | HelpRequested (const ArgsManager &args) |
void | SetupHelpOptions (ArgsManager &args) |
std::string | HelpMessageGroup (const std::string &message) |
std::string | HelpMessageOpt (const std::string &option, const std::string &message) |
int | GetNumCores () |
template<typename Callable > | |
void | TraceThread (const char *name, Callable func) |
std::string | CopyrightHolders (const std::string &strPrefix) |
int | ScheduleBatchPriority () |
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 std::function< std::string(const char *)> | G_TRANSLATION_FUN |
ArgsManager | gArgs |
|
strong |
|
inline |
Translation function. If no translation function is set, simply return the input.
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(). |
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
bool CheckDiskSpace | ( | const fs::path & | dir, |
uint64_t | additional_bytes = 0 |
||
) |
void ClearDatadirCache | ( | ) |
Tests only
std::string CopyrightHolders | ( | const std::string & | strPrefix | ) |
bool DirIsWritable | ( | const fs::path & | directory | ) |
bool error | ( | const char * | fmt, |
const Args &... | args | ||
) |
bool FileCommit | ( | FILE * | file | ) |
const fs::path& GetBlocksDir | ( | ) |
fs::path GetConfigFile | ( | const std::string & | confPath | ) |
const fs::path& GetDataDir | ( | bool | fNetSpecific = true | ) |
fs::path GetDefaultDataDir | ( | ) |
int GetNumCores | ( | ) |
Return the number of cores available on the current system.
int64_t GetStartupTime | ( | ) |
Server/client environment: argument handling, config file parsing, thread wrappers, startup time
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:") |
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") |
bool HelpRequested | ( | const ArgsManager & | args | ) |
|
inline |
bool LockDirectory | ( | const fs::path & | directory, |
const std::string | lockfile_name, | ||
bool | probe_only = false |
||
) |
void PrintExceptionContinue | ( | const std::exception * | pex, |
const char * | pszThread | ||
) |
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)
void ReleaseDirectoryLocks | ( | ) |
Release all directory locks. This is used for unit testing only, at runtime the global destructor will take care of the locks.
bool RenameOver | ( | fs::path | src, |
fs::path | dest | ||
) |
int 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.
void SetupEnvironment | ( | ) |
void SetupHelpOptions | ( | ArgsManager & | args | ) |
Add help options to the args manager
bool SetupNetworking | ( | ) |
void TraceThread | ( | const char * | name, |
Callable | func | ||
) |
.. and a wrapper that just calls func once
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.
void UnlockDirectory | ( | const fs::path & | directory, |
const std::string & | lockfile_name | ||
) |
const char* const BITCOIN_CONF_FILENAME |
const std::function<std::string(const char*)> G_TRANSLATION_FUN |
Translate a message to the native language of the user.
Translate string to current locale using Qt.
ArgsManager gArgs |