当前位置:网站首页>read stream 特别注意
read stream 特别注意
2022-08-09 12:37:00 【洪大宇】
如果 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 以指示错误。
边栏推荐
- 【HCIP持续更新】IS-IS协议原理与配置
- 内网穿透工具ngrok使用教程
- Ten minutes to teach you how to use VitePress to build and deploy a personal blog site
- Flutter introduction advanced trip (5) Image Widget
- win10编译x264库(也有生成好的lib文件)
- 自定义VIEW实现应用内消息提醒上下轮播
- Manchester city launch emotional intelligence scarf can be detected, give the fans
- 报告:想学AI的学生数量已涨200%,老师都不够用了
- How to upload local file trial version in binary mode in ABAP report
- Flutter入门进阶之旅(七)GestureDetector
猜你喜欢
Scala Advanced (7): Collection Content Summary (Part 1)
你没见过的《老友记》镜头,AI给补出来了|ECCV 2022
K个结点的组内逆序调整
Customize VIEW to realize in-app message reminder to rotate up and down
8、IDEA提交代码出现: Fetch failed fatal: Could not read from remote repository
曼城推出可检测情绪的智能围巾,把球迷给整迷惑了
Two minutes recording can pass by second language!The volcano how to practice and become voice tone reproduction technology?
我的2020年终总结
Flutter introduction advanced trip (5) Image Widget
Flutter Getting Started and Advanced Tour (3) Text Widgets
随机推荐
批量读取word docx文件指定表格内容,保存在excel文件中
李开复花上千万投的缝纫机器人,团队出自大疆
正则引擎的几种分类
leetcode 20. Valid Parentheses 有效的括号(中等)
面试题精选:神奇的斐波那契数列
8、IDEA提交代码出现: Fetch failed fatal: Could not read from remote repository
史上最猛“员工”,疯狂吐槽亿万富翁老板小扎:那么有钱,还总穿着同样的衣服!...
How to save Simulink simulation model as image or PDF
Flutter Getting Started and Advanced Tour (7) GestureDetector
腾讯发布第二代四足机器人Max,梅花桩上完成跳跃、空翻
ViewPager fragments of nested data blank page abnormal problem analysis
Flutter introduction advanced trip (5) Image Widget
Simple understanding of ThreadLocal
1小时直播招募令:行业大咖干货分享,企业报名开启丨量子位·视点
SQL Server查询优化 (转载非原创)
数字化转型之支撑保障单元
Two minutes recording can pass by second language!The volcano how to practice and become voice tone reproduction technology?
造自己的芯,让谷歌买单!谷歌再度开源 180nm 工艺的芯片
FFmpeg库在win10上配置使用(不配置libx264)
Resolved IndentationError: unindent does not match any oute r indentation Level