Closed HarikrishnanBalagopal closed 1 year ago
When I initially prototyped this project I returned -1
as error for unimplemented things rather than a real error. Some usages have been fixed since, but several still remain. fd_pread is one of those unimplemented syscalls.
When I initially prototyped this project I returned
-1
as error for unimplemented things rather than a real error. Some usages have been fixed since, but several still remain. fd_pread is one of those unimplemented syscalls.
Right, is it feasible to implement it? It's required for basic stuff like expanding a zip archive. https://www.practical-go-lessons.com/post/how-to-unzip-a-file-or-directory-with-golang-ccb0328321as70o6ujjg
I can contribute a PR if it's feasible.
Read from the file at the given offset without updating the file cursor. This acts like a stateless version of Seek + Read.
The description sounds a lot like a normal fd_read
Not sure if there any blockers that I am not aware of.
I think you could copy the fd_read
impl except use the given file offset instead of reading and modifying this.file_pos
.
@bjorn3 have implemented the fd_pread
and now Golang "archive/zip" is working for expanding .zip archives.
Nice! Merged your PR.
https://github.com/bjorn3/browser_wasi_shim/blob/f4d2382d9e61d6fda580b7a5afb37699a0015745/src/fd.ts#L38-L39
-1 becomes positive 4294967295 2^32-1 in javascript because of signed 2s complement being interpreted as unsigned javascript number