fixed: problems with WASIX definitions
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 19 Feb 2024 04:09:44 +0000 (22:09 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 19 Feb 2024 04:09:44 +0000 (22:09 -0600)
core/runtime/platform/wasi/platform.onyx
core/runtime/platform/wasi/wasi_fs.onyx
core/runtime/platform/wasi/wasix_net.onyx

index 918392e73765af6657bc7226df9416dc87e7e6f8..57d142be45e8b4a9475b5c193e5c7a89c047cb8d 100644 (file)
@@ -152,8 +152,8 @@ __random_get :: (buf: [] u8) {
 
 PollDescription :: struct {
     fd: wasi.FileDescriptor;
-    input: core.io.PollEvent;
-    out: core.io.PollEvent;
+    in_events: core.io.PollEvent;
+    out_events: core.io.PollEvent;
 }
 
 __poll :: (fds: [] PollDescription, timeout: i32) -> void {
@@ -169,7 +169,7 @@ __poll :: (fds: [] PollDescription, timeout: i32) -> void {
     subs := core.alloc.array_from_stack(wasi.Subscription, count);
     for i in fds.count {
         subs[i].userdata = ~~ i;
-        subs[i].u.tag = switch fds[i].input {
+        subs[i].u.tag = switch fds[i].in_events {
             case .None => .FDRead;
             case .Read => .FDRead;
             case .Write => .FDWrite;
@@ -199,12 +199,12 @@ __poll :: (fds: [] PollDescription, timeout: i32) -> void {
         if ev.type !=.Clock {
             if ev.fd_readwrite.nbytes > 0 {
                 i := cast(i32) ev.userdata;
-                fds[i].out = fds[i].input;
+                fds[i].out_events = fds[i].in_events;
             }
 
             if ev.fd_readwrite.flags & .ReadWriteHangUp {
                 i := cast(i32) ev.userdata;
-                fds[i].out = .Closed;
+                fds[i].out_events = .Closed;
             }
         }
     }
index 09300f6a407fb902b14e9b17f34209d7c0dff061..487d11f008f252ad6bc553c5a0a571a651bf9892 100644 (file)
@@ -265,12 +265,12 @@ __file_stream_vtable := io.Stream_Vtable.{
     poll = (use fs: &os.File, ev: io.PollEvent, timeout: i32) -> (io.Error, bool) {
         p: [1] PollDescription = .[.{
             fd = data.fd,
-            input = ev,
+            in_events = ev,
         }];
 
         runtime.platform.__poll(p, timeout);
 
-        return .None, p[0].out == ev;
+        return .None, p[0].out_events == ev;
     }
 }
 
index 612ca9a46d6e567defc21e746e7d7a745639d90a..230a1a7d5c6b55960f4a2dfe8bc31be6e76fb1ee 100644 (file)
@@ -182,7 +182,7 @@ __net_resolve :: (host: str, port: u16, out_addrs: [] SocketAddress) -> i32 {
 
 #package {
     socket_addr_to_wasix_addr :: (input: &SocketAddress, out: &wasi.AddrPort) {
-        switch *innput {
+        switch *input {
             case .Unix as &path {
                 *out = .{ Unix = .{ *cast(&[108] u8) path } };
             }