pwrite · shipping · also pwrite(), positional write

pwrite

pwrite is a seekable-file operation that writes up to the requested byte count at an explicit offset without changing the open file description's current offset.

Related Observatory article: Read on hesela.com

A successful call may transfer fewer bytes than requested. Linux man-pages documents the historical O_APPEND exception: data is appended despite the explicit position. [1] This is not universal across current C libraries: the musl 1.2.6 release announcement reports correction of the append-mode case using RWF_NOAPPEND and reports an error on older kernels instead of silently writing at the wrong position. [2] Linux documents RWF_NOAPPEND for pwritev2 since 6.9. Record the library, kernel and filesystem when testing. [3]

Relations

related
pread, File offset, Short write, O_APPEND, Open file description, fsync, RWF_ATOMIC, STATX_WRITE_ATOMIC, RWF_APPEND, RWF_NOAPPEND

Advantages

  • Separates write positioning from a shared current-offset cursor.

Limitations

  • Does not serialize overlapping writers or promise full-length, untorn or durable completion.
  • The documented Linux append exception and library workarounds need environment-specific checks.

Citations

  1. Linux man-pages 6.19: pread(2), positional writes and O_APPEND exception (accessed 2026-10-17)
  2. musl 1.2.6 release announcement: pwrite correction and older-kernel fallback (accessed 2026-10-17)
  3. Linux man-pages 6.19: readv(2), RWF_APPEND and RWF_NOAPPEND (accessed 2026-10-17)

Further reading

  1. Hesela: Atomic rename is not a durable commit (accessed 2026-10-17)

JSON: /data/terms/pwrite.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. pwrite. Hesela. 2026-11-11. https://hesela.dev/terms/pwrite/