/* Demonstrate vfork. Note that parent returns immediately after */ /* the exec call is made, not waiting for the execed process to */ /* terminate. */ /* Sample calls (executable named testvfork): */ /* testvfork ls -l | more */ /* testvfork cat testvfork.c */ #include #include #include main(argc,argv) int argc; char *argv[]; {pid_t IsParent; printf("!\n"); IsParent=vfork(); if (IsParent) { fprintf(stderr,"Parent Returns!\n"); /* Don't need to flush. stderr is also not buffered */ } else { execvp(argv[1],argv+1); } }