O_RSYNC
O_RSYNC is a POSIX open-file flag that extends the O_DSYNC or O_SYNC integrity-completion requirement to read operations.
POSIX.1-2024 pairs O_RSYNC with O_DSYNC for data-integrity completion or with O_SYNC for file-integrity completion. These are synchronized-read requirements, not merely a promise that read() blocks until it returns. [1] [2]
For data-integrity completion, pending writes affecting the requested data at the time of the read request must complete successfully before that data is read. File-integrity completion additionally covers the file attributes associated with the operation. This does not specify a transaction or snapshot across later concurrent updates. [3]
Linux man-pages 6.19 documents O_SYNC and O_DSYNC but states that Linux does not implement O_RSYNC. The generic glibc 2.39 Linux header aliases O_RSYNC to O_SYNC unless an architecture-specific __O_RSYNC is defined. A defined macro, successful open, or matching F_GETFL bit therefore does not establish POSIX synchronized-read support. Do not use an O_RSYNC-labelled Linux read as evidence that pending writes reached durable storage. [4] [5]
Relations
- related
- O_DSYNC, O_SYNC, fdatasync, fsync, Open file description, Data durability
Limitations
- The POSIX flag name and an implementation's supported completion semantics must be checked separately.
- Synchronized completion is not an independent comparison against expected file contents.
Citations
- POSIX.1-2024: open(), O_RSYNC and synchronized I/O flags
- POSIX.1-2024: read(), O_RSYNC with O_DSYNC or O_SYNC
- POSIX.1-2024: definitions 3.368-3.371, integrity completion and synchronous I/O
- Linux man-pages 6.19: open(2), synchronized I/O and the unimplemented O_RSYNC flag
- glibc 2.39: Linux fcntl header, conditional O_RSYNC alias
Sources & caveats
- Status reflects implementation-dependent availability: a POSIX specification does not establish Linux support.
- Source review of POSIX.1-2024, Linux man-pages 6.19 and the glibc 2.39 header; no device-fault injection, power-loss test or performance measurement.