An Open File Handle and Its Pathname
A pathname locates an entry when resolving it. An open handle identifies the opened object according to the operating system even if the entry later changes.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a replacement on a supporting system
A reader opens a report. A writer publishes a new report by replacing the name. The older open handle can still refer to the earlier object, while a new open uses the replacement. See file replacement.
Use the promised view
To reread the published version, reopen from the named path when appropriate. A long-lived snapshot reader may keep the earlier handle intentionally. File identity explains the underlying distinction on Unix-like filesystems.[1]
Compare an open handle with a new lookup after replacement
In a POSIX-style directory, a reader opens report.txt while it identifies object A. A writer replaces the name with object B. The existing read descriptor can continue referring to A, while a new open resolves the current name to B. See atomic file replacement.
Before replace: name → A, old descriptor → A
After replace: name → B, old descriptor → A
New open resolves B
Choose whether readers need a live name or stable object
Reopening a path can see changes during a long job. Keeping a handle preserves its referent under the stated semantics, though the object itself may be mutable. Test replacement and in-place writes separately.