in reply to Re^6: Writing to a log file without colliding
in thread Writing to a log file without colliding
Interesting. man 2 open on FreeBSD says
Opening a file with O_APPEND set causes each write on the file to be appended to the end.
That is somewhat ambiguous, though it can be interpreted to mean the same as the Solaris manpage says about O_APPEND.
On Linux, man 2 open says
- O_APPEND
The file is opened in append mode. Before each write, the file pointer is positioned at the end of the file, as if with lseek. O_APPEND may lead to corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a file, so the client kernel has to simulate it, which can't be done without a race condition.
So this seems to be a portable assumption. (The cautionary note about files on NFS mounted filesystems found in the Linux manpage is probably applicable across the board, as well.) I wonder since when this has been the case; it hasn't always been.
Makeshifts last the longest.
|
|---|