Jacob Young
f633a4845a
Io: add ring to Batch API
2026-01-12 20:05:15 -05:00
Andrew Kelley
078a19cf31
std.Io.Threaded: super broken Windows impl of batch
...
this is a cry for help
2026-01-09 20:47:25 -08:00
Andrew Kelley
1ca398b267
std.Io: exploring a different batch API proposal
2026-01-09 20:47:25 -08:00
Andrew Kelley
09d96c4903
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-09 20:47:24 -08:00
Andrew Kelley
d66d0743d9
std.Io.Threaded.operate: handle poll buffer exceeded
2026-01-09 20:47:24 -08:00
Andrew Kelley
d776ebc913
std.Io.Threaded.operate: handle cancelation and poll errors
2026-01-09 20:47:24 -08:00
Andrew Kelley
0deaf9957c
std.Io: simplify operate function
...
- no timeout
- no n_wait
- infallible
2026-01-09 20:47:24 -08:00
Andrew Kelley
d63172a35d
std.Io: proof-of-concept "operations" API
...
This commit shows a proof-of-concept direction for std.Io.VTable to go,
which is to have general support for batching, timeouts, and
non-blocking.
I'm not sure if this is a good idea or not so I'm putting it up for
scrutiny.
This commit introduces `std.Io.operate`, `std.Io.Operation`, and
implements it experimentally for `FileReadStreaming`.
In `std.Io.Threaded`, the implementation is based on poll().
This commit shows how it can be used in `std.process.run` to collect
both stdout and stderr in a single-threaded program using
`std.Threaded.Io`.
It also demonstrates how to upgrade code that was previously using
`std.Io.poll` (*not* integrated with the interface!) using concurrency.
This may not be ideal since it makes the build runner no longer support
single-threaded mode. There is still a needed abstraction for
conveniently reading multiple File streams concurrently without
io.concurrent, but this commit demonstrates that such an API can be
built on top of the new `std.Io.operate` functionality.
2026-01-09 20:47:24 -08:00
Kevin Primm
b929078dac
std.Io.Threaded: Raise specific error when DNS lookup returns no A/AAAA records
...
closes #25948
2026-01-08 20:44:47 -08:00
Andrew Kelley
ecea8cc16d
std.Io.Threaded: refactor some error handling
2026-01-08 13:35:47 -08:00
Andrew Kelley
09028bac29
std.Io.Threaded: fix init for single-threaded
2026-01-08 12:36:41 -08:00
Andrew Kelley
b0570b807f
Merge pull request 'std.Io.Threaded: clock_nanosleep is not linux-only' ( #30746 ) from clock_nanosleep into master
...
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30746
2026-01-08 21:00:36 +01:00
Andrew Kelley
4319c8924e
std.Io.Threaded: clock_nanosleep is not linux-only
...
clock_nanosleep is specified by POSIX but not implemented on these
hereby shamed operating systems:
* macOS
* OpenBSD (which defines TIMER_ABSTIME for some reason...?)
2026-01-07 21:13:16 -08:00
moriazoso
514b103edb
std.Io.Threaded: correctly initialize PosixAddress/WsaAddress from sockaddr ( #30722 )
...
Resolves ziglang/zig#30672 - UB caused by `std.Io.Threaded.netLookupFallible` incorrectly initializing `PosixAddress`/`WsaAddress` from `*sockaddr`.
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30722
Co-authored-by: moriazoso <greysonmurray.dev@gmail.com >
Co-committed-by: moriazoso <greysonmurray.dev@gmail.com >
2026-01-08 06:01:44 +01:00
Andrew Kelley
5d0929c40d
std.Io.Threaded.randomSecure: eliminate dead code
2026-01-07 11:03:37 -08:00
Andrew Kelley
1ddae8585a
std.Io.Threaded: add procfs fallback for fileHardLink
...
oof what a clunky set of functionality we have here
2026-01-07 11:03:37 -08:00
Andrew Kelley
7e8c7e5696
std.Io: fix AT_SYMLINK_FOLLOW flags
...
hard linking has the backwards default, which uses a different flag
2026-01-07 11:03:37 -08:00
Andrew Kelley
ee574f665c
std.Io.Dir: introduce renamePreserve and use it in File.Atomic.link
...
breaking change: the error for renaming over a non-empty directory now
returns error.DirNotEmpty rather than error.PathAlreadyExists.
2026-01-07 11:03:37 -08:00
Andrew Kelley
8e1850e277
std.Io.Threaded: tweak logic for use_dev_urandom
2026-01-07 11:03:37 -08:00
Andrew Kelley
0529fe3411
std.Io.Threaded: fix implementation of getRandomFd
2026-01-07 11:03:37 -08:00
Andrew Kelley
90f0d7d0da
std.Io.Threaded: implement random seed fallback for WASI
2026-01-07 11:03:37 -08:00
Andrew Kelley
7bd033275e
std.Io.Threaded: implement Windows random seed fallback
2026-01-07 11:03:37 -08:00
Andrew Kelley
1f1381a866
update API usage of std.crypto.random to io.random
2026-01-07 11:03:36 -08:00
Andrew Kelley
81a35a86ea
std.Io: introduce random and randomSecure
...
and use a thread-local CSPRNG for the former.
2026-01-07 11:03:36 -08:00
Andrew Kelley
2f639a45b4
std.Io.Threaded: implement windows random with \Device\CNG
2026-01-07 11:03:36 -08:00
Andrew Kelley
42ca9e5d8e
std.Build: remove no longer needed workaround
...
now that definitions of networking addresses are arch-independent
2026-01-07 11:03:36 -08:00
Andrew Kelley
816565dd07
std: move entropy to Io
2026-01-07 11:03:36 -08:00
Matthew Lugg
cd963ba38d
Io.Threaded: fix bad assertion
...
Resolves: https://codeberg.org/ziglang/zig/issues/30717
2026-01-07 11:27:21 +01:00
Andrew Kelley
06130c5e61
std.Io.Threaded: set O_DIRECTORY along with O_TMPFILE
2026-01-05 20:31:31 -08:00
Andrew Kelley
f9a5b34e67
std.Io.Threaded: fix compilation on s390x, hexagon, or1k, m68k
...
Apparently the O_TMPFILE flag is split across two bits on these
architectures and missing on m68k.
2026-01-05 20:28:58 -08:00
Andrew Kelley
3859250c4d
std.Io.Threaded: only linux supports fileHardLink
2026-01-05 20:28:58 -08:00
Andrew Kelley
39605bd6bc
compiler: update to new createFileAtomic API
2026-01-05 20:28:58 -08:00
Andrew Kelley
4365b0df88
std.Io.Threaded: add File.hardLink
2026-01-05 20:28:58 -08:00
Andrew Kelley
81bfd28974
std.Io.Dir: rework atomic file
2026-01-05 20:28:58 -08:00
Andrew Kelley
d3d6761e43
std: depend on NtDll rather than advapi32.dll for entropy
2026-01-05 12:16:54 -08:00
Michael Dusan
31a6e83a7c
openbsd: fix Io.Threaded bitrot
2026-01-05 11:28:57 +01:00
Jake Greenfield
8e091047b5
std.Io.Threaded: fix Windows env var mapping
...
Windows environment variables are case-insensitive, so the special Wtf16
comparison needs to be used, or PATH/PATHEXT might be missed.
2026-01-04 23:32:36 -05:00
Andrew Kelley
9eb3b54eb5
std.Io.Threaded: revert making reading fork child status cancelable
...
this caused the build runner to crash sometimes, not sure why yet
2026-01-04 00:27:09 -08:00
Andrew Kelley
854c076ff7
std.Io.Threaded: improve posix spawning
...
* avoid unreachable when the OS does something unexpected
* make waiting for the fork/exec error report cancelable
2026-01-04 00:27:09 -08:00
Andrew Kelley
fa315b1060
std.Io.Threaded: improve posix process creation
...
* cache /dev/null after opening
* make opening /dev/null cancelable
* avoid unreachable even when OS does something unexpected
2026-01-04 00:27:09 -08:00
Andrew Kelley
2c22c3dabf
std.Io.Threaded: make processReplace cancelable
...
In between each attempt to call execve() on a particular file path, it
will check cancelation before trying the next PATH.
2026-01-04 00:27:09 -08:00
Andrew Kelley
08d8b412e9
std.Io.Threaded: more robust windows process creation error handling
2026-01-04 00:27:09 -08:00
Andrew Kelley
f072313e1e
std.Io.Threaded: delete dead comment
...
The problem it talked about is solved now that the direct call to
dirOpenDirWindows makes sense in this context.
2026-01-04 00:27:09 -08:00
Andrew Kelley
2b326d27d5
std.Io.Threaded: improve various Windows logic
...
* cache nul handle for child process execution
* make opening the nul file integrate properly with cancelation
* replace all calls to SleepEx to parking_sleep.sleep instead, making
them properly cancelable. These sleeps are workarounds for Windows
kernel bugs. Now you can even cancel while waiting for kernel bug
workarounds!
2026-01-04 00:27:09 -08:00
Andrew Kelley
be977e1934
std.Io.Threaded: integrate with new cancel mechanism
2026-01-04 00:27:09 -08:00
Andrew Kelley
dd7be75f7c
std.process: add missing error.OperationUnsupported
2026-01-04 00:27:09 -08:00
Andrew Kelley
baa49e5929
std.Io.Threaded: implement processReplace
2026-01-04 00:27:09 -08:00
Andrew Kelley
08cc9e8d59
std.Io.Threaded: std.process -> process
2026-01-04 00:27:09 -08:00
Andrew Kelley
1070c2a71a
rename env_map to environ_map
...
For naming consistency with `std.process.Environ.Map`.
2026-01-04 00:27:09 -08:00
Andrew Kelley
c6b75b61b7
std: fix child processes on riscv32-linux
2026-01-04 00:27:08 -08:00