This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: How write() works
- From: "Ãngel GonzÃlez" <keisial at gmail dot com>
- To: Marcus Clyne <maccaday at gmail dot com>
- Cc: tomas at tuxteam dot de, libc-help at sourceware dot org
- Date: Wed, 01 Dec 2010 17:37:46 +0100
- Subject: Re: How write() works
- References: <4CF4EB46.7090004@gmail.com> <20101130145803.GB17946@tomas> <4CF5B83F.2040907@gmail.com>
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.