diff options
Diffstat (limited to 'src/bun.js/api/bun.zig')
-rw-r--r-- | src/bun.js/api/bun.zig | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/bun.js/api/bun.zig b/src/bun.js/api/bun.zig index 71b065993..cf984c81a 100644 --- a/src/bun.js/api/bun.zig +++ b/src/bun.js/api/bun.zig @@ -179,7 +179,7 @@ const ServerEntryPoint = bun.bundler.ServerEntryPoint; const js_printer = bun.js_printer; const js_parser = bun.js_parser; const js_ast = bun.JSAst; -const http = @import("../../http.zig"); +const http = @import("../../bun_dev_http_server.zig"); const NodeFallbackModules = @import("../../node_fallbacks.zig"); const ImportKind = ast.ImportKind; const Analytics = @import("../../analytics/analytics_thread.zig"); @@ -2738,6 +2738,11 @@ pub fn mmapFile( globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame, ) callconv(.C) JSC.JSValue { + if (comptime Environment.isWindows) { + globalThis.throwTODO("mmapFile is not supported on Windows"); + return JSC.JSValue.zero; + } + const arguments_ = callframe.arguments(2); var args = JSC.Node.ArgumentsSlice.init(globalThis.bunVM(), arguments_.slice()); defer args.deinit(); @@ -2789,7 +2794,7 @@ pub fn mmapFile( flags |= std.os.MAP.SHARED; } - const map = switch (JSC.Node.Syscall.mmapFile(buf_z, flags, map_size, offset)) { + const map = switch (bun.sys.mmapFile(buf_z, flags, map_size, offset)) { .result => |map| map, .err => |err| { @@ -2800,7 +2805,7 @@ pub fn mmapFile( return JSC.C.JSObjectMakeTypedArrayWithBytesNoCopy(globalThis, JSC.C.JSTypedArrayType.kJSTypedArrayTypeUint8Array, @as(?*anyopaque, @ptrCast(map.ptr)), map.len, struct { pub fn x(ptr: ?*anyopaque, size: ?*anyopaque) callconv(.C) void { - _ = JSC.Node.Syscall.munmap(@as([*]align(std.mem.page_size) u8, @ptrCast(@alignCast(ptr)))[0..@intFromPtr(size)]); + _ = bun.sys.munmap(@as([*]align(std.mem.page_size) u8, @ptrCast(@alignCast(ptr)))[0..@intFromPtr(size)]); } }.x, @as(?*anyopaque, @ptrFromInt(map.len)), null).?.value(); } |