This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How write() works


Clyne wrote:
> Hi again,
>
> On 30/11/2010 16:58, tomas@tuxteam.de wrote:
>> Yes, it's most definitely (1). The kernel usually decides when commit to
>> media happens, possibly juggling things to increase throughput. Elevator
>> and all those things. It wouldn't make sense to put the app to wait for
>> as long as this happens.
>>
> Can I assume that other operations like moving, copying, linking etc
> also work in the same manner - i.e. that the kernel flushes the end
> results to disk when it sees fit?
>
> Thanks,
>
> Marcus.
Yes. You will need a fsync(2) on the folder (or a global sync(2) ) for that.

Also related is fdatasync(2), which can replace fsync(2) in almost every
case, as it's uncommon to need the atime/mtime of the file to be
completely exact.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]