diff --git a/lib/compiler/aro/aro/Compilation.zig b/lib/compiler/aro/aro/Compilation.zig index f6238f1d28..0ec314ba83 100644 --- a/lib/compiler/aro/aro/Compilation.zig +++ b/lib/compiler/aro/aro/Compilation.zig @@ -335,6 +335,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { .openbsd => try define(w, "__OpenBSD__"), .dragonfly => try define(w, "__DragonFly__"), .illumos => try defineStd(w, "sun", is_gnu), + .maccatalyst, .macos, .tvos, .ios, @@ -635,7 +636,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { }, .aarch64, .aarch64_be => { try define(w, "__aarch64__"); - if (comp.target.os.tag == .macos) { + if (comp.target.os.tag.isDarwin()) { try define(w, "__AARCH64_SIMD__"); if (ptr_width == 32) { try define(w, "__ARM64_ARCH_8_32__"); @@ -992,7 +993,7 @@ fn writeBuiltinMacros(comp: *Compilation, system_defines_mode: SystemDefinesMode \\ ); if (comp.langopts.standard.atLeast(.c11)) switch (comp.target.os.tag) { - .openbsd, .driverkit, .ios, .macos, .tvos, .visionos, .watchos => { + .openbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { try w.writeAll("#define __STDC_NO_THREADS__ 1\n"); }, .ps4, .ps5 => { diff --git a/lib/compiler/aro/aro/Driver.zig b/lib/compiler/aro/aro/Driver.zig index ef871d7d26..d6e35c5761 100644 --- a/lib/compiler/aro/aro/Driver.zig +++ b/lib/compiler/aro/aro/Driver.zig @@ -1467,6 +1467,7 @@ pub fn getPICMode(d: *Driver, lastpic: []const u8) Compilation.Error!struct { ba // generation, independent of the argument order. if (kernel_or_kext and (!(target.os.tag != .ios) or (target.os.isAtLeast(.ios, .{ .major = 6, .minor = 0, .patch = 0 }) orelse false)) and + (!(target.os.tag != .maccatalyst) or (target.os.isAtLeast(.maccatalyst, .{ .major = 6, .minor = 0, .patch = 0 }) orelse false)) and !(target.os.tag != .watchos) and !(target.os.tag != .driverkit)) { diff --git a/lib/compiler/aro/aro/TypeStore.zig b/lib/compiler/aro/aro/TypeStore.zig index 8f19e318fa..2e3fd89c84 100644 --- a/lib/compiler/aro/aro/TypeStore.zig +++ b/lib/compiler/aro/aro/TypeStore.zig @@ -2091,7 +2091,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { .xcore, => return .void_pointer, .aarch64, .aarch64_be => switch (comp.target.os.tag) { - .driverkit, .ios, .macos, .tvos, .visionos, .watchos, .windows => return .char_pointer, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .windows => return .char_pointer, else => .aarch64_va_list, }, .arm, .armeb, .thumb, .thumbeb => .arm_va_list, diff --git a/lib/compiler/aro/aro/target.zig b/lib/compiler/aro/aro/target.zig index 7f918b1b75..d973b866c3 100644 --- a/lib/compiler/aro/aro/target.zig +++ b/lib/compiler/aro/aro/target.zig @@ -674,7 +674,7 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 { .emscripten => "emscripten", .uefi => "windows", .macos => "macosx", - .ios => "ios", + .ios, .maccatalyst => "ios", .tvos => "tvos", .watchos => "watchos", .driverkit => "driverkit", @@ -703,7 +703,8 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 { writer.writeByte('-') catch unreachable; const llvm_abi = switch (target.abi) { - .none, .ilp32 => "unknown", + .none => if (target.os.tag == .maccatalyst) "macabi" else "unknown", + .ilp32 => "unknown", .gnu => "gnu", .gnuabin32 => "gnuabin32", .gnuabi64 => "gnuabi64", @@ -728,7 +729,6 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 { .msvc => "msvc", .itanium => "itanium", .simulator => "simulator", - .macabi => "macabi", .ohos => "ohos", .ohoseabi => "ohoseabi", }; @@ -742,6 +742,7 @@ pub fn isPIEDefault(target: std.Target) DefaultPIStatus { return switch (target.os.tag) { .haiku, + .maccatalyst, .macos, .ios, .tvos, @@ -809,6 +810,7 @@ pub fn isPICdefault(target: std.Target) DefaultPIStatus { return switch (target.os.tag) { .haiku, + .maccatalyst, .macos, .ios, .tvos, @@ -917,6 +919,7 @@ pub fn isPICDefaultForced(target: std.Target) DefaultPIStatus { return if (target.cpu.arch == .x86_64) .yes else .no; }, + .maccatalyst, .macos, .ios, .tvos, diff --git a/lib/compiler_rt/clear_cache.zig b/lib/compiler_rt/clear_cache.zig index 0c05e12d77..6b0fc18082 100644 --- a/lib/compiler_rt/clear_cache.zig +++ b/lib/compiler_rt/clear_cache.zig @@ -49,7 +49,7 @@ fn clear_cache(start: usize, end: usize) callconv(.c) void { else => false, }; const apple = switch (os) { - .ios, .macos, .watchos, .tvos, .visionos => true, + .ios, .maccatalyst, .macos, .watchos, .tvos, .visionos => true, else => false, }; if (x86) { diff --git a/lib/std/Build/Cache.zig b/lib/std/Build/Cache.zig index b966c25efc..892ff5cd9e 100644 --- a/lib/std/Build/Cache.zig +++ b/lib/std/Build/Cache.zig @@ -538,7 +538,7 @@ pub const Manifest = struct { // disambiguates by returning EEXIST, indicating original // failure was a race, or ENOENT, indicating deletion of // the directory of our open handle. - if (builtin.os.tag != .macos) { + if (!builtin.os.tag.isDarwin()) { self.diagnostic = .{ .manifest_create = error.FileNotFound }; return error.CacheCheckFailed; } diff --git a/lib/std/Io.zig b/lib/std/Io.zig index ba82b8fb59..02fda4743f 100644 --- a/lib/std/Io.zig +++ b/lib/std/Io.zig @@ -564,7 +564,7 @@ pub const Evented = switch (builtin.os.tag) { .x86_64, .aarch64 => @import("Io/IoUring.zig"), else => void, // context-switching code not implemented yet }, - .dragonfly, .freebsd, .netbsd, .openbsd, .macos, .ios, .tvos, .visionos, .watchos => switch (builtin.cpu.arch) { + .dragonfly, .freebsd, .netbsd, .openbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (builtin.cpu.arch) { .x86_64, .aarch64 => @import("Io/Kqueue.zig"), else => void, // context-switching code not implemented yet }, diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index c0dac8a796..2d569f8f9c 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -5140,11 +5140,11 @@ fn clockToPosix(clock: Io.Clock) posix.clockid_t { return switch (clock) { .real => posix.CLOCK.REALTIME, .awake => switch (native_os) { - .macos, .ios, .watchos, .tvos => posix.CLOCK.UPTIME_RAW, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => posix.CLOCK.UPTIME_RAW, else => posix.CLOCK.MONOTONIC, }, .boot => switch (native_os) { - .macos, .ios, .watchos, .tvos => posix.CLOCK.MONOTONIC_RAW, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => posix.CLOCK.MONOTONIC_RAW, // On freebsd derivatives, use MONOTONIC_FAST as currently there's // no precision tradeoff. .freebsd, .dragonfly => posix.CLOCK.MONOTONIC_FAST, @@ -5687,7 +5687,7 @@ fn futexWait(t: *Threaded, ptr: *const std.atomic.Value(u32), expect: u32) Io.Ca else => unreachable, }; }, - .driverkit, .ios, .macos, .tvos, .visionos, .watchos => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { const c = std.c; const flags: c.UL = .{ .op = .COMPARE_AND_WAIT, @@ -5774,7 +5774,7 @@ pub fn futexWaitUncancelable(ptr: *const std.atomic.Value(u32), expect: u32) voi else => recoverableOsBugDetected(), } }, - .driverkit, .ios, .macos, .tvos, .visionos, .watchos => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { const c = std.c; const flags: c.UL = .{ .op = .COMPARE_AND_WAIT, @@ -5872,7 +5872,7 @@ pub fn futexWake(ptr: *const std.atomic.Value(u32), max_waiters: u32) void { else => return recoverableOsBugDetected(), // deadlock due to operating system bug } }, - .driverkit, .ios, .macos, .tvos, .visionos, .watchos => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { const c = std.c; const flags: c.UL = .{ .op = .COMPARE_AND_WAIT, diff --git a/lib/std/Progress.zig b/lib/std/Progress.zig index d2e962a8c2..b2d4e3fafe 100644 --- a/lib/std/Progress.zig +++ b/lib/std/Progress.zig @@ -1549,11 +1549,13 @@ const have_sigwinch = switch (builtin.os.tag) { .netbsd, .openbsd, .haiku, - .macos, + .driverkit, .ios, - .watchos, + .maccatalyst, + .macos, .tvos, .visionos, + .watchos, .dragonfly, .freebsd, .serenity, diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 81f3cc030d..0622d1c858 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -39,6 +39,7 @@ pub const Os = struct { driverkit, ios, + maccatalyst, macos, tvos, visionos, @@ -78,6 +79,7 @@ pub const Os = struct { return switch (tag) { .driverkit, .ios, + .maccatalyst, .macos, .tvos, .visionos, @@ -121,6 +123,7 @@ pub const Os = struct { .windows, .uefi => ".dll", .driverkit, .ios, + .maccatalyst, .macos, .tvos, .visionos, @@ -180,8 +183,9 @@ pub const Os = struct { .openbsd, .driverkit, - .macos, .ios, + .maccatalyst, + .macos, .tvos, .visionos, .watchos, @@ -546,7 +550,7 @@ pub const Os = struct { .max = .{ .major = 15, .minor = 6, .patch = 0 }, }, }, - .ios => .{ + .ios, .maccatalyst => .{ .semver = .{ .min = .{ .major = 15, .minor = 0, .patch = 0 }, .max = .{ .major = 18, .minor = 6, .patch = 0 }, @@ -759,7 +763,6 @@ pub const Abi = enum { msvc, itanium, simulator, - macabi, ohos, ohoseabi, @@ -885,8 +888,6 @@ pub const Abi = enum { => .eabihf, else => .none, }, - .ios => if (arch == .x86_64) .macabi else .none, - .tvos, .visionos, .watchos => if (arch == .x86_64) .simulator else .none, .windows => .gnu, .uefi => .msvc, .@"3ds" => .eabihf, @@ -902,7 +903,12 @@ pub const Abi = enum { .serenity, .dragonfly, .driverkit, + .ios, + .maccatalyst, .macos, + .tvos, + .visionos, + .watchos, .ps3, .ps4, .ps5, @@ -1018,7 +1024,7 @@ pub const ObjectFormat = enum { pub fn default(os_tag: Os.Tag, arch: Cpu.Arch) ObjectFormat { return switch (os_tag) { - .driverkit, .ios, .macos, .tvos, .visionos, .watchos => .macho, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => .macho, .plan9 => .plan9, .uefi, .windows => .coff, else => switch (arch) { @@ -1988,7 +1994,7 @@ pub const Cpu = struct { }, .armeb, .thumbeb => &arm.cpu.baseline, .aarch64 => switch (os.tag) { - .driverkit, .macos => &aarch64.cpu.apple_m1, + .driverkit, .maccatalyst, .macos => &aarch64.cpu.apple_m1, .ios, .tvos => &aarch64.cpu.apple_a7, .visionos => &aarch64.cpu.apple_m2, .watchos => &aarch64.cpu.apple_s4, @@ -2014,8 +2020,8 @@ pub const Cpu = struct { .sparc => &sparc.cpu.v9, // glibc does not work with 'plain' v8. .x86 => &x86.cpu.pentium4, .x86_64 => switch (os.tag) { - .driverkit => &x86.cpu.nehalem, - .ios, .macos, .tvos, .visionos, .watchos => &x86.cpu.core2, + .driverkit, .maccatalyst => &x86.cpu.nehalem, + .macos => &x86.cpu.core2, .ps4 => &x86.cpu.btver2, .ps5 => &x86.cpu.znver2, else => generic(arch), @@ -2112,7 +2118,7 @@ pub inline fn isMuslLibC(target: *const Target) bool { pub inline fn isDarwinLibC(target: *const Target) bool { return switch (target.abi) { - .none, .macabi, .simulator => target.os.tag.isDarwin(), + .none, .simulator => target.os.tag.isDarwin(), else => false, }; } @@ -2141,8 +2147,9 @@ pub fn requiresLibC(target: *const Target) bool { return switch (target.os.tag) { .illumos, .driverkit, - .macos, .ios, + .maccatalyst, + .macos, .tvos, .watchos, .visionos, @@ -2307,6 +2314,7 @@ pub const DynamicLinker = struct { .driverkit, .ios, + .maccatalyst, .macos, .tvos, .visionos, @@ -2722,6 +2730,7 @@ pub const DynamicLinker = struct { .driverkit, .ios, + .maccatalyst, .macos, .tvos, .visionos, @@ -3234,6 +3243,7 @@ pub fn cTypeBitSize(target: *const Target, c_type: CType) u16 { .driverkit, .ios, + .maccatalyst, .macos, .tvos, .visionos, diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index 59c6d78166..04dc1f6317 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -156,7 +156,7 @@ impl: Impl, pub const max_name_len = switch (native_os) { .linux => 15, .windows => 31, - .macos, .ios, .watchos, .tvos, .visionos => 63, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => 63, .netbsd => 31, .freebsd => 15, .openbsd => 23, @@ -234,7 +234,7 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void { else => |err| return windows.unexpectedStatus(err), } }, - .macos, .ios, .watchos, .tvos, .visionos => if (use_pthreads) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => if (use_pthreads) { // There doesn't seem to be a way to set the name for an arbitrary thread, only the current one. if (self.getHandle() != std.c.pthread_self()) return error.Unsupported; @@ -351,7 +351,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co else => |err| return windows.unexpectedStatus(err), } }, - .macos, .ios, .watchos, .tvos, .visionos => if (use_pthreads) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => if (use_pthreads) { const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); switch (@as(posix.E, @enumFromInt(err))) { .SUCCESS => return std.mem.sliceTo(buffer, 0), @@ -411,7 +411,7 @@ pub const Id = switch (native_os) { .wasi, .serenity, => u32, - .macos, .ios, .watchos, .tvos, .visionos => u64, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => u64, .windows => windows.DWORD, else => usize, }; @@ -741,7 +741,7 @@ const PosixThreadImpl = struct { .linux => { return LinuxThreadImpl.getCurrentId(); }, - .macos, .ios, .watchos, .tvos, .visionos => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { var thread_id: u64 = undefined; // Pass thread=null to get the current thread ID. assert(c.pthread_threadid_np(null, &thread_id) == 0); @@ -1734,7 +1734,7 @@ test "setName, getName" { context.test_done_event.wait(); switch (native_os) { - .macos, .ios, .watchos, .tvos, .visionos => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { const res = thread.setName("foobar"); try std.testing.expectError(error.Unsupported, res); }, diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index b190c94485..7b60289edf 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -987,7 +987,7 @@ pub const VaList = switch (builtin.cpu.arch) { .xcore, => *anyopaque, .aarch64, .aarch64_be => switch (builtin.os.tag) { - .driverkit, .ios, .macos, .tvos, .visionos, .watchos, .windows => *u8, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .windows => *u8, else => switch (builtin.zig_backend) { else => VaListAarch64, .stage2_llvm => @compileError("disabled due to miscompilations"), diff --git a/lib/std/c.zig b/lib/std/c.zig index 0bf9f40bb1..bfda9c31c9 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -115,7 +115,7 @@ pub const timespec = switch (native_os) { sec: time_t, nsec: c_long, }, - .dragonfly, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .dragonfly, .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { sec: isize, nsec: isize, }, @@ -134,7 +134,7 @@ pub const dev_t = switch (native_os) { .linux => linux.dev_t, .emscripten => emscripten.dev_t, .wasi => wasi.device_t, - .openbsd, .haiku, .illumos, .macos, .ios, .tvos, .watchos, .visionos => i32, + .openbsd, .haiku, .illumos, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => i32, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L43 .netbsd, .freebsd, .serenity => u64, else => void, @@ -145,7 +145,7 @@ pub const mode_t = switch (native_os) { .emscripten => emscripten.mode_t, .openbsd, .haiku, .netbsd, .illumos, .wasi, .windows => u32, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L44 - .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .dragonfly, .serenity => u16, + .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .dragonfly, .serenity => u16, else => u0, }; @@ -194,7 +194,7 @@ pub const passwd = switch (native_os) { dir: ?[*:0]const u8, // home directory shell: ?[*:0]const u8, // shell program }, - .netbsd, .openbsd, .macos => extern struct { + .netbsd, .openbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { name: ?[*:0]const u8, // user name passwd: ?[*:0]const u8, // encrypted password uid: uid_t, // user uid @@ -223,7 +223,7 @@ pub const passwd = switch (native_os) { }; pub const group = switch (native_os) { - .linux, .freebsd, .openbsd, .dragonfly, .netbsd, .macos => extern struct { + .linux, .freebsd, .openbsd, .dragonfly, .netbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { name: ?[*:0]const u8, passwd: ?[*:0]const u8, gid: gid_t, @@ -275,7 +275,7 @@ pub const CLOCK = clockid_t; pub const clockid_t = switch (native_os) { .linux, .emscripten => linux.clockid_t, .wasi => wasi.clockid_t, - .macos, .ios, .tvos, .watchos, .visionos => enum(u32) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => enum(u32) { REALTIME = 0, MONOTONIC = 6, MONOTONIC_RAW = 4, @@ -457,7 +457,7 @@ pub const E = switch (native_os) { DQUOT = 10069, _, }, - .macos, .ios, .tvos, .watchos, .visionos => darwin.E, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.E, .freebsd => freebsd.E, .illumos => enum(u16) { /// No error occurred. @@ -833,7 +833,7 @@ pub const F = switch (native_os) { pub const GETFL = 3; pub const SETFL = 4; }, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { /// duplicate file descriptor pub const DUPFD = 0; /// get file descriptor flags @@ -1243,7 +1243,7 @@ pub const R_OK = switch (native_os) { pub const Flock = switch (native_os) { .linux => linux.Flock, .emscripten => emscripten.Flock, - .openbsd, .dragonfly, .netbsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .openbsd, .dragonfly, .netbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { start: off_t, len: off_t, pid: pid_t, @@ -1294,7 +1294,7 @@ pub const Flock = switch (native_os) { }; pub const HOST_NAME_MAX = switch (native_os) { .linux => linux.HOST_NAME_MAX, - .macos, .ios, .tvos, .watchos, .visionos => 72, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => 72, .openbsd, .haiku, .dragonfly, .netbsd, .illumos, .freebsd => 255, // https://github.com/SerenityOS/serenity/blob/c87557e9c1865fa1a6440de34ff6ce6fc858a2b7/Kernel/API/POSIX/sys/limits.h#L22 .serenity => 64, @@ -1305,7 +1305,7 @@ pub const IOV_MAX = switch (native_os) { .emscripten => emscripten.IOV_MAX, // https://github.com/SerenityOS/serenity/blob/098af0f846a87b651731780ff48420205fd33754/Kernel/API/POSIX/sys/uio.h#L16 .openbsd, .haiku, .illumos, .wasi, .serenity => 1024, - .macos, .ios, .tvos, .watchos, .visionos => 16, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => 16, .dragonfly, .netbsd, .freebsd => KERN.IOV_MAX, else => {}, }; @@ -1524,7 +1524,7 @@ pub const KERN = switch (native_os) { pub const MADV = switch (native_os) { .linux => linux.MADV, .emscripten => emscripten.MADV, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const NORMAL = 0; pub const RANDOM = 1; pub const SEQUENTIAL = 2; @@ -1622,7 +1622,7 @@ pub const MLOCK = switch (native_os) { pub const MSF = switch (native_os) { .linux => linux.MSF, .emscripten => emscripten.MSF, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const ASYNC = 0x1; pub const INVALIDATE = 0x2; /// invalidate, leave mapped @@ -1651,7 +1651,7 @@ pub const NAME_MAX = switch (native_os) { // character, but POSIX definition says that NAME_MAX does not include the // terminating null. // https://github.com/SerenityOS/serenity/blob/c87557e9c1865fa1a6440de34ff6ce6fc858a2b7/Kernel/API/POSIX/sys/limits.h#L20 - .haiku, .openbsd, .dragonfly, .netbsd, .illumos, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => 255, + .haiku, .openbsd, .dragonfly, .netbsd, .illumos, .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .serenity => 255, else => {}, }; pub const PATH_MAX = switch (native_os) { @@ -1659,7 +1659,7 @@ pub const PATH_MAX = switch (native_os) { .emscripten => emscripten.PATH_MAX, .wasi => 4096, .windows => 260, - .openbsd, .haiku, .dragonfly, .netbsd, .illumos, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => 1024, + .openbsd, .haiku, .dragonfly, .netbsd, .illumos, .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .serenity => 1024, else => {}, }; @@ -1676,7 +1676,7 @@ pub const POLL = switch (native_os) { pub const NVAL = 0x4000; }, .windows => ws2_32.POLL, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const IN = 0x001; pub const PRI = 0x002; pub const OUT = 0x004; @@ -1823,7 +1823,7 @@ pub const PROT = switch (native_os) { /// page can be executed pub const EXEC = 0x4; }, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { /// [MC2] no permissions pub const NONE: vm_prot_t = 0x00; /// [MC2] pages can be read @@ -1846,7 +1846,7 @@ pub const RLIM = switch (native_os) { .linux => linux.RLIM, .emscripten => emscripten.RLIM, // https://github.com/SerenityOS/serenity/blob/aae106e37b48f2158e68902293df1e4bf7b80c0f/Userland/Libraries/LibC/sys/resource.h#L52 - .openbsd, .haiku, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => struct { + .openbsd, .haiku, .dragonfly, .netbsd, .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .serenity => struct { /// No limit pub const INFINITY: rlim_t = (1 << 63) - 1; @@ -1903,7 +1903,7 @@ pub const S = switch (native_os) { return m & IFMT == IFSOCK; } }, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const IFMT = 0o170000; pub const IFIFO = 0o010000; @@ -2396,7 +2396,7 @@ pub const S = switch (native_os) { pub const SA = switch (native_os) { .linux => linux.SA, .emscripten => emscripten.SA, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { /// take signal on signal stack pub const ONSTACK = 0x0001; /// restart system on signal return @@ -2502,7 +2502,7 @@ pub const _SC = if (builtin.abi.isAndroid()) enum(c_int) { PAGESIZE = 39, NPROCESSORS_ONLN = 97, } else switch (native_os) { - .driverkit, .ios, .macos, .tvos, .visionos, .watchos => enum(c_int) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => enum(c_int) { PAGESIZE = 29, }, .dragonfly => enum(c_int) { @@ -2562,7 +2562,7 @@ pub const SEEK = switch (native_os) { pub const END: wasi.whence_t = .END; }, // https://github.com/SerenityOS/serenity/blob/808ce594db1f2190e5212a250e900bde2ffe710b/Kernel/API/POSIX/stdio.h#L15-L17 - .openbsd, .haiku, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .windows, .serenity => struct { + .openbsd, .haiku, .netbsd, .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .windows, .serenity => struct { pub const SET = 0; pub const CUR = 1; pub const END = 2; @@ -2622,7 +2622,7 @@ pub const SIG = switch (native_os) { /// Signal error value (returned by signal call on error) pub const ERR = -1; }, - .macos, .ios, .tvos, .watchos, .visionos => enum(u32) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => enum(u32) { pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); @@ -3185,7 +3185,7 @@ pub const Sigaction = switch (native_os) { else => common_linux_Sigaction, }, .emscripten => emscripten.Sigaction, - .netbsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .netbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { pub const handler_fn = *align(1) const fn (SIG) callconv(.c) void; pub const sigaction_fn = *const fn (SIG, *const siginfo_t, ?*anyopaque) callconv(.c) void; @@ -3273,7 +3273,7 @@ pub const Sigaction = switch (native_os) { }; pub const T = switch (native_os) { .linux => linux.T, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const IOCGWINSZ = ior(0x40000000, 't', 104, @sizeOf(winsize)); fn ior(inout: u32, group_arg: usize, num: usize, len: usize) usize { @@ -3664,7 +3664,7 @@ pub const T = switch (native_os) { }; pub const IOCPARM_MASK = switch (native_os) { .windows => ws2_32.IOCPARM_MASK, - .macos, .ios, .tvos, .watchos, .visionos => 0x1fff, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => 0x1fff, else => void, }; pub const TCSA = std.posix.TCSA; @@ -3679,7 +3679,7 @@ pub const VDSO = switch (native_os) { pub const W = switch (native_os) { .linux => linux.W, .emscripten => emscripten.W, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { /// [XSI] no hang in wait/no child to reap pub const NOHANG = 0x00000001; /// [XSI] notify on stop, untraced child @@ -3939,7 +3939,7 @@ pub const accept_filter_arg = switch (native_os) { // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/sys/socket.h#L164 // https://github.com/NetBSD/src/blob/cad5c68a8524927f65e22ad651de3905382be6e0/sys/sys/socket.h#L188 // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/socket.h#L504 - .freebsd, .dragonfly, .netbsd, .macos, .driverkit, .ios, .tvos, .watchos, .visionos => extern struct { + .freebsd, .dragonfly, .netbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { name: [16]u8, arg: [240]u8, }, @@ -3948,7 +3948,7 @@ pub const accept_filter_arg = switch (native_os) { pub const clock_t = switch (native_os) { .linux => linux.clock_t, .emscripten => emscripten.clock_t, - .macos, .ios, .tvos, .watchos, .visionos => c_ulong, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => c_ulong, .freebsd => isize, .openbsd, .illumos => i64, .netbsd => u32, @@ -4034,7 +4034,7 @@ pub const in_pktinfo = switch (native_os) { .linux => linux.in_pktinfo, // https://github.com/illumos/illumos-gate/blob/608eb926e14f4ba4736b2d59e891335f1cba9e1e/usr/src/uts/common/netinet/in.h#L1132 // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet/in.h#L696 - .illumos, .driverkit, .ios, .macos, .tvos, .watchos, .visionos => extern struct { + .illumos, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { ifindex: u32, spec_dst: u32, addr: u32, @@ -4051,7 +4051,7 @@ pub const in6_pktinfo = switch (native_os) { // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/netinet6/in6.h#L737 // https://github.com/haiku/haiku/blob/2aab5f5f14aeb3f34c3a3d9a9064cc3c0d914bea/headers/posix/netinet6/in6.h#L63 // https://github.com/SerenityOS/serenity/blob/5bd8af99be0bc4b2e14f361fd7d7590e6bcfa4d6/Kernel/API/POSIX/sys/socket.h#L122 - .freebsd, .dragonfly, .netbsd, .openbsd, .illumos, .driverkit, .ios, .macos, .tvos, .watchos, .visionos, .haiku, .serenity => extern struct { + .freebsd, .dragonfly, .netbsd, .openbsd, .illumos, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .haiku, .serenity => extern struct { addr: [16]u8, ifindex: u32, }, @@ -4084,10 +4084,11 @@ pub const linger = switch (native_os) { // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/socket.h#L498 .driverkit, .ios, + .maccatalyst, .macos, .tvos, - .watchos, .visionos, + .watchos, => extern struct { onoff: i32, // non-zero to linger on close linger: i32, // time to linger in seconds @@ -4104,9 +4105,10 @@ pub const msghdr = switch (native_os) { .netbsd, .haiku, .illumos, - .macos, .driverkit, .ios, + .maccatalyst, + .macos, .tvos, .visionos, .watchos, @@ -4139,9 +4141,10 @@ pub const msghdr_const = switch (native_os) { .netbsd, .haiku, .illumos, - .macos, .driverkit, .ios, + .maccatalyst, + .macos, .tvos, .visionos, .watchos, @@ -4191,9 +4194,10 @@ pub const cmsghdr = switch (native_os) { // https://github.com/haiku/haiku/blob/b54f586058fd6623645512e4631468cede9933b9/headers/posix/sys/socket.h#L132 .haiku, // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/socket.h#L1041 - .macos, .driverkit, .ios, + .maccatalyst, + .macos, .tvos, .visionos, .watchos, @@ -4215,7 +4219,7 @@ pub const nfds_t = switch (native_os) { .emscripten => emscripten.nfds_t, .haiku, .illumos, .wasi => usize, .windows => c_ulong, - .openbsd, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => u32, + .openbsd, .dragonfly, .netbsd, .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => u32, // https://github.com/SerenityOS/serenity/blob/265764ff2fec038855193296588a887fc322d76a/Kernel/API/POSIX/poll.h#L32 .serenity => c_uint, else => void, @@ -4251,7 +4255,7 @@ pub const pollfd = switch (native_os) { pub const rlim_t = switch (native_os) { .linux => linux.rlim_t, .emscripten => emscripten.rlim_t, - .openbsd, .netbsd, .illumos, .macos, .ios, .tvos, .watchos, .visionos => u64, + .openbsd, .netbsd, .illumos, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => u64, .haiku, .dragonfly, .freebsd => i64, // https://github.com/SerenityOS/serenity/blob/aae106e37b48f2158e68902293df1e4bf7b80c0f/Userland/Libraries/LibC/sys/resource.h#L54 .serenity => usize, @@ -4271,7 +4275,7 @@ pub const rlimit = switch (native_os) { pub const rlimit_resource = switch (native_os) { .linux => linux.rlimit_resource, .emscripten => emscripten.rlimit_resource, - .openbsd, .macos, .ios, .tvos, .watchos, .visionos => enum(c_int) { + .openbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => enum(c_int) { CPU = 0, FSIZE = 1, DATA = 2, @@ -4378,7 +4382,7 @@ pub const rlimit_resource = switch (native_os) { pub const rusage = switch (native_os) { .linux => linux.rusage, .emscripten => emscripten.rusage, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { utime: timeval, stime: timeval, maxrss: isize, @@ -4449,7 +4453,7 @@ pub const rusage = switch (native_os) { pub const siginfo_t = switch (native_os) { .linux => linux.siginfo_t, .emscripten => emscripten.siginfo_t, - .driverkit, .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { signo: SIG, errno: c_int, code: c_int, @@ -4639,7 +4643,7 @@ pub const sigset_t = switch (native_os) { .emscripten => emscripten.sigset_t, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L19 .openbsd, .serenity => u32, - .macos, .ios, .tvos, .watchos, .visionos => darwin.sigset_t, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.sigset_t, .dragonfly, .netbsd, .illumos, .freebsd => extern struct { __bits: [SIG.WORDS]u32, }, @@ -4669,7 +4673,7 @@ pub const addrinfo = if (builtin.abi.isAndroid()) extern struct { } else switch (native_os) { .linux, .emscripten => linux.addrinfo, .windows => ws2_32.addrinfo, - .freebsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { flags: AI, family: i32, socktype: i32, @@ -4735,7 +4739,7 @@ pub const addrinfo = if (builtin.abi.isAndroid()) extern struct { pub const sockaddr = switch (native_os) { .linux, .emscripten => linux.sockaddr, .windows => ws2_32.sockaddr, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { len: u8, family: sa_family_t, data: [14]u8, @@ -5077,7 +5081,7 @@ pub const in_port_t = u16; pub const sa_family_t = switch (native_os) { .linux, .emscripten => linux.sa_family_t, .windows => ws2_32.ADDRESS_FAMILY, - .openbsd, .haiku, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => u8, + .openbsd, .haiku, .dragonfly, .netbsd, .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => u8, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L66 .illumos, .serenity => u16, else => void, @@ -5130,7 +5134,7 @@ pub const AF = if (builtin.abi.isAndroid()) struct { } else switch (native_os) { .linux, .emscripten => linux.AF, .windows => ws2_32.AF, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const UNSPEC = 0; pub const LOCAL = 1; pub const UNIX = LOCAL; @@ -5416,7 +5420,7 @@ pub const PF = if (builtin.abi.isAndroid()) struct { pub const PF_MAX = AF.MAX; } else switch (native_os) { .linux, .emscripten => linux.PF, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const UNSPEC = AF.UNSPEC; pub const LOCAL = AF.LOCAL; pub const UNIX = PF.LOCAL; @@ -5650,7 +5654,7 @@ pub const PF = if (builtin.abi.isAndroid()) struct { pub const DT = switch (native_os) { .linux => linux.DT, // https://github.com/SerenityOS/serenity/blob/1262a7d1424d0d2e89d80644409721cbf056ab17/Kernel/API/POSIX/dirent.h#L16-L35 - .netbsd, .freebsd, .openbsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => struct { + .netbsd, .freebsd, .openbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .serenity => struct { pub const UNKNOWN = 0; pub const FIFO = 1; pub const CHR = 2; @@ -5679,7 +5683,7 @@ pub const MSG = switch (native_os) { .linux => linux.MSG, .emscripten => emscripten.MSG, .windows => ws2_32.MSG, - .driverkit, .macos, .ios, .tvos, .watchos, .visionos => darwin.MSG, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.MSG, .haiku => struct { pub const OOB = 0x0001; pub const PEEK = 0x0002; @@ -5796,7 +5800,7 @@ pub const SOCK = switch (native_os) { .linux => linux.SOCK, .emscripten => emscripten.SOCK, .windows => ws2_32.SOCK, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const STREAM = 1; pub const DGRAM = 2; pub const RAW = 3; @@ -5897,7 +5901,7 @@ pub const SOCK = switch (native_os) { else => void, }; pub const TCP = switch (native_os) { - .macos => darwin.TCP, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.TCP, .linux => linux.TCP, .emscripten => emscripten.TCP, .windows => ws2_32.TCP, @@ -5911,7 +5915,7 @@ pub const TCP = switch (native_os) { pub const IPPROTO = switch (native_os) { .linux, .emscripten => linux.IPPROTO, .windows => ws2_32.IPPROTO, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const ICMP = 1; pub const ICMPV6 = 58; pub const TCP = 6; @@ -6543,7 +6547,7 @@ pub const SOL = switch (native_os) { .linux => linux.SOL, .emscripten => emscripten.SOL, .windows => ws2_32.SOL, - .openbsd, .haiku, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => struct { + .openbsd, .haiku, .dragonfly, .netbsd, .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const SOCKET = 0xffff; }, .illumos => struct { @@ -6562,7 +6566,7 @@ pub const SO = switch (native_os) { .linux => linux.SO, .emscripten => emscripten.SO, .windows => ws2_32.SO, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const DEBUG = 0x0001; pub const ACCEPTCONN = 0x0002; pub const REUSEADDR = 0x0004; @@ -6807,7 +6811,7 @@ pub const SOMAXCONN = switch (native_os) { // https://github.com/NetBSD/src/blob/a673fb3f8487e974c669216064f7588207229fea/sys/sys/socket.h#L472 // https://github.com/openbsd/src/blob/8ba9cd88f10123fef7af805b8e5ccc2463ad8fa4/sys/sys/socket.h#L483 // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/socket.h#L815 - .freebsd, .dragonfly, .netbsd, .openbsd, .driverkit, .macos, .ios, .tvos, .watchos, .visionos => 128, + .freebsd, .dragonfly, .netbsd, .openbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => 128, else => void, }; pub const SCM = switch (native_os) { @@ -6856,7 +6860,7 @@ pub const SCM = switch (native_os) { pub const TIMESTAMP = 0x04; }, // https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/sys/socket.h#L1114 - .driverkit, .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const RIGHTS = 1; pub const TIMESTAMP = 2; pub const CREDS = 3; @@ -6870,7 +6874,7 @@ pub const IFNAMESIZE = switch (native_os) { .emscripten => emscripten.IFNAMESIZE, .windows => 30, // https://github.com/SerenityOS/serenity/blob/9882848e0bf783dfc8e8a6d887a848d70d9c58f4/Kernel/API/POSIX/net/if.h#L50 - .openbsd, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => 16, + .openbsd, .dragonfly, .netbsd, .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .serenity => 16, .illumos => 32, else => {}, }; @@ -6921,7 +6925,7 @@ pub const timeval = switch (native_os) { sec: c_long, usec: c_long, }, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { sec: c_long, usec: i32, }, @@ -6941,7 +6945,7 @@ pub const timeval = switch (native_os) { pub const timezone = switch (native_os) { .linux => linux.timezone, .emscripten => emscripten.timezone, - .openbsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .openbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { minuteswest: i32, dsttime: i32, }, @@ -6968,7 +6972,7 @@ pub const utsname = switch (native_os) { machine: [256:0]u8, domainname: [256:0]u8, }, - .macos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { sysname: [255:0]u8, nodename: [255:0]u8, release: [255:0]u8, @@ -6999,7 +7003,7 @@ pub const _errno = switch (native_os) { .emscripten => private.__errno_location, .wasi, .dragonfly => private.errnoFromThreadLocal, .windows => private._errno, - .macos, .ios, .tvos, .watchos, .visionos, .freebsd => private.__error, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .freebsd => private.__error, .illumos => private.___errno, .openbsd, .netbsd => private.__errno, .haiku => haiku._errnop, @@ -7070,7 +7074,7 @@ pub const RTLD = switch (native_os) { TRACE: bool = false, _: u22 = 0, }, - .macos, .ios, .tvos, .watchos, .visionos => packed struct(u32) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => packed struct(u32) { LAZY: bool = false, NOW: bool = false, LOCAL: bool = false, @@ -7102,7 +7106,7 @@ pub const dirent = switch (native_os) { type: u8, name: [256]u8, }, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { ino: u64, seekoff: u64, reclen: u16, @@ -7246,7 +7250,7 @@ pub const AI = if (builtin.abi.isAndroid()) packed struct(u32) { ADDRCONFIG: bool = false, _: u25 = 0, }, - .macos, .ios, .tvos, .watchos, .visionos => packed struct(u32) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => packed struct(u32) { PASSIVE: bool = false, CANONNAME: bool = false, NUMERICHOST: bool = false, @@ -7363,7 +7367,7 @@ pub const EAI = if (builtin.abi.isAndroid()) enum(c_int) { _, }, - .haiku, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => enum(c_int) { + .haiku, .dragonfly, .netbsd, .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => enum(c_int) { /// address family for hostname not supported ADDRFAMILY = 1, /// temporary failure in name resolution @@ -7697,7 +7701,7 @@ pub const Stat = switch (native_os) { }; } }, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { dev: i32, mode: u16, nlink: u16, @@ -7940,7 +7944,7 @@ pub const pthread_mutex_t = switch (native_os) { else => @compileError("unsupported ABI"), }; }, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { sig: c_long = 0x32AAABA7, data: [data_len]u8 = [_]u8{0} ** data_len, @@ -7997,7 +8001,7 @@ pub const pthread_cond_t = switch (native_os) { .linux => extern struct { data: [48]u8 align(@alignOf(usize)) = [_]u8{0} ** 48, }, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { sig: c_long = 0x3CB0B1BB, data: [data_len]u8 = [_]u8{0} ** data_len, const data_len = if (@sizeOf(usize) == 8) 40 else 24; @@ -8056,7 +8060,7 @@ pub const pthread_rwlock_t = switch (native_os) { data: [56]u8 align(@alignOf(usize)) = [_]u8{0} ** 56, }, }, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { sig: c_long = 0x2DA8B3B4, data: [192]u8 = [_]u8{0} ** 192, }, @@ -8108,7 +8112,7 @@ pub const pthread_attr_t = switch (native_os) { __size: [56]u8, __align: c_long, }, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { __sig: c_long, __opaque: [56]u8, }, @@ -8136,7 +8140,7 @@ pub const pthread_attr_t = switch (native_os) { pub const pthread_key_t = switch (native_os) { .linux, .emscripten => c_uint, - .macos, .ios, .tvos, .watchos, .visionos => c_ulong, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => c_ulong, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L65 .openbsd, .illumos, .serenity => c_int, else => void, @@ -8169,7 +8173,7 @@ pub const sem_t = switch (native_os) { .linux, .emscripten => extern struct { __size: [4 * @sizeOf(usize)]u8 align(@alignOf(usize)), }, - .macos, .ios, .tvos, .watchos, .visionos => c_int, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => c_int, .freebsd => extern struct { _magic: u32, _kern: extern struct { @@ -8213,7 +8217,7 @@ pub const Kevent = switch (native_os) { data: i64, udata: usize, }, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { ident: usize, filter: i16, flags: u16, @@ -8293,7 +8297,7 @@ pub const AT = switch (native_os) { /// Remove directory instead of unlinking file pub const REMOVEDIR = 0x200; }, - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const FDCWD = -2; /// Use effective ids in access check pub const EACCESS = 0x0010; @@ -8548,7 +8552,7 @@ pub const O = switch (native_os) { DIRECTORY: bool = false, _: u10 = 0, }, - .macos, .ios, .tvos, .watchos, .visionos => packed struct(u32) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => packed struct(u32) { ACCMODE: std.posix.ACCMODE = .RDONLY, NONBLOCK: bool = false, APPEND: bool = false, @@ -8727,7 +8731,7 @@ pub const MAP = switch (native_os) { NORESERVE: bool = false, _: u27 = 0, }, - .macos, .ios, .tvos, .watchos, .visionos => packed struct(u32) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => packed struct(u32) { TYPE: enum(u4) { SHARED = 0x01, PRIVATE = 0x02, @@ -8812,7 +8816,7 @@ pub const cc_t = u8; /// Indices into the `cc` array in the `termios` struct. pub const V = switch (native_os) { .linux => linux.V, - .macos, .ios, .tvos, .watchos, .visionos, .netbsd, .openbsd => enum { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .netbsd, .openbsd => enum { EOF, EOL, EOL2, @@ -8932,7 +8936,7 @@ pub const V = switch (native_os) { pub const NCCS = switch (native_os) { .linux => linux.NCCS, - .macos, .ios, .tvos, .watchos, .visionos, .freebsd, .netbsd, .openbsd, .dragonfly => 20, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .freebsd, .netbsd, .openbsd, .dragonfly => 20, .haiku => 11, .illumos => 19, // https://github.com/SerenityOS/serenity/blob/d277cdfd4c7ed21d5248a83217ae03b9f890c3c8/Kernel/API/POSIX/termios.h#L15 @@ -8942,7 +8946,7 @@ pub const NCCS = switch (native_os) { pub const termios = switch (native_os) { .linux => linux.termios, - .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { iflag: tc_iflag_t, oflag: tc_oflag_t, cflag: tc_cflag_t, @@ -8993,7 +8997,7 @@ pub const termios = switch (native_os) { pub const tc_iflag_t = switch (native_os) { .linux => linux.tc_iflag_t, - .macos, .ios, .tvos, .watchos, .visionos => packed struct(u64) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => packed struct(u64) { IGNBRK: bool = false, BRKINT: bool = false, IGNPAR: bool = false, @@ -9104,7 +9108,7 @@ pub const tc_iflag_t = switch (native_os) { pub const tc_oflag_t = switch (native_os) { .linux => linux.tc_oflag_t, - .macos, .ios, .tvos, .watchos, .visionos => packed struct(u64) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => packed struct(u64) { OPOST: bool = false, ONLCR: bool = false, OXTABS: bool = false, @@ -9202,7 +9206,7 @@ pub const CSIZE = switch (native_os) { pub const tc_cflag_t = switch (native_os) { .linux => linux.tc_cflag_t, - .macos, .ios, .tvos, .watchos, .visionos => packed struct(u64) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => packed struct(u64) { CIGNORE: bool = false, _1: u5 = 0, CSTOPB: bool = false, @@ -9351,7 +9355,7 @@ pub const tc_cflag_t = switch (native_os) { pub const tc_lflag_t = switch (native_os) { .linux => linux.tc_lflag_t, - .macos, .ios, .tvos, .watchos, .visionos => packed struct(u64) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => packed struct(u64) { ECHOKE: bool = false, ECHOE: bool = false, ECHOK: bool = false, @@ -9498,7 +9502,7 @@ pub const tc_lflag_t = switch (native_os) { pub const speed_t = switch (native_os) { .linux => linux.speed_t, - .macos, .ios, .tvos, .watchos, .visionos, .openbsd => enum(u64) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .openbsd => enum(u64) { B0 = 0, B50 = 50, B75 = 75, @@ -9693,7 +9697,7 @@ pub const NSIG = switch (native_os) { .windows => 23, .haiku => 65, .netbsd, .freebsd => 32, - .macos => darwin.NSIG, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.NSIG, .illumos => 75, // https://github.com/SerenityOS/serenity/blob/046c23f567a17758d762a33bdf04bacbfd088f9f/Kernel/API/POSIX/signal_numbers.h#L42 .openbsd, .serenity => 33, @@ -9701,7 +9705,7 @@ pub const NSIG = switch (native_os) { }; pub const MINSIGSTKSZ = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => 32768, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => 32768, .freebsd => switch (builtin.cpu.arch) { .powerpc64, .powerpc64le, .x86, .x86_64 => 2048, .arm, .aarch64, .riscv64 => 4096, @@ -9715,7 +9719,7 @@ pub const MINSIGSTKSZ = switch (native_os) { else => {}, }; pub const SIGSTKSZ = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => 131072, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => 131072, .netbsd, .freebsd => MINSIGSTKSZ + 32768, .illumos => 8192, .haiku => 16384, @@ -9726,7 +9730,7 @@ pub const SIGSTKSZ = switch (native_os) { }; pub const SS = switch (native_os) { .linux => linux.SS, - .openbsd, .macos, .ios, .tvos, .watchos, .visionos, .netbsd, .freebsd => struct { + .openbsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .netbsd, .freebsd => struct { pub const ONSTACK = 1; pub const DISABLE = 4; }, @@ -9739,7 +9743,7 @@ pub const SS = switch (native_os) { }; pub const EV = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { /// add event to kq (implies enable) pub const ADD = 0x0001; /// delete event from kq @@ -9879,7 +9883,7 @@ pub const EV = switch (native_os) { }; pub const EVFILT = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { pub const READ = -1; pub const WRITE = -2; /// attached to aio requests @@ -10002,7 +10006,7 @@ pub const EVFILT = switch (native_os) { }; pub const NOTE = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct { /// On input, TRIGGER causes the event to be triggered for output. pub const TRIGGER = 0x01000000; /// ignore input fflags @@ -10293,7 +10297,7 @@ pub extern "c" fn sigwait(set: ?*sigset_t, sig: ?*c_int) c_int; pub extern "c" fn alarm(seconds: c_uint) c_uint; pub const close = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => darwin.@"close$NOCANCEL", + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.@"close$NOCANCEL", else => private.close, }; @@ -10308,7 +10312,7 @@ pub const clock_gettime = switch (native_os) { }; pub const fstat = switch (native_os) { - .macos => switch (native_arch) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (native_arch) { .x86_64 => private.@"fstat$INODE64", else => private.fstat, }, @@ -10317,7 +10321,7 @@ pub const fstat = switch (native_os) { }; pub const fstatat = switch (native_os) { - .macos => switch (native_arch) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (native_arch) { .x86_64 => private.@"fstatat$INODE64", else => private.fstatat, }, @@ -10351,7 +10355,7 @@ pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_ pub const arc4random_buf = switch (native_os) { .linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {}, - .dragonfly, .netbsd, .freebsd, .illumos, .openbsd, .serenity, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf, + .dragonfly, .netbsd, .freebsd, .illumos, .openbsd, .serenity, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => private.arc4random_buf, else => {}, }; pub const getentropy = switch (native_os) { @@ -10404,7 +10408,7 @@ pub extern "c" fn ftruncate64(fd: c_int, length: off_t) c_int; pub extern "c" fn fallocate(fd: fd_t, mode: c_int, offset: off_t, len: off_t) c_int; pub const sendfile = switch (native_os) { .freebsd => freebsd.sendfile, - .macos, .ios, .tvos, .watchos, .visionos => darwin.sendfile, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.sendfile, .linux => private.sendfile, else => {}, }; @@ -10445,7 +10449,7 @@ pub extern "c" fn madvise( ) c_int; pub const getdirentries = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => private.__getdirentries64, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => private.__getdirentries64, else => private.getdirentries, }; @@ -10500,7 +10504,7 @@ pub const nanosleep = switch (native_os) { }; pub const readdir = switch (native_os) { - .macos => switch (native_arch) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (native_arch) { .x86_64 => private.@"readdir$INODE64", else => private.readdir, }, @@ -10509,7 +10513,7 @@ pub const readdir = switch (native_os) { }; pub const realpath = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => private.@"realpath$DARWIN_EXTSN", + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => private.@"realpath$DARWIN_EXTSN", else => private.realpath, }; @@ -10573,7 +10577,7 @@ pub const socketpair = switch (native_os) { }; pub const stat = switch (native_os) { - .macos => switch (native_arch) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (native_arch) { .x86_64 => private.@"stat$INODE64", else => private.stat, }, @@ -10585,7 +10589,7 @@ pub const _msize = switch (native_os) { else => {}, }; pub const malloc_size = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos, .serenity => private.malloc_size, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .serenity => private.malloc_size, else => {}, }; pub const malloc_usable_size = switch (native_os) { @@ -10593,7 +10597,7 @@ pub const malloc_usable_size = switch (native_os) { else => {}, }; pub const posix_memalign = switch (native_os) { - .dragonfly, .netbsd, .freebsd, .illumos, .openbsd, .linux, .macos, .ios, .tvos, .watchos, .visionos, .serenity => private.posix_memalign, + .dragonfly, .netbsd, .freebsd, .illumos, .openbsd, .linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .serenity => private.posix_memalign, else => {}, }; pub const sysconf = switch (native_os) { @@ -10602,7 +10606,7 @@ pub const sysconf = switch (native_os) { }; pub const sf_hdtr = switch (native_os) { - .freebsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .freebsd, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct { headers: ?[*]const iovec_const, hdr_cnt: c_int, trailers: ?[*]const iovec_const, @@ -10661,15 +10665,17 @@ pub extern "c" fn wait4(pid: pid_t, status: ?*c_int, options: c_int, ru: ?*rusag pub const fork = switch (native_os) { .dragonfly, .freebsd, - .ios, .linux, + .driverkit, + .ios, + .maccatalyst, .macos, + .tvos, + .visionos, + .watchos, .netbsd, .openbsd, .illumos, - .tvos, - .watchos, - .visionos, .haiku, .serenity, => private.fork, @@ -10813,7 +10819,7 @@ pub extern "c" fn pthread_getspecific(key: pthread_key_t) ?*anyopaque; pub extern "c" fn pthread_setspecific(key: pthread_key_t, value: ?*anyopaque) c_int; pub extern "c" fn pthread_sigmask(how: c_int, set: *const sigset_t, oldset: *sigset_t) c_int; pub const pthread_setname_np = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => darwin.pthread_setname_np, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.pthread_setname_np, .illumos => illumos.pthread_setname_np, .netbsd => netbsd.pthread_setname_np, else => private.pthread_setname_np, @@ -10823,7 +10829,7 @@ pub extern "c" fn pthread_getname_np(thread: pthread_t, name: [*:0]u8, len: usiz pub extern "c" fn pthread_kill(pthread_t, signal: SIG) c_int; pub const pthread_threadid_np = switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => private.pthread_threadid_np, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => private.pthread_threadid_np, else => {}, }; @@ -10831,7 +10837,7 @@ pub const caddr_t = ?[*]u8; pub const ptrace = switch (native_os) { .linux, .serenity => private.ptrace, - .macos, .ios, .tvos, .watchos, .visionos => darwin.ptrace, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.ptrace, .dragonfly => dragonfly.ptrace, .freebsd => freebsd.ptrace, .netbsd => netbsd.ptrace, @@ -10850,7 +10856,7 @@ pub extern "c" fn sem_timedwait(sem: *sem_t, abs_timeout: *const timespec) c_int pub extern "c" fn sem_getvalue(sem: *sem_t, sval: *c_int) c_int; pub const shm_open = switch (native_os) { - .driverkit, .macos, .ios, .tvos, .watchos, .visionos => darwin.shm_open, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.shm_open, else => private.shm_open, }; pub extern "c" fn shm_unlink(name: [*:0]const u8) c_int; diff --git a/lib/std/crypto/Certificate/Bundle.zig b/lib/std/crypto/Certificate/Bundle.zig index cc52ce71d3..d7f6537c4a 100644 --- a/lib/std/crypto/Certificate/Bundle.zig +++ b/lib/std/crypto/Certificate/Bundle.zig @@ -73,7 +73,7 @@ pub const RescanError = RescanLinuxError || RescanMacError || RescanWithPathErro pub fn rescan(cb: *Bundle, gpa: Allocator, io: Io, now: Io.Timestamp) RescanError!void { switch (builtin.os.tag) { .linux => return rescanLinux(cb, gpa, io, now), - .macos => return rescanMac(cb, gpa, io, now), + .maccatalyst, .macos => return rescanMac(cb, gpa, io, now), .freebsd, .openbsd => return rescanWithPath(cb, gpa, io, now, "/etc/ssl/cert.pem"), .netbsd => return rescanWithPath(cb, gpa, io, now, "/etc/openssl/certs/ca-certificates.crt"), .dragonfly => return rescanWithPath(cb, gpa, io, now, "/usr/local/etc/ssl/cert.pem"), diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 696d4f232d..3f1982070c 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -1392,6 +1392,7 @@ pub const have_segfault_handling_support = switch (native_os) { .driverkit, .ios, + .maccatalyst, .macos, .tvos, .visionos, @@ -1487,6 +1488,7 @@ fn handleSegfaultPosix(sig: posix.SIG, info: *const posix.siginfo_t, ctx_ptr: ?* .freebsd, .driverkit, .ios, + .maccatalyst, .macos, .tvos, .visionos, diff --git a/lib/std/debug/cpu_context.zig b/lib/std/debug/cpu_context.zig index 637c01d34b..de8baffea4 100644 --- a/lib/std/debug/cpu_context.zig +++ b/lib/std/debug/cpu_context.zig @@ -2131,7 +2131,7 @@ const signal_ucontext_t = switch (native_os) { }, }, // https://github.com/ziglang/zig/blob/60be67d3c0ba6ae15fa7115596734ab1e74fbcd3/lib/libc/include/any-macos-any/sys/_types/_ucontext.h - .driverkit, .macos, .ios, .tvos, .watchos, .visionos => extern struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .watchos, .visionos => extern struct { _onstack: i32, _sigmask: std.c.sigset_t, _stack: std.c.stack_t, diff --git a/lib/std/dynamic_library.zig b/lib/std/dynamic_library.zig index b889f5116e..d23d1ff1dd 100644 --- a/lib/std/dynamic_library.zig +++ b/lib/std/dynamic_library.zig @@ -16,7 +16,7 @@ pub const DynLib = struct { else DlDynLib, .windows => WindowsDynLib, - .macos, .tvos, .watchos, .ios, .visionos, .freebsd, .netbsd, .openbsd, .dragonfly, .illumos => DlDynLib, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .freebsd, .netbsd, .openbsd, .dragonfly, .illumos => DlDynLib, else => struct { const open = @compileError("unsupported platform"); const openZ = @compileError("unsupported platform"); @@ -675,7 +675,7 @@ test "dynamic_library" { const libname = switch (native_os) { .linux, .freebsd, .openbsd, .illumos => "invalid_so.so", .windows => "invalid_dll.dll", - .macos, .tvos, .watchos, .ios, .visionos => "invalid_dylib.dylib", + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => "invalid_dylib.dylib", else => return error.SkipZigTest, }; diff --git a/lib/std/fs.zig b/lib/std/fs.zig index 6db63b6e2b..26ce27e2b3 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -52,7 +52,7 @@ pub const GetAppDataDirError = @import("fs/get_app_data_dir.zig").GetAppDataDirE /// * On other platforms, `[]u8` file paths are opaque sequences of bytes with /// no particular encoding. pub const max_path_bytes = switch (native_os) { - .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .illumos, .plan9, .emscripten, .wasi, .serenity => posix.PATH_MAX, + .linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .illumos, .plan9, .emscripten, .wasi, .serenity => posix.PATH_MAX, // Each WTF-16LE code unit may be expanded to 3 WTF-8 bytes. // If it would require 4 WTF-8 bytes, then there would be a surrogate // pair in the WTF-16LE, and we (over)account 3 bytes for it that way. @@ -73,7 +73,7 @@ pub const max_path_bytes = switch (native_os) { /// On WASI, file name components are encoded as valid UTF-8. /// On other platforms, `[]u8` components are an opaque sequence of bytes with no particular encoding. pub const max_name_bytes = switch (native_os) { - .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .illumos, .serenity => posix.NAME_MAX, + .linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .freebsd, .openbsd, .netbsd, .dragonfly, .illumos, .serenity => posix.NAME_MAX, // Haiku's NAME_MAX includes the null terminator, so subtract one. .haiku => posix.NAME_MAX - 1, // Each WTF-16LE character may be expanded to 3 WTF-8 bytes. diff --git a/lib/std/fs/Dir.zig b/lib/std/fs/Dir.zig index c90eeef508..f229204f45 100644 --- a/lib/std/fs/Dir.zig +++ b/lib/std/fs/Dir.zig @@ -39,7 +39,7 @@ const IteratorError = error{ } || posix.UnexpectedError; pub const Iterator = switch (native_os) { - .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .illumos => struct { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .freebsd, .netbsd, .dragonfly, .openbsd, .illumos => struct { dir: Dir, seek: i64, buf: [1024]u8 align(@alignOf(posix.system.dirent)), @@ -55,7 +55,7 @@ pub const Iterator = switch (native_os) { /// with subsequent calls to `next`, as well as when this `Dir` is deinitialized. pub fn next(self: *Self) Error!?Entry { switch (native_os) { - .macos, .ios => return self.nextDarwin(), + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => return self.nextDarwin(), .freebsd, .netbsd, .dragonfly, .openbsd => return self.nextBsd(), .illumos => return self.nextIllumos(), else => @compileError("unimplemented"), @@ -612,8 +612,13 @@ pub fn iterateAssumeFirstIteration(self: Dir) Iterator { fn iterateImpl(self: Dir, first_iter_start_value: bool) Iterator { switch (native_os) { - .macos, + .driverkit, .ios, + .maccatalyst, + .macos, + .tvos, + .visionos, + .watchos, .freebsd, .netbsd, .dragonfly, @@ -1103,7 +1108,7 @@ pub fn deleteFileZ(self: Dir, sub_path_c: [*:0]const u8) DeleteFileError!void { error.AccessDenied, error.PermissionDenied => |e| switch (native_os) { // non-Linux POSIX systems return permission errors when trying to delete a // directory, so we need to handle that case specifically and translate the error - .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .illumos => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .freebsd, .netbsd, .dragonfly, .openbsd, .illumos => { // Don't follow symlinks to match unlinkat (which acts on symlinks rather than follows them) const fstat = posix.fstatatZ(self.fd, sub_path_c, posix.AT.SYMLINK_NOFOLLOW) catch return e; const is_dir = fstat.mode & posix.S.IFMT == posix.S.IFDIR; diff --git a/lib/std/fs/get_app_data_dir.zig b/lib/std/fs/get_app_data_dir.zig index 05b115956c..24741206cc 100644 --- a/lib/std/fs/get_app_data_dir.zig +++ b/lib/std/fs/get_app_data_dir.zig @@ -23,7 +23,7 @@ pub fn getAppDataDir(allocator: mem.Allocator, appname: []const u8) GetAppDataDi defer allocator.free(local_app_data_dir); return fs.path.join(allocator, &[_][]const u8{ local_app_data_dir, appname }); }, - .macos => { + .maccatalyst, .macos => { const home_dir = posix.getenv("HOME") orelse { // TODO look in /etc/passwd return error.AppDataDirUnavailable; diff --git a/lib/std/heap.zig b/lib/std/heap.zig index 24d84c83c2..ebc0de26b8 100644 --- a/lib/std/heap.zig +++ b/lib/std/heap.zig @@ -83,7 +83,7 @@ pub fn defaultQueryPageSize() usize { @max(std.c.sysconf(@intFromEnum(std.c._SC.PAGESIZE)), 0) else std.os.linux.getauxval(std.elf.AT_PAGESZ), - .driverkit, .ios, .macos, .tvos, .visionos, .watchos => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { const task_port = std.c.mach_task_self(); // mach_task_self may fail "if there are any resource failures or other errors". if (task_port == std.c.TASK.NULL) break :size 0; @@ -155,7 +155,7 @@ const CAllocator = struct { else {}; pub const supports_posix_memalign = switch (builtin.os.tag) { - .dragonfly, .netbsd, .freebsd, .illumos, .openbsd, .linux, .macos, .ios, .tvos, .watchos, .visionos, .serenity => true, + .dragonfly, .netbsd, .freebsd, .illumos, .openbsd, .linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .serenity => true, else => false, }; @@ -703,7 +703,7 @@ pub fn testAllocatorAlignedShrink(base_allocator: mem.Allocator) !void { } const page_size_min_default: ?usize = switch (builtin.os.tag) { - .driverkit, .ios, .macos, .tvos, .visionos, .watchos => switch (builtin.cpu.arch) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (builtin.cpu.arch) { .x86_64 => 4 << 10, .aarch64 => 16 << 10, else => null, @@ -862,7 +862,7 @@ const page_size_min_default: ?usize = switch (builtin.os.tag) { }; const page_size_max_default: ?usize = switch (builtin.os.tag) { - .driverkit, .ios, .macos, .tvos, .visionos, .watchos => switch (builtin.cpu.arch) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (builtin.cpu.arch) { .x86_64 => 4 << 10, .aarch64 => 16 << 10, else => null, diff --git a/lib/std/math/modf.zig b/lib/std/math/modf.zig index 60680cf831..99068d1a78 100644 --- a/lib/std/math/modf.zig +++ b/lib/std/math/modf.zig @@ -85,7 +85,7 @@ fn ModfTests(comptime T: type) type { try expectApproxEqAbs(expected_c, r.fpart, epsilon); } test "vector" { - if (builtin.os.tag == .macos and builtin.cpu.arch == .aarch64) return error.SkipZigTest; + if (builtin.os.tag.isDarwin() and builtin.cpu.arch == .aarch64) return error.SkipZigTest; if (builtin.cpu.arch == .s390x) return error.SkipZigTest; if (comptime builtin.cpu.has(.loongarch, .lsx)) return error.SkipZigTest; // https://github.com/llvm/llvm-project/issues/159529 diff --git a/lib/std/os.zig b/lib/std/os.zig index 02fddb32b4..5efca5899c 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -74,11 +74,13 @@ pub fn accessW(path: [*:0]const u16) windows.GetFileAttributesError!void { pub fn isGetFdPathSupportedOnTarget(os: std.Target.Os) bool { return switch (os.tag) { .windows, - .macos, + .driverkit, .ios, - .watchos, + .maccatalyst, + .macos, .tvos, .visionos, + .watchos, .linux, .illumos, .freebsd, @@ -113,7 +115,7 @@ pub fn getFdPath(fd: std.posix.fd_t, out_buffer: *[max_path_bytes]u8) std.posix. const end_index = std.unicode.wtf16LeToWtf8(out_buffer, wide_slice); return out_buffer[0..end_index]; }, - .macos, .ios, .watchos, .tvos, .visionos => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { // On macOS, we can use F.GETPATH fcntl command to query the OS for // the path to the file descriptor. @memset(out_buffer[0..max_path_bytes], 0); diff --git a/lib/std/posix.zig b/lib/std/posix.zig index 97c5c1b204..91bfef60d1 100644 --- a/lib/std/posix.zig +++ b/lib/std/posix.zig @@ -861,7 +861,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize { // Prevents EINVAL. const max_count = switch (native_os) { .linux => 0x7ffff000, - .macos, .ios, .watchos, .tvos, .visionos => maxInt(i32), + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => maxInt(i32), else => maxInt(isize), }; while (true) { @@ -1002,7 +1002,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize { // Prevent EINVAL. const max_count = switch (native_os) { .linux => 0x7ffff000, - .macos, .ios, .watchos, .tvos, .visionos => maxInt(i32), + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => maxInt(i32), else => maxInt(isize), }; @@ -1115,7 +1115,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void { /// On these systems, the read races with concurrent writes to the same file descriptor. pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize { const have_pread_but_not_preadv = switch (native_os) { - .windows, .macos, .ios, .watchos, .tvos, .visionos, .haiku => true, + .windows, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .haiku => true, else => false, }; if (have_pread_but_not_preadv) { @@ -1269,7 +1269,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { const max_count = switch (native_os) { .linux => 0x7ffff000, - .macos, .ios, .watchos, .tvos, .visionos => maxInt(i32), + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => maxInt(i32), else => maxInt(isize), }; while (true) { @@ -1433,7 +1433,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { // Prevent EINVAL. const max_count = switch (native_os) { .linux => 0x7ffff000, - .macos, .ios, .watchos, .tvos, .visionos => maxInt(i32), + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => maxInt(i32), else => maxInt(isize), }; @@ -1487,7 +1487,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { /// If `iov.len` is larger than `IOV_MAX`, a partial write will occur. pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usize { const have_pwrite_but_not_pwritev = switch (native_os) { - .windows, .macos, .ios, .watchos, .tvos, .visionos, .haiku => true, + .windows, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .haiku => true, else => false, }; @@ -1747,7 +1747,7 @@ pub fn execveZ( .NOTDIR => return error.NotDir, .TXTBSY => return error.FileBusy, else => |err| switch (native_os) { - .macos, .ios, .tvos, .watchos, .visionos => switch (err) { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (err) { .BADEXEC => return error.InvalidExe, .BADARCH => return error.InvalidExe, else => return unexpectedErrno(err), @@ -6570,7 +6570,7 @@ pub fn ptrace(request: u32, pid: pid_t, addr: usize, data: usize) PtraceError!vo else => |err| return unexpectedErrno(err), }, - .macos, .ios, .tvos, .watchos, .visionos => switch (errno(std.c.ptrace( + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (errno(std.c.ptrace( @enumFromInt(request), pid, @ptrFromInt(addr), diff --git a/lib/std/posix/test.zig b/lib/std/posix/test.zig index b1daf11730..aaaaa1d948 100644 --- a/lib/std/posix/test.zig +++ b/lib/std/posix/test.zig @@ -521,7 +521,7 @@ test "getrlimit and setrlimit" { } test "sigrtmin/max" { - if (native_os == .wasi or native_os == .windows or native_os == .macos) { + if (native_os == .wasi or native_os == .windows or native_os.isDarwin()) { return error.SkipZigTest; } @@ -550,7 +550,7 @@ test "sigset empty/full" { // Some signals (i.e., 32 - 34 on glibc/musl) are not allowed to be added to a // sigset by the C library, so avoid testing them. fn reserved_signo(i: usize) bool { - if (native_os == .macos) return false; + if (native_os.isDarwin()) return false; if (!builtin.link_libc) return false; const max = if (native_os == .netbsd) 32 else 31; return i > max and i < posix.sigrtmin(); diff --git a/lib/std/process.zig b/lib/std/process.zig index ee81bdad26..4e41d5901e 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -1530,11 +1530,13 @@ pub const UserInfo = struct { pub fn getUserInfo(name: []const u8) !UserInfo { return switch (native_os) { .linux, - .macos, - .watchos, - .visionos, - .tvos, + .driverkit, .ios, + .maccatalyst, + .macos, + .tvos, + .visionos, + .watchos, .freebsd, .netbsd, .openbsd, @@ -1666,7 +1668,7 @@ pub fn getBaseAddress() usize { else => {}, } else unreachable; }, - .driverkit, .ios, .macos, .tvos, .visionos, .watchos => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { return @intFromPtr(&std.c._mh_execute_header); }, .windows => return @intFromPtr(windows.kernel32.GetModuleHandleW(null)), @@ -1682,7 +1684,7 @@ pub const can_execv = switch (native_os) { /// Tells whether spawning child processes is supported (e.g. via Child) pub const can_spawn = switch (native_os) { - .wasi, .watchos, .tvos, .visionos => false, + .wasi, .ios, .tvos, .visionos, .watchos => false, else => true, }; @@ -1770,7 +1772,7 @@ pub fn totalSystemMemory() TotalSystemMemoryError!u64 { return @as(u64, @intCast(physmem)); }, // whole Darwin family - .driverkit, .ios, .macos, .tvos, .visionos, .watchos => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { // "hw.memsize" returns uint64_t var physmem: u64 = undefined; var len: usize = @sizeOf(u64); diff --git a/lib/std/process/Child.zig b/lib/std/process/Child.zig index 65b49707e4..63cad29b85 100644 --- a/lib/std/process/Child.zig +++ b/lib/std/process/Child.zig @@ -136,7 +136,7 @@ pub const ResourceUsageStatistics = struct { return null; } }, - .macos, .ios => { + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { if (rus.rusage) |ru| { // Darwin oddly reports in bytes instead of kilobytes. return @as(usize, @intCast(ru.maxrss)); @@ -149,7 +149,7 @@ pub const ResourceUsageStatistics = struct { } const rusage_init = switch (native_os) { - .linux, .macos, .ios => @as(?posix.rusage, null), + .linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => @as(?posix.rusage, null), .windows => @as(?windows.VM_COUNTERS, null), else => {}, }; @@ -486,7 +486,7 @@ fn waitUnwrappedPosix(self: *ChildProcess) void { const res: posix.WaitPidResult = res: { if (self.request_resource_usage_statistics) { switch (native_os) { - .linux, .macos, .ios => { + .linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { var ru: posix.rusage = undefined; const res = posix.wait4(self.id, 0, &ru); self.resource_usage_statistics.rusage = ru; diff --git a/lib/std/time.zig b/lib/std/time.zig index 66a38051ba..c47a3121a7 100644 --- a/lib/std/time.zig +++ b/lib/std/time.zig @@ -76,7 +76,7 @@ pub const Instant = struct { }, // On darwin, use UPTIME_RAW instead of MONOTONIC as it ticks while // suspended. - .macos, .ios, .tvos, .watchos, .visionos => posix.CLOCK.UPTIME_RAW, + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => posix.CLOCK.UPTIME_RAW, // On freebsd derivatives, use MONOTONIC_FAST as currently there's // no precision tradeoff. .freebsd, .dragonfly => posix.CLOCK.MONOTONIC_FAST, diff --git a/lib/std/zig/LibCDirs.zig b/lib/std/zig/LibCDirs.zig index 83864bc238..dbd14a4f56 100644 --- a/lib/std/zig/LibCDirs.zig +++ b/lib/std/zig/LibCDirs.zig @@ -227,7 +227,7 @@ pub fn detectFromBuilding( fn libCGenericName(target: *const std.Target) [:0]const u8 { switch (target.os.tag) { .windows => return "mingw", - .macos, .ios, .tvos, .watchos, .visionos => return "darwin", + .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => return "darwin", .freebsd => return "freebsd", .netbsd => return "netbsd", else => {}, @@ -263,7 +263,6 @@ fn libCGenericName(target: *const std.Target) [:0]const u8 { .msvc, .itanium, .simulator, - .macabi, => unreachable, } } diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index c45f6db789..6737a610db 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -81,7 +81,7 @@ pub fn getExternalExecutor( // If the OS match and OS is macOS and CPU is arm64, we can use Rosetta 2 // to emulate the foreign architecture. if (options.allow_rosetta and os_match and - host.os.tag == .macos and host.cpu.arch == .aarch64) + (host.os.tag == .maccatalyst or host.os.tag == .macos) and host.cpu.arch == .aarch64) { switch (candidate.cpu.arch) { .x86_64 => return .rosetta, diff --git a/lib/std/zig/system/darwin.zig b/lib/std/zig/system/darwin.zig index a5f28c2206..fbd6da2a9e 100644 --- a/lib/std/zig/system/darwin.zig +++ b/lib/std/zig/system/darwin.zig @@ -37,13 +37,9 @@ pub fn isSdkInstalled(allocator: Allocator) bool { pub fn getSdk(allocator: Allocator, target: *const Target) ?[]const u8 { const is_simulator_abi = target.abi == .simulator; const sdk = switch (target.os.tag) { - .ios => switch (target.abi) { - .macabi => "macosx", - .simulator => "iphonesimulator", - else => "iphoneos", - }, .driverkit => "driverkit", - .macos => "macosx", + .ios => if (is_simulator_abi) "iphonesimulator" else "iphoneos", + .maccatalyst, .macos => "macosx", .tvos => if (is_simulator_abi) "appletvsimulator" else "appletvos", .visionos => if (is_simulator_abi) "xrsimulator" else "xros", .watchos => if (is_simulator_abi) "watchsimulator" else "watchos", diff --git a/src/Compilation.zig b/src/Compilation.zig index 3076cfdc6d..d6167b2e66 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -6761,12 +6761,15 @@ fn addCommonCCArgs( } switch (target.os.tag) { - .ios, .macos, .tvos, .watchos => |os| if (is_clang) { + .ios, .maccatalyst, .macos, .tvos, .watchos => |os| if (is_clang) { try argv.ensureUnusedCapacity(2); // Pass the proper -m-version-min argument for darwin. const ver = target.os.version_range.semver.min; argv.appendAssumeCapacity(try std.fmt.allocPrint(arena, "-m{s}{s}-version-min={d}.{d}.{d}", .{ - @tagName(os), + switch (os) { + .maccatalyst => "ios", + else => @tagName(os), + }, switch (target.abi) { .simulator => "-simulator", else => "", diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig index 2eca2c8411..0cb442d90f 100644 --- a/src/Compilation/Config.zig +++ b/src/Compilation/Config.zig @@ -369,7 +369,7 @@ pub fn resolve(options: Options) ResolveError!Config { // load_dynamic_library standalone test not passing on this combination // https://github.com/ziglang/zig/issues/24080 - if (target.os.tag == .macos and is_dyn_lib) break :b true; + if (target.os.tag.isDarwin() and is_dyn_lib) break :b true; // At this point we would prefer to use our own self-hosted backend, // because the compilation speed is better than LLVM. But only do it if diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index 41b5a32f6e..ce7d44c4b6 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -189,7 +189,7 @@ pub fn updateFile( // disambiguates by returning EEXIST, indicating original // failure was a race, or ENOENT, indicating deletion of the // directory of our open handle. - if (builtin.os.tag != .macos) { + if (!builtin.os.tag.isDarwin()) { std.process.fatal("cache directory '{f}' unexpectedly removed during compiler execution", .{ cache_directory, }); diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index c2c09bbd1f..7c7151524a 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -183,6 +183,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 try llvm_triple.appendSlice(switch (target.os.tag) { .driverkit, .ios, + .maccatalyst, .macos, .tvos, .visionos, @@ -204,7 +205,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 try llvm_triple.append('-'); const llvm_os = switch (target.os.tag) { - .freestanding => "unknown", .dragonfly => "dragonfly", .freebsd => "freebsd", .fuchsia => "fuchsia", @@ -218,11 +218,9 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 .cuda => "cuda", .nvcl => "nvcl", .amdhsa => "amdhsa", - .opencl => "unknown", // https://llvm.org/docs/SPIRVUsage.html#target-triples .ps3 => "lv2", .ps4 => "ps4", .ps5 => "ps5", - .vita => "unknown", // LLVM doesn't know about this target .mesa3d => "mesa3d", .amdpal => "amdpal", .hermit => "hermit", @@ -230,7 +228,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 .wasi => "wasi", .emscripten => "emscripten", .macos => "macosx", - .ios => "ios", + .ios, .maccatalyst => "ios", .tvos => "tvos", .watchos => "watchos", .driverkit => "driverkit", @@ -240,10 +238,13 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 .managarm => "managarm", .@"3ds", - .opengl, - .plan9, .contiki, + .freestanding, + .opencl, // https://llvm.org/docs/SPIRVUsage.html#target-triples + .opengl, .other, + .plan9, + .vita, => "unknown", }; try llvm_triple.appendSlice(llvm_os); @@ -266,7 +267,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 try llvm_triple.append('-'); const llvm_abi = switch (target.abi) { - .none, .ilp32 => "unknown", + .none => if (target.os.tag == .maccatalyst) "macabi" else "unknown", .gnu => "gnu", .gnuabin32 => "gnuabin32", .gnuabi64 => "gnuabi64", @@ -275,6 +276,7 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 .gnuf32 => "gnuf32", .gnusf => "gnusf", .gnux32 => "gnux32", + .ilp32 => "unknown", .code16 => "code16", .eabi => "eabi", .eabihf => "eabihf", @@ -296,7 +298,6 @@ pub fn targetTriple(allocator: Allocator, target: *const std.Target) ![]const u8 .msvc => "msvc", .itanium => "itanium", .simulator => "simulator", - .macabi => "macabi", .ohos, .ohoseabi => "ohos", }; try llvm_triple.appendSlice(llvm_abi); @@ -12595,7 +12596,7 @@ fn ccAbiPromoteInt(cc: std.builtin.CallingConvention, zcu: *Zcu, ty: Type) ?std. else => return null, }; return switch (target.os.tag) { - .macos, .ios, .watchos, .tvos, .visionos => switch (int_info.bits) { + .driverkit, .ios, .maccatalyst, .macos, .watchos, .tvos, .visionos => switch (int_info.bits) { 0...16 => int_info.signedness, else => null, }, diff --git a/src/libs/libtsan.zig b/src/libs/libtsan.zig index 12642bc452..541d2bab3c 100644 --- a/src/libs/libtsan.zig +++ b/src/libs/libtsan.zig @@ -30,7 +30,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo const root_name = switch (target.os.tag) { // On Apple platforms, we use the same name as LLVM because the // TSAN library implementation hard-codes a check for these names. - .driverkit, .macos => "clang_rt.tsan_osx_dynamic", + .driverkit, .maccatalyst, .macos => "clang_rt.tsan_osx_dynamic", .ios => if (target.abi == .simulator) "clang_rt.tsan_iossim_dynamic" else "clang_rt.tsan_ios_dynamic", .tvos => if (target.abi == .simulator) "clang_rt.tsan_tvossim_dynamic" else "clang_rt.tsan_tvos_dynamic", .visionos => if (target.abi == .simulator) "clang_rt.tsan_xrossim_dynamic" else "clang_rt.tsan_xros_dynamic", @@ -134,7 +134,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo } const platform_tsan_sources = switch (target.os.tag) { - .ios, .macos, .watchos, .tvos, .visionos => &darwin_tsan_sources, + .driverkit, .ios, .maccatalyst, .macos, .watchos, .tvos, .visionos => &darwin_tsan_sources, .windows => &windows_tsan_sources, else => &unix_tsan_sources, }; diff --git a/src/link.zig b/src/link.zig index c0a8facb77..c343c7e30f 100644 --- a/src/link.zig +++ b/src/link.zig @@ -620,7 +620,7 @@ pub const File = struct { .linux => std.posix.ptrace(std.os.linux.PTRACE.ATTACH, pid, 0, 0) catch |err| { log.warn("ptrace failure: {s}", .{@errorName(err)}); }, - .macos => { + .maccatalyst, .macos => { const macho_file = base.cast(.macho).?; macho_file.ptraceAttach(pid) catch |err| { log.warn("attaching failed with error: {s}", .{@errorName(err)}); @@ -700,7 +700,7 @@ pub const File = struct { if (base.child_pid) |pid| { switch (builtin.os.tag) { - .macos => { + .maccatalyst, .macos => { const macho_file = base.cast(.macho).?; macho_file.ptraceDetach(pid) catch |err| { log.warn("detaching failed with error: {s}", .{@errorName(err)}); diff --git a/src/link/MachO.zig b/src/link/MachO.zig index ef5c837fd1..8a3ee07315 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -3596,7 +3596,7 @@ pub fn requiresCodeSig(self: MachO) bool { const target = self.getTarget(); return switch (target.cpu.arch) { .aarch64 => switch (target.os.tag) { - .driverkit, .macos => true, + .driverkit, .maccatalyst, .macos => true, .ios, .tvos, .visionos, .watchos => target.abi == .simulator, else => false, }, @@ -4032,7 +4032,7 @@ fn formatSectType(tt: u8, w: *Writer) Writer.Error!void { } const is_hot_update_compatible = switch (builtin.target.os.tag) { - .macos => true, + .maccatalyst, .macos => true, else => false, }; @@ -4174,7 +4174,7 @@ pub const Platform = struct { .os_tag = switch (cmd.platform) { .DRIVERKIT => .driverkit, .IOS, .IOSSIMULATOR => .ios, - .MACCATALYST => .ios, + .MACCATALYST => .maccatalyst, .MACOS => .macos, .TVOS, .TVOSSIMULATOR => .tvos, .VISIONOS, .VISIONOSSIMULATOR => .visionos, @@ -4182,7 +4182,6 @@ pub const Platform = struct { else => @panic("TODO"), }, .abi = switch (cmd.platform) { - .MACCATALYST => .macabi, .IOSSIMULATOR, .TVOSSIMULATOR, .VISIONOSSIMULATOR, @@ -4198,6 +4197,7 @@ pub const Platform = struct { .VERSION_MIN_TVOS, .VERSION_MIN_WATCHOS, => { + // We can't distinguish Mac Catalyst here, but this is legacy stuff anyway. const cmd = lc.cast(macho.version_min_command).?; return .{ .os_tag = switch (lc.cmd()) { @@ -4230,11 +4230,8 @@ pub const Platform = struct { pub fn toApplePlatform(plat: Platform) macho.PLATFORM { return switch (plat.os_tag) { .driverkit => .DRIVERKIT, - .ios => switch (plat.abi) { - .macabi => .MACCATALYST, - .simulator => .IOSSIMULATOR, - else => .IOS, - }, + .ios => if (plat.abi == .simulator) .IOSSIMULATOR else .IOS, + .maccatalyst => .MACCATALYST, .macos => .MACOS, .tvos => if (plat.abi == .simulator) .TVOSSIMULATOR else .TVOS, .visionos => if (plat.abi == .simulator) .VISIONOSSIMULATOR else .VISIONOS, @@ -4300,17 +4297,17 @@ const SupportedPlatforms = struct { // Source: https://github.com/apple-oss-distributions/ld64/blob/59a99ab60399c5e6c49e6945a9e1049c42b71135/src/ld/PlatformSupport.cpp#L52 // zig fmt: off const supported_platforms = [_]SupportedPlatforms{ - .{ .driverkit, .none, 0x130000, 0x130000 }, - .{ .ios, .none, 0x0C0000, 0x070000 }, - .{ .ios, .macabi, 0x0D0000, 0x0D0000 }, - .{ .ios, .simulator, 0x0D0000, 0x080000 }, - .{ .macos, .none, 0x0A0E00, 0x0A0800 }, - .{ .tvos, .none, 0x0C0000, 0x070000 }, - .{ .tvos, .simulator, 0x0D0000, 0x080000 }, - .{ .visionos, .none, 0x010000, 0x010000 }, - .{ .visionos, .simulator, 0x010000, 0x010000 }, - .{ .watchos, .none, 0x050000, 0x020000 }, - .{ .watchos, .simulator, 0x060000, 0x020000 }, + .{ .driverkit, .none, 0x130000, 0x130000 }, + .{ .ios, .none, 0x0C0000, 0x070000 }, + .{ .ios, .simulator, 0x0D0000, 0x080000 }, + .{ .maccatalyst, .none, 0x0D0000, 0x0D0000 }, + .{ .macos, .none, 0x0A0E00, 0x0A0800 }, + .{ .tvos, .none, 0x0C0000, 0x070000 }, + .{ .tvos, .simulator, 0x0D0000, 0x080000 }, + .{ .visionos, .none, 0x010000, 0x010000 }, + .{ .visionos, .simulator, 0x010000, 0x010000 }, + .{ .watchos, .none, 0x050000, 0x020000 }, + .{ .watchos, .simulator, 0x060000, 0x020000 }, }; // zig fmt: on diff --git a/src/link/MachO/load_commands.zig b/src/link/MachO/load_commands.zig index 59717dc9c9..758475f06f 100644 --- a/src/link/MachO/load_commands.zig +++ b/src/link/MachO/load_commands.zig @@ -281,7 +281,7 @@ pub fn writeRpathLC(rpath: []const u8, writer: *Writer) !void { pub fn writeVersionMinLC(platform: MachO.Platform, sdk_version: ?std.SemanticVersion, writer: *Writer) !void { const cmd: macho.LC = switch (platform.os_tag) { .macos => .VERSION_MIN_MACOSX, - .ios => .VERSION_MIN_IPHONEOS, + .ios, .maccatalyst => .VERSION_MIN_IPHONEOS, .tvos => .VERSION_MIN_TVOS, .watchos => .VERSION_MIN_WATCHOS, else => unreachable, diff --git a/src/main.zig b/src/main.zig index 52bb4b9c4e..d52616aa77 100644 --- a/src/main.zig +++ b/src/main.zig @@ -4487,7 +4487,7 @@ fn runOrTestHotSwap( } switch (builtin.target.os.tag) { - .macos, .ios, .tvos, .watchos, .visionos => { + .macos => { const PosixSpawn = @import("DarwinPosixSpawn.zig"); var attr = try PosixSpawn.Attr.init(); diff --git a/src/target.zig b/src/target.zig index 77765c2239..66aba7e5cd 100644 --- a/src/target.zig +++ b/src/target.zig @@ -29,6 +29,7 @@ pub fn libCNeedsLibUnwind(target: *const std.Target, link_mode: std.builtin.Link pub fn libCxxNeedsLibUnwind(target: *const std.Target) bool { return switch (target.os.tag) { + .maccatalyst, .macos, .ios, .watchos, diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig index c98caed91f..d704151aa6 100644 --- a/test/behavior/basic.zig +++ b/test/behavior/basic.zig @@ -1398,7 +1398,7 @@ test "allocation and looping over 3-byte integer" { if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .macos) { + if (builtin.zig_backend == .stage2_llvm and builtin.os.tag.isDarwin()) { return error.SkipZigTest; // TODO } if (builtin.cpu.arch == .s390x and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // TODO diff --git a/test/behavior/threadlocal.zig b/test/behavior/threadlocal.zig index 48b1bcc530..cb4480f759 100644 --- a/test/behavior/threadlocal.zig +++ b/test/behavior/threadlocal.zig @@ -9,7 +9,7 @@ test "thread local variable" { if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag == .macos) { + if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag.isDarwin()) { // Fails due to register hazards. return error.SkipZigTest; } diff --git a/test/behavior/var_args.zig b/test/behavior/var_args.zig index 964fac339e..5b71bcb4c3 100644 --- a/test/behavior/var_args.zig +++ b/test/behavior/var_args.zig @@ -97,7 +97,7 @@ test "simple variadic function" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_llvm and builtin.os.tag != .macos and builtin.cpu.arch.isAARCH64()) { + if (builtin.zig_backend == .stage2_llvm and !builtin.os.tag.isDarwin() and builtin.cpu.arch.isAARCH64()) { // https://github.com/ziglang/zig/issues/14096 return error.SkipZigTest; } @@ -159,7 +159,7 @@ test "coerce reference to var arg" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_llvm and builtin.os.tag != .macos and builtin.cpu.arch.isAARCH64()) { + if (builtin.zig_backend == .stage2_llvm and !builtin.os.tag.isDarwin() and builtin.cpu.arch.isAARCH64()) { // https://github.com/ziglang/zig/issues/14096 return error.SkipZigTest; } @@ -191,7 +191,7 @@ test "variadic functions" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_llvm and builtin.os.tag != .macos and builtin.cpu.arch.isAARCH64()) { + if (builtin.zig_backend == .stage2_llvm and !builtin.os.tag.isDarwin() and builtin.cpu.arch.isAARCH64()) { // https://github.com/ziglang/zig/issues/14096 return error.SkipZigTest; } @@ -244,7 +244,7 @@ test "copy VaList" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_llvm and builtin.os.tag != .macos and builtin.cpu.arch.isAARCH64()) { + if (builtin.zig_backend == .stage2_llvm and !builtin.os.tag.isDarwin() and builtin.cpu.arch.isAARCH64()) { // https://github.com/ziglang/zig/issues/14096 return error.SkipZigTest; } @@ -279,7 +279,7 @@ test "unused VaList arg" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_llvm and builtin.os.tag != .macos and builtin.cpu.arch.isAARCH64()) { + if (builtin.zig_backend == .stage2_llvm and !builtin.os.tag.isDarwin() and builtin.cpu.arch.isAARCH64()) { // https://github.com/ziglang/zig/issues/14096 return error.SkipZigTest; } diff --git a/test/c_abi/main.zig b/test/c_abi/main.zig index a6f692601a..8316847743 100644 --- a/test/c_abi/main.zig +++ b/test/c_abi/main.zig @@ -1157,7 +1157,7 @@ test "big simd vector" { if (builtin.cpu.arch.isMIPS64() and builtin.mode != .Debug) return error.SkipZigTest; if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest; if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .x86_64 and builtin.os.tag == .macos and builtin.mode != .Debug) return error.SkipZigTest; + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .x86_64 and builtin.os.tag.isDarwin() and builtin.mode != .Debug) return error.SkipZigTest; c_big_vec(.{ 1, 2, 3, 4, 5, 6, 7, 8 }); diff --git a/test/llvm_targets.zig b/test/llvm_targets.zig index 7909ea843d..ff6ed68300 100644 --- a/test/llvm_targets.zig +++ b/test/llvm_targets.zig @@ -9,7 +9,6 @@ const targets = [_]std.Target.Query{ .{ .cpu_arch = .aarch64, .os_tag = .haiku, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .hermit, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .hurd, .abi = .gnu }, - .{ .cpu_arch = .aarch64, .os_tag = .ios, .abi = .macabi }, .{ .cpu_arch = .aarch64, .os_tag = .ios, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .ios, .abi = .simulator }, .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .android }, @@ -17,6 +16,7 @@ const targets = [_]std.Target.Query{ .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .musl }, .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .ohos }, + .{ .cpu_arch = .aarch64, .os_tag = .maccatalyst, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .macos, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .netbsd, .abi = .none }, .{ .cpu_arch = .aarch64, .os_tag = .openbsd, .abi = .none }, @@ -326,6 +326,7 @@ const targets = [_]std.Target.Query{ .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .muslx32 }, .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .none }, .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .ohos }, + .{ .cpu_arch = .x86_64, .os_tag = .maccatalyst, .abi = .none }, .{ .cpu_arch = .x86_64, .os_tag = .macos, .abi = .none }, .{ .cpu_arch = .x86_64, .os_tag = .netbsd, .abi = .none }, .{ .cpu_arch = .x86_64, .os_tag = .openbsd, .abi = .none },