当前位置:网站首页>read stream special attention
read stream special attention
2022-08-09 13:43:00 【Hong Dayu】
如果 read() 没有检索到消息中的所有数据,则剩余数据应留在 STREAM 中,并且可以通过下一次 read() 调用检索.信息-
丢弃模式还会检索数据,直到传输了所请求的字节数,或者达到了消息边界.然而,未读数据保留在一个
read() 返回后的消息将被丢弃,并且不能用于后续的 read()、getmsg() 或 getpmsg() 调用.
read() 如何处理零字节 STREAMS 消息由当前的读取模式设置决定.在字节流模式下,read() 将接受数据,直到它读取
nbyte 字节,或者直到没有更多数据要读取,或者直到遇到零字节消息块.然后 read() 函数应返回的数量
读取的字节数,并将零字节消息放回 STREAM 上,以供下一个 read()、getmsg() 或 getpmsg() 检索.在消息不丢弃模式或消息中
sage-discard 模式,零字节消息应返回 0,并且该消息应从 STREAM 中删除.当零字节消息作为第一条消息被读取时
在 STREAM 上,无论读取模式如何,都应从 STREAM 中删除消息并返回 0.
来自 STREAMS 文件的 read() 应在 STREAM 头读取队列的前面返回消息中的数据,而不管消息的优先级带.
默认情况下,STREAM 处于控制正常模式,其中来自 STREAMS 文件的 read() 只能处理包含数据部分但不包含
控制部分.如果在 STREAM 头部遇到包含控制部分的消息,read() 将失败.这个默认动作可以通过放置
使用 I_SRDOPT ioctl() 命令在控制数据模式或控制丢弃模式下进行 STREAM.在控制数据模式下,read() 应将任何控制部分转换为
数据并将其传递给应用程序,然后再传递最初存在于同一消息中的任何数据部分.在控制丢弃模式下,read() 将丢弃消息
控制部分,但将消息中的任何数据部分返回给进程.
此外,如果 STREAM 头在调用之前处理了异步错误,则 read() 将失败.在这种情况下,errno 的值不应反映
read() 的结果,但反映了先前的错误.如果正在读取的 STREAM 发生挂起,read() 将继续正常运行,直到 STREAM 头
读取队列为空.此后,它将返回 0.
pread() 函数应等效于 read(),除了它应从文件中的给定位置读取而不更改文件指针.首先
pread() 的三个参数与 read() 相同,只是为文件内的所需位置添加了第四个参数偏移量.尝试执行
无法查找的文件上的 pread() 将导致错误.
返回值
成功完成后,这些函数应返回一个非负整数,指示实际读取的字节数.否则,函数应
返回 -1 并设置 errno 以指示错误.
边栏推荐
- The core key points of microservice architecture
- 5G China unicom 一般性异常处理
- glide工具类的简单封装
- jenkins api创建自定义pipeline
- 两个链表相加
- Flutter entry and advanced tour (6) Layout Widget
- Win10 compiles the x264 library (there are also generated lib files)
- 5G 联通网管设计思路
- 30行代码实现微信朋友圈自动点赞
- Report: The number of students who want to learn AI has increased by 200%, and there are not enough teachers
猜你喜欢
5G China unicom general exception handling
Flutter入门进阶之旅(八)Button Widget
World's 4th mad scientist dies on his 103rd birthday
Manchester city launch emotional intelligence scarf can be detected, give the fans
Say goodbye to the AI era of hand looms
Customize VIEW to realize in-app message reminder to rotate up and down
30行代码实现蚂蚁森林自动偷能量
#Internet of Things essay#Xiaoxiong pie equipment development actual combat
我的2020年终总结
Fragment中嵌套ViewPager数据空白页异常问题分析
随机推荐
从NPU-SLAM-EDA技术分析
ABAP interview questions: how to use the System CALL interface of the ABAP programming language, direct execution ABAP server operating System's shell command?
Two minutes recording can pass by second language!The volcano how to practice and become voice tone reproduction technology?
WSA工具箱安装应用商店提示无法工作怎么解决?
Flutter入门进阶之旅(五)Image Widget
AQS Synchronization Component - FutureTask Analysis and Use Cases
AI basketball referee, walking is special, ask harden care don't care
正则引擎的几种分类
手写大根堆
h264 protocol
Dry+Bean+Dataset R语言数据分析,报告英文
win10编译x264库(也有生成好的lib文件)
第六届”蓝帽杯“全国大学生网络安全技能大赛 半决赛
5G China unicom 一般性异常处理
Flutter Getting Started and Advanced Tour (2) Hello Flutter
Redis源码剖析之跳表(skiplist)
Flutter入门进阶之旅(七)GestureDetector
Customize VIEW to realize in-app message reminder to rotate up and down
二叉树的序列化和反序列化
ansible-cmdb friendly display ansible collects host information