mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 09:23:25 +00:00
Optimize the latency of lat-sig-install
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
cf9c71119a
commit
fb718fd440
@ -3,6 +3,7 @@
|
||||
use core::time::Duration;
|
||||
|
||||
use crate::{
|
||||
get_current_userspace,
|
||||
prelude::*,
|
||||
process::posix_thread::futex::{
|
||||
futex_op_and_flags_from_u32, futex_requeue, futex_wait, futex_wait_bitset, futex_wake,
|
||||
@ -45,7 +46,7 @@ pub fn sys_futex(
|
||||
}
|
||||
|
||||
let timeout = {
|
||||
let time_spec: timespec_t = CurrentUserSpace::get().read_val(timeout_addr)?;
|
||||
let time_spec: timespec_t = get_current_userspace!().read_val(timeout_addr)?;
|
||||
Duration::try_from(time_spec)?
|
||||
};
|
||||
|
||||
|
@ -21,20 +21,24 @@ pub fn sys_rt_sigaction(
|
||||
old_sig_action_addr,
|
||||
sigset_size
|
||||
);
|
||||
|
||||
let mut sig_dispositions = ctx.process.sig_dispositions().lock();
|
||||
let old_action = sig_dispositions.get(sig_num);
|
||||
let old_action_c = old_action.as_c_type();
|
||||
if old_sig_action_addr != 0 {
|
||||
ctx.get_user_space()
|
||||
.write_val(old_sig_action_addr, &old_action_c)?;
|
||||
}
|
||||
if sig_action_addr != 0 {
|
||||
|
||||
let old_action = if sig_action_addr != 0 {
|
||||
let sig_action_c = ctx
|
||||
.get_user_space()
|
||||
.read_val::<sigaction_t>(sig_action_addr)?;
|
||||
let sig_action = SigAction::try_from(sig_action_c).unwrap();
|
||||
trace!("sig action = {:?}", sig_action);
|
||||
sig_dispositions.set(sig_num, sig_action);
|
||||
sig_dispositions.set(sig_num, sig_action)
|
||||
} else {
|
||||
sig_dispositions.get(sig_num)
|
||||
};
|
||||
|
||||
if old_sig_action_addr != 0 {
|
||||
let old_action_c = old_action.as_c_type();
|
||||
ctx.get_user_space()
|
||||
.write_val(old_sig_action_addr, &old_action_c)?;
|
||||
}
|
||||
|
||||
Ok(SyscallReturn::Return(0))
|
||||
|
Reference in New Issue
Block a user