Release worker private (#74)

* 释放worker private,to_thread问题待解决

* 增加process_free_task_

* 测试free_kthread_struct,process_free_task

* free_kthread_struct测试ok

* 修正函数重复的问题

Co-authored-by: longjin <longjin@RinGoTek.cn>
This commit is contained in:
houmkh
2022-11-04 14:19:24 +08:00
committed by GitHub
parent 09f8d6f577
commit d9ee9a0f5b
8 changed files with 58 additions and 25 deletions

View File

@ -10,7 +10,7 @@
#include <mm/slab.h>
#include <process/process.h>
#include <time/sleep.h>
#include <common/kthread.h>
// 导出系统调用入口函数定义在entry.S中
extern void system_call(void);
extern void syscall_int(void);
@ -544,10 +544,7 @@ uint64_t sys_wait4(struct pt_regs *regs)
// copy_to_user(status, (void*)child_proc->exit_code, sizeof(int));
proc->next_pcb = child_proc->next_pcb;
// 释放子进程的页表
process_exit_mm(child_proc);
// 释放子进程的pcb
kfree(child_proc);
process_release_pcb(child_proc);
return 0;
}
@ -611,3 +608,4 @@ system_call_t system_call_table[MAX_SYSTEM_CALL_NUM] = {
[23 ... 254] = system_call_not_exists,
[255] = sys_ahci_end_req,
};

View File

@ -2,8 +2,9 @@
#include <common/glib.h>
#include <common/kprint.h>
#include <process/ptrace.h>
#include <common/unistd.h>
#include <process/ptrace.h>
// 定义最大系统调用数量
#define MAX_SYSTEM_CALL_NUM 256
@ -63,7 +64,7 @@ ul sys_printf(struct pt_regs *regs);
* arg0=0 ===> 返回堆区域的起始地址
* arg0=-1 ===> 返回堆区域的结束地址
* @return uint64_t 错误码
*
*
*/
uint64_t sys_brk(struct pt_regs *regs);
@ -80,18 +81,18 @@ uint64_t sys_sbrk(struct pt_regs *regs);
* 在VFS.c中实现
* @param path(r8) 路径
* @param mode(r9) 模式
* @return uint64_t
* @return uint64_t
*/
uint64_t sys_mkdir(struct pt_regs * regs);
uint64_t sys_mkdir(struct pt_regs *regs);
/**
* @brief 创建管道
* 在pipe.c中实现
* @param fd(r8) 文件句柄指针
* @param num(r9) 文件句柄个数
* @return uint64_t
* @return uint64_t
*/
uint64_t sys_pipe(struct pt_regs * regs);
uint64_t sys_pipe(struct pt_regs *regs);
ul sys_ahci_end_req(struct pt_regs *regs);