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

Closed
opened 2026-11-28 15:40:32 +00:00 by AnastasisKon · 3 comments
AnastasisKon commented 2026-11-28 15:40:32 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:40:32Z.


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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6667521261 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/620). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T15:40:32Z. --- ## 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.
AnastasisKon commented 2026-11-28 15:40:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:40:37Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7241649692 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/620#issuecomment-7241649692). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T15:40:37Z. --- /claim
github-actions[bot] commented 2026-11-28 15:40:47 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T15:40:47Z.


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

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7241651979 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/620#issuecomment-7241651979). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T15:40:47Z. --- Claimed by @AnastasisKon. Open a draft pull request with `Refs #620` in its description within 24 hours, or the claim expires.
AnastasisKon commented 2026-11-28 16:31:43 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T16:31:43Z.


Merged with the PR that serves these calls; closing.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7242311501 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/620#issuecomment-7242311501). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T16:31:43Z. --- Merged with the PR that serves these calls; closing.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS#620
No description provided.