What is the recommended way for atomic (complete) file data updates in FreeBSD?
The non-atomic variant is like:
Note this is more about kernal internals then userspace.
The non-atomic variant is like:
Code:
// old state
int fd = open("", O_CREAT | O_TRUNC | O_WRONLY)
write(fd, ...); // 0+ times
fsync(fd); // optional
close(fd);
// new state
Note this is more about kernal internals then userspace.