{
  "slug": "posix-fallocate",
  "term": "posix_fallocate",
  "aliases": [
    "POSIX file-space allocation"
  ],
  "definition": "A POSIX library function that reserves storage for a file byte range and reports failure by returning an error number directly.",
  "note": "It returns zero on success; do not test for -1 or use errno as its result. glibc 2.40 tries native allocation first and uses emulation after EOPNOTSUPP. Its read/write fallback can race concurrent modifications; this is not a universal property of native allocation or every C library.",
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "related": [
    "file-preallocation",
    "sparse-file",
    "unwritten-extent"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-16",
  "citations": [
    {
      "id": "posix-fallocate",
      "title": "Linux man-pages: posix_fallocate(3), return convention and glibc caveats",
      "url": "https://man7.org/linux/man-pages/man3/posix_fallocate.3.html",
      "accessed": "2026-10-16"
    },
    {
      "id": "glibc-dispatch",
      "title": "glibc 2.40: Linux posix_fallocate dispatch to emulation on EOPNOTSUPP",
      "url": "https://raw.githubusercontent.com/bminor/glibc/glibc-2.40/sysdeps/unix/sysv/linux/posix_fallocate.c",
      "accessed": "2026-10-16"
    },
    {
      "id": "glibc-emulation",
      "title": "glibc 2.40: generic posix_fallocate read/write emulation",
      "url": "https://raw.githubusercontent.com/bminor/glibc/glibc-2.40/sysdeps/posix/posix_fallocate.c",
      "accessed": "2026-10-16"
    },
    {
      "id": "hesela-allocation",
      "title": "Sparse files, preallocation and thin-pool capacity",
      "url": "https://hesela.com/analyses/sparse-files-preallocation-thin-capacity/",
      "accessed": "2026-10-16"
    }
  ]
}
