999 Commits
Author SHA1 Message Date
Masa Bence 1420479be7 std: update Arraylist in unicode.zig to unmanaged 2026-10-27 19:37:22 +01:00
akbarhusain 167a8f987f std.Io: fix flush spin on failing io 2026-10-27 17:35:34 +01:00
Alex Rønne Petersen 11c8c38332 disentangle std.c and std.posix on Windows
std.c should reflect the CRT, not std.posix's bizarre view of the world.

Also:

* Audit some incorrect std.c types and function signatures
* Remove ws2_32 from std.c (dubious quality, and ws2_32 isn't libc)
* Remove remnants of Windows support in std.posix

closes https://codeberg.org/ziglang/zig/issues/37382
2026-10-24 07:23:58 +02:00
CMDRZero 64e4f9db8f Implement partially ordered operator precedence 2026-10-22 12:21:43 +02:00
Andrew Kelley 416ed78779 std.Io.Threaded.batchAwaitConcurrent: rework submission logic
take advantage of labeled blocks to reuse eager code, remove confusing
usage of `defer`, add comments for clarity
2026-10-21 12:55:22 -07:00
Billal GHILAS ae7f9deb16 std.Io.Threaded.batchAwaitConcurrent: fix eager path 2026-10-21 12:54:52 -07:00
Jacob Young 07ea1c97ee process: fix bsd spawn 2026-10-21 10:04:01 -07:00
Robbie Lyman 755d09660d fix(Io.Dispatch): synchronize with updates to VTable
This is a minimal set of changes to let a test program which uses
Dispatch to sleep to compile.
2026-10-21 18:52:45 +02:00
Ayoctl 877bcb27d2 std.Io.Dir: fix realPath documentation 2026-10-16 04:03:17 +09:00
Andrew Kelley cdd6e545cc std.Io.Threaded: handle unsupported renamePreserveLinux
with link/unlink fallback. closes #31960
2026-10-13 13:26:23 -07:00
Lateef Jackson 59f1471306 On Linux the system call of renameat2 return an INVAL error. This is not
a bug it should map to which should OperationUnsupported error is
a better fit to the system call response.
2026-10-12 22:10:54 +02:00
kernelnomad 85e2896e17 std.Io.net.Ip4Address: fix fromAny return type 2026-10-12 20:13:05 +02:00
Andrew Kelley eee0e6d70e Merge pull request 'Io.Threaded: a few Windows stat fixes' (#37174) from squeek502/zig:misc-windows-fixes into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37174
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-10-11 19:43:20 +02:00
Jonathan Marler 9276a56e3c std.Io.Threaded: map LOCAL_DISCONNECT to ConnectionResetByPeer on Windows
netReadWindows and netWriteWindows returned error.Unexpected when AFD
reported STATUS_LOCAL_DISCONNECT. I was able to produce this error in
both the read and write paths locally.

Partial fix of #31956
2026-10-10 20:00:54 +02:00
Andrew Kelley 9449bac422 Merge pull request 'Io.Uring fixes & updates' (#37172) from sinon/zig:iouring-fixes into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37172
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-10-10 19:47:29 +02:00
Ryan Liptak 55d429e0ba Threaded.fileStatWindows: disambiguate between files and named pipes 2026-10-09 23:35:36 -07:00
Ryan Liptak 1c6a9d75df Threaded.fileStatWindows: fix for character device files
Tested with a program that calls `stdin().stat(io)`. With this change, the following all work and return `.kind = .character_device` whereas before they would hit error.Unexpected or panic:

stdin-stat.exe
stdin-stat.exe < NUL
stdin-stat.exe < COM1
stdin-stat.exe < AUX
2026-10-09 22:32:38 -07:00
Ryan Liptak 61656d0e0e Threaded.windowsCreatePipe: Set READ_ATTRIBUTES flags
Without this, the child trying to read the attributes of the stdout/stderr/stdin file (NtQueryInformationFile, NtQueryVolumeInformationFile, etc) would get ACCESS_DENIED. It's not strictly necessary on the server side of the pipe but I don't see a reason not to set it there, too.
2026-10-09 22:32:38 -07:00
Jan Schlien 3f3e88e7b4 std.Io.Threaded: map EACCES from file reads
A read can fail with EACCES on a file that was opened successfully, e.g.
procfs entries such as /proc/<pid>/stack check permissions at read time.
The readv, preadv and pread switches did not handle it, so it ended up
in unexpectedErrno which dumps a stack trace in Debug builds.
2026-10-10 02:02:30 +02:00
Brandon L Black f8c073d0b1 Io.net: expand IPv6:IPv4 formatting and parsing
The IPv6 formatter code now emits the :IPv4 alternate text form
for both "IPv4 Mapped" and "Well-Known Prefix" (RFC 6052).

The IPv6 parser now accepts the :IPv4 form regardless of what the
first 12 bytes are, so long as there is no trailing "%interface"
(which should only be useful for link-locals anyways). RFC 4291
does not require any special prefix for the :IPv4 form on the
parsing side, and there are many non-canonical cases in the real
world which should still parse correctly.
2026-10-10 01:23:15 +02:00
Brandon Black 36173dcccf Concurrent recv should return msg_i alongside err
If there were multiple potential messages to receive, and some
were received successfully before encountering an error, it should
report the count of succesful receives along with the error found
during the final attempt.
2026-10-10 01:22:25 +02:00
David Rubin 18b98cee06 Io.Uring: fix batch completion handling 2026-10-09 17:55:43 -05:00
David Rubin 5f4173bb1f Io.Uring: clean up child process setup 2026-10-09 17:52:13 -05:00
David Rubin 5bec90b3bc Io.Uring: update process API 2026-10-09 17:52:13 -05:00
Brandon Black 71f6780c98 Move netAccept to an Operation 2026-10-10 00:47:09 +02:00
Linus Groh 1fcc9cbe3d std.Io.Threaded: Implement futexWait/futexWake for serenity
Taken from the downstream patch with slight modifications:
https://github.com/SerenityOS/serenity/blob/3d85104ef2ad231f31ec3de703f24306ea2aa0bf/Ports/zig/patches/0005-Extend-support-for-SerenityOS-target.patch#L19-L73
2026-10-10 00:19:51 +02:00
Nils Juto 06efbc37cb document File.Atomic.sub_path lifetime requirement 2026-10-09 21:15:09 +02:00
zacoons cf03d737e4 std.Io.Reader: Add clarification to streamDelimiterEnding doc comment 2026-10-09 12:10:57 +02:00
Brandon L Black be8e7da103 Io.net.cmsg: Fix Iterator.Message.header alignment
Without this change, on some targets (e.g. aarch64-freebsd),
calling `cmsg.data()` with `Iterator.message.header` as the
argument would result in compilation failures like:

    error: expected type '*align(8) c.posix_cmsghdr', found '*c.posix_cmsghdr'
2026-10-06 07:31:14 +02:00
Alex Rønne Petersen 5e754304de remove support for wasi-libc
closes https://github.com/ziglang/zig/issues/9342
closes https://github.com/ziglang/zig/issues/15005
closes https://github.com/ziglang/zig/issues/20747
closes https://github.com/ziglang/zig/issues/22570
closes https://codeberg.org/ziglang/zig/issues/30977
2026-10-04 18:23:18 +02:00
Alex Rønne Petersen 56023ff8fe Merge pull request 'std.Io.Threaded: only use spawnDarwin in processReplace when spawning is supported' (#37063) from enfipy/zig:std-threaded-ios-process-replace into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37063
Reviewed-by: Jacob Young <jacobly@ziglang.org>
2026-10-04 18:19:10 +02:00
David c92c8ef8cf std.process: match can_spawn and can_replace to Apple SDK availability 2026-10-04 10:39:43 +04:00
hemisputnik 78093ce4c8 Io.net.Stream: fix read post control data changes 2026-10-04 00:01:57 +03:00
hemisputnik febc1d4cf7 Io.Threaded: fix wasi branch of netReadPosix post control data changes 2026-10-03 23:47:32 +03:00
David 0bfd34342b std.Io.Threaded: only use spawnDarwin in processReplace when spawning is supported
ios, tvos, visionos and watchos can't spawn processes, so their
null_file has no fd and spawnDarwin doesn't compile for them. The
vtable always references processReplace and the default panic handler
uses Threaded, so nearly every program for these targets failed to
compile. Fall back to posixExec there, as before 9fe0ebe108.

closes https://codeberg.org/ziglang/zig/issues/37061
2026-10-03 17:10:32 +04:00
Isaac Freund 2217d43cc9 Revert "std.Io.net: improve reception of control data"
It is not clear to me that this is the right path to take, using a
shared buffer for control data makes managing the alignment trickier,
and would require the Io interface itself to deal with alignment.

For an example of what I consider clean design, see net_read/net_write.
There is no need for the Io interface/operations to be aware of control
buffer alignment and it is sufficient for the net.Stream.Reader
abstraction to use an aligned buffer.

Also this has no test coverage and is (to my knowledege)
not currently blocking any real world Zig project.

This reverts commit 7c0347fce0b6f510b43ca503ad9c1cd2f8ac9a6b.
2026-10-01 11:21:28 +02:00
Isaac Freund c53cb65568 std.Io.net: add control message utilities 2026-10-01 11:21:28 +02:00
hemisputnik b3e8eb6577 std.Io.net.test: add fd passing test
Similarly to the other unix socket test, this test opens a unix socket,
but also uses the newly-introduced control data API to pass a file
descriptor to the other side.

The other side then writes to the file descriptor, then deletes the
temporary file.
2026-10-01 10:55:12 +02:00
hemisputnik c4d9d65a7b std.Io.net: send control data with .net_write
Add a new parameter to .net_write - control.
2026-10-01 10:55:12 +02:00
hemisputnik 875cb2ff2f std.Io.net: read control data with .net_read
Also adds a way to read control data using Stream.Reader. Stream.Reader
will buffer control data until it can't no more, in which case it will
be truncated.

The readv syscall in netReadPosix has been replaced with recvmsg.
2026-10-01 10:55:12 +02:00
hemisputnik 2035549408 std.Io.net: improve reception of control data
A couple of changes to improve reception of control data when using the
datagram API.

Instead of having a separate control buffer per received message,
there's one big buffer that all messages share (like the data buffer).

This means that now IncomingMessage has no user-initialised fields, and
can be initialised with undefined (which means that .init is now
deprecated).

Also, instead of taking a pointer to mutable IncomingMessage,
netReceiveOne* functions simply return a IncomingMessage.
2026-10-01 10:55:12 +02:00
hemisputnik 8909d25b36 std.Io.Threaded: avoid passing undefined flags to kernel 2026-10-01 10:55:12 +02:00
hemisputnik e07da33a77 std.Io.Threaded: drop MSG_NOSIGNAL from recvmsg flags
MSG_NOSIGNAL is not defined for recvmsg, only sendmsg.
2026-10-01 10:55:12 +02:00
Tengs Fan fd1c549332 Uring Errno: fix casting
1. @bitCast has no target type anymore and throws error, discard it
   because the old errno only accept usize. The new errno takes any
   integer width and does the signed conversion itself
2. also throw away the widening (i32 -> usize), the logic is in linux.errno
   now
2026-09-29 23:29:02 +02:00
Jacob Young d48441e87e Revert "Threaded: Reduce the number of Windows rename ACCESS_DENIED retries to 3"
This reverts commit 36a308ce42.
2026-09-29 15:49:29 -04:00
Ryan Liptak dd144a1988 Threaded.createFileMap: Update comments to reflect Windows prefetch efficacy findings
With a test case that (1) calls createFileMap on a 250MiB text file, and (2) reads every byte in the mapped region looking for `\n`, hard page faults were eliminated in the `populate = true` case. `rammap -Et` is used to clear the relevant Windows cache.

```
> rammap -Et
> bench-no-populate.exe
.{ .page = 1090, .hard = 0 } // initial count
.{ .page = 1112, .hard = 0 } // after createFileMap
.{ .page = 1114, .hard = 0 } // after 1s sleep
4194304 newlines in the file
.{ .page = 66779, .hard = 255 }

> rammap -Et
> bench-populate.exe
.{ .page = 1093, .hard = 0 } // initial count
.{ .page = 1242, .hard = 0 } // after createFileMap
.{ .page = 1244, .hard = 0 } // after 1s sleep
4194304 newlines in the file
.{ .page = 66782, .hard = 1 }
```

More details are in https://codeberg.org/ziglang/zig/pulls/36964
2026-09-28 18:00:39 -07:00
Ryan Liptak 070294b36c Threaded.createFileMap: fix handling of populate on Windows
This both fixes populate=false, since NtCreateSection needs COMMIT=true when called with a file handle (the higher level API sets this flag for the user), and also signals the intention to prefetch when populate=true, which wasn't happening before.

However, PrefetchVirtualMemory (and the ntdll equivalent NtSetInformationVirtualMemory with MEMORY_PREFETCH_INFORMATION) doesn't appear to actually do anything to decrease the number of page/hard faults. We still do the call though since it accurately signals intent, and future version of Windows may be able to do something with that.
2026-09-29 02:46:27 +02:00
Ryan Liptak c27e685e63 Merge pull request 'std.zig.stringEscape: Escape invalid/disallowed UTF-8 sequences' (#36923) from squeek502/zig:string-escape-utf8 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36923
2026-09-28 22:23:47 +02:00
Ryan Liptak 36a308ce42 Threaded: Reduce the number of Windows rename ACCESS_DENIED retries to 3 2026-09-26 20:11:45 -07:00
Jacob Young 44524cbf51 std.Io.Reader: revert interface change
This function was broken before and is still broken after, so avoiding
the change for now.
2026-09-26 19:33:36 -04:00