aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/os/mach.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/os/mach.zig
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/os/mach.zig')
-rw-r--r--vendor/libghostty-vt/src/os/mach.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/vendor/libghostty-vt/src/os/mach.zig b/vendor/libghostty-vt/src/os/mach.zig
index 4477bd12..5f5a3ed8 100644
--- a/vendor/libghostty-vt/src/os/mach.zig
+++ b/vendor/libghostty-vt/src/os/mach.zig
@@ -46,6 +46,9 @@ pub fn taggedPageAllocator(tag: VMTag) Allocator {
/// This is based heavily on the Zig 0.15.2 PageAllocator implementation,
/// with only the posix implementation. Zig 0.15.2 is MIT licensed.
const TaggedPageAllocator = struct {
+ // Static local next_mmap_addr_hint since this has been removed from stdlib now
+ var next_mmap_addr_hint: ?[*]align(std.heap.page_size_min) u8 = null;
+
pub const vtable: Allocator.VTable = .{
.alloc = alloc,
.resize = resize,
@@ -92,11 +95,11 @@ const TaggedPageAllocator = struct {
aligned_len
else
mem.alignForward(usize, aligned_len + max_drop_len, page_size);
- const hint = @atomicLoad(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, .unordered);
+ const hint = @atomicLoad(@TypeOf(next_mmap_addr_hint), &next_mmap_addr_hint, .unordered);
const slice = std.posix.mmap(
hint,
overalloc_len,
- std.posix.PROT.READ | std.posix.PROT.WRITE,
+ .{ .READ = true, .WRITE = true },
.{ .TYPE = .PRIVATE, .ANONYMOUS = true },
tag.make(),
0,
@@ -110,7 +113,7 @@ const TaggedPageAllocator = struct {
const remaining_len = overalloc_len - drop_len;
if (remaining_len > aligned_len) std.posix.munmap(@alignCast(result_ptr[aligned_len..remaining_len]));
const new_hint: [*]align(std.heap.page_size_min) u8 = @alignCast(result_ptr + aligned_len);
- _ = @cmpxchgStrong(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, hint, new_hint, .monotonic, .monotonic);
+ _ = @cmpxchgStrong(@TypeOf(next_mmap_addr_hint), &next_mmap_addr_hint, hint, new_hint, .monotonic, .monotonic);
return result_ptr;
}