Ensure process signals can also interrupt.

This commit is contained in:
4lDO2
2024-07-17 17:31:05 +02:00
parent 2d50055dfb
commit c54195f10d
5 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -21,12 +21,12 @@ pub fn signal_handler() {
.and_then(|_| ptrace::next_breakpoint().map(|f| f.contains(PTRACE_FLAG_IGNORE)));*/
// TODO: thumbs_down
let Some((thread_ctl, _proc_ctl, st)) = context.sigcontrol() else {
let Some((thread_ctl, proc_ctl, st)) = context.sigcontrol() else {
// Discard signal if sigcontrol is unset.
log::trace!("no sigcontrol, returning");
return;
};
if thread_ctl.currently_pending_unblocked() == 0 {
if thread_ctl.currently_pending_unblocked(proc_ctl) == 0 {
// The context is currently Runnable. When transitioning into Blocked, it will check for
// signals (with the context lock held, which is required when sending signals). After
// that, any detection of pending unblocked signals by the sender, will result in the
+2 -2
View File
@@ -49,8 +49,8 @@ impl WaitCondition {
{
{
let mut context = current_context_ref.write();
if let Some((control, _, _)) = context.sigcontrol()
&& control.currently_pending_unblocked() != 0
if let Some((control, pctl, _)) = context.sigcontrol()
&& control.currently_pending_unblocked(pctl) != 0
{
return false;
}
+2 -2
View File
@@ -142,8 +142,8 @@ pub fn futex(addr: usize, op: usize, val: usize, val2: usize, _addr2: usize) ->
context.wake = timeout_opt.map(|TimeSpec { tv_sec, tv_nsec }| {
tv_sec as u128 * time::NANOS_PER_SEC + tv_nsec as u128
});
if let Some((tctl, _pctl, _)) = context.sigcontrol() {
if tctl.currently_pending_unblocked() != 0 {
if let Some((tctl, pctl, _)) = context.sigcontrol() {
if tctl.currently_pending_unblocked(pctl) != 0 {
return Err(Error::new(EINTR));
}
}
+2 -2
View File
@@ -34,8 +34,8 @@ pub fn nanosleep(req_buf: UserSliceRo, rem_buf_opt: Option<UserSliceWo>) -> Resu
{
let mut context = current_context.write();
if let Some((tctl, _pctl, _)) = context.sigcontrol() {
if tctl.currently_pending_unblocked() != 0 {
if let Some((tctl, pctl, _)) = context.sigcontrol() {
if tctl.currently_pending_unblocked(pctl) != 0 {
return Err(Error::new(EINTR));
}
}
+1 -1
Submodule syscall updated: 6128f1acf0...99f49db824