mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 06:09:08 +00:00
LibWasm/WASI: Add support for fd_seek()
This commit is contained in:
parent
708abf6bb1
commit
e08a7cb94d
Notes:
sideshowbarker
2024-07-18 23:45:37 +09:00
Author: https://github.com/alimpfard
Commit: e08a7cb94d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/671
1 changed files with 13 additions and 1 deletions
|
@ -812,6 +812,19 @@ ErrorOr<Result<FDStat>> Implementation::impl$fd_fdstat_get(Configuration&, FD fd
|
|||
};
|
||||
}
|
||||
|
||||
ErrorOr<Result<FileSize>> Implementation::impl$fd_seek(Configuration&, FD fd, FileDelta offset, Whence whence)
|
||||
{
|
||||
auto mapped_fd = map_fd(fd);
|
||||
if (!mapped_fd.has<u32>())
|
||||
return errno_value_from_errno(EBADF);
|
||||
|
||||
u32 fd_value = mapped_fd.get<u32>();
|
||||
auto result = lseek(fd_value, offset, static_cast<int>(whence));
|
||||
if (result < 0)
|
||||
return errno_value_from_errno(errno);
|
||||
return FileSize(result);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
|
@ -830,7 +843,6 @@ ErrorOr<Result<Size>> Implementation::impl$fd_pread(Configuration&, FD, Pointer<
|
|||
ErrorOr<Result<Size>> Implementation::impl$fd_pwrite(Configuration&, FD, Pointer<CIOVec> iovs, Size iovs_len, FileSize offset) { return Errno::NoSys; }
|
||||
ErrorOr<Result<Size>> Implementation::impl$fd_readdir(Configuration&, FD, Pointer<u8> buf, Size buf_len, DirCookie cookie) { return Errno::NoSys; }
|
||||
ErrorOr<Result<void>> Implementation::impl$fd_renumber(Configuration&, FD from, FD to) { return Errno::NoSys; }
|
||||
ErrorOr<Result<FileSize>> Implementation::impl$fd_seek(Configuration&, FD, FileDelta offset, Whence whence) { return Errno::NoSys; }
|
||||
ErrorOr<Result<void>> Implementation::impl$fd_sync(Configuration&, FD) { return Errno::NoSys; }
|
||||
ErrorOr<Result<FileSize>> Implementation::impl$fd_tell(Configuration&, FD) { return Errno::NoSys; }
|
||||
ErrorOr<Result<void>> Implementation::impl$path_filestat_set_times(Configuration&, FD, LookupFlags, Pointer<u8> path, Size path_len, Timestamp atim, Timestamp mtim, FSTFlags) { return Errno::NoSys; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue