Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/std/Io/Threaded.zig
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,10 @@ fn await(
result_alignment: std.mem.Alignment,
) void {
_ = result_alignment;
if (builtin.single_threaded) return;
const t: *Threaded = @ptrCast(@alignCast(userdata));
const closure: *AsyncClosure = @ptrCast(@alignCast(any_future));
closure.waitAndDeinit(t.allocator, result);
const ac: *AsyncClosure = @ptrCast(@alignCast(any_future));
ac.waitAndDeinit(t.allocator, result);
}

fn cancel(
Expand All @@ -809,6 +810,7 @@ fn cancel(
result_alignment: std.mem.Alignment,
) void {
_ = result_alignment;
if (builtin.single_threaded) return;
const t: *Threaded = @ptrCast(@alignCast(userdata));
const ac: *AsyncClosure = @ptrCast(@alignCast(any_future));
ac.closure.requestCancel();
Expand Down
15 changes: 13 additions & 2 deletions lib/std/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,16 @@ pub const POLL = switch (native_os) {
/// Basic memory protection flags
pub const PROT = switch (native_os) {
.linux => linux.PROT,
.emscripten => emscripten.PROT,
// https://github.com/emscripten-core/emscripten/blob/08e2de1031913e4ba7963b1c56f35f036a7d4d56/system/lib/libc/musl/include/sys/mman.h#L57-L62
// lib/libc/include/wasm-wasi-musl/sys/mman.h
.emscripten, .wasi => struct {
pub const NONE = 0;
pub const READ = 1;
pub const WRITE = 2;
pub const EXEC = 4;
pub const GROWSDOWN = 0x01000000;
pub const GROWSUP = 0x02000000;
},
// https://github.com/SerenityOS/serenity/blob/6d59d4d3d9e76e39112842ec487840828f1c9bfe/Kernel/API/POSIX/sys/mman.h#L28-L31
.openbsd, .haiku, .dragonfly, .netbsd, .illumos, .freebsd, .windows, .serenity => struct {
/// page can not be accessed
Expand Down Expand Up @@ -8692,7 +8701,9 @@ pub const O = switch (native_os) {

pub const MAP = switch (native_os) {
.linux => linux.MAP,
.emscripten => packed struct(u32) {
// https://github.com/emscripten-core/emscripten/blob/08e2de1031913e4ba7963b1c56f35f036a7d4d56/system/lib/libc/musl/include/sys/mman.h#L21-L39
// lib/libc/include/wasm-wasi-musl/sys/mman.h
.emscripten, .wasi => packed struct(u32) {
TYPE: enum(u4) {
SHARED = 0x01,
PRIVATE = 0x02,
Expand Down
2 changes: 1 addition & 1 deletion lib/std/heap.zig
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ pub const page_allocator: Allocator = if (@hasDecl(root, "os") and
@hasDecl(root.os, "heap") and
@hasDecl(root.os.heap, "page_allocator"))
root.os.heap.page_allocator
else if (builtin.target.cpu.arch.isWasm()) .{
else if (builtin.target.cpu.arch.isWasm() and !builtin.link_libc) .{
.ptr = undefined,
.vtable = &WasmAllocator.vtable,
} else if (builtin.target.os.tag == .plan9) .{
Expand Down
9 changes: 0 additions & 9 deletions lib/std/os/emscripten.zig
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,6 @@ pub const POLL = struct {
pub const RDBAND = 0x080;
};

pub const PROT = struct {
pub const NONE = 0x0;
pub const READ = 0x1;
pub const WRITE = 0x2;
pub const EXEC = 0x4;
pub const GROWSDOWN = 0x01000000;
pub const GROWSUP = 0x02000000;
};

pub const rlim_t = u64;

pub const RLIM = struct {
Expand Down