This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
RE: clone(2)
- From: vijay nag <vijunag at gmail dot com>
- To: "libc-help at sourceware dot org" <libc-help at sourceware dot org>
- Date: Wed, 18 Dec 2013 23:44:37 +0530
- Subject: RE: clone(2)
- Authentication-results: sourceware.org; auth=none
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.