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)
    return 0;
pid_t fork()
return value
  • >0: 子進程的進程號, 只在父進程中返回
  • -1: failure
  • 0: 只在子進程返回

2. Execute

  • execl()調用後, 當前進程"死亡", 代碼段替換, 然後創建新的數據段及堆棧段, 保留原有的進程號.
int execve(const char* path, char* const argv[], char* envp)
int execl(const char* path, const char* argv, ...)
  • path: 程序路徑名
  • argv: 命令行參數
return value
Empty Comments
Sign in GitHub

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.