Commit graph

35807 commits

Author SHA1 Message Date
Andrew Kelley
18ec9685fb std.Io.Threaded: add support for getaddrinfo
this API sucks but it's the best we've got on some operating systems
2025-10-29 06:20:49 -07:00
Andrew Kelley
031044b399 std: fix macos compilation errors 2025-10-29 06:20:49 -07:00
Andrew Kelley
f7d47aed47 README: LLVM-less builds are more capable now 2025-10-29 06:20:49 -07:00
Andrew Kelley
bb1bf5b96f std.Io: stub file writing rather than incorrect impl 2025-10-29 06:20:49 -07:00
Andrew Kelley
1e81c3a925 std.Io: rename EventLoop to IoUring
`std.Io.Evented` is introduced to select an appropriate Io
implementation depending on OS
2025-10-29 06:20:49 -07:00
Andrew Kelley
81b1bfbfbb std.Io.Threaded: wrangle TODOs 2025-10-29 06:20:49 -07:00
Andrew Kelley
060fd975d9 std.Io.Group: add cancellation support to "wait" 2025-10-29 06:20:49 -07:00
Andrew Kelley
10bfbd7d60 std.Io.Threaded: rename from "pool" 2025-10-29 06:20:49 -07:00
Andrew Kelley
870a682cd8 std.Io.net.HostName.connect: fix resource leaks
Must free other succeeded connections that lost the race.
2025-10-29 06:20:49 -07:00
Andrew Kelley
426a377c7b std.Io.net.Stream: add "const" variant to "close"
useful for resource management
2025-10-29 06:20:49 -07:00
Andrew Kelley
80069c1e69 std.Io.Queue: add "uncancelable" variants to "get"
useful for resource management
2025-10-29 06:20:49 -07:00
Andrew Kelley
adaef433d2 std.net.HostName.connect: rework to avoid waiting for DNS
The previous implementation would eagerly attempt TCP connection upon
receiving a DNS reply, but it would still wait for all the DNS results
before returning from the function.

This implementation returns immediately upon first successful TCP
connection, canceling not only in-flight TCP connection attempts but
also unfinished DNS queries.
2025-10-29 06:20:49 -07:00
Andrew Kelley
d3c4158a10 std.Io: implement Select
and finish implementation of HostName.connect
2025-10-29 06:20:49 -07:00
Andrew Kelley
35ce907c06 std.Io.net.HostName: move lookup to the interface
Unfortunately this can't be implemented "above the vtable" because
various operating systems don't provide low level DNS resolution
primitives such as just putting the list of nameservers in a file.

Without libc on Linux it works great though!

Anyway this also changes the API to be based on Io.Queue. By using a
large enough buffer, reusable code can be written that does not require
concurrent, yet takes advantage of responding to DNS queries as they
come in. I sketched out a new implementation of `HostName.connect` to
demonstrate this, but it will require an additional API (`Io.Select`) to
be implemented in a future commit.

