On Fri, Nov 22, 2024 at 15:25:49 -0500, Roy J. Tellason, Sr. wrote: > Why would you want to append to a file that some other program is also > writing to? Sounds messy...
Opening a file in append mode has the following behavior: O_APPEND The file is opened in append mode. Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). The modification of the file offset and the write op‐ eration are performed as a single atomic step. So, if multiple processes all open the same file in append mode, and write data to it, each write will be kept separate, and they will all appear in chronological order. This is exactly what you want with a shared log file.