Syscall_test/clonetest.c
void func(void *arg)
{
  int pid = getpid();

  printf(1, "\tChild thread: pid is %d\n", pid);
  printf(1, "\tChild thread: dereferenced function's arg to %d\n", *(int*) arg);
  *(int*) arg += 10;
  printf(1, "\tChild thread: incremented arg's value by 10. arg is now %d\n", *(int*) arg);
  sharedVal += 10;
  printf(1, "\tChild thread: incremented sharedVal by 10. sharedVal is now %d\n", sharedVal);
  exit();
  printf(1, "ERROR: Child continued past exit()\n");
}
// this function will be run by the cloned process
// it takes a void* argument which will be dereferenced to an integer pointer

this function will be run by the cloned process
it takes a void* argument which will be dereferenced to an integer pointer
this function will be run by the cloned process it takes a void * argument which will be dereferenced to an integer pointer
void func(void *arg)
{
  int pid = getpid();
  printf(1, "\tChild thread: pid is %d\n", pid);
  printf(1, "\tChild thread: dereferenced function's arg to %d\n", *(int*) arg);
  *(int*) arg += 10;
  printf(1, "\tChild thread: incremented arg's value by 10. arg is now %d\n", *(int*) arg);
  sharedVal += 10;
  printf(1, "\tChild thread: incremented sharedVal by 10. sharedVal is now %d\n", sharedVal);
  exit();
  printf(1, "ERROR: Child continued past exit()\n");
}
void func ( void * arg ) { int pid = getpid ( ) ; printf ( 1 , " \t \n " , pid ) ; printf ( 1 , " \t \n " , * ( int * ) arg ) ; * ( int * ) arg += 10 ; printf ( 1 , " \t \n " , * ( int * ) arg ) ; sharedVal += 10 ; printf ( 1 , " \t \n " , sharedVal ) ; exit ( ) ; printf ( 1 , " \n " ) ; }
this function will be run by the cloned process
it takes a void* argument which will be dereferenced to an integer pointer
this function will be run by the cloned process it takes a void * argument which will be dereferenced to an integer pointer