解决 read: Resource temporarily unavailable

简介:

场景

    代码 if((fd = open("my_fifo" , O_WR|O_NONBLOCK)) < 0)


分析

    返回值文件句柄是-1,错误提示(read: Resource temporarily unavailable),设置成无阻塞的模式,就必须匹配上可读写的模式


解决

    if((fd = open("my_fifo" , O_RDWR|O_NONBLOCK)) < 0)

    if((mkfifo("my_fifo", O_CREAT|O_RDWR|0666)) < 0)


总结

    上述是一种比较常见的模式匹配不正确,导致文件打开异常的错误。在其他类似这样子的模式匹配的情况下,每一种模式之间的匹配都是有特定的规则





     本文转自fengyuzaitu 51CTO博客,原文链接:http://blog.51cto.com/fengyuzaitu/1568752,如需转载请自行联系原作者
相关文章
|
运维 Cloud Native 前端开发
如何解决 503 Service Temporarily Unavailable?
如何解决 503 Service Temporarily Unavailable?
1421 0
|
5月前
|
iOS开发 Perl
解決pod install报错:unable to access: LibreSSL SSL_read: error:Operation timed out, errno 60
解決pod install报错:unable to access: LibreSSL SSL_read: error:Operation timed out, errno 60
106 0
Failed to load resource:9090/searchvideolist?mysearch%E8%B0%B7%E6%AD%8C:1
Failed to load resource:9090/searchvideolist?mysearch%E8%B0%B7%E6%AD%8C:1
|
8月前
|
开发者 iOS开发
Unable to boot device due to insufficient system resources
Unable to boot device due to insufficient system resources
74 1
|
8月前
|
Oracle 关系型数据库
Customer RecommendedORA-27090 - Unable to Reserve Kernel Resources for Asynchronous Disk I/O
Customer RecommendedORA-27090 - Unable to Reserve Kernel Resources for Asynchronous Disk I/O
54 4
|
7月前
|
JSON 数据格式
【ERROR】Error: transaction invalidated with status (ENDORSEMENT_POLICY_FAILURE)
【ERROR】Error: transaction invalidated with status (ENDORSEMENT_POLICY_FAILURE)
56 0
|
8月前
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
|
缓存 Ubuntu Linux
错误 E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
错误 E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
Install fail! Error: EBUSY: resource busy or locked, symlink
Install fail! Error: EBUSY: resource busy or locked, symlink
130 0