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: pwrite 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
short-write, o-append, open-file-description, fsync, rwf-atomic

Advantages

Limitations

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