This commit also introduces "uncancelable" variants for mutex locking,
waiting on a condition, and putting items into a queue.
2025-10-29 06:20:49 -07:00
Andrew Kelley
1382e41226 std.Io.Threaded: import std.Io.net 2025-10-29 06:20:49 -07:00
Andrew Kelley
2bcdde2985 compiler: update for introduction of std.Io
only thing remaining is using libc dns resolution when linking libc
2025-10-29 06:20:49 -07:00
Andrew Kelley
c2d1a339da std.fs.File: begrudgingly add back deprecated APIs
I'm not ready to rework MachO linker file access at the moment.
2025-10-29 06:20:49 -07:00
Andrew Kelley
79a59c5165 coff linker: don't check the time
compiler toolchains have no business knowing what time it is
2025-10-29 06:20:49 -07:00
Andrew Kelley
0732ff2263 std.Io.Threaded: implement connecting to unix sockets 2025-10-29 06:20:49 -07:00
Andrew Kelley
e8cea8accb std.Io.Threaded: implement netListenUnix 2025-10-29 06:20:49 -07:00
Andrew Kelley
d680b9e9b2 std.Io.File: add WouldBlock to the error set
Even in an asynchronous world, the concept of a non-blocking flag is
useful because it determines under what conditions the operation
completes.
2025-10-29 06:20:49 -07:00
Andrew Kelley
539808239e std.net: IPv6 parsing fixes 2025-10-29 06:20:49 -07:00
Andrew Kelley
d3f0c460ec std.Io.net.HostName: fix DNS resolution
* merge conflict with changing behavior of takeDelimiterExclusive
* check bounds before adding to result array
2025-10-29 06:20:49 -07:00
Andrew Kelley
923a7bdd7e std.Io.net: fix parsing IPv4-mapped IPv6 addresses 2025-10-29 06:20:49 -07:00
Andrew Kelley
e0e463bcf7 std.Io.net.Stream.Reader: fix not using buffer 2025-10-29 06:20:49 -07:00
Andrew Kelley
4d62f08393 add BRANCH_TODO file
to be deleted before merging into master
2025-10-29 06:20:49 -07:00
Andrew Kelley
be1ae430a1 std.Io.Threaded.netReadPosix: support cancelation 2025-10-29 06:20:49 -07:00
Andrew Kelley
71ff6e0ef7 std: fix seekBy unit test 2025-10-29 06:20:49 -07:00
Andrew Kelley
d40803284e progress towards compiler building again 2025-10-29 06:20:49 -07:00
Andrew Kelley
3b34622368 std.Io: add unix domain sockets API
note that "reuseaddr" does nothing for these
2025-10-29 06:20:49 -07:00
Andrew Kelley
9e681cab56 std.Uri: fix compilation error 2025-10-29 06:20:49 -07:00
Andrew Kelley
63801c4b05 std.crypto.Certificate.Bundle: remove use of File.readAll 2025-10-29 06:20:49 -07:00
Lukas Lalinsky
fcac8617b4 Add missing clobbers to context switching
This only shows in release mode, the compiler tries to preserve some
value in rdi, but that gets replaced inside the fiber. This would not
happen in the C calling convention, but in these normal Zig functions,
it can happen.
2025-10-29 06:20:49 -07:00
Andrew Kelley
7d478114ec fix compilation errors introduced by rebasing 2025-10-29 06:20:49 -07:00
Andrew Kelley
b1733b7bce std.Io: implement dirOpenFile 2025-10-29 06:20:49 -07:00
Andrew Kelley
8a1e6c8c39 std.Io: implement dirStatPath 2025-10-29 06:20:49 -07:00
Andrew Kelley
750b1431bf std: fix some Io compilation errors 2025-10-29 06:20:49 -07:00
Andrew Kelley
eadfefa002 std.Io: implement dirMake
In the future, it might be nice to introduce a type for file system path
names. This would be a way to avoid having InvalidFileName in the error
set, since construction of such type could validate it above the
interface.
2025-10-29 06:20:49 -07:00
Andrew Kelley
e85df854aa std.mem: improve containsAtLeastScalar implementation and rename 2025-10-29 06:20:49 -07:00
Andrew Kelley
ebcc6f166c std.Io: bring back Timestamp but also keep Clock.Timestamp
this feels better
2025-10-29 06:20:49 -07:00
Andrew Kelley
89412fda77 std.Io: implement fileStat 2025-10-29 06:20:48 -07:00
Andrew Kelley
69b54b0cd1 remove bad assert 2025-10-29 06:20:48 -07:00
Andrew Kelley
47aa5a70a5 std: updating to std.Io interface
got the build runner compiling
2025-10-29 06:20:48 -07:00
Andrew Kelley
066864a0bf std.zig.system: upgrade to std.Io.Reader 2025-10-29 06:20:48 -07:00
Andrew Kelley
b428612a20 WIP: hack away at std.Io return flight 2025-10-29 06:20:48 -07:00
Andrew Kelley
774df26835 WIP: hack at std.Io on a plane 2025-10-29 06:20:48 -07:00
Andrew Kelley
00f26cb0a4 WIP land the std.Io interface
fix std lib compilation errors caused by introducing std.Io
2025-10-29 06:20:48 -07:00
Andrew Kelley
85a6fea3be std.Io.net.HostName: implement DNS name expansion 2025-10-29 06:20:48 -07:00
Andrew Kelley
f1a590c876 std.Io.net.HostName: implement DNS reply parsing 2025-10-29 06:20:48 -07:00
Andrew Kelley
62d0dd0d36 std.Io.Threaded.netReceive: recvmsg first, then poll
Calling recvmsg first means no poll syscall needed when messages are
already in the operating system queue. Empirically, this happens when
repeating a DNS query that has been already been made recently. In such
case, poll() is never called!
2025-10-29 06:20:48 -07:00