how to use clone()
I read man about clone(), and write a little program as follow:
#include <sched.h>
#include <stdio.h>
int fn(void *p)
{
int i=0;
printf("a");
return i;
}
char stack[30];
int main()
{
int i=0;
i=clone(fn , (void *)stack , CLONE_FS , NULL);
printf("%d" , i);
}
But it can not run correctly. The program can not print anything at all.
How to use clone()?
|