Commit graph

11959 commits

Author SHA1 Message Date
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
Andrew Kelley
a6347a68a9 std.Io.net: implement receiving connectionless messages 2025-10-29 06:20:48 -07:00
Andrew Kelley
961961cf85 std: fix msghdr and cmsghdr when using musl libc
glibc and linux kernel use size_t for some field lengths while POSIX and
musl use int. This bug would have caused breakage the first time someone
tried to call sendmsg on a 64-bit big endian system when linking musl
libc.

my opinion:
* msghdr.iovlen: kernel and glibc have it right. This field should
  definitely be size_t. With int, the padding bytes are wasted for no
  reason.
* msghdr.controllen: POSIX and musl have it right. 4 bytes is plenty for
  the length, and it saves 4 bytes next to flags.
* cmsghdr.len: POSIX and musl have it right. 4 bytes is plenty for the
  length, and it saves 4 bytes since the other fields are also 32-bits
  each.
2025-10-29 06:20:48 -07:00
Andrew Kelley
95dee2af9c std.Io: implement netSend 2025-10-29 06:20:48 -07:00
Andrew Kelley
bcb6760fa5 std.os.linux: remove unnecessary warnings from sendmmsg
The one about INT_MAX is self-evident from the type system.

The one about kernel having bad types doesn't seem accurate as I checked
the source code and it uses size_t for all the appropriate types,
matching the libc struct definition for msghdr and msghdr_const.
2025-10-29 06:20:48 -07:00
Andrew Kelley
3b80fde6f4 std.os.linux: remove sendmmsg workaround
This "fix" is too opinionated to belong here. Better instead to
document the pitfalls.
2025-10-29 06:20:48 -07:00
Andrew Kelley
cde5a51d0c std.Io.net: make netSend support multiple messages
this lowers to sendmmsg on linux, and means Io.Group is no longer
needed, resulting in a more efficient implementation.
2025-10-29 06:20:48 -07:00
Andrew Kelley
b22400271f std.Io.net.HostName: finish implementing DNS lookup 2025-10-29 06:20:48 -07:00
Andrew Kelley
2e1ab5d3f7 std.Io.Threaded: implement Group.cancel 2025-10-29 06:20:48 -07:00
Andrew Kelley
8e1da66ba1 std.Io: implement Group API 2025-10-29 06:20:48 -07:00
Andrew Kelley
5469db66e4 std.Thread.ResetEvent: make it more reusable 2025-10-29 06:20:48 -07:00
Andrew Kelley
f9d976a4e1 std.Io: rename asyncConcurrent to concurrent 2025-10-29 06:20:48 -07:00
Andrew Kelley
60c4bdb14c Io.net: implement more networking
the next task is now implementing Io.Group
2025-10-29 06:20:48 -07:00
Andrew Kelley
8771a9f082 std.Io.net: progress towards DNS resolution 2025-10-29 06:20:48 -07:00
Andrew Kelley
5782158628 std.net: fix parsing IPv6 addr "::" 2025-10-29 06:20:48 -07:00
Andrew Kelley
885b3f8342 Io.net: finish implementing IPv6 parsing 2025-10-29 06:20:48 -07:00
Andrew Kelley
e7c9df9fb0 Io.net: use resolve for IPv6
/etc/resolv.conf might have IPv6 addresses with scope in it, so this is
needed.
2025-10-29 06:20:48 -07:00
Andrew Kelley
d776a6bbbe Io.net: rework IPv6 parsing and printing
extract pure functional logic into pure functions and then layer the
scope crap on top properly

the formatting code incorrectly didn't do the reverse operation
(if_indextoname). fix that with some TODO panics
2025-10-29 06:20:48 -07:00
Andrew Kelley
5089352b86 std.Io: rename ThreadPool to Threaded 2025-10-29 06:20:48 -07:00
Andrew Kelley
0e9280ef1a std.Io: extract Dir to separate file 2025-10-29 06:20:48 -07:00
Andrew Kelley
fc1e3d5bc9 Io.net: partial implementation of dns lookup 2025-10-29 06:20:48 -07:00
Andrew Kelley
b4e5e9d48f Io.net: implement sortLookupResults 2025-10-29 06:20:48 -07:00
Andrew Kelley
e7729a7b89 std: start moving fs.File to Io 2025-10-29 06:20:48 -07:00
Andrew Kelley
bd3c65f752 std.Io.net: partially implement HostName.lookup 2025-10-29 06:20:48 -07:00
Andrew Kelley
668f905243 add some networking 2025-10-29 06:20:48 -07:00
Andrew Kelley
d801a71d29 add std.testing.io 2025-10-29 06:20:48 -07:00
Andrew Kelley
84d60404be std.Io: delete asyncParallel 2025-10-29 06:20:48 -07:00
Andrew Kelley
7ead86e339 std.Io: fix error handling and asyncParallel docs 2025-10-29 06:20:48 -07:00
Andrew Kelley
f762597724 std.Io: add asyncConcurrent and asyncParallel 2025-10-29 06:20:48 -07:00
Andrew Kelley
ec3e4c00c3 std.Io.EventLoop: add aarch64 support 2025-10-29 06:20:48 -07:00
Andrew Kelley
30be75ca40 std.Io.ThreadPool: fix asyncDetached 2025-10-29 06:20:48 -07:00
Andrew Kelley
f5d8492b1f std.Io: rename go to asyncDetached
it's a better name because it's more descriptive, not a reference, and
hints that it is less common than async
2025-10-29 06:20:48 -07:00
Andrew Kelley
14c3dc4c49 revert std.Thread.Pool for now
and move the Io impl to a separate file
2025-10-29 06:20:48 -07:00
Andrew Kelley
fd4dd3befb update to sync with master 2025-10-29 06:20:48 -07:00
Andrew Kelley
e1cbcecf89 Io: update for new linked list API 2025-10-29 06:20:48 -07:00
Andrew Kelley
4b657d2de5 std.Io: remove @ptrCast workarounds
thanks to d53cc5e5b2
2025-10-29 06:20:48 -07:00
Andrew Kelley
c88b8e3c15 std.Io.EventLoop: implement select 2025-10-29 06:20:48 -07:00
Andrew Kelley
f158ec5530 Io.EventLoop: select stub 2025-10-29 06:20:48 -07:00
Andrew Kelley
7aa4062f5c introduce Io.select and implement it in thread pool 2025-10-29 06:20:48 -07:00
Jacob Young
c4fcf85c43 Io.Condition: implement full API 2025-10-29 06:20:48 -07:00
Jacob Young
3eb7be5cf6 EventLoop: implement detached fibers 2025-10-29 06:20:48 -07:00
Andrew Kelley
0f105a8a10 EventLoop: let the allocator do its job
to bucket and free fiber allocations
2025-10-29 06:20:48 -07:00