{
  "slug": "pwrite",
  "term": "pwrite",
  "aliases": [
    "pwrite()",
    "positional write"
  ],
  "definition": "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.",
  "note": "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. [pwrite-api] 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. [musl-126] Linux documents RWF_NOAPPEND for pwritev2 since 6.9. Record the library, kernel and filesystem when testing. [readv-api]",
  "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."
  ],
  "related": [
    "short-write",
    "o-append",
    "open-file-description",
    "fsync",
    "rwf-atomic"
  ],
  "citations": [
    {
      "id": "pwrite-api",
      "title": "Linux man-pages 6.19: pread(2), positional writes and O_APPEND exception",
      "url": "https://man7.org/linux/man-pages/man2/pwrite.2.html",
      "accessed": "2026-10-17"
    },
    {
      "id": "musl-126",
      "title": "musl 1.2.6 release announcement: pwrite correction and older-kernel fallback",
      "url": "https://openwall.com/lists/musl/2026/03/20/1",
      "accessed": "2026-10-17"
    },
    {
      "id": "readv-api",
      "title": "Linux man-pages 6.19: readv(2), RWF_APPEND and RWF_NOAPPEND",
      "url": "https://man7.org/linux/man-pages/man2/readv.2.html",
      "accessed": "2026-10-17"
    },
    {
      "id": "hesela-publication",
      "title": "Hesela: Atomic rename is not a durable commit",
      "url": "https://hesela.com/analyses/atomic-rename-directory-durability/",
      "accessed": "2026-10-17"
    }
  ],
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-17"
}
