fsync,fdatasync -将文件与内核状态同步到存储设备
个人资料
#includeintfsync(IntFD ); intfdatasync(intfd );
fync(transfers ) ' flushes ' ) allmodifiedin-coredataof ) I.e .modifiedbuffercachepagesfor (thefilereferredtobythefior ) werethatfileresides.thecallblocksuntilthedevicereportsthatthetransferhascompleted.italsoflushesmetadatainformationassssociation
呼叫fsync (doesnotnecessarilyensurethattheentryinthedirectorycontainingthefilehasalsoreacheddisk.forthatanexplicitfsyning
数据同步(issimilartofsync )、 utdoesnotflushmodifiedmetadataunlessthatmetadataisneededinordertoallowasubsequentdataretrievaltobecorrectlyhandled.forexampampppppppared 变更tost _ atime orst _ mtime (respectively,timeoflastaccessandtimeoflastmodification; seestat(2) ) donotnotrequireflushingbecausetheyarenotnecessaryforasubsequentdatareadtobehandledcorrectly.on the other hand as made by sayftruncate(2)2),would require a metadata flush。
theaimoffdatasync(2) istoreducediskactivityforapplicationsthatdonotrequireallmetadatatobesynchronisedwiththedisk。
返回值
On success,zero is returned. On error,-1 is returned,anderrnois set appropriately。
错误
fdisnotavalidfiledescriptoropenforwriting。
分析重建同步化。
EROFS,fr dwn/pfdisboundtoaspecialfilewhichdoesnotsupportsynchronization。
注意
iftheunderlyingharddiskhaswritecachingenabled,thenthedatamaynotreallybeonpermanentstoragewhenfsync (/fdata sync ) ) return
whenanext 2文件系统同步选项,directoryentriesarealsoimplicitlysyncedbyfsync ()。
On kernels before 2.4,onbigfilescanbeinefficient.analternativemightbetousetheo _ syncflagtoopen ) 2。
遵从命令
POSIX.1-2001
外向的大神/补充
注意:建议各位候选人按照自己的技术方向添加小组。 建议在同一QQ上最多添加三个组。