![]() The child process may also terminate explicitly by callingĮxit(2) or after receiving a fatal signal. The integer returned by fn is the exit code for the child process. When the fn( arg) function application returns, the child process terminates. The arg argument is passed to the fn function. (This differs from fork(2), where execution continues in the child from the point of the fork(2)Ĭall.) The fn argument is a pointer to a function that is called by the child process at the beginning of its execution. When the child process is created with clone(), it executes the function application fn( arg). The main use of clone() is to implement threads: multiple threads of control in a program that run concurrently in a shared memory space. But see the description of CLONE_PARENT below.) Page, "calling process" normally corresponds to "parent process". Unlike fork(2), these calls allow the child process to share parts of its execution context with the calling process, such as the memory space, the table of file descriptors, and the table of signal handlers. A description of sys_clone is given towards the end of this page. It is actually a library function layered on top of the underlying clone() system call, hereinafter referred to as * pid_t * pid, struct user_desc * tlsĬlone() creates a new process, in a manner similar to fork(2). Int _clone2(int (* fn )(void *), void * child_stack_base, size_t stack_size, int flags, void * arg. Int clone(int (* fn )(void *), void * child_stack, int flags, void * arg. Clone, _clone2 - create a child process SYNOPSIS #include
0 Comments
Leave a Reply. |