All pastes #931380 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-03-07 03:27 UTC
rendered paste body
#include <stdio.h>
#include <sys/types.h>

main()
{
 
 int childid;
 int parentid = getppid();
 
 childid = fork();
 
    if (childid == 0) /* this is the parent process */
    {
       printf("Created a child process\n");
    }
    else    /* this is the child process */
    {
      //something being called
      execl ("./child", "red", "white", "blue",  NULL);
    }
    //Why is this thing skipped? Shouldn't it wait indefinately 
    //since parentid+100 doesn't have any child that it is waiting on ?
    waitpid(parentid+100);
    
}