#include
#include
#include
void test()
{
pid_t pid;
pid=vfork();
if(pid==-1)
{
perror("vfork");
exit(EXIT_FAILURE);
}
else if(pid==0)
{
printf("1:child pid=%d,ppid=%d\n",getpid(),getppid());
}
else
{
printf("2:parent pid=%d,ppid=%d\n",getpid(),getppid());
}
}
void fun()
{
int buf[100];
for(int i=0;i<100;i++)
{
buf[i]=0;
}
printf("3:child pid=%d,ppid=%d\n",getpid(),getppid());
_exit(0);
}
int main()
{
pid_t pid;
test();
fun();
printf("hello\n");
}