TreeviewCopyright © aleen42 all right reserved, powered by aleen42
Create Processes Back
- 共享代碼段, 複製數據段和堆栈段
1. Create
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char** argv)
{
pid_t child_pid = fork();
if(child_pid > 0)
{
//父進程
}
else if(child_pid == 0)
{
//子進程
}
else
{
//調用失敗
}
return 0;
}
method
pid_t fork()
return value
- >0: 子進程的進程號, 只在父進程中返回
- -1: failure
- 0: 只在子進程返回
2. Execute
execl()
調用後, 當前進程"死亡", 代碼段替換, 然後創建新的數據段及堆棧段, 保留原有的進程號.
method
int execve(const char* path, char* const argv[], char* envp)
int execl(const char* path, const char* argv, ...)
parameters
- path: 程序路徑名
- argv: 命令行參數
As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.
Notice: This plugin has used Cookie to store your token with an expiration.