Skip to content

Commit

Permalink
Fix for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzc19 committed Apr 13, 2022
1 parent de77f11 commit 7deff3e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 34 deletions.
2 changes: 1 addition & 1 deletion linux-syscall/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
30 changes: 15 additions & 15 deletions linux-syscall/src/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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),
}
}

Expand All @@ -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 => {
Expand All @@ -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),
}
}



}
11 changes: 6 additions & 5 deletions loader/src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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);
Expand Down
15 changes: 2 additions & 13 deletions zircon-object/src/signal/futex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,8 @@ impl Futex {
///
/// [`wait_with_owner`]: Futex::wait_with_owner
/// [`wake`]: Futex::wake
pub fn wait(
self: &Arc<Self>,
current_value: u32,
lock_pi: bool,
thread_id: i32,
) -> impl Future<Output = ZxResult> {
self.wait_with_owner(current_value, None, None, lock_pi, thread_id)
pub fn wait(self: &Arc<Self>, current_value: u32) -> impl Future<Output = ZxResult> {
self.wait_with_owner(current_value, None, None)
}

/// Wake some number of threads waiting on a futex.
Expand Down Expand Up @@ -122,16 +117,12 @@ impl Futex {
current_value: u32,
thread: Option<Arc<Thread>>,
new_owner: Option<Arc<Thread>>,
lock_pi: bool,
thread_id: i32,
) -> impl Future<Output = ZxResult> {
#[must_use = "wait does nothing unless polled/`await`-ed"]
struct FutexFuture {
waiter: Arc<Waiter>,
current_value: u32,
new_owner: Option<Arc<Thread>>,
lock_pi: bool,
thread_id: i32,
}
impl Future for FutexFuture {
type Output = ZxResult;
Expand Down Expand Up @@ -189,8 +180,6 @@ impl Futex {
}),
current_value,
new_owner,
lock_pi,
thread_id,
}
}

Expand Down

0 comments on commit 7deff3e

Please sign in to comment.