new: 内核态fork

This commit is contained in:
fslongjin
2022-08-01 11:34:06 +08:00
parent 311a6181b5
commit 2fd21e0395
6 changed files with 135 additions and 27 deletions

21
kernel/common/unistd.c Normal file
View File

@ -0,0 +1,21 @@
#include <common/unistd.h>
/**
* @brief fork当前进程
*
* @return pid_t
*/
pid_t fork(void)
{
return (pid_t)enter_syscall_int(SYS_FORK, 0, 0, 0, 0, 0, 0, 0, 0);
}
/**
* @brief vfork当前进程
*
* @return pid_t
*/
pid_t vfork(void)
{
return (pid_t)enter_syscall_int(SYS_VFORK, 0, 0, 0, 0, 0, 0, 0, 0);
}