6 #if defined(HAVE_CONFIG_H)
54 int fork_daemon(
bool nochdir,
bool noclose,
TokenPipeEnd& endpoint)
68 endpoint = umbilical->TakeReadEnd();
69 umbilical->TakeWriteEnd().
Close();
80 endpoint = umbilical->TakeWriteEnd();
81 umbilical->TakeReadEnd().
Close();
90 if (chdir(
"/") != 0) {
97 int fd = open(
"/dev/null", O_RDWR);
99 bool err = dup2(fd, STDIN_FILENO) < 0 || dup2(fd, STDOUT_FILENO) < 0 || dup2(fd, STDERR_FILENO) < 0;
101 if (fd > 2) close(fd);
136 strUsage +=
"\nUsage: bitcoind [options] Start " PACKAGE_NAME "\n"
161 for (
int i = 1; i < argc; i++) {
181 node.kernel = std::make_unique<kernel::Context>();
193 switch (fork_daemon(1, 0, daemon_ep)) {
208 tfm::format(std::cerr,
"Error during initialization - check debug.log for details\n");
225 catch (
const std::exception& e) {
251 common::WinCmdLineArgs winArgs;
252 std::tie(argc, argv) = winArgs.get();
bool HelpRequested(const ArgsManager &args)
bool IsSwitchChar(char c)
UrlDecodeFn *const URL_DECODE
static bool AppInit(NodeContext &node, int argc, char *argv[])
const std::function< std::string(const char *)> G_TRANSLATION_FUN
Translate string to current locale using Qt.
#define Assert(val)
Identity function.
bool ParseParameters(int argc, const char *const argv[], std::string &error)
std::string GetHelpMessage() const
Get the help string.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
bool SoftSetBoolArg(const std::string &strArg, bool fValue)
Set a boolean argument if it doesn't already have a value.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
bool IsOpen()
Return whether endpoint is open.
int TokenWrite(uint8_t token)
Write token to endpoint.
void Close()
Explicit close function.
int TokenRead()
Read token from endpoint.
static std::optional< TokenPipe > Make()
Create a new pipe.
std::string FormatFullVersion()
std::string LicenseInfo()
Returns licensing information (for -version)
void PrintExceptionContinue(const std::exception *pex, std::string_view thread_name)
void Interrupt(NodeContext &node)
Interrupt threads.
void InitLogging(const ArgsManager &args)
Initialize global loggers.
bool AppInitLockDataDirectory()
Lock bitcoin core data directory.
void SetupServerArgs(ArgsManager &argsman)
Register all arguments with the ArgsManager.
void Shutdown(NodeContext &node)
bool AppInitBasicSetup(const ArgsManager &args)
Initialize bitcoin core: Basic context setup.
bool AppInitInterfaces(NodeContext &node)
Initialize node and wallet interface pointers.
void InitParameterInteraction(ArgsManager &args)
Parameter interaction: change current parameters depending on various rules.
bool AppInitMain(NodeContext &node, interfaces::BlockAndHeaderTipInfo *tip_info)
Bitcoin core main initialization.
bool AppInitSanityChecks(const kernel::Context &kernel)
Initialization sanity checks.
bool AppInitParameterInteraction(const ArgsManager &args, bool use_syscall_sandbox)
Initialization: parameter interaction.
static constexpr bool DEFAULT_DAEMON
Default value for -daemon option.
static constexpr bool DEFAULT_DAEMONWAIT
Default value for -daemonwait option.
bool InitError(const bilingual_str &str)
Show error message.
bool error(const char *fmt, const Args &... args)
std::optional< ConfigError > InitConfig(ArgsManager &args, SettingsAbortFn settings_abort_fn)
std::unique_ptr< Init > MakeNodeInit(node::NodeContext &node, int argc, char *argv[], int &exit_status)
Return implementation of Init interface for the node process.
void ThreadSetInternalName(std::string &&)
Set the internal (in-memory) name of the current thread only.
void WaitForShutdown()
Wait for StartShutdown to be called in any thread.
NodeContext struct containing references to chain state and connection state.
void SetSyscallSandboxPolicy(SyscallSandboxPolicy syscall_policy)
Force the current thread (and threads created from the current thread) into a restricted-service oper...
std::string SysErrorString(int err)
Return system error string from errno value.
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
std::string(const std::string &url_encoded) UrlDecodeFn
std::string FormatParagraph(std::string_view in, size_t width, size_t indent)
Format a paragraph of text to a fixed width, adding spaces for indentation to any added line.