mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-14 12:06:48 +00:00
fix: 修复SignalStruct创建的时候,栈上内存占用过大的问题 (#1201)
Signed-off-by: longjin <longjin@DragonOS.org>
This commit is contained in:
parent
e696ba4440
commit
478d68a4de
@ -5,7 +5,7 @@ use core::{
|
||||
sync::atomic::AtomicI64,
|
||||
};
|
||||
|
||||
use alloc::{boxed::Box, vec::Vec};
|
||||
use alloc::vec::Vec;
|
||||
use system_error::SystemError;
|
||||
|
||||
use crate::{
|
||||
@ -60,7 +60,7 @@ pub const SIG_KERNEL_IGNORE_MASK: SigSet = Signal::into_sigset(Signal::SIGCONT)
|
||||
/// SignalStruct 在 pcb 中加锁
|
||||
#[derive(Debug)]
|
||||
pub struct SignalStruct {
|
||||
inner: Box<InnerSignalStruct>,
|
||||
inner: InnerSignalStruct,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -69,14 +69,14 @@ pub struct InnerSignalStruct {
|
||||
pub cnt: AtomicI64,
|
||||
/// 如果对应linux,这部分会有一个引用计数,但是没发现在哪里有用到需要计算引用的地方,因此
|
||||
/// 暂时删掉,不然这个Arc会导致其他地方的代码十分丑陋
|
||||
pub handlers: [Sigaction; MAX_SIG_NUM],
|
||||
pub handlers: Vec<Sigaction>,
|
||||
}
|
||||
|
||||
impl SignalStruct {
|
||||
#[inline(never)]
|
||||
pub fn new() -> Self {
|
||||
let mut r = Self {
|
||||
inner: Box::<InnerSignalStruct>::default(),
|
||||
inner: InnerSignalStruct::default(),
|
||||
};
|
||||
let mut sig_ign = Sigaction::default();
|
||||
// 收到忽略的信号,重启系统调用
|
||||
@ -115,7 +115,7 @@ impl Default for InnerSignalStruct {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
cnt: Default::default(),
|
||||
handlers: [Sigaction::default(); MAX_SIG_NUM],
|
||||
handlers: vec![Sigaction::default(); MAX_SIG_NUM],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ impl ProcessManager {
|
||||
}
|
||||
|
||||
// log::debug!("Just copy sighand");
|
||||
new_pcb.sig_struct_irqsave().handlers = current_pcb.sig_struct_irqsave().handlers;
|
||||
new_pcb.sig_struct_irqsave().handlers = current_pcb.sig_struct_irqsave().handlers.clone();
|
||||
|
||||
if clone_flags.contains(CloneFlags::CLONE_CLEAR_SIGHAND) {
|
||||
flush_signal_handlers(new_pcb.clone(), false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user