我正在尝试打开一个我在open命令之前创建的文件。但它挂起在open()
命令行。你有什么想法吗?
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));
答案 0 :(得分:2)
来自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.