فهرست منبع

+ implemented WASI file close

git-svn-id: branches/wasm@48344 -
nickysn 4 سال پیش
والد
کامیت
a28eb39f4b
2فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  1. 9 1
      rtl/wasi/sysfile.inc
  2. 1 0
      rtl/wasi/system.pp

+ 9 - 1
rtl/wasi/sysfile.inc

@@ -14,8 +14,16 @@
  **********************************************************************}
 
 procedure Do_Close(Handle:thandle);
+var
+  res: __wasi_errno_t;
 begin
-  DebugWriteLn('Do_Close');
+  repeat
+    res:=fd_close(Handle);
+  until (res=__WASI_ERRNO_SUCCESS) or (res<>__WASI_ERRNO_INTR);
+  if res=__WASI_ERRNO_SUCCESS then
+    InOutRes:=0
+  else
+    InOutRes:=Errno2InoutRes(res);
 end;
 
 procedure Do_Erase(p: pchar; pchangeable: boolean);

+ 1 - 0
rtl/wasi/system.pp

@@ -244,6 +244,7 @@ function path_open(fd: __wasi_fd_t;
                    fs_rights_inherting: __wasi_rights_t;
                    fdflags: __wasi_fdflags_t;
                    opened_fd: P__wasi_fd_t): __wasi_errno_t; external 'wasi_snapshot_preview1';
+function fd_close(fd: __wasi_fd_t): __wasi_errno_t; external 'wasi_snapshot_preview1';
 
 {$I system.inc}