[英]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.