diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2025-10-26 14:57:16 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2025-10-31 14:41:03 +0000 |
| commit | 514c8f173ce0597c51b5f651a4ef6863aeb2aa33 (patch) | |
| tree | eec37546d34232f5182ae1ab0f73fd5dac66e83d | |
| parent | 7e3c0565cfbf0e745f28a42da80ac9726bc9ed16 (diff) | |
write.2: explain the atomicity guarantees of the writes
(cherry picked from commit 1c8d7bb4cf7a6b19262333b2a9b1dacf3094b938)
| -rw-r--r-- | lib/libsys/write.2 | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/libsys/write.2 b/lib/libsys/write.2 index d2ff41ceead9..77067893ab4c 100644 --- a/lib/libsys/write.2 +++ b/lib/libsys/write.2 @@ -132,6 +132,26 @@ and may write fewer bytes than requested; the return value must be noted, and the remainder of the operation should be retried when possible. +.Sh ATOMICITY OF WRITES +When operating on regular files on local file systems, the effects of +.Fn write +are atomic. +As required by the POSIX standard, +the +.Fn read , +.Fn write , +and +.Fn ftruncate +functions and their variations are atomic with respect to +each other on the file data and metadata for regular files. +See for instance +.St -p1003.1-2024 +Volume 2, Section 2.9.7 for more information. +.Pp +.Fx +implements the requirement by taking +a read/write range lock on the file byte range +affected by the corresponding function. .Sh RETURN VALUES Upon successful completion the number of bytes which were written is returned. |
