authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-03-20 00:39:09-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-03-20 00:39:09-07:00
log7ecbb6f3a07743669590f0c0e1767f49c7ca1fc3
tree4f99a180cf5c14b04191aba0cfc221249f37ee76
parent3a836b4800337567735b2619075d8bb4e9f21c4d
parentcba155510431104fcfe2f6b61e955bc4d42927fb
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #19360 from ziglang/no-byos-posix

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

2 files changed, 4 insertions(+), 8 deletions(-)

lib/std/os/linux.zig+2-2
...@@ -2264,7 +2264,7 @@ pub fn map_shadow_stack(addr: u64, size: u64, flags: u32) usize {...@@ -2264,7 +2264,7 @@ pub fn map_shadow_stack(addr: u64, size: u64, flags: u32) usize {
2264}2264}
22652265
2266pub const E = switch (native_arch) {2266pub const E = switch (native_arch) {
2267 .mips, .mipsel => enum(i32) {2267 .mips, .mipsel => enum(u16) {
2268 /// No error occurred.2268 /// No error occurred.
2269 SUCCESS = 0,2269 SUCCESS = 0,
22702270
...@@ -2406,7 +2406,7 @@ pub const E = switch (native_arch) {...@@ -2406,7 +2406,7 @@ pub const E = switch (native_arch) {
24062406
2407 pub const init = errnoFromSyscall;2407 pub const init = errnoFromSyscall;
2408 },2408 },
2409 .sparc, .sparcel, .sparc64 => enum(i32) {2409 .sparc, .sparcel, .sparc64 => enum(u16) {
2410 /// No error occurred.2410 /// No error occurred.
2411 SUCCESS = 0,2411 SUCCESS = 0,
24122412
lib/std/posix.zig+2-6
...@@ -39,12 +39,8 @@ const linux = std.os.linux;...@@ -39,12 +39,8 @@ const linux = std.os.linux;
39const windows = std.os.windows;39const windows = std.os.windows;
40const wasi = std.os.wasi;40const wasi = std.os.wasi;
4141
42/// Applications can override the `system` API layer in their root source file.42/// A libc-compatible API layer.
43/// Otherwise, when linking libc, this is the C API.43pub const system = if (use_libc)
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)
48 std.c44 std.c
49else switch (native_os) {45else switch (native_os) {
50 .linux => linux,46 .linux => linux,