fix: 解决进程退出时没有主动释放fdtable的问题 (#1069)

会导致http server被kill时,pcb没有drop

Signed-off-by: longjin <longjin@DragonOS.org>
This commit is contained in:
LoGin 2024-12-02 00:39:52 +08:00 committed by GitHub
parent ffa8e88c60
commit 4f8f269baf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -426,6 +426,7 @@ impl ProcessManager {
}
drop(thread);
unsafe { pcb.basic_mut().set_user_vm(None) };
pcb.exit_files();
// TODO 由于未实现进程组tty记录的前台进程组等于当前进程故退出前要置空
// 后续相关逻辑需要在SYS_EXIT_GROUP系统调用中实现
@ -1055,6 +1056,11 @@ impl ProcessControlBlock {
pub fn set_nsproxy(&self, nsprsy: NsProxy) {
*self.nsproxy.write() = nsprsy;
}
/// Exit fd table when process exit
fn exit_files(&self) {
self.basic.write_irqsave().set_fd_table(None);
}
}
impl Drop for ProcessControlBlock {