authorgravatar for achan1989@gmail.comachan1989 <achan1989@gmail.com> 2024-10-04 22:13:33+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-05 15:23:00+02:00
log0d85284e4d5729c316f812c68004f3fa7847d9e2
tree3b9508946bbdbd4403e023933feae3b8b5705b8c
parentd23db9427b82d7dc798442accf34729c16e92f2d

Create/open file on WASI targets should have POLL_FD_READWRITE rights


1 files changed, 3 insertions(+), 0 deletions(-)

lib/std/fs/Dir.zig+3
......@@ -809,6 +809,7 @@ pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.Ope
809809 base.FD_TELL = true;
810810 base.FD_SEEK = true;
811811 base.FD_FILESTAT_GET = true;
812 base.POLL_FD_READWRITE = true;
812813 }
813814 if (flags.isWrite()) {
814815 base.FD_WRITE = true;
......@@ -821,6 +822,7 @@ pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.Ope
821822 base.FD_ADVISE = true;
822823 base.FD_FILESTAT_SET_TIMES = true;
823824 base.FD_FILESTAT_SET_SIZE = true;
825 base.POLL_FD_READWRITE = true;
824826 }
825827 const fd = try posix.openatWasi(self.fd, sub_path, .{}, .{}, .{}, base, .{});
826828 return .{ .handle = fd };
......@@ -982,6 +984,7 @@ pub fn createFile(self: Dir, sub_path: []const u8, flags: File.CreateFlags) File
982984 .FD_FILESTAT_SET_TIMES = true,
983985 .FD_FILESTAT_SET_SIZE = true,
984986 .FD_FILESTAT_GET = true,
987 .POLL_FD_READWRITE = true,
985988 }, .{}),
986989 };
987990 }