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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • NYOJ202 红黑树 【预购】

    NYOJ202 红黑树 【预购】

    2022年1月17日
    41
  • RTU远程测控终端[通俗易懂]

    RTU远程测控终端[通俗易懂]RTU远程测控终端是一种基于无线网络通信的物联网智能终端设备,测控终端集A/D功能和I/O功能为一体,负责对现场信号、工业设备的监测和控制。RTU远程测控终端输出控制信号,控制继电器输出,从而达到对远

    2022年8月6日
    6
  • 华为P40怎么解账号锁P40Pro忘记密码ID账号锁解除方案开机设备解锁帐号软件使用方法

    华为P40怎么解账号锁P40Pro忘记密码ID账号锁解除方案开机设备解锁帐号软件使用方法​今天带来一台用户华为mate30手机强制清除华为账号锁案例分享,这个台手机是用户公司手机,由于前使用者离职后未能退出手机的华为账号和锁屏密码,导致手机无法使用。自己通过简单的恢复出厂设置后,发现手机有华为账号锁无法激活手机,这才联系到刷机爱好者技术人员,给予远程强制刷机移除华为mate30的账号锁。在此提醒广大用户,登录的华为账号建议绑定经常使用的手机号码,防止无法找回密码从而到时手机无法使用。在刷机解锁过程中需要准备以下工具:准备windwos系统电脑一台,有条件的用户可以找台配置.

    2022年6月23日
    128
  • 二十种电容分类详解(附常用电子元件实物图片大全)

    二十种电容分类详解(附常用电子元件实物图片大全)转载—嘉峪检测网2020-04-2320:50以下为正文:一、瓷介电容器(CC)1.结构用陶瓷材料作介质,在陶瓷表面涂覆一层金属(银)薄膜,再经高温烧结后作为电极而成。瓷介电容器又分1类电介质(NPO、CCG);2类电介质(X7R、2X1)和3类电介质(Y5V、2F4)瓷介电容器。2.特点1类瓷介电容器具有温度系数小、稳定性高、损耗低、耐压高等优点。最大容量不超过1000pF,常用的有CC1、CC2、CC18A、CC11、CCG等系列。2、3.

    2022年8月22日
    6
  • windows下更新pip源「建议收藏」

    windows下更新pip源更新pip源原因由于之前通过pip的一个命令将我所装的所有可更新的Python包均更新了一遍,导致好像将pip本身也更新了(也可能不是通过pip命令是conda命令将pip给更新了),结果就是之后我使用pip时,无论下载安装什么均是timeout!!!而且还提示我pip该更新了,当我使用python-mpipinstall–upgradepip…

    2022年4月16日
    195
  • GitHub 热榜:轻量级无 Agent 的自动化运维平台!「建议收藏」

    GitHub 热榜:轻量级无 Agent 的自动化运维平台!「建议收藏」大家好,我是JackTian。作为一名运维工程师,大家都知道。早在几年前,偏传统运维,以cacti、nagios为主流,到后来的zabbix、Prometheus、Open-Falcon等,也是现在大多数企业用的偏多的运维监控平台。甚至有些企业,都是自主研发。不管是自主研发还是用开源的,其最终目的都是为了提高日常运维工作效率。那么,今天杰哥给大家推荐一款GitHub热榜开源运维平台——spug。这款开源运维平台是:面向中小型企业设计的轻量级无Agent的自动化运维平台,其主要功能

    2022年5月13日
    56

发表回复

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

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