From 7deff3e73b5f6d88a439eaa86907231e9581bf4e Mon Sep 17 00:00:00 2001 From: Zichun Yu Date: Wed, 13 Apr 2022 17:32:41 +0800 Subject: [PATCH] Fix for CI --- linux-syscall/src/misc.rs | 2 +- linux-syscall/src/signal.rs | 30 +++++++++++++++--------------- loader/src/linux.rs | 11 ++++++----- zircon-object/src/signal/futex.rs | 15 ++------------- 4 files changed, 24 insertions(+), 34 deletions(-) diff --git a/linux-syscall/src/misc.rs b/linux-syscall/src/misc.rs index afcc7f16f..347fd3093 100644 --- a/linux-syscall/src/misc.rs +++ b/linux-syscall/src/misc.rs @@ -127,7 +127,7 @@ impl Syscall<'_> { ZxError::BAD_STATE => LxError::EAGAIN, e => e.into(), }; - let future = futex.wait(val, false, self.thread.id() as i32); + let future = futex.wait(val); let res = if duration.as_millis() == 0 { future.await } else { diff --git a/linux-syscall/src/signal.rs b/linux-syscall/src/signal.rs index bd4f27c77..a6783bdc0 100644 --- a/linux-syscall/src/signal.rs +++ b/linux-syscall/src/signal.rs @@ -136,7 +136,7 @@ impl Syscall<'_> { 0 => SendTarget::EveryProcessInGroup, -1 => SendTarget::EveryProcess, p if p < -1 => SendTarget::EveryProcessInGroupByPID((-p) as KoID), - _ => unimplemented!() + _ => unimplemented!(), }; let parent = self.zircon_process().clone(); match target { @@ -154,18 +154,17 @@ impl Syscall<'_> { process.exit(-1); } } - _ => unimplemented!() + _ => unimplemented!(), }; Ok(0) } - Err(_) => Err(LxError::EINVAL) + Err(_) => Err(LxError::EINVAL), } } - _ => unimplemented!() + _ => unimplemented!(), } } - /// Send a signal to a thread specified by tid /// TODO: support all the signals pub fn sys_tkill(&mut self, tid: usize, signum: usize) -> SysResult { @@ -192,12 +191,12 @@ impl Syscall<'_> { thread_linux.signal_mask.insert(signal); drop(thread_linux); } - }, - _ => unimplemented!() + } + _ => unimplemented!(), }; Ok(0) } - Err(_) => Err(LxError::EINVAL) + Err(_) => Err(LxError::EINVAL), } } @@ -214,7 +213,11 @@ impl Syscall<'_> { signum ); let parent = self.zircon_process().clone(); - match parent.job().get_child(tgid as u64).map(|proc| proc.get_child(tid as u64)) { + match parent + .job() + .get_child(tgid as u64) + .map(|proc| proc.get_child(tid as u64)) + { Ok(Ok(obj)) => { match signal { Signal::SIGRT33 => { @@ -229,15 +232,12 @@ impl Syscall<'_> { thread_linux.signal_mask.insert(signal); drop(thread_linux); } - }, - _ => unimplemented!() + } + _ => unimplemented!(), }; Ok(0) } - _ => Err(LxError::EINVAL) + _ => Err(LxError::EINVAL), } } - - - } diff --git a/loader/src/linux.rs b/loader/src/linux.rs index d9a108344..682fd030c 100644 --- a/loader/src/linux.rs +++ b/loader/src/linux.rs @@ -59,10 +59,13 @@ async fn run_user(thread: CurrentThread) { break; } - info!("back to user: thread id = {}", thread.id()); - // check the signal if was killed - if thread.inner().lock_linux().signal_mask.contains(linux_object::signal::Signal::SIGRT33) { + if thread + .inner() + .lock_linux() + .signal_mask + .contains(linux_object::signal::Signal::SIGRT33) + { thread.exit_linux(-1); // do not break temporarily } @@ -72,8 +75,6 @@ async fn run_user(thread: CurrentThread) { ctx.enter_uspace(); trace!("back from user: {:#x?}", ctx); - info!("into kernel: thread id = {}", thread.id()); - // handle trap/interrupt/syscall if let Err(err) = handle_user_trap(&thread, ctx).await { thread.exit_linux(err as i32); diff --git a/zircon-object/src/signal/futex.rs b/zircon-object/src/signal/futex.rs index e65a08cb3..5f1d96287 100644 --- a/zircon-object/src/signal/futex.rs +++ b/zircon-object/src/signal/futex.rs @@ -57,13 +57,8 @@ impl Futex { /// /// [`wait_with_owner`]: Futex::wait_with_owner /// [`wake`]: Futex::wake - pub fn wait( - self: &Arc, - current_value: u32, - lock_pi: bool, - thread_id: i32, - ) -> impl Future { - self.wait_with_owner(current_value, None, None, lock_pi, thread_id) + pub fn wait(self: &Arc, current_value: u32) -> impl Future { + self.wait_with_owner(current_value, None, None) } /// Wake some number of threads waiting on a futex. @@ -122,16 +117,12 @@ impl Futex { current_value: u32, thread: Option>, new_owner: Option>, - lock_pi: bool, - thread_id: i32, ) -> impl Future { #[must_use = "wait does nothing unless polled/`await`-ed"] struct FutexFuture { waiter: Arc, current_value: u32, new_owner: Option>, - lock_pi: bool, - thread_id: i32, } impl Future for FutexFuture { type Output = ZxResult; @@ -189,8 +180,6 @@ impl Futex { }), current_value, new_owner, - lock_pi, - thread_id, } }