Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jun 2021 23:29:52 +0100
From:      Steve O'Hara-Smith <steve@sohara.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: Is a successful call to write(2) atomic?
Message-ID:  <20210615232952.661a4fa1783c0c5bf1bb77d6@sohara.org>
In-Reply-To: <22223.1623737465@segfault.tristatelogic.com>
References:  <22223.1623737465@segfault.tristatelogic.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 14 Jun 2021 23:11:05 -0700
"Ronald F. Guilmette" <rfg@tristatelogic.com> wrote:

> In other words:  Is a block of data that is successfully written by a
> single call to write() itself treated as being effectively atomic and
> indivisible, i.e. with repsect to the physical output file?

	In a word ... no.

	There is no guarantee that a write(2) operation will result in
contiguous data in the file. To ensure that you need locking or a single
writer.

-- 
Steve O'Hara-Smith <steve@sohara.org>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210615232952.661a4fa1783c0c5bf1bb77d6>