Is a successful call to write(2) atomic?

Steve O'Hara-Smith steve at
Tue Jun 15 22:30:07 UTC 2021

On Mon, 14 Jun 2021 23:11:05 -0700
"Ronald F. Guilmette" <rfg at> 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

Steve O'Hara-Smith <steve at>

More information about the freebsd-questions mailing list