当前位置:网站首页>UNIX Environment Programming Chapter 15 15.5FIFO
UNIX Environment Programming Chapter 15 15.5FIFO
2022-08-09 10:28:00 【Mary Soda Meatloaf】
FIFOs are sometimes named pipes.Through FIFO, unrelated processes can also exchange data.
Creating a FIFO is similar to creating a file
#include int mkfifo(const char *path,mode_t mode);int mkfifoat(int fd,const char *path,mode_t mode);//successful return 0, error return -1
The specification of the mode parameter is the same as that of the mode in the open function.
When opening a FIFO, the non-blocking flag has the following effects:
- Under normal circumstances, the system open blocks until other processes open the FIFO for writing.Similarly, write-only open blocks until some other process opens it for reading.
- If O_NONBLOCK is specified, read-only open returns immediately.However, if no process has a FIFO open for reading, write-only open will return -1 and set errno to ENXIO.
It is common to have multiple writing processes for a given FIFO, which means that atomic operations must be considered if data written by multiple processes is not expected to be interleaved.
FIFO serves two purposes:
- The shell command uses FIFO to transfer data from one pipe to another without creating intermediate temporary files.
- In a client-server application, the FIF acts as a rendezvous point, passing data between the client and server processes.
边栏推荐
猜你喜欢
随机推荐
今天做了手机播放器的均衡器
源代码阅读器项目
多行省略和选择器
函数组件和类组件和dva视图更新问题
Win7 远程桌面限制IP
1005 继续(3n+1)猜想 (25 分)
[相机配置] 海康相机丢包配置环境
机器学习--朴素贝叶斯(Naive Bayes)
机器学习--线性回归(Linear Regression)
2021-01-11-雪碧图做表情管理器
MySQL备份与恢复
深度学习--循环神经网络(Recurrent Neural Network)
一天半的结果——xmms on E2
stimulus.js 初体验
主从postition变化无法锁定_Slave_IO_Running显示No_Slave_Sql_Running显示No---Mysql主从复制同步002
shell脚本实战(第2版)/人民邮电出版社 脚本2 验证输入:仅限字母和数字
学长告诉我,大厂MySQL都是通过SSH连接的
SQL Server查询优化
按键精灵之输出文本
【原创】解决阿里云oss-browser.exe双击没反应打不开,提供一种解决方案