Commit graph

36713 commits

Author SHA1 Message Date
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
c95c442b75 std.process.Child.collectOutput: change back to other impl
this one avoids calling poll() more than necessary
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
be2b93a073 Revert "std.process.Child: rewrite using concurrent"
This reverts commit 76e1ba8f490812c6e2ebf6f6becd89a71275d21e.
2026-01-09 20:47:25 -08:00
Andrew Kelley
e1f7844616 std.process.Child: rewrite using concurrent
I plan to immediately revert this, but here's a commit for posterity
2026-01-09 20:47:25 -08:00
Andrew Kelley
f8e1257b62 fix error set 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
Andrew Kelley
31fadc0eee std.Io: delete the poll API 2026-01-09 20:47:24 -08:00
Andrew Kelley
ec25b13848 Merge pull request 'std: move memory locking and memory protection to process' (#30758) from mmap into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30758
2026-01-10 04:14:48 +01:00
Andrew Kelley
4d6d2922b8 std: move memory locking and memory protection to process
and introduce type safety for posix.PROT (mmap, mprotect)

progress towards #6600
2026-01-09 13:52:00 -08:00
Andrew Kelley
9aaecde63f build: bump freebsd max_rss
error: memory usage peaked at 0.75GB (751378432 bytes), exceeding the
declared upper bound of 0.74GB (743802470 bytes)
2026-01-09 13:52:00 -08:00
Andrew Kelley
5e242f0551 Merge pull request 'libc: use common ctype.h implementation' (#30763) from GasInfinity/zig:libc-ascii-ctype into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30763
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-01-09 22:38:06 +01:00
Andrew Kelley
721bdb6256 Merge pull request 'crypto.scrypt: accept an std.Io parameter instead of direct entropy' (#30738) from jedisct1/zig:scryptfixes into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30738
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-01-09 09:39:35 +01:00
Andrew Kelley
7c0b42ba0c Merge pull request 'crypto.ed25519.Signer: get an std.io parameter rather than entropy' (#30736) from jedisct1/zig:edsigned into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30736
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-01-09 09:38:44 +01:00
Linus Groh
27039a014c std.c: Make clock_nanosleep available on serenity
Follow-up to https://codeberg.org/ziglang/zig/pulls/30746.

The TIMER_ABSTIME value was adjusted to match other systems in
https://github.com/SerenityOS/serenity/pull/26543.
2026-01-09 09:37:49 +01: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
Jon Parise
efe649b13e std.Io.net: make HostName.validate RFC 1123-compliant
The implementation of HostName.validate was too generous. It considered
strings like ".example.com", "exa..mple.com", and "-example.com" to be
valid hostnames, which is incorrect according to RFC 1123 (the currently
accepted standard).

Reviewed-on: https://github.com/ziglang/zig/pull/25710
2026-01-08 20:40:32 -08:00
Matthew Lugg
6069161a51 link.Wasm: reserve sufficient capacity for @tagName function code
Resolves: https://codeberg.org/ziglang/zig/issues/30748
2026-01-09 03:49:24 +01:00
Matthew Lugg
aebd84b525 build runner: refactor step evaluation logic
The previous logic was made really messy by the fact that upon entry to
the step eval worker, the step may not be ready to run, we may be racing
with other workers doing the same check, and we had already acquired our
RSS requirement even though we might not run. It also required iterating
all dependencies each time we were called to check whether we were even
ready to run yet.

A much better strategy is for each step to have an atomic counter
representing how many of its dependencies are yet to complete. When a
step completes (successfully or otherwise), it decrements this value for
all of its dependants, and if it drops any to 0, it schedules that step
to run. This means each step is scheduled exactly once, and only when
all of its dependencies have finished, reducing redundant checks and
hence contention. If the step being scheduled needs to claim RSS which
isn't available, then it is instead added to `memory_blocked_steps`,
which is iterated by the step worker after a step with an RSS claim
finishes.

This logic is more concise than before, simpler to understand, generally
more efficient, and fixes a bug in the RSS tracking. Also, as a nice
side effect, it should also play a little bit nicer with `Io.Threaded`'s
scheduling strategy, because we no longer spawn extremely short-lived
tasks all the time as we previously did.

Resolves: https://codeberg.org/ziglang/zig/issues/30742
2026-01-09 03:16:39 +01:00
GasInfinity
6abb1dcd35
feat(libzigc): add common ctype implementation
* implements all functions in the standard `ctype.h` header
* also removes their musl implementations
2026-01-09 02:51:29 +01:00
Luna Schwalbe
04e73d03bd android: detect native ABI and API level correctly
ABI detection previously did not take into account the non-standard
directory structure of Android. This has been fixed.

The API level is detected by running `getprop ro.build.version.sdk`,
since we don't want to depend on bionic, and reading system properties
ourselves is not trivially possible.
2026-01-09 02:47:13 +01:00
Khitiara
e8af0f2cc0 Fix format on uefi guid type, was hitting unreachable 2026-01-09 02:42:22 +01:00
GasInfinity
e558e64ca0
feat(std.ascii): add isGraphical and isPunctuation 2026-01-09 02:27:31 +01:00
GasInfinity
7f6eab2704 feat(libzigc): add nan, nanf, nanl and bsearch
* also remove musl implementation
2026-01-09 00:26:20 +01: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
20baf049aa std.Io: add doc comments 2026-01-08 12:36:07 -08:00
Andrew Kelley
70af303a2b std.Io: move some decls around
This file has changed a lot since the previous release, and I resisted
the urge to do this until the conflicts would be minimized.
2026-01-08 12:35:57 -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
1face9ad78 std.c.SIG: make it non-exhaustive
54a84964f8 did this for std.os.linux.SIG
but I neglected to also do it for std.c.SIG
2026-01-08 20:52:42 +01:00
Alex Rønne Petersen
d1be8b138e Merge pull request 'enable x86_64-openbsd CI' (#30733) from alexrp/zig:openbsd-ci into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30733
2026-01-08 12:35:11 +01:00
Ian Johnson
ac91799332 std.meta.hasUniqueRepresentation: consider enum tag type
Closes #30731
2026-01-08 09:24:12 +01:00
Andrew Kelley
6f7968f165 Merge branch "remove many std.posix functions"
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30741
2026-01-08 00:19:12 -08:00
Alex Rønne Petersen
cc38acfea3
ci: skip incremental tests on loongarch64-linux
https://codeberg.org/ziglang/zig/issues/30748
2026-01-08 07:01:57 +01:00
Andrew Kelley
130fc7ef75 std.c: use {} rather than void for absent functions 2026-01-07 21:13:16 -08: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
6a5bb3ede3 std: find a better home for the "preopens" concept 2026-01-08 05:06:31 +01:00
pentuppup
d2d8b969a1 fix redundant safety checks being emitted for slicing 2026-01-08 05:05:39 +01:00
Bingwu Zhang
cdaf279314 link.Elf2: fix incorrect expected node length
Change-Id: Iba9c4bf2cfa4ff1b82dd5f0828c57711f238f1bf
2026-01-08 04:54:49 +01:00
Bingwu Zhang
8d06d8dca2 link.Elf: allow multiple relocs at the same location
RISC-V and LoongArch ELF psABIs define a kind of
RELAX relocations which are expected to have a normal
relocation at the same address.

Change-Id: I5737bfcfd3e5041fb6ab7d193c9fc57eeca1eec8
2026-01-08 04:53:16 +01:00
Andrew Kelley
ce89006035 std.Io.Kqueue: fix bitrot 2026-01-07 18:00:36 -08:00
Andrew Kelley
c0092f5394 std.Io: expose Kqueue and IoUring directly 2026-01-07 17:33:07 -08:00
Andrew Kelley
cbd75b484f std.posix: remove recvfrom, recvmsg
see #6600
2026-01-07 17:33:07 -08:00
Andrew Kelley
d96d735338 posix: remove send, sendto, sendmsg
see #6600
2026-01-07 17:33:07 -08:00