authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-03-19 17:02:04-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-03-20 00:38:44-07:00
logcba155510431104fcfe2f6b61e955bc4d42927fb
tree4f99a180cf5c14b04191aba0cfc221249f37ee76
parent5d389535e875f3d1b4865fc10fb79317b26c5ed7

std: don't do BYOS at the POSIX API layer

This was a mistake from day one. This is the wrong abstraction layer to do this in. My alternate plan for this is to make all I/O operations require an IO interface parameter, similar to how allocations require an Allocator interface parameter today.

1 files changed, 2 insertions(+), 6 deletions(-)

lib/std/posix.zig+2-6
......@@ -39,12 +39,8 @@ const linux = std.os.linux;
3939const windows = std.os.windows;
4040const wasi = std.os.wasi;
4141
42/// Applications can override the `system` API layer in their root source file.
43/// Otherwise, when linking libc, this is the C API.
44/// When not linking libc, it is the OS-specific system interface.
45pub const system = if (@hasDecl(root, "os") and @hasDecl(root.os, "system") and root.os != @This())
46 root.os.system
47else if (use_libc)
42/// A libc-compatible API layer.
43pub const system = if (use_libc)
4844 std.c
4945else switch (native_os) {
5046 .linux => linux,