簡體   English   中英

使用 clone() 時出現無效參數錯誤

[英]Invalid Argument error when using clone()

我正在使用此函數調用 clone()

clone (fun, (char*)stack + 0x500000, SIGCHLD | CLONE_FILES | CLONE_FS, arg);

其中 fun 是一個函數:int fun(void*),stack = malloc (0x500000),arg 是 void* 類型。

我想知道無效參數錯誤的其他一些可能原因是什么。

我檢查過堆棧不是 NULL。

人克隆:

  The  child_stack  argument  specifies the location of the stack used by
   the child process.  Since the child and calling process may share  mem‐
   ory,  it  is  not possible for the child process to execute in the same
   stack as the calling process.  The calling process must  therefore  set
   up memory space for the child stack and pass a pointer to this space to
   clone().  Stacks grow downward on all processors that run Linux (except
   the  HP  PA  processors),  so child_stack usually points to the topmost
   address of the memory space set up for the child stack.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM