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...@@ -809,6 +809,7 @@ pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.Ope
809 base.FD_TELL = true;809 base.FD_TELL = true;
810 base.FD_SEEK = true;810 base.FD_SEEK = true;
811 base.FD_FILESTAT_GET = true;811 base.FD_FILESTAT_GET = true;
812 base.POLL_FD_READWRITE = true;
812 }813 }
813 if (flags.isWrite()) {814 if (flags.isWrite()) {
814 base.FD_WRITE = true;815 base.FD_WRITE = true;
...@@ -821,6 +822,7 @@ pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.Ope...@@ -821,6 +822,7 @@ pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.Ope
821 base.FD_ADVISE = true;822 base.FD_ADVISE = true;
822 base.FD_FILESTAT_SET_TIMES = true;823 base.FD_FILESTAT_SET_TIMES = true;
823 base.FD_FILESTAT_SET_SIZE = true;824 base.FD_FILESTAT_SET_SIZE = true;
825 base.POLL_FD_READWRITE = true;
824 }826 }
825 const fd = try posix.openatWasi(self.fd, sub_path, .{}, .{}, .{}, base, .{});827 const fd = try posix.openatWasi(self.fd, sub_path, .{}, .{}, .{}, base, .{});
826 return .{ .handle = fd };828 return .{ .handle = fd };
...@@ -982,6 +984,7 @@ pub fn createFile(self: Dir, sub_path: []const u8, flags: File.CreateFlags) File...@@ -982,6 +984,7 @@ pub fn createFile(self: Dir, sub_path: []const u8, flags: File.CreateFlags) File
982 .FD_FILESTAT_SET_TIMES = true,984 .FD_FILESTAT_SET_TIMES = true,
983 .FD_FILESTAT_SET_SIZE = true,985 .FD_FILESTAT_SET_SIZE = true,
984 .FD_FILESTAT_GET = true,986 .FD_FILESTAT_GET = true,
987 .POLL_FD_READWRITE = true,
985 }, .{}),988 }, .{}),
986 };989 };
987 }990 }