Skip to content

Avoid filesystem dependencies in pathless Unix errno mapping - #137072

Merged
MichalStrehovsky merged 2 commits into
dotnet:mainfrom
MichalStrehovsky:errno
Nov 8, 2026
Merged

MichalStrehovsky merged 2 commits into
dotnet:mainfrom
MichalStrehovsky:errno

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

I wondered why Hello World needs to use Path APIs and check directory existence. This is the reason.

This provides a 1.84% size saving for the size-optimized WASI NativeAOT Release Hello World: 823,214 to 808,084 bytes, saving 15,130 bytes.

Select parent-directory handling through a static-abstract interface and sealed policy classes so pathless callers do not retain filesystem APIs. Preserve existing exception mappings and path-aware behavior.

This provides a 1.84% size saving for the size-optimized WASI NativeAOT Release Hello World: 823,214 to 808,084 bytes, saving 15,130 bytes.

Validated WASI Release/Checked errno mappings against the original implementation, filesystem error paths, Sleep, Preinitialization, and Hello World.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9bc3dfee-1040-4648-bdad-86922a749613
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Handle the ENOENT parent-directory check in the path-aware overload and share exception mapping through GetExceptionForIoErrnoCore. Document the separation needed for better trimming of pathless callers.

Validated WASI Release and Checked errno mappings, filesystem checks, Sleep, and Preinitialization. Matching-toolchain stripped Hello World saves 15,635 bytes (1.83%) versus the original mapper.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: a33cda55-cbd2-452e-9a41-5aa6a1c97aca
@MichalStrehovsky
MichalStrehovsky merged commit ba88dfb into dotnet:main Nov 8, 2026
87 checks passed
@MichalStrehovsky
MichalStrehovsky deleted the errno branch November 8, 2026 23:48
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants