36421 Commits

Author SHA1 Message Date
Andrew Kelley
6984992153 Merge pull request 'std.Io.File.Stat: make access time optional' (#30607) from atime into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30607
2025-12-27 23:35:51 +01:00
unerr
2e73288e63 Fix #30167: std.mem.window returns slices smaller or equal to size 2025-12-27 20:45:26 +01:00
Andrew Kelley
6bf9499c0c Merge pull request 'Optimize {write,take}Leb128' (#30012) from NicoElbers/zig:leb-perf into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30012
Reviewed-by: Andrew Kelley <andrewrk@noreply.codeberg.org>
2025-12-27 20:43:13 +01:00
Lucas Santos
ef77cc0de1 Fixes doc comment of Futex.wait
On Windows, changing the value at the target address is not sufficient, there needs to be a wake call.
From [MSDN](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitonaddress):
> If the value at Address differs from the value at CompareAddress, the function returns immediately. If the values are the same, the function does not return until another thread in the same process signals that the value at Address has changed by calling WakeByAddressSingle or WakeByAddressAll or the timeout elapses, whichever comes first.
We could note that this behavior is only observed on Windows. However, if we want the function to have consistent behavior across all platforms, we should require users to call wake. On platforms where changing the value is sufficient to wake the waiting thread, an unblocking of the thread without a matching wake would just be considered a spurious wake.
2025-12-27 20:40:19 +01:00
Aaron Ang
9db3e23e80 std.math.big: require sufficient capacity for aliased params 2025-12-27 20:38:33 +01:00
Andrew Kelley
212968c574 std.Io.Threaded: handle missing atime from statx 2025-12-27 11:18:16 -08:00
Andrew Kelley
c0809c9b68 std: add more timespec OMIT and NOW definitions 2025-12-27 11:08:56 -08:00
Andrew Kelley
10e72a8cad std.Io.Threaded: implement fileSetTimestamps on WASI 2025-12-27 11:01:16 -08:00
Andrew Kelley
dd98188ce0 std.Io.Threaded: mostly implement fileSetTimestamps for Windows
it's still missing the case of setting to now (which was also not
implemented before)
2025-12-27 10:52:17 -08:00
Andrew Kelley
a7c9d11b28 std.Io: make file access time optional
Some filesystems, such as ZFS, do not report atime. It's pretty useless
in general, so make it an optional field in File.Stat.

Also take the opportunity to make setting timestamps API more flexible
and match the APIs widely available, which have UTIME_OMIT and UTIME_NOW
constants that can be independently set for both fields.

This is needed to handle smoothly the case when atime is null.
2025-12-27 10:40:24 -08:00
Andrew Kelley
e55e6b5528 Merge pull request 'std: migrate all fs APIs to Io' (#30232) from std.Io-fs into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30232
2025-12-27 14:10:46 +01:00
Matthew Lugg
60a1ba0a8f
stage1: add more wasi.c stubs
Because `std.Io` forces analysis of unused functions in the vtable,
there are now references to 4 more WASI functions, even though the
compiler does not actually call them at runtime.

Therefore, these new stubs fix the bootstrap process after a zig1.wasm
update (though this branch does *not* update zig1.wasm).
2025-12-27 10:23:46 +00:00
Andrew Kelley
d8460910b4 std.Io.Threaded: init stderr_writer in streaming mode 2025-12-26 19:58:56 -08:00
Andrew Kelley
2fb46b0ed9 std.Progress: recancel in start()
one must never swallow error.Canceled; if you can't handle it, either
temporarily disable it for the function, or recancel if you catch it.
2025-12-26 19:58:56 -08:00
Andrew Kelley
e08837b0fe build.zig: simplify max_rss compiler_rt on windows
I observed this take more memory than the previous declaration
2025-12-26 19:58:56 -08:00
Ryan Liptak
e3f36d0d81 Fix a few standalone tests on Windows 2025-12-26 19:58:56 -08:00
Ryan Liptak
4f8aa8213d Fix for compile error in resinator 2025-12-26 19:58:56 -08:00
Ryan Liptak
ec5c2d4ce3 Skip posix-specific standalone test on Windows 2025-12-26 19:58:56 -08:00
Ryan Liptak
447f80c0cc Delete test_symlink in standalone/posix, it's fully redundant
See readlink tests in std/fs/test.zig
2025-12-26 19:58:56 -08:00
Andrew Kelley
252c4e57c6 std.Progress: fix compilation on Windows
by using std.Io.File.readStreaming rather than posix.read
2025-12-26 19:58:56 -08:00
Andrew Kelley
28810f5e3d std.Io.File: add readStreaming
I resisted adding this because it's generally better to create a
File.Reader instead, but we do need a simple wrapper around the vtable
function, and there are use cases for it such as std.Progress.
2025-12-26 19:58:56 -08:00
Andrew Kelley
f160d5f979 std.Io.Threaded: implement file writing for Windows 2025-12-26 19:58:56 -08:00
Andrew Kelley
feeed922e1 std.Io.net: disable flaky test on mipsel 2025-12-26 19:58:56 -08:00
Ryan Liptak
58f0c8cfed Fix logic for detecting zero buffer capacity in fileReadStreamingWindows/fileReadPositionalWindows 2025-12-26 19:58:56 -08:00
Andrew Kelley
eb29737d5d std.Io.Threaded: more efficient statx mask check 2025-12-26 19:58:56 -08:00
Andrew Kelley
6dcf951391 std.Io.Threaded: error instead of assert for statx
when statx fails to return some of the requested fields
2025-12-26 19:58:56 -08:00
Andrew Kelley
2e9415d8a0 std.Io.Threaded: fix missing @memcpy in realPathPosix for FreeBSD 2025-12-26 19:58:56 -08:00
Andrew Kelley
0dbcf97551 std.Io.Threaded: fix resource leak in dirRealPathFilePosix
it should unconditionally close the opened file descriptor, not only on
error.
2025-12-26 19:58:56 -08:00
Andrew Kelley
eb0d5b1377 std.testing: use debug Io instance in expectEqualSlices 2025-12-26 19:58:56 -08:00
Andrew Kelley
28639bd6d7 std: prevent testing.io from use outside tests 2025-12-26 19:58:56 -08:00
Andrew Kelley
b0691df5ba test_runner: fix simple runner compilation 2025-12-26 19:58:56 -08:00
Andrew Kelley
0126e71903 build.zig: adjust max_rss for zig libc
this isn't meant to be a precisely measured thing that is different per
operating system. it's meant to have some room for growth but not too
much.
2025-12-26 19:58:56 -08:00
Andrew Kelley
8d96d7d219 remove test for nonexistent API 2025-12-26 19:58:56 -08:00
Andrew Kelley
dc1d27a646 std.Io.Threaded: more verbose TODO panic messages 2025-12-26 19:58:56 -08:00
Andrew Kelley
d7bf0dab82 link.Wasm: fix incremental update crash
Description of problem:

- wasm linker does GC in flush()
- it has the mechanism where it tracks the end index of a bunch of
  ArrayHashMap before flush() and after flush, shrinkRetainingCapacity()
  them to restore them to pre-flush() state
- this includes `functions`, which contains `__divti3`
- flush() notices the call to `__divti3` and calls markFunctionImport(),
  but that function does nothing on a second update because `alive` is
  already set to `true` so it incorrectly skips adding the intrinsic
  back to `functions`

I tried to remember why I thought it was OK to use this `alive` flag
which is state that's not being restored after flush(). If I remember
correctly, I was just leaving the code how it was before, with the plan
to change the data layout after encountering this exact problem.

However, I found a solution that doesn't require changing data layout,
and still takes advantage of the 1-bit-per-symbol data layout.
2025-12-26 19:58:56 -08:00
Andrew Kelley
3ad9a6a604 incr-check: more general --debug-log CLI 2025-12-26 19:58:56 -08:00
Andrew Kelley
a7d2cb7045 test-incremental: ignore .swp files 2025-12-26 19:58:56 -08:00
Andrew Kelley
66da6773eb build: make test-incremental respect -Dtest-filter 2025-12-26 19:58:56 -08:00
Andrew Kelley
b243e8f8cc std: integrate DebugAllocator with terminal mode
by adding a new std.Option for log.terminalMode

this is an alternative to the approach that was deleted in
aa57793b680b3da05f1d888b4df15807905e57c8
2025-12-26 19:58:56 -08:00
Andrew Kelley
a72c411fdb disable self-hosted aarch64 tests
These can be re-enabled when the assertion failures in the backend are
fixed, which does not need to block this branch.
2025-12-26 19:58:56 -08:00
Andrew Kelley
315bc10a0c std.Io.Threaded: dirRealPathFilePosix use libc realpath sometimes
When linking libc, and the directory is the cwd.

This avoids bugs on FreeBSD.
2025-12-24 12:57:18 -08:00
Andrew Kelley
02e560d9ef build.zig: adjust max_rss for unit tests
this isn't meant to be a precisely measured thing that is different per
operating system. it's meant to have some room for growth but not too
much.
2025-12-24 11:37:51 -08:00
Andrew Kelley
6f4e93f0dd std.Io.Threaded: wasi does not support processExecutablePath 2025-12-24 00:55:27 -08:00
Andrew Kelley
ace08ba642 std.Io.Threaded: prevent 0-byte file writes
these cause EINVAL on darwin and are generally a wasted syscall.

and remove a bogus error from File.Writer.Error.
2025-12-23 23:46:43 -08:00
Andrew Kelley
a901e92413 std.Io.Threaded: implement process executable path on darwin 2025-12-23 23:31:47 -08:00
Andrew Kelley
2708a3c1ac fix the guess number game example 2025-12-23 22:40:17 -08:00
Andrew Kelley
c9a609a61a test-cases: disable self-hosted aarch64 backend coverage 2025-12-23 22:15:12 -08:00
Andrew Kelley
6dbc95fb1f update test cases 2025-12-23 22:15:12 -08:00
Andrew Kelley
fa79d34674 std: add changing cur dir back
There's a good argument to not have this in the std lib but it's more
work to remove it than to leave it in, and this branch is already
20,000+ lines changed.
2025-12-23 22:15:12 -08:00
Andrew Kelley
98e9716c08 std: fix compilation on NetBSD 2025-12-23 22:15:12 -08:00