I am trying to open a file which I created just before open command. But it hangs at open()
command line. Do you have any idea?
if(mkfifo("test", S_IRWXU | S_IRWXG | S_IRWXO))
{
开发者_如何学运维 printf("File creation error.\n");
return 0;
}
// Hangs below
while (((test_fd = open("test", O_RDONLY)) == -1) && (errno == EINTR));
from the manpage of mkfifo :
Opening a FIFO for reading normally blocks until some other process opens the same FIFO for writing, and vice versa.
See fifo(7) for nonblocking handling of FIFO special files.
精彩评论