From 7157189143e83dedb29d25553d2841ff2576dc5c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 19 Jul 2024 00:40:00 -0700 Subject: [PATCH] macos doesn't have pipe2 --- lib/std/c.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/std/c.zig b/lib/std/c.zig index 967392ece3..c051303d33 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -8903,8 +8903,10 @@ pub const sigaltstack = switch (native_os) { }; pub extern "c" fn memfd_create(name: [*:0]const u8, flags: c_uint) c_int; -pub extern "c" fn pipe2(fds: *[2]fd_t, flags: O) c_int; - +pub const pipe2 = switch (native_os) { + .dragonfly, .emscripten, .netbsd, .freebsd, .kfreebsd, .solaris, .illumos, .openbsd, .linux => private.pipe2, + else => {}, +}; pub const copy_file_range = switch (native_os) { .linux => private.copy_file_range, .freebsd, .kfreebsd => freebsd.copy_file_range, @@ -9686,6 +9688,7 @@ const private = struct { extern "c" fn gettimeofday(noalias tv: ?*timeval, noalias tz: ?*timezone) c_int; extern "c" fn msync(addr: *align(page_size) const anyopaque, len: usize, flags: c_int) c_int; extern "c" fn nanosleep(rqtp: *const timespec, rmtp: ?*timespec) c_int; + extern "c" fn pipe2(fds: *[2]fd_t, flags: O) c_int; extern "c" fn readdir(dir: *DIR) ?*dirent; extern "c" fn realpath(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8; extern "c" fn sched_yield() c_int;