{
  "slug": "regular-file",
  "term": "Regular file",
  "aliases": [
    "ordinary file"
  ],
  "definition": "A regular file is a file type that presents data as a byte sequence, distinct from directories, symbolic links and device or communication files.",
  "note": "On Linux, S_ISREG(st_mode) tests the type reported by a successful status call. stat() follows a final symbolic link, lstat() reports the link itself, and fstat() reports the object referenced by an open descriptor. A filename extension is not this file-type classification. Fields returned by one status call can reflect different moments during concurrent metadata changes. Checking a pathname and opening it later does not establish that both operations selected the same object. [inode-api] [stat-api] [open-api]\n\nFor ordinary stored files, st_size is the logical length in bytes, while Linux st_blocks reports allocated space in 512-byte units. Sparse holes can make allocation smaller than logical length; st_blksize is a preferred I/O size, not the multiplier for st_blocks. These fields do not directly measure physical consumption in a lower storage pool. [inode-api] [capacity-analysis]\n\nRegular-file type does not establish persistent backing. Tmpfs keeps files in virtual memory, may swap pages, and loses its contents when unmounted. On a persistent filesystem, successful write() completion alone does not establish durability. Synchronization and its errors must be handled separately; fsync() on a file does not necessarily persist its containing directory entry. [tmpfs-doc] [write-api] [fsync-api]\n\nThe file object, its names and its open descriptions are separate concepts. Replacing a pathname does not redirect an already open descriptor to the replacement file. Separate opens create separate open descriptions; duplicated descriptors share an offset and file-status flags. Neither arrangement alone makes file contents an immutable snapshot. [open-api]",
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "related": [
    "file-size",
    "end-of-file",
    "inode",
    "file-offset",
    "sparse-file",
    "tmpfs",
    "named-pipe"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-15",
  "citations": [
    {
      "id": "inode-api",
      "title": "Linux man-pages: inode(7), file types, logical size and allocated blocks",
      "url": "https://man7.org/linux/man-pages/man7/inode.7.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "stat-api",
      "title": "Linux man-pages: stat(2), pathname, link and descriptor observations",
      "url": "https://man7.org/linux/man-pages/man2/stat.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "open-api",
      "title": "Linux man-pages: open(2), descriptors and open file descriptions",
      "url": "https://man7.org/linux/man-pages/man2/open.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "tmpfs-doc",
      "title": "Linux kernel documentation: Tmpfs, virtual memory and unmount lifetime",
      "url": "https://docs.kernel.org/filesystems/tmpfs.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "write-api",
      "title": "Linux man-pages: write(2), successful writes and delayed errors",
      "url": "https://man7.org/linux/man-pages/man2/write.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "fsync-api",
      "title": "Linux man-pages: fsync(2), file and directory synchronization",
      "url": "https://man7.org/linux/man-pages/man2/fsync.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "capacity-analysis",
      "title": "Hesela: Sparse files, preallocation and thin-pool capacity",
      "url": "https://hesela.com/analyses/sparse-files-preallocation-thin-capacity/#measure",
      "accessed": "2026-11-15"
    }
  ],
  "provenance": [
    "Primary-source terminology synthesis, not a new filesystem experiment or a claim about every synthetic filesystem's readable length or seek behavior."
  ]
}
