A fork-like C-wrapper for clone()?

Francesc Oller (francesc@mat.upc.es)
Fri, 06 Apr 2001 12:42:25 +0200


Hi all!

is there a fork-like C-wrapper for clone which would let write
something like:

if ((pid=clone(0,SIGCHLD|CLONE_VM))==0) /* child */
{
child_code;
_exit(0);
}
else
{
assert(pid>0); /* mother */
mother_code;
exit(0);
}

I'm not thinking in glibc'__clone or Linus' clone.c example since
they encapsulate the main thread code in a function. (i.e. not
fork-like)

Can somebody point me to some sample code?

I'll thank a CC to my e-mail

cheers

Francesc Oller
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/