Join With Me...

3:13 AM

Use of vfork in Unix C program

#include
int glob=6;
main()
{
int var,pid;
var=88;
printf(" Before vfork \n");
if((pid=vfork())<0)
printf("Vfork error \n");
else
if(pid>0);
else
{
glob++;
var++;
//_exit(0);
//sleep(2);
}
printf(" Pid=%d,glob=%d,var=%d\n",getpid(),glob,var);
exit(0);
}

1 comments:

Anonymous said...

The above code is copied from Advanced Programming In The UNIX Environment, 2nd Edition (2005).
Can i see some originality ??

Post a Comment