Skip to content

Fix/windows cli - #6

Merged
meokit merged 8 commits into
mainfrom
fix/windows-cli
May 17, 2026
Merged

Fix/windows cli#6
meokit merged 8 commits into
mainfrom
fix/windows-cli

Conversation

@meokit

@meokit meokit commented May 17, 2026

Copy link
Copy Markdown
Owner

This pull request introduces significant improvements to Windows host-mapped file resizing and memory mapping alignment, along with a few other targeted fixes. The core changes add robust support for suspending and restoring host-mapped file views during file truncation and resizing on Windows, ensuring data consistency and correct memory mapping behavior. Additionally, the memory mapping logic is updated to respect the Windows allocation granularity, which is critical for correctness and performance.

The most important changes are:

Windows Host-Mapped File Resize Support:

  • Introduced WindowsHostMappedResizeScope and AddressSpaceResizeScope types in ProcessAddressSpaceSync.cs to track and restore host-mapped file views during file resizing operations on Windows. Added logic to suspend and restore these mappings as needed. [1] [2]
  • Added WindowsHostMappedResizePlan type and implemented SuspendHostMappedFileViewsForResize and RestoreHostMappedFileViewsAfterResize methods in VMAManager.cs to manage the suspension and restoration of host-mapped file views, including invalidation and teardown of native mappings. [1] [2]

Windows Memory Mapping Alignment Improvements:

  • Updated WindowedMappedFilePageBackend.cs to align memory mappings to the Windows allocation granularity using system calls, ensuring correct mapping offsets and lengths. This includes new helpers for retrieving system info and alignment values, and refactoring mapping logic to use these values. [1] [2] [3] [4]

Bug Fixes and Minor Improvements:

  • Fixed pointer usage in flush logic in WindowedMappedFilePageBackend.cs, replacing RawPtr with Ptr to ensure correct flush addresses. [1] [2]
  • Improved logic for selecting engine lists when syncing mapped files, defaulting to the current engine if no snapshot engines are present. [1] [2]

Other:

  • Added a field to track in-flight connect operations in HostSocketInode and refactored ConnectAsync to use a new async connect start helper, improving socket connection handling. [1] [2]

- HostTermios: implement EnableRawMode/DisableRawMode for Windows
  via GetConsoleMode/SetConsoleMode (disable echo, line, processed input)
- ContainerRuntimeService: branch stdin stream (SafeFileHandle on Unix,
  Console.OpenStandardInput on Windows)
- ContainerRuntimeService: set TreatControlCAsInput=true on Windows
  to forward Ctrl+C as raw 0x03 to guest
- ContainerRuntimeService: lift raw mode OS guards to cover all non-Browser platforms
- ContainerRuntimeService: change stdinStream type from FileStream to Stream
  for Windows Console.OpenStandardInput() compatibility
- Fiberish.X86: switch Linux compiler from clang to gcc/g++ to avoid
  libc++ dependency (Arch Linux defaults to libstdc++)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@meokit
meokit merged commit 3149a4b into main May 17, 2026
6 checks passed
@meokit
meokit deleted the fix/windows-cli branch May 17, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants