36993 Commits

Author SHA1 Message Date
Andrew Kelley 31994fd2d0 WIP 2026-01-30 22:30:19 -08:00
Andrew Kelley 13f13fe0a7 std.Io: add documentation to Batch 2026-01-30 20:21:07 -08:00
Andrew Kelley 9f6152ae93 std.Io.Threaded: rework file reading to observe nonblocking flag
- batchAwaitAsync does blocking reads with NtReadFile (no APC, no event)
  when the nonblocking flag is unset, but still takes advantage of
  APCs when nonblocking flag is set.
- batchAwaitConcurrent returns error.ConcurrencyUnavailable when it
  encounters a file_read_streaming operation on a file in blocking mode.
- fileReadStreaming avoids pointlessly checking sync cancelation status
  when nonblocking flag is set, uses an APC with a done flag, and waits
  on that value to change in NtDelayExecution before returning.
- fix incorrect use of NtCancelIoFile (ntdll function prototype was
  wrong, leading to misuse)
2026-01-30 19:10:44 -08:00
Andrew Kelley a9778e2549 std.Io.File: add non-blocking flag
On Windows, we need to know ahead of time whether a file was opened in
synchronous mode or asynchronous mode. There may be advantages to
tracking this state for POSIX operating systems as well.
2026-01-30 17:59:48 -08:00
Andrew Kelley dd463caa15 std.Io.Threaded: stop checking bytes read with END_OF_FILE 2026-01-30 16:58:26 -08:00
Jacob Young 3d3f22a14d Io.Batch: implement alternate API 2026-01-30 12:10:05 -08:00
Andrew Kelley 10bec043f5 std.process: simplify RunError set 2026-01-30 12:10:02 -08:00
Andrew Kelley a860865303 std.Build.Step: evalZigProcess handles EndOfStream
and a happy little info log when the process needs to be restarted
2026-01-30 12:10:02 -08:00
Andrew Kelley 9121ee5168 std.Io.Threaded: handle TIMEOUT from NtDelayExceution 2026-01-30 12:10:02 -08:00
Matthew Lugg b976f0d8ad std.Build: fully upgrade Step.Run to std.Io timing (and fix a typo) 2026-01-30 12:10:02 -08:00
Matthew Lugg 1a0fa1fa76 std.Io.Threaded: fix ntdll timeouts on Windows 2026-01-30 12:10:02 -08:00
Andrew Kelley 4e198dc187 std.Io.Threaded: ntReadFileResult handles EOF + bytes available 2026-01-30 12:10:02 -08:00
Andrew Kelley 816f70d0c3 std.Io.Threaded: compress ntReadFile logic
Just use the ntstatus field rather than an additional enum
2026-01-30 12:10:02 -08:00
Andrew Kelley 0ac63ff9df std.Io.Threaded.batchWait better fix for any_done
It is legal to call batchWait with already completed operations in the
ring. In such case, we need to avoid waiting in the syscall. The
any_done flag was a poor way of tracking state we already have: whether
the completion queue is empty.

This problem affects the posix poll implementation as well.

Thanks again to jacobly for finding the problem.
2026-01-30 12:10:02 -08:00
Andrew Kelley a635d62a6b std.Io.Threaded.batchWaitWindows: eager result sets any_done true
Thanks jacobly for finding the bug
2026-01-30 12:10:02 -08:00
Andrew Kelley 7ea1d02f9e std.Io.Threaded: add missing check for pending status in batchCancel 2026-01-30 12:10:02 -08:00
Andrew Kelley fe15534cd5 std.process.run: use Io.File.MultiReader
and delete the special-cased function
2026-01-30 12:10:02 -08:00
Andrew Kelley 0fd8263e97 build.zig: only-c implies no-lib 2026-01-30 12:10:02 -08:00
Andrew Kelley 4593a0dc2e std.Io.File.MultiReader: make checkAnyError exclude EndOfStream 2026-01-30 12:10:02 -08:00
Andrew Kelley f69891797a std: remove error.BrokenPipe from file reads, add error.EndOfStream
and make reading file streaming allowed to return 0 byte reads.
According to Microsoft documentation, on Windows it is possible to get
0-byte reads from pipes when 0-byte writes are made.
2026-01-30 12:10:02 -08:00
Andrew Kelley 291d941111 std.Io.Threaded: move the NtDelayExecution later in batchWait
also guard against receiving SUCCESS with 0 byte read

ms docs say that pipes can do this if there is a 0 byte write
2026-01-30 12:10:02 -08:00
Andrew Kelley ab1268efc3 std.Io.Threaded: fix bad use of AlertableSyscall
The defer would cause two problems:
1. keeping the state active during call to NtCancelIoFile
2. invalid state transition. after canceled is returned from
   checkCancel, new status is already canceled. calling finish after
   that is illegal.
