mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 09:29:26 +02:00
+ implemented SysUtils.FileWrite for WASI
This commit is contained in:
parent
09e61201d2
commit
14f361e13f
@ -219,7 +219,20 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
Function FileWrite (Handle : THandle; const Buffer; Count : Longint) : Longint;
|
Function FileWrite (Handle : THandle; const Buffer; Count : Longint) : Longint;
|
||||||
|
var
|
||||||
|
our_iov: __wasi_ciovec_t;
|
||||||
|
our_nwritten: longint;
|
||||||
|
res: __wasi_errno_t;
|
||||||
begin
|
begin
|
||||||
|
repeat
|
||||||
|
our_iov.buf:=@Buffer;
|
||||||
|
our_iov.buf_len:=Count;
|
||||||
|
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
|
||||||
|
Result:=our_nwritten
|
||||||
|
else
|
||||||
|
Result:=-1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user