-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
File descriptors are handled as i32 in WASI functions arguments, like this.
pub export fn fd_close(fd: i32) callconv(.C) WasiErrorWe pass them around as i32. But indices must be usize in Zig, so we must cast them every time we index the file descriptor table.
pub fn get(self: *Self, fd: i32) ?*Stream {
const streams = self.streams.acquire();
defer self.streams.release();
const s = &streams.*[@as(usize, @intCast(fd))];
if (s.* == null) {
return null;
}
return @as(*Stream, @ptrCast(s));
}To avoid it, we want to cast fd to usize in WASI functions, and handle it as usize in stream module.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers