Commit Graph

37011 Commits

Author SHA1 Message Date
Andrew Kelley 171459f678 Merge pull request 'libzigc: round, roundf' (#31075) from jeffective/zig:jeff/libzigc-round into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31075
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-02-01 20:02:06 +01:00
Andrew Kelley 59073484ba std.Io: add ioctl / DeviceIoControlFile API 2026-02-01 01:08:01 -08:00
Andrew Kelley e5454ff780 Merge pull request 'std.Io: move fileWriteStreaming to Operation' (#31065) from more-poll into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31065
2026-02-01 07:56:09 +01:00
Andrew Kelley cc442d24ab std.Io: move fileWriteStreaming to Operation
This serves as an example to contributors of how to move VTable
functions to becoming an Operation, thereby enabling Batch API and
timeouts.
2026-01-31 22:53:28 -08:00
Andrew Kelley 9bd648bd40 std.Io.Operation: support non-fallible results 2026-01-31 22:52:00 -08:00
Jeff Anderson 379d128cba libzigc: roundf 2026-01-31 18:18:29 -08:00
Andrew Kelley 3abc96a601 std.Io: add test for batchAwaitAsync
and make it always work for all targets including WASI

This function guarantees no additional failure modes introduced.
2026-02-01 02:49:36 +01:00
Jeff Anderson 69a95571ed libzigc: round 2026-01-31 17:26:17 -08:00
kj4tmp@gmail.com e60ba21114 libzigc: roundl 2026-02-01 00:59:35 +01:00
Andrew Kelley 2b19134c86 Merge pull request 'std.Io: introduce batching and operations API, satisfying the "poll" use case' (#30743) from poll into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30743
2026-01-31 12:07:31 +01:00
Andrew Kelley 5ccc2ea85d std: IoUring test handles EINTR 2026-01-31 09:36:40 +01:00
Alex Rønne Petersen da95409f31 Merge pull request 'llvm: handle packed structs in C ABI integer promotion' (#31062) from alexrp/zig:packed-struct-cconv-fix into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31062
2026-01-31 07:09:19 +01:00
Andrew Kelley 9646801bed std: fix Preopens compilation error 2026-01-30 22:06:33 -08:00
Andrew Kelley 14e1e5f6d8 std: IoUring test handles EINTR 2026-01-30 22:03:44 -08:00
Andrew Kelley 43866f7439 build.zig: bump max_rss
encountered error: memory usage peaked at 0.66GB (656060416 bytes),
exceeding the declared upper bound of 0.64GB (639565414 bytes)
2026-01-30 22:03:39 -08:00
Andrew Kelley b6f4bb91c4 std.Io: add documentation to Batch 2026-01-30 22:03:33 -08:00
Andrew Kelley 25aef0dd87 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 22:03:14 -08:00
Andrew Kelley 39a6d5d1c5 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 22:03:14 -08:00
Andrew Kelley 62c97b745d std.Io.Threaded: stop checking bytes read with END_OF_FILE 2026-01-30 22:03:14 -08:00
Jacob Young 2674acdb77 Io.Batch: implement alternate API 2026-01-30 22:03:14 -08:00
Andrew Kelley a520355e4c std.process: simplify RunError set 2026-01-30 22:03:14 -08:00
Andrew Kelley a41ee5994d std.Build.Step: evalZigProcess handles EndOfStream
and a happy little info log when the process needs to be restarted
2026-01-30 22:03:14 -08:00
Andrew Kelley 866ee4f1c5 std.Io.Threaded: handle TIMEOUT from NtDelayExceution 2026-01-30 22:03:14 -08:00
Matthew Lugg f8828e543a std.Build: fully upgrade Step.Run to std.Io timing (and fix a typo) 2026-01-30 22:03:14 -08:00
Matthew Lugg c2679feaaa std.Io.Threaded: fix ntdll timeouts on Windows 2026-01-30 22:03:14 -08:00
Andrew Kelley 8f8aa8346a std.Io.Threaded: ntReadFileResult handles EOF + bytes available 2026-01-30 22:03:14 -08:00
Andrew Kelley 4dd7fe90a2 std.Io.Threaded: compress ntReadFile logic
Just use the ntstatus field rather than an additional enum
2026-01-30 22:03:14 -08:00
Andrew Kelley 3320e6a1ae 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 22:03:14 -08:00
Andrew Kelley d770e14e00 std.Io.Threaded.batchWaitWindows: eager result sets any_done true
Thanks jacobly for finding the bug
2026-01-30 22:03:14 -08:00
Andrew Kelley 7a13d57916 std.Io.Threaded: add missing check for pending status in batchCancel 2026-01-30 22:03:14 -08:00
Andrew Kelley 687123a85e std.process.run: use Io.File.MultiReader
and delete the special-cased function
2026-01-30 22:03:14 -08:00
Andrew Kelley b2816f2698 build.zig: only-c implies no-lib 2026-01-30 22:03:14 -08:00
Andrew Kelley 6a1fd3c69d std.Io.File.MultiReader: make checkAnyError exclude EndOfStream 2026-01-30 22:03:14 -08:00
Andrew Kelley 8a80b54640 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 22:03:14 -08:00
Andrew Kelley fdf1ee973e 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 22:03:14 -08:00
Andrew Kelley 2fb224cb84 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 22:03:14 -08:00
Andrew Kelley efa502a1cd 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 22:03:14 -08:00
Andrew Kelley 523aa213c9 std.Io.Threaded: batchWait and batchCancel for Windows 2026-01-30 22:03:14 -08:00
Andrew Kelley 37316a3cf6 std.Io.Threaded: resolve merge conflicts 2026-01-30 22:03:14 -08:00
Andrew Kelley 276ca77bf0 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 22:03:14 -08:00
Andrew Kelley ec74d650fe incr-check: update to std.Io.File.MultiReader
from std.Io.poll
2026-01-30 22:03:14 -08:00
Andrew Kelley a901ea23b0 update doctest API usage 2026-01-30 22:03:14 -08:00
Andrew Kelley 15ca46d1e7 std.Io.Threaded: fix compilation error on some systems 2026-01-30 22:03:14 -08:00
Andrew Kelley a4d438562d std.Io.Threaded: fix compilation failures on Windows
it's still broken as hell tho
2026-01-30 22:03:14 -08:00
Andrew Kelley 54241bc770 tools: update for std.process API changes 2026-01-30 22:03:14 -08:00
Andrew Kelley 9134430387 std.Io.Threaded: fix batchWait impl 2026-01-30 22:03:14 -08:00
Andrew Kelley 68a34df025 std.Io.Threaded: fix error set 2026-01-30 22:03:14 -08:00
Andrew Kelley 372e8e54d3 compiler: update for std.Io.File.MultiReader API 2026-01-30 22:03:14 -08:00
Andrew Kelley dd0153b91b 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 22:03:14 -08:00
Andrew Kelley e56563ce3f std.Io.File.MultiReader: implementation fixes 2026-01-30 22:03:14 -08:00