open-file-description · shipping · also OFD

Open file description

An open file description is a system-wide open-file object referenced by one or more file descriptors and holding state such as the current file offset and file status flags.

Related Observatory article: Read on hesela.com

On Linux, each successful open creates a new open file description; dup and descriptors inherited through fork refer to the existing object. In the generic writeback-error path, that object's f_wb_err cursor is shared by its aliases. This source-code relationship explains why two descriptor numbers need not provide independent error observations. A descriptor opened before pathname replacement keeps referring to the file it originally opened; a fresh open() after replacement can reach a different inode. Separate opens of the same inode do not share an open file description merely because the inode matches.

Handoff: SCM_RIGHTS shares an open file description, including its offset; dup does not make a private cursor. Sealing the inode's content and size does not stop another holder from seeking. [7] In the separate 4096-byte Linux handoff experiment, read and dup-read consumed 3072 unchanged suffix bytes after the sender sought to 1024. Positional and separately reopened controls read all 4096 bytes. [9]

Consumption: pread supplies an explicit offset without advancing the shared current position. A complete reader still checks errors, short reads and expected coverage. Stable bytes, valid format and complete consumption are separate properties; none proves producer authenticity or disk persistence. [8]

Retained access: chmod 0600 did not upgrade an O_RDONLY handle or its duplicate in same-owner Linux 6.8 ext4/tmpfs controls; a fresh O_RDWR procfs reopen could write. Duplication and reopening are distinct. [12] [13] This is visibility, not crash durability, NFS or changed-LSM evidence. [14]

Relations

related
pread, File offset, fsync, Writeback error, errseq_t, Atomic rename, Inode, Hard link, Unlink, syncfs, O_SYNC, Advisory file lock, Open-file-description lock, O_APPEND, pwrite, File descriptor, close, Linux file sealing, sync_file_range, O_PATH, Close-on-exec, Unix-domain socket, chmod

Limitations

  • Sharing an offset or error cursor does not establish persistence or application-level recovery.

Citations

  1. Linux man-pages: unix(7), SCM_RIGHTS shares the open file description (accessed 2026-10-23)
  2. Linux man-pages: pread(2), explicit offsets and short reads (accessed 2026-10-23)
  3. Hesela: sealed bytes and a shared read cursor (accessed 2026-10-23)
  4. Linux man-pages: F_GETFD(2const), descriptor flags and exec outcome (accessed 2026-11-05)
  5. Linux man-pages: fork(2), inherited descriptors and shared open file descriptions (accessed 2026-11-05)
  6. Linux man-pages: F_GETFL / F_SETFL, access modes (accessed 2026-11-05)
  7. Linux man-pages: proc_pid_fd(5), reopen permission checks (accessed 2026-11-05)
  8. Hesela: retained local access after permission changes, native evidence and limits (accessed 2026-11-05)
  9. Hesela: permission-lifetime native observations, source receipts and MIT replay bundle (accessed 2026-11-05)

Further reading

  1. Linux man-pages 6.19: open(2), open file descriptions (accessed 2026-10-13)
  2. Linux man-pages 6.19: dup(2), shared open file descriptions (accessed 2026-10-13)
  3. Linux v6.12: file_check_and_advance_wb_err in mm/filemap.c (accessed 2026-10-13)
  4. Hesela: Two descriptors are not necessarily two error observers (accessed 2026-10-13)
  5. Hesela: The name changes; existing readers do not (accessed 2026-10-15)
  6. Hesela: A lock follows the opened file, not the replacement name (accessed 2026-10-16)
Sources & caveats
  • Permission-lifetime evidence: nine scenarios, 108 recorded executions and 108 matching replay records; two compiler configurations, three repetitions per mount and one host, not independent fleet samples. No changed LSM policy, concurrent writer or power-loss experiment. [15]
  • Inheritance: close-on-exec belongs to each descriptor, not this shared object. Successful exec can close one reference while an unmarked alias keeps the same description and offset alive. Fork alone does not trigger that closure. [10] [11]

JSON: /data/terms/open-file-description.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Open file description. Hesela. 2026-11-16. https://hesela.dev/terms/open-file-description/