c - Invalid Argument error when using clone() -
i'm using function call clone()
clone (fun, (char*)stack + 0x500000, sigchld | clone_files | clone_fs, arg);
where fun function: int fun(void*), stack = malloc (0x500000), , arg of type void*.
i'm wondering other possible causes invalid argument perror.
i have checked stack not null.
man clone:
child_stack argument specifies location of stack used child process. since child , calling process may share mem‐ ory, not possible child process execute in same stack calling process. calling process must therefore set memory space child stack , pass pointer space clone(). stacks grow downward on processors run linux (except hp pa processors), child_stack points topmost address of memory space set child stack.
Comments
Post a Comment