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


相关推荐

  • js编写桌面应用_web桌面应用框架

    js编写桌面应用_web桌面应用框架最近要做个桌面的应用,用起来也方便。找了一圈发现NW.js挺容易上手,分享给大家。NW.js官网https://nwjs.io/1.下载适合当前版本的js【这里下载的SDK版本,方便后续调试】

    2022年8月2日
  • 路径分析如何操作?模型如何修正?

    路径分析如何操作?模型如何修正?一、研究场景路径分析,也称通径分析(有时也称结构方程模型,一般情况下如果包括测量模型和结构模型,则称为结构方程模型;如果只包括结构模型,则称为路径分析)。路径分析在于研究模型影响关系,用于对模型假设进行验证。比如下图的模型框架:希望研究工作条件,人际关系对于公司满意度的影响;同时还希望研究公司满意度和机会感知对于离职倾向的影响。路径有一共有4条(即4对影响关系),路径分析可以同时研究此4对影响关系。二、SPSSAU操作1.SPSSAU上传数据登录账号后进入SPSSAU页面,点击右上角..

    2022年8月24日
  • CentOS7网络配置-静态IP设置

    CentOS7网络配置-静态IP设置安装完VM后,需要进行网络配置。第一个目标为可以进行SSH连接,可以从本机到VM进行文件传送。故,VM中centos需要可以独立访问外网!【1】修改网络配置文件安装完CentOS7时,网络是通的。此时网络配置如下:网络配置文件路径:/etc/sysconfig/network-scripts/ifcfg-enp0s3其中“enp03”是你的网卡名称。TYPE="Ethernet"PROXY_ME

    2022年6月9日
  • windows2003 dns 414错误「建议收藏」

    windows2003 dns 414错误「建议收藏」原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://rainbird.blog.51cto.com/211214/121697       因为原来在Linux下实现过域根dns.所以朋友也想做域名用自己的dns服务器的时候肯定是一马当先的帮着做了。操作系统这回用的是2003。用windows配置服务就一个字:“简单”。

    2022年6月11日
  • Java中用fastjson对String、JSONObject、JSONArray相互转换

    Java中用fastjson对String、JSONObject、JSONArray相互转换fastjson是阿里巴巴的开源JSON解析库,它可以解析JSON格式的字符串,支持将JavaBean序列化为JSON字符串,也可以从JSON字符串反序列化到JavaBean下面主要是本人在工作中经常用到的关于String、JSONObject、JSONArray的相互装换String——>>>JSONArrayStringst="[{name:Tim,age…

    2022年6月20日
  • vue引入图片url变量

    vue引入图片url变量1.引入方式普通引入<template>//普通引入<imgsrc=”../assets/images/01.jpg”>//webpack编译处理后:<imgsrc=”/img/01.f0afc36d.jpg”><template>变量引入<template>…

    2022年9月22日

发表回复

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

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