mysql 查看函数fsync_fsync()函数 Unix/Linux「建议收藏」

mysql 查看函数fsync_fsync()函数 Unix/Linux「建议收藏」fsync,fdatasync-同步文件在内核态与存储设备内容简介#includeintfsync(intfd);intfdatasync(intfd);描述fsync()transfers(“flushes”)allmodifiedin-coredataof(i.e.,modifiedbuffercachepagesfor)thefilereferre…

大家好,又见面了,我是你们的朋友全栈君。

fsync, fdatasync – 同步文件在内核态与存储设备

内容简介

#include int fsync(intfd);int fdatasync(intfd);

描述

fsync() transfers (“flushes”) all modified in-core data of (i.e., modified buffer cache pages for) the file referred to by the file descriptor fd to the disk device (or other permanent storage device) where that file resides. The call blocks until the device reports that the transfer has completed. It also flushes metadata information associated with the file (see stat(2)).

Calling fsync() does not necessarily ensure that the entry in the directory containing the file has also reached disk. For that an explicit fsync() on a file descriptor for the directory is also needed.

fdatasync() is similar to fsync(), but does not flush modified metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handled. For example, changes to st_atime or st_mtime (respectively, time of last access and time of last modification; see stat(2)) do not not require flushing because they are not necessary for a subsequent data read to be handled correctly. On the other hand, a change to the file size (st_size, as made by say ftruncate(2)), would require a metadata flush.

The aim of fdatasync(2) is to reduce disk activity for applications that do not require all metadata to be synchronised with the disk.

返回值

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

错误

标签

描述

EBADF

fd is not a valid file descriptor open for writing.

EIO

An error occurred during synchronization.

EROFS, EINVAL

fd is bound to a special file which does not support synchronization.

注意

If the underlying hard disk has write caching enabled, then the data may not really be on permanent storage when fsync() / fdatasync() return.

When an ext2 file system is mounted with the sync option, directory entries are also implicitly synced by fsync().

On kernels before 2.4, fsync() on big files can be inefficient. An alternative might be to use the O_SYNC flag to open(2).

遵循于

POSIX.1-2001

另请参阅

¥ 我要打赏

纠错/补充

收藏

加QQ群啦,易百教程官方技术学习群

注意:建议每个人选自己的技术方向加群,同一个QQ最多限加 3 个群。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/144871.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • python激活码2021【2021.8最新】

    (python激活码2021)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。https://javaforall.net/100143.htmlIntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,上面是详细链接哦~S32PGH0SQB-eyJsaWNlbnNlSWQiOi…

    2022年3月26日
    92
  • murmurhash算法_shell dash使用数组

    murmurhash算法_shell dash使用数组MurmurHash 是一种非加密型哈希函数,适用于一般的哈希检索操作。[1][2][3] 由AustinAppleby在2008年发明,[4][5] 并出现了多个变种,[6] 都已经发布到了公有领域(publicdomain)。与其它流行的哈希函数相比,对于规律性较强的key,MurmurHash的随机分布特征表现更良好

    2022年10月19日
    0
  • linq 实现查询字符串拼接 : And 和 OR 两种方式

    N年前我们是这样来拼接查询字符串的:现在我们使用linq来实现上边的代码:推荐:http://www.cnblogs.com/roucheng/p/dushubiji.html

    2021年12月26日
    48
  • Vim查找命令及快捷键

    Vim查找命令及快捷键Vim查找命令及快捷键一、通过指令查找 1、左斜杠/ 从光标所在位置向文件尾搜索  例:/hello   2、问号? 从光标所在位置向文件头搜索  例:/hello   注:/和?均可加参数做指定查找(两者搜索方向不同,此处以/举例进行说明)    1) \<匹配单词的开头 \>匹配单词的结尾  例: \<hel

    2022年6月17日
    73
  • js查询手机号码归属地[通俗易懂]

    js查询手机号码归属地[通俗易懂]js查询手机号码归属地

    2022年7月22日
    10
  • YOLO v3网络结构分析

    YOLO v3网络结构分析相信阅读了YOLOv3论文的小伙伴们会发现为什么这次的论文篇幅这么少?除去参考文献就四面?Excuseme?我是下了篇假文献吧。读完后感觉内容确实不多,而且总感觉写的不够细致,很多地方都比较模糊,可能是作者想让大家去观摩他的代码吧。本人是小白,看后表示有点蒙。于是在Github上搜了大牛们基于Tensorflow搭建的YOLOv3模型进行分析(本人只接触过TF,所以就不去看caffe的源码…

    2022年6月24日
    27

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号