1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
crate::ix!();
//-------------------------------------------[.cpp/bitcoin/src/ipc/process.h]
//-------------------------------------------[.cpp/bitcoin/src/ipc/process.cpp]
pub struct Process {
}
impl ProcessInterface for Process { }
impl Spawn for Process {
fn spawn(&mut self,
new_exe_name: &String,
argv0_path: Box<&Path>,
pid: &mut i32) -> i32 {
todo!();
/*
return mp::SpawnProcess(pid, [&](int fd) {
fs::path path = argv0_path;
path.remove_filename();
path /= fs::PathFromString(new_exe_name);
return std::vector<std::string>{fs::PathToString(path), "-ipcfd", strprintf("%i", fd)};
});
*/
}
}
impl WaitSpawned for Process {
fn wait_spawned(&mut self, pid: i32) -> i32 {
todo!();
/*
return mp::WaitProcess(pid);
*/
}
}
impl CheckSpawned for Process {
fn check_spawned(&mut self,
argc: i32,
argv: &[*mut u8],
fd: &mut i32) -> bool {
todo!();
/*
// If this process was not started with a single -ipcfd argument, it is
// not a process spawned by the spawn() call above, so return false and
// do not try to serve requests.
if (argc != 3 || strcmp(argv[1], "-ipcfd") != 0) {
return false;
}
// If a single -ipcfd argument was provided, return true and get the
// file descriptor so Protocol::serve() can be called to handle
// requests from the parent process. The -ipcfd argument is not valid
// in combination with other arguments because the parent process
// should be able to control the child process through the IPC protocol
// without passing information out of band.
if (!ParseInt32(argv[2], &fd)) {
throw std::runtime_error(strprintf("Invalid -ipcfd number '%s'", argv[2]));
}
return true;
*/
}
}
/**
| Constructor for Process interface.
| Implementation will vary depending
| on the platform (unix or windows).
|
*/
pub fn make_process() -> Box<Process> {
todo!();
/*
return std::make_unique<Process>();
*/
}