开发者

Unix system programming: File open error

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.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