Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Like fork() and vfork(), the Linux-specific clone() system call creates a new process. It differs from the other two calls in allowing finer control over the steps that occur during process creation. The main use of clone() is in the implementation of threading libraries. Because clone() is not portable, its direct use in application programs should normally be avoided. We describe it here because it is useful background for the discussion of POSIX threads in Chapter 29 to Chapter 33, and also because it further illuminates the operation of fork() and vfork().
#define _GNU_SOURCE #include <sched.h> int clone(int (*func) (void *), void *child_stack, int flags, void *func_arg, ... /* pid_t *ptid, struct user_desc *tls, pid_t *ctid */ );