clone

Hurricane Electric Internet Services: Accounts starting at $9.95/month
Hurricane Electric Internet Services

NAME

       clone - create a child process


SYNOPSIS

       #include <linux/sched.h>
       #include <linux/unistd.h>

       pid_t clone(void *sp, unsigned long flags)


DESCRIPTION

       clone  is  an  alternate  interface  to  fork,  with  more
       options.  fork is equivalent to clone(0, SIGCLD|COPYVM).

       If sp is non-zero, the child process uses sp as  its  ini-
       tial stack pointer.


       The low byte of flags contains the signal sent to the par-
       ent when the child dies.  flags may also be  bitwise-or'ed
       with either or both of COPYVM or COPYFD.

       If  COPYVM is set, child pages are copy-on-write images of
       the parent pages.  If COPYVM is not set, the child process
       shares  the  same pages as the parent, and both parent and
       child may write on the same data.

       If COPYFD is set, the child's file descriptors are  copies
       of  the  parent's file descriptors.  If COPYFD is not set,
       the child's file descriptors are shared with the parent.


RETURN VALUE

       On  success,  the  PID of the child process is returned in
       the parent's thread of execution, and a 0 is  returned  in
       the child's thread of execution.  On failure, a -1 will be
       returned in the parent's context, no child process will be
       created, and errno will be set appropriately.


ERRORS

       ENOSYS clone  will  always  return this error, unless your
              kernel was  compiled  with  CLONE_ACTUALLY_WORKS_OK
              defined.

       EAGAIN fork  cannot allocate sufficient memory to copy the
              parent's page tables and allocate a task  structure
              for the child.


BUGS

       By default, CLONE_ACTUALLY_WORKS_OK is not defined.
       There is no entry for clone in /lib/libc.so.4.5.26.
       Comments  in the kernel as of 1.1.46 indicate that it mis-
       handles the case where COPYVM is not set.


SEE ALSO

       fork(2)
Hurricane Electric Internet Services: Accounts starting at $9.95/month
Hurricane Electric Internet Services
Copyright (C) 1998 Hurricane Electric. All Rights Reserved.