Bitcoin Core  21.99.0
P2P Digital Currency
process.h
Go to the documentation of this file.
1 // Copyright (c) 2021 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_IPC_PROCESS_H
6 #define BITCOIN_IPC_PROCESS_H
7 
8 #include <memory>
9 #include <string>
10 
11 namespace ipc {
12 class Protocol;
13 
19 class Process
20 {
21 public:
22  virtual ~Process() = default;
23 
26  virtual int spawn(const std::string& new_exe_name, const fs::path& argv0_path, int& pid) = 0;
27 
29  virtual int waitSpawned(int pid) = 0;
30 
34  virtual bool checkSpawned(int argc, char* argv[], int& fd) = 0;
35 };
36 
39 std::unique_ptr<Process> MakeProcess();
40 } // namespace ipc
41 
42 #endif // BITCOIN_IPC_PROCESS_H
ipc
Definition: protocol.cpp:27
ipc::Process::waitSpawned
virtual int waitSpawned(int pid)=0
Wait for spawned process to exit and return its exit code.
ipc::Process::spawn
virtual int spawn(const std::string &new_exe_name, const fs::path &argv0_path, int &pid)=0
Spawn process and return socket file descriptor for communicating with it.
ipc::Process::checkSpawned
virtual bool checkSpawned(int argc, char *argv[], int &fd)=0
Parse command line and determine if current process is a spawned child process.
ipc::Process::~Process
virtual ~Process()=default
ipc::MakeProcess
std::unique_ptr< Process > MakeProcess()
Constructor for Process interface.
Definition: process.cpp:60
ipc::Process
IPC process interface for spawning bitcoin processes and serving requests in processes that have been...
Definition: process.h:19