hle(host_posix): completion ports are unimplemented, so an overlapped read reports nowhere #624

Closed
opened 2026-11-28 15:41:46 +00:00 by github-bot · 3 comments
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 15:40 UTC · original

Summary

The three calls a title uses to stream files asynchronously were unimplemented in host_posix/files.rs: CreateIoCompletionPort, GetQueuedCompletionStatus and PostQueuedCompletionStatus all landed in the loader's import stub. A title that reads its archives with overlapped I/O and waits on a port would get nothing back from the port, which is a stall rather than an error.

The hazard in adding the port alone is the opposite one: a title whose port never receives a packet waits forever, so the packets have to come from the I/O the title already issues.

What the change does

  • CreateIoCompletionPort: a port, or a file handle associated with one and a key (the same port handle comes back, as Windows does).
  • PostQueuedCompletionStatus: a packet of the caller's own making, which is how a title tells a worker to stop.
  • GetQueuedCompletionStatus: waits up to its timeout, then ERROR_TIMEOUT; hands back the byte count, the key and the title's OVERLAPPED.
  • GetQueuedCompletionStatusEx: everything already finished in one call, filling OVERLAPPED_ENTRYs.
  • A finished overlapped read or write on an associated file posts its packet. A read that reached the end posts STATUS_END_OF_FILE, which the call reports as a failure with ERROR_HANDLE_EOF, as Windows does.
  • Overlapped I/O still completes before the call returns here, so a packet is always ready when the title asks for it; the OVERLAPPED's event is set as before, which a title waiting on a port never notices. A file with no port posts nothing.

Tests

Three new ones in files.rs: a posted packet comes back with its key, count and OVERLAPPED, and an empty port times out; a file associated with a port reports an overlapped read there, and its end-of-file read posts a failure; a file with no port posts nothing, and the batch form drains two packets in one call.

Why it matters

A streaming title gets its completions instead of waiting on a port that never has any, and the diagnostics take the same path as a real run.

**@⁠AnastasisKon** on GitHub · 2026-11-28 15:40 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/620) ## Summary The three calls a title uses to stream files asynchronously were unimplemented in `host_posix/files.rs`: `CreateIoCompletionPort`, `GetQueuedCompletionStatus` and `PostQueuedCompletionStatus` all landed in the loader's import stub. A title that reads its archives with overlapped I/O and waits on a port would get nothing back from the port, which is a stall rather than an error. The hazard in adding the port alone is the opposite one: a title whose port never receives a packet waits forever, so the packets have to come from the I/O the title already issues. ## What the change does - `CreateIoCompletionPort`: a port, or a file handle associated with one and a key (the same port handle comes back, as Windows does). - `PostQueuedCompletionStatus`: a packet of the caller's own making, which is how a title tells a worker to stop. - `GetQueuedCompletionStatus`: waits up to its timeout, then `ERROR_TIMEOUT`; hands back the byte count, the key and the title's `OVERLAPPED`. - `GetQueuedCompletionStatusEx`: everything already finished in one call, filling `OVERLAPPED_ENTRY`s. - A finished overlapped read or write on an associated file posts its packet. A read that reached the end posts `STATUS_END_OF_FILE`, which the call reports as a failure with `ERROR_HANDLE_EOF`, as Windows does. - Overlapped I/O still completes before the call returns here, so a packet is always ready when the title asks for it; the `OVERLAPPED`'s event is set as before, which a title waiting on a port never notices. A file with no port posts nothing. ## Tests Three new ones in `files.rs`: a posted packet comes back with its key, count and `OVERLAPPED`, and an empty port times out; a file associated with a port reports an overlapped read there, and its end-of-file read posts a failure; a file with no port posts nothing, and the batch form drains two packets in one call. ## Why it matters A streaming title gets its completions instead of waiting on a port that never has any, and the diagnostics take the same path as a real run.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 15:41:46 +00:00
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 15:40 UTC · original

/claim

**@⁠AnastasisKon** on GitHub · 2026-11-28 15:40 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/620#issuecomment-7241649692) /claim
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-28 15:40 UTC · original

Claimed by @⁠AnastasisKon. Open a draft pull request with Refs #620 in its description within 24 hours, or the claim expires.

**@⁠github-actions[bot]** on GitHub · 2026-11-28 15:40 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/620#issuecomment-7241651979) Claimed by @⁠AnastasisKon. Open a draft pull request with `Refs #620` in its description within 24 hours, or the claim expires.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 16:31 UTC · original

Merged with the PR that serves these calls; closing.

**@⁠AnastasisKon** on GitHub · 2026-11-28 16:31 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/620#issuecomment-7242311501) Merged with the PR that serves these calls; closing.
This discussion has been locked. Commenting is limited to contributors.
No description provided.