diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2021-01-25 22:45:54 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2021-03-04 18:24:00 +0100 |
commit | e017a913d0d78ef0766cf73586fe7a38488e1a26 (patch) | |
tree | f5d47c98db9c0c32c59a0f08aaeb6aaed75dbe70 /src/init.h | |
parent | c3e6fdee6d39d3f52dec421b48a0ac8bad5006f7 (diff) |
bitcoind: Add -daemonwait option to wait for initialization
This adds a `-daemonwait` flag that does the same as `-daemon` except
it, from a user perspective, backgrounds the process only after
initialization is complete.
This can be useful when the process launching bitcoind wants to
guarantee that either the RPC server is running, or that initialization
failed, before continuing. The exit code indicates the initialization
result.
This replaces the use of the libc function `daemon()` by a custom
implementation which is inspired by the glibc implementation, but also
creates a pipe from the child to the parent process for communication.
An additional advantage of having our own `daemon()` implementation is
that no MACOS-specific pragmas are needed anymore to silence a
deprecation warning.
Diffstat (limited to 'src/init.h')
-rw-r--r-- | src/init.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/init.h b/src/init.h index c04d966d06..34bca09dd1 100644 --- a/src/init.h +++ b/src/init.h @@ -9,6 +9,11 @@ #include <memory> #include <string> +//! Default value for -daemon option +static constexpr bool DEFAULT_DAEMON = false; +//! Default value for -daemonwait option +static constexpr bool DEFAULT_DAEMONWAIT = false; + class ArgsManager; struct NodeContext; namespace interfaces { |