Expand description
Atomic symlink swap primitives and helpers.
This module implements a TOCTOU-safe sequence using directory handles:
open_dir_nofollow(parent) -> symlinkat(tmp) -> renameat(tmp, final) -> fsync(dirfd)
.
Test override knobs:
SWITCHYARD_FORCE_EXDEV=1
— simulate a cross-filesystem rename error (EXDEV) to exercise degraded fallback paths and telemetry in higher layers.
Functions§
- atomic_
symlink_ swap - Atomically swap a symlink target using a temporary file and renameat.
- fsync_
parent_ dir - Fsync the parent directory of
path
for durability. - open_
dir_ nofollow - Open a directory with
O_DIRECTORY
|O_NOFOLLOW
for atomic operations.