Skip to content

Add symlinkat, renameatx_np, and unlinkat system call wrappers to the _NIOFileSystem module#3524

Merged
glbrntt merged 4 commits intoapple:mainfrom
stepan-ulyanin:backport-copy-to-niofilesystem
Mar 2, 2026
Merged

Add symlinkat, renameatx_np, and unlinkat system call wrappers to the _NIOFileSystem module#3524
glbrntt merged 4 commits intoapple:mainfrom
stepan-ulyanin:backport-copy-to-niofilesystem

Conversation

@stepan-ulyanin
Copy link
Copy Markdown
Contributor

@stepan-ulyanin stepan-ulyanin commented Feb 26, 2026

Ports the added system calls from NIOFS (from #3505) to _NIOFileSystem:

Adds three new system call wrappers for the symlinkat, renameatx_np, and unlinkat system calls.

Motivation:

_NIOFileSystem module is around for backward compatibility - hence, we are porting the new feature to it.

Modifications:

Exactly same as in #3505 but applied to the _NIOFileSystem:

Related to #3403 and #3470. This PR adds syscall wrappers needed to atomically overwrite existing files or symlinks at the destination during copy operations. On Linux, atomic overwrites require a "copy to temp file, then rename" strategy. We use the *at family of syscalls (which operate relative to directory file descriptors) to avoid TOCTOU race conditions.

@stepan-ulyanin stepan-ulyanin marked this pull request as ready for review February 26, 2026 02:53
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Mar 2, 2026
@glbrntt
Copy link
Copy Markdown
Contributor

glbrntt commented Mar 2, 2026

The API breakage check is incorrect; only an SPI for testing has changed. The benchmark failures are also unrelated to this change so merging over it.

@glbrntt glbrntt merged commit fff2515 into apple:main Mar 2, 2026
52 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants