authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-01-03 14:52:17+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-01-03 14:52:17+00:00
log04226193ccb69f50936e47804be56bd1bdc316d9
tree6aa1f9bfbebd7e18b853bd96f7dbce5cf54e7c89
parentd024d9f00566968fd3aa85e0e6a0e8907016977c
signaturelock-open Commit is signed but in an unrecognized format.

Revert "Use `mmap` `std.heap.page_allocator` impl when compiling for Wasm + libc"

This reverts commit c9fa8e46df21cdf66b291fb3dfdcef1b6a1d3cab. This commit was failing CI checks. This failure was unfortunately not noticed before merge, due in part to the build runner bug fixed in the last commit.

3 files changed, 12 insertions(+), 14 deletions(-)

lib/std/c.zig+2-13
...@@ -1885,16 +1885,7 @@ pub const POLL = switch (native_os) {...@@ -1885,16 +1885,7 @@ pub const POLL = switch (native_os) {
1885/// Basic memory protection flags1885/// Basic memory protection flags
1886pub const PROT = switch (native_os) {1886pub const PROT = switch (native_os) {
1887 .linux => linux.PROT,1887 .linux => linux.PROT,
1888 // https://github.com/emscripten-core/emscripten/blob/08e2de1031913e4ba7963b1c56f35f036a7d4d56/system/lib/libc/musl/include/sys/mman.h#L57-L621888 .emscripten => emscripten.PROT,
1889 // lib/libc/include/wasm-wasi-musl/sys/mman.h
1890 .emscripten, .wasi => struct {
1891 pub const NONE = 0;
1892 pub const READ = 1;
1893 pub const WRITE = 2;
1894 pub const EXEC = 4;
1895 pub const GROWSDOWN = 0x01000000;
1896 pub const GROWSUP = 0x02000000;
1897 },
1898 // https://github.com/SerenityOS/serenity/blob/6d59d4d3d9e76e39112842ec487840828f1c9bfe/Kernel/API/POSIX/sys/mman.h#L28-L311889 // https://github.com/SerenityOS/serenity/blob/6d59d4d3d9e76e39112842ec487840828f1c9bfe/Kernel/API/POSIX/sys/mman.h#L28-L31
1899 .openbsd, .haiku, .dragonfly, .netbsd, .illumos, .freebsd, .windows, .serenity => struct {1890 .openbsd, .haiku, .dragonfly, .netbsd, .illumos, .freebsd, .windows, .serenity => struct {
1900 /// page can not be accessed1891 /// page can not be accessed
...@@ -8649,9 +8640,7 @@ pub const O = switch (native_os) {...@@ -8649,9 +8640,7 @@ pub const O = switch (native_os) {
86498640
8650pub const MAP = switch (native_os) {8641pub const MAP = switch (native_os) {
8651 .linux => linux.MAP,8642 .linux => linux.MAP,
8652 // https://github.com/emscripten-core/emscripten/blob/08e2de1031913e4ba7963b1c56f35f036a7d4d56/system/lib/libc/musl/include/sys/mman.h#L21-L398643 .emscripten => packed struct(u32) {
8653 // lib/libc/include/wasm-wasi-musl/sys/mman.h
8654 .emscripten, .wasi => packed struct(u32) {
8655 TYPE: enum(u4) {8644 TYPE: enum(u4) {
8656 SHARED = 0x01,8645 SHARED = 0x01,
8657 PRIVATE = 0x02,8646 PRIVATE = 0x02,
lib/std/heap.zig+1-1
...@@ -352,7 +352,7 @@ pub const page_allocator: Allocator = if (@hasDecl(root, "os") and...@@ -352,7 +352,7 @@ pub const page_allocator: Allocator = if (@hasDecl(root, "os") and
352 @hasDecl(root.os, "heap") and352 @hasDecl(root.os, "heap") and
353 @hasDecl(root.os.heap, "page_allocator"))353 @hasDecl(root.os.heap, "page_allocator"))
354 root.os.heap.page_allocator354 root.os.heap.page_allocator
355else if (builtin.target.cpu.arch.isWasm() and !builtin.link_libc) .{355else if (builtin.target.cpu.arch.isWasm()) .{
356 .ptr = undefined,356 .ptr = undefined,
357 .vtable = &WasmAllocator.vtable,357 .vtable = &WasmAllocator.vtable,
358} else if (builtin.target.os.tag == .plan9) .{358} else if (builtin.target.os.tag == .plan9) .{
lib/std/os/emscripten.zig+9
...@@ -331,6 +331,15 @@ pub const POLL = struct {...@@ -331,6 +331,15 @@ pub const POLL = struct {
331 pub const RDBAND = 0x080;331 pub const RDBAND = 0x080;
332};332};
333333
334pub const PROT = struct {
335 pub const NONE = 0x0;
336 pub const READ = 0x1;
337 pub const WRITE = 0x2;
338 pub const EXEC = 0x4;
339 pub const GROWSDOWN = 0x01000000;
340 pub const GROWSUP = 0x02000000;
341};
342
334pub const rlim_t = u64;343pub const rlim_t = u64;
335344
336pub const RLIM = struct {345pub const RLIM = struct {