msync() 是如何工作的? [英] how does msync() work?

查看:33
本文介绍了msync() 是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用mmap将文件F映射到块B,然后我只写了一个字节的B.如果我使用 MS_SYNC 为 B 调用 msync(),操作系统是否将所有块都写入 F?还是只写修改后的一个字节到F?

I use mmap to map file F to block B, and then I only write one byte of B. If I call msync() for B with MS_SYNC, does the OS write all the block to F? Or it only writes the one byte modified to F?

推荐答案

您特定系统上的手册页说了什么?如果它不是开源的,那是您必须继续下去的最佳方式,除非您可以找到适用于您的 UNIX 平台的更详细的文档.

What does the man page on your particular system say? If it's not open source, that's about the best you have to go on, unless you have can find more detailed documentation for your UNIX platform.

至少在一个系统上,man msync 说:

On at least one system, man msync says:

msync() 系统调用将修改后的整个页面写回文件系统并更新文件修改时间.只有那些页面将检查包含 addr 和 len-1 的后续位置.

The msync() system call writes modified whole pages back to the filesystem and updates the file modification time. Only those pages containing addr and len-1 succeeding locations will be examined.

这篇关于msync() 是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