 |
Bitcoin Core
22.99.0
P2P Digital Currency
|
Go to the documentation of this file.
6 #if defined(HAVE_CONFIG_H)
50 int fork_daemon(
bool nochdir,
bool noclose,
TokenPipeEnd& endpoint)
64 endpoint = umbilical->TakeReadEnd();
65 umbilical->TakeWriteEnd().
Close();
76 endpoint = umbilical->TakeWriteEnd();
77 umbilical->TakeReadEnd().
Close();
86 if (chdir(
"/") != 0) {
93 int fd = open(
"/dev/null", O_RDWR);
95 bool err = dup2(fd, STDIN_FILENO) < 0 || dup2(fd, STDOUT_FILENO) < 0 || dup2(fd, STDERR_FILENO) < 0;
97 if (fd > 2) close(fd);
160 }
catch (
const std::exception& e) {
165 for (
int i = 1; i < argc; i++) {
199 switch (fork_daemon(1, 0, daemon_ep)) {
214 tfm::format(std::cerr,
"Error during initializaton - check debug.log for details\n");
221 #endif // HAVE_DECL_FORK
231 catch (
const std::exception& e) {
254 int main(
int argc,
char* argv[])
257 util::WinCmdLineArgs winArgs;
258 std::tie(argc, argv) = winArgs.get();
273 return (
AppInit(
node, argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE);
bool AppInitInterfaces(NodeContext &node)
Initialize node and wallet interface pointers.
int TokenRead()
Read token from endpoint.
UrlDecodeFn *const URL_DECODE
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
void Close()
Explicit close function.
void InitParameterInteraction(ArgsManager &args)
Parameter interaction: change current parameters depending on various rules.
bool SoftSetBoolArg(const std::string &strArg, bool fValue)
Set a boolean argument if it doesn't already have a value.
void InitLogging(const ArgsManager &args)
Initialize global loggers.
std::string GetHelpMessage() const
Get the help string.
std::string GetChainName() const
Returns the appropriate chain name from the program arguments.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
NodeContext struct containing references to chain state and connection state.
int TokenWrite(uint8_t token)
Write token to endpoint.
std::unique_ptr< Init > MakeNodeInit(node::NodeContext &node, int argc, char *argv[], int &exit_status)
Return implementation of Init interface for the node process.
std::string LicenseInfo()
Returns licensing information (for -version)
bool InitSettings(std::string &error)
Read and update settings file with saved settings.
bool HelpRequested(const ArgsManager &args)
bool AppInitBasicSetup(const ArgsManager &args)
Initialize bitcoin core: Basic context setup.
#define Assert(val)
Identity function.
void noui_connect()
Connect all bitcoind signal handlers.
int main(int argc, char *argv[])
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
bool InitError(const bilingual_str &str)
Show error message.
bool AppInitMain(NodeContext &node, interfaces::BlockAndHeaderTipInfo *tip_info)
Bitcoin core main initialization.
bool IsSwitchChar(char c)
static bool AppInit(NodeContext &node, int argc, char *argv[])
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
static constexpr bool DEFAULT_DAEMONWAIT
Default value for -daemonwait option.
void Interrupt(NodeContext &node)
Interrupt threads.
void SetSyscallSandboxPolicy(SyscallSandboxPolicy syscall_policy)
Force the current thread (and threads created from the current thread) into a restricted-service oper...
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given chain name.
bool ParseParameters(int argc, const char *const argv[], std::string &error)
bool AppInitParameterInteraction(const ArgsManager &args)
Initialization: parameter interaction.
bool AppInitSanityChecks()
Initialization sanity checks: ecc init, sanity checks, dir lock.
bool ReadConfigFiles(std::string &error, bool ignore_invalid_keys=false)
void WaitForShutdown()
Wait for StartShutdown to be called in any thread.
bool CheckDataDirOption()
static std::optional< TokenPipe > Make()
Create a new pipe.
bool AppInitLockDataDirectory()
Lock bitcoin core data directory.
const std::function< std::string(const char *)> G_TRANSLATION_FUN
Translate string to current locale using Qt.
bool IsOpen()
Return whether endpoint is open.
std::string(const std::string &url_encoded) UrlDecodeFn
void PrintExceptionContinue(const std::exception *pex, const char *pszThread)
std::string FormatFullVersion()
bool error(const char *fmt, const Args &... args)
void SetupServerArgs(ArgsManager &argsman)
Register all arguments with the ArgsManager.
static constexpr bool DEFAULT_DAEMON
Default value for -daemon option.
void ThreadSetInternalName(std::string &&)
Set the internal (in-memory) name of the current thread only.
void Shutdown(NodeContext &node)
std::string FormatParagraph(const std::string &in, size_t width, size_t indent)
Format a paragraph of text to a fixed width, adding spaces for indentation to any added line.