Date: Wed, 16 Jun 2021 01:15:43 -0700 From: "Ronald F. Guilmette" <rfg@tristatelogic.com> Cc: freebsd-questions@freebsd.org Subject: Re: Is a successful call to write(2) atomic? Message-ID: <28134.1623831343@segfault.tristatelogic.com> In-Reply-To: <20210616091158.313f9d26a415bf42ee0ebf94@sohara.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <20210616091158.313f9d26a415bf42ee0ebf94@sohara.org>, Steve O'Hara-Smith <steve@sohara.org> wrote: >> I'll try both... O_APPEND, with and without locking... but it kind of >> seems to me that if O_APPEND, by itself, were actually doing what the man >> page says it does, then that alone ought to be enough to prevent garbling >> of the output lines. > > No, in the ABDEF example the ABC process calls write and finds the >end of file and sets up ABC to be written there then the DEF process calls >write and finds EOF when the A and B have been written out but not C however >C gets written between the DEF process finding the end of file and writing >D out so C gets written and then overwritten. The O_APPEND guarantee that >the blocks are written contiguously starting at EOF is held but nothing >prevents the blocks from two writers interleaving and writing over each >other. ACK. Thank you. I'll do both and hope for the best. Regards, rfg
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?28134.1623831343>