I need some help with the clone() system call. I'm trying to use it with the flag CLONE_CHILD_CLEARTID but I cant see any change in the value of the field I specify as argument. Here it is a simple code:
int the_child(){
exit(0);
}
int main(int argc, char * argv[])
{
pid_t child_id = 99;
printf("child %p\n",child_id);
clone((int (*)(void *))the_child,
NULL,
CLONE_VM | CLONE_CHILD_CLEARTID | SIGCHLD,
NULL, NULL,NULL, child_id);
sleep(1);
printf("child %p\n",child_id);
}
However when the two printf display always 99, What am I doing wrong?