Commit graph

301 commits

Author SHA1 Message Date
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
Andrew Kelley
f2cf7b538f std.Io.Threaded: fix the child process error fd mechanism 2026-01-04 00:27:08 -08:00
Andrew Kelley
85fe35d246 compiler: fix -Denable-llvm compilation failures 2026-01-04 00:27:08 -08:00
Andrew Kelley
1ccc87363a std: fixes for WASI 2026-01-04 00:27:08 -08:00
Andrew Kelley
60447ea97c std: fix windows compilation errors 2026-01-04 00:27:08 -08:00
Andrew Kelley
08447ca47e std.fs.path: make relative a pure function
Instead of querying the operating system for current working directory
and environment variables, this function now accepts those things as
inputs.
2026-01-04 00:27:08 -08:00
Andrew Kelley
9009ab2495 std.Io.Threaded: make environ init non-optional
and argv0 on systems that need it too.

fixes surprising behavior for applications that forget to initialize the
environment field.
2026-01-04 00:27:08 -08:00
Andrew Kelley
69d07472a1 std lib tests passing on linux 2026-01-04 00:27:08 -08:00
Andrew Kelley
3e6d6150d9 std.process.Environ: fix compile errors on POSIX 2026-01-04 00:27:08 -08:00
Andrew Kelley
384bfc5f99 std.Progress: go through Io interface for parent IPC mechanism
and fix start code
2026-01-04 00:27:08 -08:00
Andrew Kelley
42988fc5f4 std.process.Environ.Block: enhance type safety 2026-01-04 00:27:08 -08:00
Andrew Kelley
b85524d0c8 std.process.Environ: fix contains function 2026-01-04 00:27:08 -08:00
Andrew Kelley
32af0f6154 std: move child process APIs to std.Io
this gets the build runner compiling again on linux

this work is incomplete; it only moves code around so that environment
variables can be wrangled properly. a future commit will need to audit
the cancelation and error handling of this moved logic.
2026-01-04 00:27:08 -08:00
Andrew Kelley
d6a1e73142 std: start wrangling environment variables and process args
this commit is unfinished. It marks a spot where I wanted to start
moving child process stuff below the std.Io.VTable
2026-01-04 00:27:07 -08:00