|
}
if((pid=fork())==0)
//子进程:解析从管道中获取的命令,并作相应的处理
{
printf("\n");
close(pipe_fd.);
sleep(2);
while(!childexit)
{
read(pipe_fd[0],r_buf,4);
cmd=atoi(r_buf);
if(cmd==0)
{
printf("child: receive command from parent over\n now child process exit\n");
childexit=1;
}
else if(handle_cmd(cmd)!=0)
return;
sleep(1);
}
close(pipe_fd[0]);
exit( 页码:[1] [2] [3] [4] [5] [6] 第4页、共6页 |