2026-01-30 12:10:01 -08:00
Andrew Kelley 8a985236af std.Build.Step.Run: gracefully handle test runner misbehavior
specifically if it misbehaves after sending a message header but not the
body
2026-01-30 12:10:01 -08:00
Andrew Kelley e1604c1923 std.Io.Threaded: batchWait and batchCancel for Windows 2026-01-30 12:10:01 -08:00
Andrew Kelley 351a3dd997 std.Io.Threaded: resolve merge conflicts 2026-01-30 12:10:01 -08:00
Andrew Kelley a68cb81a84 build: adjust max_rss for behavior tests
observed error: memory usage peaked at 0.70GB (699138048 bytes),
exceeding the declared upper bound of 0.66GB (659809075 bytes)
2026-01-30 12:10:01 -08:00
Andrew Kelley ccf85b51ea incr-check: update to std.Io.File.MultiReader
from std.Io.poll
2026-01-30 12:10:01 -08:00
Andrew Kelley a04e296d88 update doctest API usage 2026-01-30 12:10:01 -08:00
Andrew Kelley 4feb2ba094 std.Io.Threaded: fix compilation error on some systems 2026-01-30 12:10:01 -08:00
Andrew Kelley 0f1a78b554 std.Io.Threaded: fix compilation failures on Windows
it's still broken as hell tho
2026-01-30 12:10:01 -08:00
Andrew Kelley cfd142c4c6 tools: update for std.process API changes 2026-01-30 12:10:01 -08:00
Andrew Kelley f4140f6e8b std.Io.Threaded: fix batchWait impl 2026-01-30 12:10:01 -08:00
Andrew Kelley afd91234a1 std.Io.Threaded: fix error set 2026-01-30 12:10:01 -08:00
Andrew Kelley d67c8f5d23 compiler: update for std.Io.File.MultiReader API 2026-01-30 12:10:01 -08:00
Andrew Kelley d579375a7a std.Io.operate: fix bogus catch
this used to have a different error set. just goes to show you how
useful switching on error set is even when there is only 1 prong
2026-01-30 12:10:01 -08:00
Andrew Kelley 5a2cab21e1 std.Io.File.MultiReader: implementation fixes 2026-01-30 12:10:01 -08:00
Andrew Kelley 0cca18e43c std: update rest of build runner to new File.MultiReader API 2026-01-30 12:10:01 -08:00
Andrew Kelley 1a168f08b5 std.Io.File: introduce MultiReader
Concurrently read from multiple file streams, eliminating risk of
deadlocking.
2026-01-30 12:10:01 -08:00
Andrew Kelley a1b3d9e447 std.Io.Threaded: delete dead code 2026-01-30 12:10:01 -08:00
Andrew Kelley 50db074bdf Build.WebServer: update concurrency API usage 2026-01-30 12:10:01 -08:00
Jacob Young dea653fdb9 Io: add ring to Batch API 2026-01-30 12:10:01 -08:00
Andrew Kelley 5456f953fa std.Io.Threaded: super broken Windows impl of batch
this is a cry for help
2026-01-30 12:10:01 -08:00
Andrew Kelley 72894900ec std.process.Child.collectOutput: change back to other impl
this one avoids calling poll() more than necessary
2026-01-30 12:10:01 -08:00
Andrew Kelley 45bc4b4e36 std.Io: exploring a different batch API proposal 2026-01-30 12:10:01 -08:00
Andrew Kelley d1d39cb3fe Revert "std.process.Child: rewrite using concurrent"
This reverts commit 76e1ba8f490812c6e2ebf6f6becd89a71275d21e.
2026-01-30 12:10:01 -08:00
Andrew Kelley 3998fa3c3b std.process.Child: rewrite using concurrent
I plan to immediately revert this, but here's a commit for posterity
2026-01-30 12:10:01 -08:00
Andrew Kelley 13ef792cc6 fix error set 2026-01-30 12:10:01 -08:00
Andrew Kelley 3ef1266582 std.Io.Threaded: set poll_buffer_len to 32
reasoning is that polling with large amount of operations will be rarely
done with std.Io.Threaded. However this still provides the opportunity
to provide concurrency for any real world use cases that need it.
2026-01-30 12:10:01 -08:00
Andrew Kelley 24b3c4cec1 std.Io.Threaded.operate: handle poll buffer exceeded 2026-01-30 12:10:01 -08:00
Andrew Kelley ae2d71b65e std.Io.Threaded.operate: handle cancelation and poll errors 2026-01-30 12:10:01 -08:00