/* Prototype for the glibc wrapper function */
#define _GNU_SOURCE
#include <sched.h>
int clone(int (*
fn)(void *), void *
stack, int
flags, void *
arg, ...
/* pid_t *
parent_tid, void *
tls, pid_t *
child_tid */ );
/* For the prototype of the raw clone() system call, see NOTES */
#include <linux/sched.h>
/* Definition of struct clone_args
*/
#include <sched.h>
/* Definition of CLONE_*
constants */
#include <sys/syscall.h>
/* Definition of SYS_*
constants */
#include <unistd.h>
long syscall(SYS_clone3, struct clone_args *
cl_args, size_t
size);
Note: glibc provides no wrapper for clone3
(), necessitating the
use of syscall(2).