我有一个检查管道是否存在的程序,所以在函数中写了这个:
status = mkfifo("recv",0666);
fd1 = open("recv",O_WRONLY);
fd2 = open("sendd", O_RDONLY);
cout<<"we are checking botth bcz we have both read and write in the program------:)";
if(fd1 <0 && fd2 <0)
{
//strerror(errno);
err = 1;// a const for remote
}
else if(fd1 >0 || fd2 >0){
err = 2; // a const for local
}
else{
err = 3; // a const for progrm failure error
cout<<"program has some problems";
}
但是每次我运行我的程序时,它都会停在 fd1 = open("recv",O_WRONLY); 说 Thread1: signal SIGSTOP 虽然它只用 fd2= open("sendd", O_RDONLY); 我不知道为什么它会给出这个错误?我是 linux 管道的新手。