mirror of
https://github.com/joleuger/vuinputd.git
synced 2026-07-18 00:45:07 +00:00
Fixed a problem with zombie processes
This commit is contained in:
parent
8d5f6139b6
commit
32431b73d3
5 changed files with 9 additions and 3 deletions
1
debian/control
vendored
1
debian/control
vendored
|
|
@ -9,6 +9,7 @@ Build-Depends: debhelper (>= 12),
|
|||
rustc:native,
|
||||
pkg-config,
|
||||
libudev-dev,
|
||||
librust-bindgen-dev,
|
||||
librust-nix-dev,
|
||||
librust-libc-dev,
|
||||
librust-time-dev,
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ impl InjectInContainerJob {
|
|||
if runtime_data.is_none() {
|
||||
debug!("Give up reading runtime data");
|
||||
}
|
||||
self.set_state(&State::Finished);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +144,7 @@ impl InjectInContainerJob {
|
|||
|
||||
}))
|
||||
.expect("subprocess should work");
|
||||
let _exit_info = await_process(Pid::Pid(child_pid.as_raw())).await;
|
||||
let _exit_info = await_process(Pid::Pid(child_pid.as_raw())).await.unwrap();
|
||||
self.set_state(&State::Finished);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,12 +92,14 @@ impl RemoveFromContainerJob {
|
|||
Some(netlink_event) => netlink_event,
|
||||
None => {
|
||||
debug!("do nothing, because the device has never been announced via netlink");
|
||||
self.set_state(&State::Finished);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if netlink_event.tombstone {
|
||||
debug!("do nothing, because the device has already been removed in the meantime");
|
||||
self.set_state(&State::Finished);
|
||||
return;
|
||||
}
|
||||
let netlink_data=netlink_event.add_data;
|
||||
|
|
|
|||
|
|
@ -520,6 +520,7 @@ unsafe extern "C" fn vuinput_ioctl(
|
|||
let awaiter = inject_job.get_awaiter_for_state();
|
||||
JOB_DISPATCHER.get().unwrap().lock().unwrap().dispatch(Box::new(inject_job));
|
||||
awaiter(&container::inject_in_container_job::State::Finished);
|
||||
debug!("fh {}: injecting dev-nodes in container has been finished ", fh);
|
||||
}
|
||||
|
||||
// write a SYN-event (which is just zeros) just for validation
|
||||
|
|
@ -538,7 +539,8 @@ unsafe extern "C" fn vuinput_ioctl(
|
|||
let remove_job=RemoveFromContainerJob::new(vuinput_state.requesting_process.clone(),input_device.devnode.clone(),input_device.syspath.clone(),input_device.major,input_device.minor);
|
||||
let awaiter = remove_job.get_awaiter_for_state();
|
||||
JOB_DISPATCHER.get().unwrap().lock().unwrap().dispatch(Box::new(remove_job));
|
||||
awaiter(&container::remove_from_container_job::State::Finished)
|
||||
awaiter(&container::remove_from_container_job::State::Finished);
|
||||
debug!("fh {}: removing dev-nodes from container has been finished ", fh);
|
||||
}
|
||||
|
||||
ui_dev_destroy(fd).unwrap();
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ pub async fn await_process(pid: Pid) -> io::Result<i32> {
|
|||
libc::P_PID,
|
||||
pid as u32,
|
||||
&mut si,
|
||||
libc::WEXITED | libc::WNOWAIT,
|
||||
libc::WEXITED,
|
||||
);
|
||||
if r != 0 {
|
||||
return Err(io::Error::last_os_error());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue