rustjail: delete function signal in BaseContainer

Function signal in BaseContainer is not used anymore.

Fixes: #3835

Signed-off-by: bin <bin@hyper.sh>
This commit is contained in:
bin 2022-03-05 10:31:33 +08:00
parent d647b28bb8
commit b257e0e5ab

View File

@ -215,7 +215,6 @@ pub trait BaseContainer {
async fn start(&mut self, p: Process) -> Result<()>; async fn start(&mut self, p: Process) -> Result<()>;
async fn run(&mut self, p: Process) -> Result<()>; async fn run(&mut self, p: Process) -> Result<()>;
async fn destroy(&mut self) -> Result<()>; async fn destroy(&mut self) -> Result<()>;
fn signal(&self, sig: Signal, all: bool) -> Result<()>;
fn exec(&mut self) -> Result<()>; fn exec(&mut self) -> Result<()>;
} }
@ -1057,18 +1056,6 @@ impl BaseContainer for LinuxContainer {
Ok(()) Ok(())
} }
fn signal(&self, sig: Signal, all: bool) -> Result<()> {
if all {
for pid in self.processes.keys() {
signal::kill(Pid::from_raw(*pid), Some(sig))?;
}
}
signal::kill(Pid::from_raw(self.init_process_pid), Some(sig))?;
Ok(())
}
fn exec(&mut self) -> Result<()> { fn exec(&mut self) -> Result<()> {
let fifo = format!("{}/{}", &self.root, EXEC_FIFO_FILENAME); let fifo = format!("{}/{}", &self.root, EXEC_FIFO_FILENAME);
let fd = fcntl::open(fifo.as_str(), OFlag::O_WRONLY, Mode::from_bits_truncate(0))?; let fd = fcntl::open(fifo.as_str(), OFlag::O_WRONLY, Mode::from_bits_truncate(0))?;
@ -2049,14 +2036,6 @@ mod tests {
assert!(ret.is_ok(), "Expecting Ok, Got {:?}", ret); assert!(ret.is_ok(), "Expecting Ok, Got {:?}", ret);
} }
#[test]
fn test_linuxcontainer_signal() {
let ret = new_linux_container_and_then(|c: LinuxContainer| {
c.signal(nix::sys::signal::SIGCONT, true)
});
assert!(ret.is_ok(), "Expecting Ok, Got {:?}", ret);
}
#[test] #[test]
fn test_linuxcontainer_exec() { fn test_linuxcontainer_exec() {
let ret = new_linux_container_and_then(|mut c: LinuxContainer| c.exec()); let ret = new_linux_container_and_then(|mut c: LinuxContainer| c.exec());