Rename .macosx to .macos

This commit is contained in:
Vignesh Rajagopalan 2020-10-12 14:29:43 +05:30 committed by Andrew Kelley
parent 53c63bdb73
commit 2ab0c7391a
26 changed files with 73 additions and 71 deletions

View File

@ -22,7 +22,7 @@ pub usingnamespace @import("os/bits.zig");
pub usingnamespace switch (std.Target.current.os.tag) { pub usingnamespace switch (std.Target.current.os.tag) {
.linux => @import("c/linux.zig"), .linux => @import("c/linux.zig"),
.windows => @import("c/windows.zig"), .windows => @import("c/windows.zig"),
.macosx, .ios, .tvos, .watchos => @import("c/darwin.zig"), .macos, .ios, .tvos, .watchos => @import("c/darwin.zig"),
.freebsd, .kfreebsd => @import("c/freebsd.zig"), .freebsd, .kfreebsd => @import("c/freebsd.zig"),
.netbsd => @import("c/netbsd.zig"), .netbsd => @import("c/netbsd.zig"),
.dragonfly => @import("c/dragonfly.zig"), .dragonfly => @import("c/dragonfly.zig"),
@ -122,7 +122,7 @@ pub extern "c" fn readlink(noalias path: [*:0]const u8, noalias buf: [*]u8, bufs
pub extern "c" fn readlinkat(dirfd: fd_t, noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize; pub extern "c" fn readlinkat(dirfd: fd_t, noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize;
pub usingnamespace switch (builtin.os.tag) { pub usingnamespace switch (builtin.os.tag) {
.macosx, .ios, .watchos, .tvos => struct { .macos, .ios, .watchos, .tvos => struct {
pub const realpath = @"realpath$DARWIN_EXTSN"; pub const realpath = @"realpath$DARWIN_EXTSN";
pub const fstatat = @"fstatat$INODE64"; pub const fstatat = @"fstatat$INODE64";
}, },
@ -189,7 +189,7 @@ pub usingnamespace switch (builtin.os.tag) {
pub const sigprocmask = __sigprocmask14; pub const sigprocmask = __sigprocmask14;
pub const stat = __stat50; pub const stat = __stat50;
}, },
.macosx, .ios, .watchos, .tvos => struct { .macos, .ios, .watchos, .tvos => struct {
// XXX: close -> close$NOCANCEL // XXX: close -> close$NOCANCEL
// XXX: getdirentries -> _getdirentries64 // XXX: getdirentries -> _getdirentries64
pub extern "c" fn clock_getres(clk_id: c_int, tp: *timespec) c_int; pub extern "c" fn clock_getres(clk_id: c_int, tp: *timespec) c_int;
@ -252,7 +252,7 @@ pub usingnamespace switch (builtin.os.tag) {
.linux, .freebsd, .kfreebsd, .netbsd, .openbsd => struct { .linux, .freebsd, .kfreebsd, .netbsd, .openbsd => struct {
pub extern "c" fn malloc_usable_size(?*const c_void) usize; pub extern "c" fn malloc_usable_size(?*const c_void) usize;
}, },
.macosx, .ios, .watchos, .tvos => struct { .macos, .ios, .watchos, .tvos => struct {
pub extern "c" fn malloc_size(?*const c_void) usize; pub extern "c" fn malloc_size(?*const c_void) usize;
}, },
else => struct {}, else => struct {},

View File

@ -654,7 +654,7 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo {
.freebsd, .freebsd,
.netbsd, .netbsd,
.dragonfly, .dragonfly,
.macosx, .macos,
.windows, .windows,
=> return DebugInfo.init(allocator), => return DebugInfo.init(allocator),
else => @compileError("openSelfDebugInfo unsupported for this platform"), else => @compileError("openSelfDebugInfo unsupported for this platform"),
@ -1320,7 +1320,7 @@ const SymbolInfo = struct {
}; };
pub const ModuleDebugInfo = switch (builtin.os.tag) { pub const ModuleDebugInfo = switch (builtin.os.tag) {
.macosx, .ios, .watchos, .tvos => struct { .macos, .ios, .watchos, .tvos => struct {
base_address: usize, base_address: usize,
mapped_memory: []const u8, mapped_memory: []const u8,
symbols: []const MachoSymbol, symbols: []const MachoSymbol,

View File

@ -19,7 +19,7 @@ const max = std.math.max;
pub const DynLib = switch (builtin.os.tag) { pub const DynLib = switch (builtin.os.tag) {
.linux => if (builtin.link_libc) DlDynlib else ElfDynLib, .linux => if (builtin.link_libc) DlDynlib else ElfDynLib,
.windows => WindowsDynLib, .windows => WindowsDynLib,
.macosx, .tvos, .watchos, .ios, .freebsd => DlDynlib, .macos, .tvos, .watchos, .ios, .freebsd => DlDynlib,
else => void, else => void,
}; };
@ -404,7 +404,7 @@ test "dynamic_library" {
const libname = switch (builtin.os.tag) { const libname = switch (builtin.os.tag) {
.linux, .freebsd => "invalid_so.so", .linux, .freebsd => "invalid_so.so",
.windows => "invalid_dll.dll", .windows => "invalid_dll.dll",
.macosx, .tvos, .watchos, .ios => "invalid_dylib.dylib", .macos, .tvos, .watchos, .ios => "invalid_dylib.dylib",
else => return error.SkipZigTest, else => return error.SkipZigTest,
}; };

View File

@ -66,7 +66,7 @@ pub const Loop = struct {
}; };
pub const EventFd = switch (builtin.os.tag) { pub const EventFd = switch (builtin.os.tag) {
.macosx, .freebsd, .netbsd, .dragonfly => KEventFd, .macos, .freebsd, .netbsd, .dragonfly => KEventFd,
.linux => struct { .linux => struct {
base: ResumeNode, base: ResumeNode,
epoll_op: u32, epoll_op: u32,
@ -85,7 +85,7 @@ pub const Loop = struct {
}; };
pub const Basic = switch (builtin.os.tag) { pub const Basic = switch (builtin.os.tag) {
.macosx, .freebsd, .netbsd, .dragonfly => KEventBasic, .macos, .freebsd, .netbsd, .dragonfly => KEventBasic,
.linux => struct { .linux => struct {
base: ResumeNode, base: ResumeNode,
}, },
@ -259,7 +259,7 @@ pub const Loop = struct {
self.extra_threads[extra_thread_index] = try Thread.spawn(self, workerRun); self.extra_threads[extra_thread_index] = try Thread.spawn(self, workerRun);
} }
}, },
.macosx, .freebsd, .netbsd, .dragonfly => { .macos, .freebsd, .netbsd, .dragonfly => {
self.os_data.kqfd = try os.kqueue(); self.os_data.kqfd = try os.kqueue();
errdefer os.close(self.os_data.kqfd); errdefer os.close(self.os_data.kqfd);
@ -384,7 +384,7 @@ pub const Loop = struct {
while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd); while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd);
os.close(self.os_data.epollfd); os.close(self.os_data.epollfd);
}, },
.macosx, .freebsd, .netbsd, .dragonfly => { .macos, .freebsd, .netbsd, .dragonfly => {
os.close(self.os_data.kqfd); os.close(self.os_data.kqfd);
}, },
.windows => { .windows => {
@ -478,7 +478,7 @@ pub const Loop = struct {
.linux => { .linux => {
self.linuxWaitFd(fd, os.EPOLLET | os.EPOLLONESHOT | os.EPOLLIN); self.linuxWaitFd(fd, os.EPOLLET | os.EPOLLONESHOT | os.EPOLLIN);
}, },
.macosx, .freebsd, .netbsd, .dragonfly => { .macos, .freebsd, .netbsd, .dragonfly => {
self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_READ, os.EV_ONESHOT); self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_READ, os.EV_ONESHOT);
}, },
else => @compileError("Unsupported OS"), else => @compileError("Unsupported OS"),
@ -490,7 +490,7 @@ pub const Loop = struct {
.linux => { .linux => {
self.linuxWaitFd(fd, os.EPOLLET | os.EPOLLONESHOT | os.EPOLLOUT); self.linuxWaitFd(fd, os.EPOLLET | os.EPOLLONESHOT | os.EPOLLOUT);
}, },
.macosx, .freebsd, .netbsd, .dragonfly => { .macos, .freebsd, .netbsd, .dragonfly => {
self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_WRITE, os.EV_ONESHOT); self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_WRITE, os.EV_ONESHOT);
}, },
else => @compileError("Unsupported OS"), else => @compileError("Unsupported OS"),
@ -502,7 +502,7 @@ pub const Loop = struct {
.linux => { .linux => {
self.linuxWaitFd(fd, os.EPOLLET | os.EPOLLONESHOT | os.EPOLLOUT | os.EPOLLIN); self.linuxWaitFd(fd, os.EPOLLET | os.EPOLLONESHOT | os.EPOLLOUT | os.EPOLLIN);
}, },
.macosx, .freebsd, .netbsd, .dragonfly => { .macos, .freebsd, .netbsd, .dragonfly => {
self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_READ, os.EV_ONESHOT); self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_READ, os.EV_ONESHOT);
self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_WRITE, os.EV_ONESHOT); self.bsdWaitKev(@intCast(usize, fd), os.EVFILT_WRITE, os.EV_ONESHOT);
}, },
@ -571,7 +571,7 @@ pub const Loop = struct {
const eventfd_node = &resume_stack_node.data; const eventfd_node = &resume_stack_node.data;
eventfd_node.base.handle = next_tick_node.data; eventfd_node.base.handle = next_tick_node.data;
switch (builtin.os.tag) { switch (builtin.os.tag) {
.macosx, .freebsd, .netbsd, .dragonfly => { .macos, .freebsd, .netbsd, .dragonfly => {
const kevent_array = @as(*const [1]os.Kevent, &eventfd_node.kevent); const kevent_array = @as(*const [1]os.Kevent, &eventfd_node.kevent);
const empty_kevs = &[0]os.Kevent{}; const empty_kevs = &[0]os.Kevent{};
_ = os.kevent(self.os_data.kqfd, kevent_array, empty_kevs, null) catch { _ = os.kevent(self.os_data.kqfd, kevent_array, empty_kevs, null) catch {
@ -633,7 +633,7 @@ pub const Loop = struct {
if (!builtin.single_threaded) { if (!builtin.single_threaded) {
switch (builtin.os.tag) { switch (builtin.os.tag) {
.linux, .linux,
.macosx, .macos,
.freebsd, .freebsd,
.netbsd, .netbsd,
.dragonfly, .dragonfly,
@ -725,7 +725,7 @@ pub const Loop = struct {
} }
return; return;
}, },
.macosx, .freebsd, .netbsd, .dragonfly => { .macos, .freebsd, .netbsd, .dragonfly => {
const final_kevent = @as(*const [1]os.Kevent, &self.os_data.final_kevent); const final_kevent = @as(*const [1]os.Kevent, &self.os_data.final_kevent);
const empty_kevs = &[0]os.Kevent{}; const empty_kevs = &[0]os.Kevent{};
// cannot fail because we already added it and this just enables it // cannot fail because we already added it and this just enables it
@ -1218,7 +1218,7 @@ pub const Loop = struct {
} }
} }
}, },
.macosx, .freebsd, .netbsd, .dragonfly => { .macos, .freebsd, .netbsd, .dragonfly => {
var eventlist: [1]os.Kevent = undefined; var eventlist: [1]os.Kevent = undefined;
const empty_kevs = &[0]os.Kevent{}; const empty_kevs = &[0]os.Kevent{};
const count = os.kevent(self.os_data.kqfd, empty_kevs, eventlist[0..], null) catch unreachable; const count = os.kevent(self.os_data.kqfd, empty_kevs, eventlist[0..], null) catch unreachable;
@ -1344,7 +1344,7 @@ pub const Loop = struct {
const OsData = switch (builtin.os.tag) { const OsData = switch (builtin.os.tag) {
.linux => LinuxOsData, .linux => LinuxOsData,
.macosx, .freebsd, .netbsd, .dragonfly => KEventData, .macos, .freebsd, .netbsd, .dragonfly => KEventData,
.windows => struct { .windows => struct {
io_port: windows.HANDLE, io_port: windows.HANDLE,
extra_thread_count: usize, extra_thread_count: usize,

View File

@ -39,7 +39,7 @@ pub const Watch = @import("fs/watch.zig").Watch;
/// fit into a UTF-8 encoded array of this length. /// fit into a UTF-8 encoded array of this length.
/// The byte count includes room for a null sentinel byte. /// The byte count includes room for a null sentinel byte.
pub const MAX_PATH_BYTES = switch (builtin.os.tag) { pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
.linux, .macosx, .ios, .freebsd, .netbsd, .dragonfly => os.PATH_MAX, .linux, .macos, .ios, .freebsd, .netbsd, .dragonfly => os.PATH_MAX,
// Each UTF-16LE character may be expanded to 3 UTF-8 bytes. // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
// If it would require 4 UTF-8 bytes, then there would be a surrogate // If it would require 4 UTF-8 bytes, then there would be a surrogate
// pair in the UTF-16LE, and we (over)account 3 bytes for it that way. // pair in the UTF-16LE, and we (over)account 3 bytes for it that way.
@ -303,7 +303,7 @@ pub const Dir = struct {
const IteratorError = error{AccessDenied} || os.UnexpectedError; const IteratorError = error{AccessDenied} || os.UnexpectedError;
pub const Iterator = switch (builtin.os.tag) { pub const Iterator = switch (builtin.os.tag) {
.macosx, .ios, .freebsd, .netbsd, .dragonfly => struct { .macos, .ios, .freebsd, .netbsd, .dragonfly => struct {
dir: Dir, dir: Dir,
seek: i64, seek: i64,
buf: [8192]u8, // TODO align(@alignOf(os.dirent)), buf: [8192]u8, // TODO align(@alignOf(os.dirent)),
@ -318,7 +318,7 @@ pub const Dir = struct {
/// with subsequent calls to `next`, as well as when this `Dir` is deinitialized. /// with subsequent calls to `next`, as well as when this `Dir` is deinitialized.
pub fn next(self: *Self) Error!?Entry { pub fn next(self: *Self) Error!?Entry {
switch (builtin.os.tag) { switch (builtin.os.tag) {
.macosx, .ios => return self.nextDarwin(), .macos, .ios => return self.nextDarwin(),
.freebsd, .netbsd, .dragonfly => return self.nextBsd(), .freebsd, .netbsd, .dragonfly => return self.nextBsd(),
else => @compileError("unimplemented"), else => @compileError("unimplemented"),
} }
@ -615,7 +615,7 @@ pub const Dir = struct {
pub fn iterate(self: Dir) Iterator { pub fn iterate(self: Dir) Iterator {
switch (builtin.os.tag) { switch (builtin.os.tag) {
.macosx, .ios, .freebsd, .netbsd, .dragonfly => return Iterator{ .macos, .ios, .freebsd, .netbsd, .dragonfly => return Iterator{
.dir = self, .dir = self,
.seek = 0, .seek = 0,
.index = 0, .index = 0,
@ -1302,7 +1302,7 @@ pub const Dir = struct {
error.AccessDenied => |e| switch (builtin.os.tag) { error.AccessDenied => |e| switch (builtin.os.tag) {
// non-Linux POSIX systems return EPERM when trying to delete a directory, so // non-Linux POSIX systems return EPERM when trying to delete a directory, so
// we need to handle that case specifically and translate the error // we need to handle that case specifically and translate the error
.macosx, .ios, .freebsd, .netbsd, .dragonfly => { .macos, .ios, .freebsd, .netbsd, .dragonfly => {
// Don't follow symlinks to match unlinkat (which acts on symlinks rather than follows them) // Don't follow symlinks to match unlinkat (which acts on symlinks rather than follows them)
const fstat = os.fstatatZ(self.fd, sub_path_c, os.AT_SYMLINK_NOFOLLOW) catch return e; const fstat = os.fstatatZ(self.fd, sub_path_c, os.AT_SYMLINK_NOFOLLOW) catch return e;
const is_dir = fstat.mode & os.S_IFMT == os.S_IFDIR; const is_dir = fstat.mode & os.S_IFMT == os.S_IFDIR;

View File

@ -42,7 +42,7 @@ pub fn getAppDataDir(allocator: *mem.Allocator, appname: []const u8) GetAppDataD
else => return error.AppDataDirUnavailable, else => return error.AppDataDirUnavailable,
} }
}, },
.macosx => { .macos => {
const home_dir = os.getenv("HOME") orelse { const home_dir = os.getenv("HOME") orelse {
// TODO look in /etc/passwd // TODO look in /etc/passwd
return error.AppDataDirUnavailable; return error.AppDataDirUnavailable;

View File

@ -143,7 +143,7 @@ fn contains(entries: *const std.ArrayList(Dir.Entry), el: Dir.Entry) bool {
test "Dir.realpath smoke test" { test "Dir.realpath smoke test" {
switch (builtin.os.tag) { switch (builtin.os.tag) {
.linux, .windows, .macosx, .ios, .watchos, .tvos => {}, .linux, .windows, .macos, .ios, .watchos, .tvos => {},
else => return error.SkipZigTest, else => return error.SkipZigTest,
} }

View File

@ -49,7 +49,7 @@ pub fn Watch(comptime V: type) type {
const OsData = switch (builtin.os.tag) { const OsData = switch (builtin.os.tag) {
// TODO https://github.com/ziglang/zig/issues/3778 // TODO https://github.com/ziglang/zig/issues/3778
.macosx, .freebsd, .netbsd, .dragonfly => KqOsData, .macos, .freebsd, .netbsd, .dragonfly => KqOsData,
.linux => LinuxOsData, .linux => LinuxOsData,
.windows => WindowsOsData, .windows => WindowsOsData,
@ -160,7 +160,7 @@ pub fn Watch(comptime V: type) type {
return self; return self;
}, },
.macosx, .freebsd, .netbsd, .dragonfly => { .macos, .freebsd, .netbsd, .dragonfly => {
self.* = Self{ self.* = Self{
.allocator = allocator, .allocator = allocator,
.channel = channel, .channel = channel,
@ -178,7 +178,7 @@ pub fn Watch(comptime V: type) type {
/// All addFile calls and removeFile calls must have completed. /// All addFile calls and removeFile calls must have completed.
pub fn deinit(self: *Self) void { pub fn deinit(self: *Self) void {
switch (builtin.os.tag) { switch (builtin.os.tag) {
.macosx, .freebsd, .netbsd, .dragonfly => { .macos, .freebsd, .netbsd, .dragonfly => {
// TODO we need to cancel the frames before destroying the lock // TODO we need to cancel the frames before destroying the lock
self.os_data.table_lock.deinit(); self.os_data.table_lock.deinit();
var it = self.os_data.file_table.iterator(); var it = self.os_data.file_table.iterator();
@ -229,7 +229,7 @@ pub fn Watch(comptime V: type) type {
pub fn addFile(self: *Self, file_path: []const u8, value: V) !?V { pub fn addFile(self: *Self, file_path: []const u8, value: V) !?V {
switch (builtin.os.tag) { switch (builtin.os.tag) {
.macosx, .freebsd, .netbsd, .dragonfly => return addFileKEvent(self, file_path, value), .macos, .freebsd, .netbsd, .dragonfly => return addFileKEvent(self, file_path, value),
.linux => return addFileLinux(self, file_path, value), .linux => return addFileLinux(self, file_path, value),
.windows => return addFileWindows(self, file_path, value), .windows => return addFileWindows(self, file_path, value),
else => @compileError("Unsupported OS"), else => @compileError("Unsupported OS"),

View File

@ -62,7 +62,7 @@ pub const system = if (@hasDecl(root, "os") and root.os != @This())
else if (builtin.link_libc) else if (builtin.link_libc)
std.c std.c
else switch (builtin.os.tag) { else switch (builtin.os.tag) {
.macosx, .ios, .watchos, .tvos => darwin, .macos, .ios, .watchos, .tvos => darwin,
.freebsd => freebsd, .freebsd => freebsd,
.linux => linux, .linux => linux,
.netbsd => netbsd, .netbsd => netbsd,
@ -354,7 +354,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
// Prevents EINVAL. // Prevents EINVAL.
const max_count = switch (std.Target.current.os.tag) { const max_count = switch (std.Target.current.os.tag) {
.linux => 0x7ffff000, .linux => 0x7ffff000,
.macosx, .ios, .watchos, .tvos => math.maxInt(i32), .macos, .ios, .watchos, .tvos => math.maxInt(i32),
else => math.maxInt(isize), else => math.maxInt(isize),
}; };
const adjusted_len = math.min(max_count, buf.len); const adjusted_len = math.min(max_count, buf.len);
@ -582,7 +582,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. /// 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 { pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize {
const have_pread_but_not_preadv = switch (std.Target.current.os.tag) { const have_pread_but_not_preadv = switch (std.Target.current.os.tag) {
.windows, .macosx, .ios, .watchos, .tvos => true, .windows, .macos, .ios, .watchos, .tvos => true,
else => false, else => false,
}; };
if (have_pread_but_not_preadv) { if (have_pread_but_not_preadv) {
@ -709,7 +709,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {
const max_count = switch (std.Target.current.os.tag) { const max_count = switch (std.Target.current.os.tag) {
.linux => 0x7ffff000, .linux => 0x7ffff000,
.macosx, .ios, .watchos, .tvos => math.maxInt(i32), .macos, .ios, .watchos, .tvos => math.maxInt(i32),
else => math.maxInt(isize), else => math.maxInt(isize),
}; };
const adjusted_len = math.min(max_count, bytes.len); const adjusted_len = math.min(max_count, bytes.len);
@ -863,7 +863,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize {
// Prevent EINVAL. // Prevent EINVAL.
const max_count = switch (std.Target.current.os.tag) { const max_count = switch (std.Target.current.os.tag) {
.linux => 0x7ffff000, .linux => 0x7ffff000,
.macosx, .ios, .watchos, .tvos => math.maxInt(i32), .macos, .ios, .watchos, .tvos => math.maxInt(i32),
else => math.maxInt(isize), else => math.maxInt(isize),
}; };
const adjusted_len = math.min(max_count, bytes.len); const adjusted_len = math.min(max_count, bytes.len);
@ -915,7 +915,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize {
/// If `iov.len` is larger than will fit in a `u31`, a partial write will occur. /// If `iov.len` is larger than will fit in a `u31`, a partial write will occur.
pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usize { pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usize {
const have_pwrite_but_not_pwritev = switch (std.Target.current.os.tag) { const have_pwrite_but_not_pwritev = switch (std.Target.current.os.tag) {
.windows, .macosx, .ios, .watchos, .tvos => true, .windows, .macos, .ios, .watchos, .tvos => true,
else => false, else => false,
}; };
@ -4091,7 +4091,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {
const end_index = std.unicode.utf16leToUtf8(out_buffer, wide_slice) catch unreachable; const end_index = std.unicode.utf16leToUtf8(out_buffer, wide_slice) catch unreachable;
return out_buffer[0..end_index]; return out_buffer[0..end_index];
}, },
.macosx, .ios, .watchos, .tvos => { .macos, .ios, .watchos, .tvos => {
// On macOS, we can use F_GETPATH fcntl command to query the OS for // On macOS, we can use F_GETPATH fcntl command to query the OS for
// the path to the file descriptor. // the path to the file descriptor.
@memset(out_buffer, 0, MAX_PATH_BYTES); @memset(out_buffer, 0, MAX_PATH_BYTES);
@ -4688,7 +4688,7 @@ pub fn sendfile(
}); });
const max_count = switch (std.Target.current.os.tag) { const max_count = switch (std.Target.current.os.tag) {
.linux => 0x7ffff000, .linux => 0x7ffff000,
.macosx, .ios, .watchos, .tvos => math.maxInt(i32), .macos, .ios, .watchos, .tvos => math.maxInt(i32),
else => math.maxInt(size_t), else => math.maxInt(size_t),
}; };
@ -4846,7 +4846,7 @@ pub fn sendfile(
} }
} }
}, },
.macosx, .ios, .tvos, .watchos => sf: { .macos, .ios, .tvos, .watchos => sf: {
var hdtr_data: std.c.sf_hdtr = undefined; var hdtr_data: std.c.sf_hdtr = undefined;
var hdtr: ?*std.c.sf_hdtr = null; var hdtr: ?*std.c.sf_hdtr = null;
if (headers.len != 0 or trailers.len != 0) { if (headers.len != 0 or trailers.len != 0) {

View File

@ -12,7 +12,7 @@ const std = @import("std");
const root = @import("root"); const root = @import("root");
pub usingnamespace switch (std.Target.current.os.tag) { pub usingnamespace switch (std.Target.current.os.tag) {
.macosx, .ios, .tvos, .watchos => @import("bits/darwin.zig"), .macos, .ios, .tvos, .watchos => @import("bits/darwin.zig"),
.dragonfly => @import("bits/dragonfly.zig"), .dragonfly => @import("bits/dragonfly.zig"),
.freebsd => @import("bits/freebsd.zig"), .freebsd => @import("bits/freebsd.zig"),
.linux => @import("bits/linux.zig"), .linux => @import("bits/linux.zig"),

View File

@ -360,7 +360,7 @@ fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void {
} }
test "dl_iterate_phdr" { test "dl_iterate_phdr" {
if (builtin.os.tag == .windows or builtin.os.tag == .wasi or builtin.os.tag == .macosx) if (builtin.os.tag == .windows or builtin.os.tag == .wasi or builtin.os.tag == .macos)
return error.SkipZigTest; return error.SkipZigTest;
var counter: usize = 0; var counter: usize = 0;

View File

@ -618,7 +618,7 @@ test "PackedIntArray at end of available memory" {
if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest; if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest;
switch (builtin.os.tag) { switch (builtin.os.tag) {
.linux, .macosx, .ios, .freebsd, .netbsd, .windows => {}, .linux, .macos, .ios, .freebsd, .netbsd, .windows => {},
else => return, else => return,
} }
const PackedArray = PackedIntArray(u3, 8); const PackedArray = PackedIntArray(u3, 8);
@ -639,7 +639,7 @@ test "PackedIntSlice at end of available memory" {
if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest; if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest;
switch (builtin.os.tag) { switch (builtin.os.tag) {
.linux, .macosx, .ios, .freebsd, .netbsd, .windows => {}, .linux, .macos, .ios, .freebsd, .netbsd, .windows => {},
else => return, else => return,
} }
const PackedSlice = PackedIntSlice(u11); const PackedSlice = PackedIntSlice(u11);

View File

@ -585,7 +585,7 @@ pub const UserInfo = struct {
/// POSIX function which gets a uid from username. /// POSIX function which gets a uid from username.
pub fn getUserInfo(name: []const u8) !UserInfo { pub fn getUserInfo(name: []const u8) !UserInfo {
return switch (builtin.os.tag) { return switch (builtin.os.tag) {
.linux, .macosx, .watchos, .tvos, .ios, .freebsd, .netbsd => posixGetUserInfo(name), .linux, .macos, .watchos, .tvos, .ios, .freebsd, .netbsd => posixGetUserInfo(name),
else => @compileError("Unsupported OS"), else => @compileError("Unsupported OS"),
}; };
} }
@ -688,7 +688,7 @@ pub fn getBaseAddress() usize {
const phdr = os.system.getauxval(std.elf.AT_PHDR); const phdr = os.system.getauxval(std.elf.AT_PHDR);
return phdr - @sizeOf(std.elf.Ehdr); return phdr - @sizeOf(std.elf.Ehdr);
}, },
.macosx, .freebsd, .netbsd => { .macos, .freebsd, .netbsd => {
return @ptrToInt(&std.c._mh_execute_header); return @ptrToInt(&std.c._mh_execute_header);
}, },
.windows => return @ptrToInt(os.windows.kernel32.GetModuleHandleW(null)), .windows => return @ptrToInt(os.windows.kernel32.GetModuleHandleW(null)),
@ -733,7 +733,7 @@ pub fn getSelfExeSharedLibPaths(allocator: *Allocator) error{OutOfMemory}![][:0]
}.callback); }.callback);
return paths.toOwnedSlice(); return paths.toOwnedSlice();
}, },
.macosx, .ios, .watchos, .tvos => { .macos, .ios, .watchos, .tvos => {
var paths = List.init(allocator); var paths = List.init(allocator);
errdefer { errdefer {
const slice = paths.toOwnedSlice(); const slice = paths.toOwnedSlice();

View File

@ -44,7 +44,7 @@ pub fn clear_cache(start: usize, end: usize) callconv(.C) void {
else => false, else => false,
}; };
const apple = switch (os) { const apple = switch (os) {
.ios, .macosx, .watchos, .tvos => true, .ios, .macos, .watchos, .tvos => true,
else => false, else => false,
}; };
if (x86) { if (x86) {

View File

@ -31,7 +31,7 @@ pub const Target = struct {
kfreebsd, kfreebsd,
linux, linux,
lv2, lv2,
macosx, macos,
netbsd, netbsd,
openbsd, openbsd,
solaris, solaris,
@ -61,7 +61,7 @@ pub const Target = struct {
pub fn isDarwin(tag: Tag) bool { pub fn isDarwin(tag: Tag) bool {
return switch (tag) { return switch (tag) {
.ios, .macosx, .watchos, .tvos => true, .ios, .macos, .watchos, .tvos => true,
else => false, else => false,
}; };
} }
@ -234,7 +234,7 @@ pub const Target = struct {
.max = .{ .major = 12, .minor = 1 }, .max = .{ .major = 12, .minor = 1 },
}, },
}, },
.macosx => return .{ .macos => return .{
.semver = .{ .semver = .{
.min = .{ .major = 10, .minor = 13 }, .min = .{ .major = 10, .minor = 13 },
.max = .{ .major = 10, .minor = 15, .patch = 3 }, .max = .{ .major = 10, .minor = 15, .patch = 3 },
@ -312,7 +312,7 @@ pub const Target = struct {
.windows => return TaggedVersionRange{ .windows = self.version_range.windows }, .windows => return TaggedVersionRange{ .windows = self.version_range.windows },
.freebsd, .freebsd,
.macosx, .macos,
.ios, .ios,
.tvos, .tvos,
.watchos, .watchos,
@ -341,7 +341,7 @@ pub const Target = struct {
return switch (os.tag) { return switch (os.tag) {
.freebsd, .freebsd,
.netbsd, .netbsd,
.macosx, .macos,
.ios, .ios,
.tvos, .tvos,
.watchos, .watchos,
@ -450,7 +450,7 @@ pub const Target = struct {
.other, .other,
=> return .eabi, => return .eabi,
.openbsd, .openbsd,
.macosx, .macos,
.freebsd, .freebsd,
.ios, .ios,
.tvos, .tvos,
@ -1277,7 +1277,7 @@ pub const Target = struct {
.ios, .ios,
.tvos, .tvos,
.watchos, .watchos,
.macosx, .macos,
.uefi, .uefi,
.windows, .windows,
.emscripten, .emscripten,
@ -1450,7 +1450,7 @@ pub const Target = struct {
.ios, .ios,
.tvos, .tvos,
.watchos, .watchos,
.macosx, .macos,
.uefi, .uefi,
.windows, .windows,
.emscripten, .emscripten,

View File

@ -143,7 +143,7 @@ pub const Timer = struct {
/// be less precise /// be less precise
frequency: switch (builtin.os.tag) { frequency: switch (builtin.os.tag) {
.windows => u64, .windows => u64,
.macosx, .ios, .tvos, .watchos => os.darwin.mach_timebase_info_data, .macos, .ios, .tvos, .watchos => os.darwin.mach_timebase_info_data,
else => void, else => void,
}, },
resolution: u64, resolution: u64,

View File

@ -137,7 +137,7 @@ pub const CrossTarget = struct {
}, },
.freebsd, .freebsd,
.macosx, .macos,
.ios, .ios,
.tvos, .tvos,
.watchos, .watchos,
@ -578,7 +578,7 @@ pub const CrossTarget = struct {
const os = switch (self.getOsTag()) { const os = switch (self.getOsTag()) {
.windows => "windows", .windows => "windows",
.linux => "linux", .linux => "linux",
.macosx => "macos", .macos => "macos",
else => return error.UnsupportedVcpkgOperatingSystem, else => return error.UnsupportedVcpkgOperatingSystem,
}; };
@ -718,7 +718,7 @@ pub const CrossTarget = struct {
=> return error.InvalidOperatingSystemVersion, => return error.InvalidOperatingSystemVersion,
.freebsd, .freebsd,
.macosx, .macos,
.ios, .ios,
.tvos, .tvos,
.watchos, .watchos,

View File

@ -267,7 +267,7 @@ pub const NativeTargetInfo = struct {
os.version_range.windows.max = @intToEnum(Target.Os.WindowsVersion, version); os.version_range.windows.max = @intToEnum(Target.Os.WindowsVersion, version);
os.version_range.windows.min = @intToEnum(Target.Os.WindowsVersion, version); os.version_range.windows.min = @intToEnum(Target.Os.WindowsVersion, version);
}, },
.macosx => { .macos => {
var scbuf: [32]u8 = undefined; var scbuf: [32]u8 = undefined;
var size: usize = undefined; var size: usize = undefined;

View File

@ -69,7 +69,7 @@ pub fn targetTriple(allocator: *Allocator, target: std.Target) ![]u8 {
.kfreebsd => "kfreebsd", .kfreebsd => "kfreebsd",
.linux => "linux", .linux => "linux",
.lv2 => "lv2", .lv2 => "lv2",
.macosx => "macosx", .macos => "macosx",
.netbsd => "netbsd", .netbsd => "netbsd",
.openbsd => "openbsd", .openbsd => "openbsd",
.solaris => "solaris", .solaris => "solaris",

View File

@ -525,7 +525,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
try argv.append(darwinArchString(target.cpu.arch)); try argv.append(darwinArchString(target.cpu.arch));
switch (target.os.tag) { switch (target.os.tag) {
.macosx => { .macos => {
try argv.append("-macosx_version_min"); try argv.append("-macosx_version_min");
}, },
.ios, .tvos, .watchos => switch (target.cpu.arch) { .ios, .tvos, .watchos => switch (target.cpu.arch) {

View File

@ -123,14 +123,14 @@ pub fn cannotDynamicLink(target: std.Target) bool {
/// since this is the stable syscall interface. /// since this is the stable syscall interface.
pub fn osRequiresLibC(target: std.Target) bool { pub fn osRequiresLibC(target: std.Target) bool {
return switch (target.os.tag) { return switch (target.os.tag) {
.freebsd, .netbsd, .dragonfly, .macosx, .ios, .watchos, .tvos => true, .freebsd, .netbsd, .dragonfly, .macos, .ios, .watchos, .tvos => true,
else => false, else => false,
}; };
} }
pub fn libcNeedsLibUnwind(target: std.Target) bool { pub fn libcNeedsLibUnwind(target: std.Target) bool {
return switch (target.os.tag) { return switch (target.os.tag) {
.macosx, .macos,
.ios, .ios,
.watchos, .watchos,
.tvos, .tvos,
@ -197,7 +197,7 @@ pub fn osToLLVM(os_tag: std.Target.Os.Tag) llvm.OSType {
.kfreebsd => .KFreeBSD, .kfreebsd => .KFreeBSD,
.linux => .Linux, .linux => .Linux,
.lv2 => .Lv2, .lv2 => .Lv2,
.macosx => .MacOSX, .macos => .MacOSX,
.netbsd => .NetBSD, .netbsd => .NetBSD,
.openbsd => .OpenBSD, .openbsd => .OpenBSD,
.solaris => .Solaris, .solaris => .Solaris,

View File

@ -3104,7 +3104,7 @@ pub const CType = enum {
}, },
.linux, .linux,
.macosx, .macos,
.freebsd, .freebsd,
.netbsd, .netbsd,
.dragonfly, .dragonfly,

View File

@ -817,7 +817,9 @@ const char *ZigLLVMGetVendorTypeName(ZigLLVM_VendorType vendor) {
} }
const char *ZigLLVMGetOSTypeName(ZigLLVM_OSType os) { const char *ZigLLVMGetOSTypeName(ZigLLVM_OSType os) {
return (const char*)Triple::getOSTypeName((Triple::OSType)os).bytes_begin(); const char* name = (const char*)Triple::getOSTypeName((Triple::OSType)os).bytes_begin();
if (strcmp(name, "macosx") == 0) return "macos";
return name;
} }
const char *ZigLLVMGetEnvironmentTypeName(ZigLLVM_EnvironmentType env_type) { const char *ZigLLVMGetEnvironmentTypeName(ZigLLVM_EnvironmentType env_type) {

View File

@ -308,7 +308,7 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
}, },
); );
}, },
.macosx => { .macos => {
cases.addCase( cases.addCase(
"return", "return",
source_return, source_return,

View File

@ -13,7 +13,7 @@ const linux_x64 = std.zig.CrossTarget{
const macosx_x64 = std.zig.CrossTarget{ const macosx_x64 = std.zig.CrossTarget{
.cpu_arch = .x86_64, .cpu_arch = .x86_64,
.os_tag = .macosx, .os_tag = .macos,
}; };
const linux_riscv64 = std.zig.CrossTarget{ const linux_riscv64 = std.zig.CrossTarget{

View File

@ -234,7 +234,7 @@ const test_targets = blk: {
TestTarget{ TestTarget{
.target = .{ .target = .{
.cpu_arch = .x86_64, .cpu_arch = .x86_64,
.os_tag = .macosx, .os_tag = .macos,
.abi = .gnu, .abi = .gnu,
}, },
// https://github.com/ziglang/zig/issues/3295 // https://github.com/ziglang/zig/issues/3295