开发者

Unix system programming: File open error

开发者 https://www.devze.com 2023-03-01 09:38 出处:网络
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?

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

精彩评论

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

关注公众号