regular-file · shipping · also ordinary file

Regular file

A regular file is a file type that presents data as a byte sequence, distinct from directories, symbolic links and device or communication files.

Related Observatory article: Read on hesela.com

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. [1] [2] [3]

For 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. [1] [7]

Regular-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. [4] [5] [6]

The 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. [3]

Relations

related
File size, End of file, Inode, File offset, Sparse file, tmpfs, Named pipe (FIFO special file)

Citations

  1. Linux man-pages: inode(7), file types, logical size and allocated blocks (accessed 2026-11-15)
  2. Linux man-pages: stat(2), pathname, link and descriptor observations (accessed 2026-11-15)
  3. Linux man-pages: open(2), descriptors and open file descriptions (accessed 2026-11-15)
  4. Linux kernel documentation: Tmpfs, virtual memory and unmount lifetime (accessed 2026-11-15)
  5. Linux man-pages: write(2), successful writes and delayed errors (accessed 2026-11-15)
  6. Linux man-pages: fsync(2), file and directory synchronization (accessed 2026-11-15)
  7. Hesela: Sparse files, preallocation and thin-pool capacity (accessed 2026-11-15)
Sources & caveats
  • Primary-source terminology synthesis, not a new filesystem experiment or a claim about every synthetic filesystem's readable length or seek behavior.

JSON: /data/terms/regular-file.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Regular file. Hesela. 2026-11-15. https://hesela.dev/terms/regular-file/