o-path · shipping · also O_PATH descriptor

O_PATH

O_PATH is a Linux open flag that returns a filesystem-object reference without opening the object for ordinary data access.

Related Observatory article: O_PATH on hesela.com

The descriptor supports fstat(), duplication and, for a directory, relative openat() calls. It cannot supply file data or synchronize storage: read(), write(), mmap() and fsync() fail with EBADF, including fsync() on a directory reference. Acquiring it requires path-prefix search permission, not permissions on the final object; subsequent operations may perform their own checks. [1]

With O_NOFOLLOW, the descriptor can hold the final symlink itself for operations such as readlinkat() with an empty pathname. It does not hold that link's referent. [2]

A held reference remains associated with its object through pathname replacement. That lifetime guarantee is separate from namespace locking or preserving a version of file contents: another authorized writer can still modify the held file. [3]

Relations

related
Path resolution, Symbolic link, Open file description, Directory fsync

Advantages

  • Provides a reference for metadata inspection or directory-relative lookup without requesting ordinary data access.

Limitations

  • Linux-specific; an O_PATH descriptor is not a readable backup stream or a content snapshot.
  • A directory reference alone does not confine later lookup beneath that directory.

Citations

  1. Linux man-pages: open(2), O_PATH operations and permission checks (accessed 2026-11-04)
  2. Linux v6.12: Pathname lookup, dentry references and locking (accessed 2026-11-04)
Sources & caveats
  • API source review. Reference lifetime, data-access permission and content consistency are separate properties; no crash-recovery guarantee is inferred.

JSON: /data/terms/o-path.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. O_PATH. Hesela. 2026-11-04. https://hesela.dev/terms/o-path/