当前位置:网站首页>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.
边栏推荐
猜你喜欢
随机推荐
阿里神作!吃透这份资料入厂率高达99%
[相机配置] 海康相机丢包配置环境
Received your first five-figure salary
分类预测 | MATLAB实现CNN-LSTM(卷积长短期记忆神经网络)多特征分类预测
深度学习--循环神经网络(Recurrent Neural Network)
实现下拉加载更多
antd的Table列选择、列拓展
动态内存管理
1001 害死人不偿命的(3n+1)猜想 (15 分)
markdown转ipynb--利用包notedown
单元测试2之实际结果检查的引用
学长告诉我,大厂MySQL都是通过SSH连接的
深度学习--神经网络(基础讲解)
关于页面初始化
条件控制语句
如何快速打通镜像发布流程?
Cpolar内网穿透的面板功能介绍
Win系统 - 罗技 G604 鼠标蓝灯闪烁、失灵解决方案
开源SPL,WebService/Restful广泛应用于程序间通讯,如微服务、数据交换、公共或私有的数据服务等。
程序员的专属浪漫——用3D Engine 5分钟实现烟花绽放效果