This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: clone(2)


Hello,

I want to create a new process using clone(2) system call.  The
clone(2) is invoked the following way "clone(NULL, NULL, SIGCHLD |
CLONE_PARENT, NULL);" and seems to be returning EINVAL.  I RTFM of
clone(2) which suggested me to use NULL for child_stack when creating
a new task. It also suggests that EINVAL is returned when child_stack
argument is NULL. I'm little bit confused about its usage. Can someone
illustrate a simple invocation of clone(2) for creating a child task ?


Excerpts from man for sys_clone

"Another difference for sys_clone is that the child_stack argument may
be zero, in which case copy-on-write semantics ensure that the child
gets separate copies of stack pages when either process modifies the
stack. In this case, for correct operation, the CLONE_VM option should
not be specified."

EINVAL

Returned by clone() when a zero value is specified for child_stack.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]