diff --git a/rtl/wasi/sysfile.inc b/rtl/wasi/sysfile.inc index 5b01ae1659..de09a6b3e1 100644 --- a/rtl/wasi/sysfile.inc +++ b/rtl/wasi/sysfile.inc @@ -18,7 +18,7 @@ var res: __wasi_errno_t; begin repeat - res:=fd_close(Handle); + res:=__wasi_fd_close(Handle); until (res=__WASI_ERRNO_SUCCESS) or (res<>__WASI_ERRNO_INTR); if res=__WASI_ERRNO_SUCCESS then InOutRes:=0 @@ -50,7 +50,7 @@ begin repeat our_iov.buf := Addr; our_iov.buf_len := Len; - res:=fd_write(Handle, @our_iov, 1, @our_nwritten); + res:=__wasi_fd_write(Handle, @our_iov, 1, @our_nwritten); until (res=__WASI_ERRNO_SUCCESS) or ((res<>__WASI_ERRNO_INTR) and (res<>__WASI_ERRNO_AGAIN)); if res=__WASI_ERRNO_SUCCESS then begin @@ -73,7 +73,7 @@ begin repeat our_iov.buf:=Addr; our_iov.buf_len:=Len; - fd_read(Handle,@our_iov,1,@our_nread); + __wasi_fd_read(Handle,@our_iov,1,@our_nread); until (res=__WASI_ERRNO_SUCCESS) or ((res<>__WASI_ERRNO_INTR) and (res<>__WASI_ERRNO_AGAIN)); if res=__WASI_ERRNO_SUCCESS then begin @@ -176,15 +176,15 @@ Begin end; { real open call } repeat - res:=path_open(3, { not sure about this fd... } - 0, - p, - strlen(p), - oflags, - fs_rights_base, - fs_rights_base, - fdflags, - @ourfd); + res:=__wasi_path_open(3, { not sure about this fd... } + 0, + p, + strlen(p), + oflags, + fs_rights_base, + fs_rights_base, + fdflags, + @ourfd); until (res=__WASI_ERRNO_SUCCESS) or (res<>__WASI_ERRNO_INTR); {if (res=__WASI_ERRNO_ROFS) and ((OFlags and O_RDWR)<>0) then begin diff --git a/rtl/wasi/sysos.inc b/rtl/wasi/sysos.inc index bd35669e6f..cfe69c0944 100644 --- a/rtl/wasi/sysos.inc +++ b/rtl/wasi/sysos.inc @@ -60,6 +60,6 @@ function Do_IsDevice(Handle:THandle):boolean; var ourfdstat: __wasi_fdstat_t; begin - fd_fdstat_get(Handle,@ourfdstat); + __wasi_fd_fdstat_get(Handle,@ourfdstat); Do_IsDevice:=ourfdstat.fs_filetype in [__WASI_FILETYPE_BLOCK_DEVICE,__WASI_FILETYPE_CHARACTER_DEVICE]; end; diff --git a/rtl/wasi/system.pp b/rtl/wasi/system.pp index a18bb42e9f..809ba6127e 100644 --- a/rtl/wasi/system.pp +++ b/rtl/wasi/system.pp @@ -77,7 +77,7 @@ End; procedure System_exit; begin - proc_exit(ExitCode); + __wasi_proc_exit(ExitCode); End; Function ParamCount: Longint; @@ -108,7 +108,7 @@ var begin our_iov.buf := PByte(P); our_iov.buf_len := StrLen(P); - fd_write(1, @our_iov, 1, @our_nwritten); + __wasi_fd_write(1, @our_iov, 1, @our_nwritten); end; procedure DebugWriteLn(const P: PChar); diff --git a/rtl/wasi/wasiinc/wasiprocs.inc b/rtl/wasi/wasiinc/wasiprocs.inc index e1f5284348..2312c64d01 100644 --- a/rtl/wasi/wasiinc/wasiprocs.inc +++ b/rtl/wasi/wasiinc/wasiprocs.inc @@ -13,24 +13,25 @@ **********************************************************************} -function fd_write(fd: __wasi_fd_t; - iovs: P__wasi_ciovec_t; - iovs_len: size_t; - nwritten: P__wasi_size_t): __wasi_errno_t; external 'wasi_snapshot_preview1'; -function fd_read(fd: __wasi_fd_t; - iovs: P__wasi_iovec_t; - iovs_len: size_t; - nread: P__wasi_size_t): __wasi_errno_t; external 'wasi_snapshot_preview1'; -procedure proc_exit(rval: __wasi_exitcode_t); noreturn; external 'wasi_snapshot_preview1'; -function fd_fdstat_get(fd: __wasi_fd_t; - stat: P__wasi_fdstat_t): __wasi_errno_t; external 'wasi_snapshot_preview1'; -function path_open(fd: __wasi_fd_t; - dirflags: __wasi_lookupflags_t; - path: PChar; - path_len: size_t; - oflags: __wasi_oflags_t; - fs_rights_base, - 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'; +function __wasi_fd_write(fd: __wasi_fd_t; + iovs: P__wasi_ciovec_t; + iovs_len: size_t; + nwritten: P__wasi_size_t): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'fd_write'; +function __wasi_fd_read(fd: __wasi_fd_t; + iovs: P__wasi_iovec_t; + iovs_len: size_t; + nread: P__wasi_size_t): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'fd_read'; +procedure __wasi_proc_exit(rval: __wasi_exitcode_t); noreturn; external 'wasi_snapshot_preview1' name 'proc_exit'; +function __wasi_fd_fdstat_get(fd: __wasi_fd_t; + stat: P__wasi_fdstat_t): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'fd_fdstat_get'; +function __wasi_path_open(fd: __wasi_fd_t; + dirflags: __wasi_lookupflags_t; + path: PChar; + path_len: size_t; + oflags: __wasi_oflags_t; + fs_rights_base, + fs_rights_inherting: __wasi_rights_t; + fdflags: __wasi_fdflags_t; + opened_fd: P__wasi_fd_t): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_open'; +function __wasi_fd_close(fd: __wasi_fd_t): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'fd_close'; +