T
Toni
Hi,
I'm writing a C program that should do something like transactions on
files.
I have several reader processes and one writer, and I have to make sure
that the writer either writes everything or nothing to (part of) a
file.
So I thought of COW (copy-on-write), but how to do that?
mmap() with MAP_PRIVATE can give me a copy of the (part of the) file to
work with. But how can I write the changes back to the original file so
that other processes would see those changes? MAP_PRIVATE prevents
writing changes to the original file, so I can't use msync().
AIX has deferred write capability (open() with O_DEFER flag)- changes
are written to a file only when fsync() is called. Linux doesn't seem
to have such a capability.
Any ideas?
Cheers, Toni
I'm writing a C program that should do something like transactions on
files.
I have several reader processes and one writer, and I have to make sure
that the writer either writes everything or nothing to (part of) a
file.
So I thought of COW (copy-on-write), but how to do that?
mmap() with MAP_PRIVATE can give me a copy of the (part of the) file to
work with. But how can I write the changes back to the original file so
that other processes would see those changes? MAP_PRIVATE prevents
writing changes to the original file, so I can't use msync().
AIX has deferred write capability (open() with O_DEFER flag)- changes
are written to a file only when fsync() is called. Linux doesn't seem
to have such a capability.
Any ideas?
Cheers, Toni