ueno labeled Issue #2076:
The documentation of
wasi_common::virtfs::FileContents::pwritesays:/// Write contents from `buf` to this file starting at `offset`. `offset` plus the length of /// `buf` is guaranteed to not exceed `max_size`. Implementations must not indicate more bytes /// have been written than the size of `buf`. fn pwrite(&mut self, buf: &[u8], offset: types::Filesize) -> Result<usize>;while POSIX says the
offsetis a file offset rather than the offset in buffer. AlthoughFileContents::pwriteis currently only used byInMemoryFileimplementation, it would be consistent to treat theoffsetas a file offset.
ueno opened Issue #2076:
The documentation of
wasi_common::virtfs::FileContents::pwritesays:/// Write contents from `buf` to this file starting at `offset`. `offset` plus the length of /// `buf` is guaranteed to not exceed `max_size`. Implementations must not indicate more bytes /// have been written than the size of `buf`. fn pwrite(&mut self, buf: &[u8], offset: types::Filesize) -> Result<usize>;while POSIX says the
offsetis a file offset rather than the offset in buffer. AlthoughFileContents::pwriteis currently only used byInMemoryFileimplementation, it would be consistent to treat theoffsetas a file offset.
ueno edited Issue #2076:
The documentation of
wasi_common::virtfs::FileContents::pwritesays:/// Write contents from `buf` to this file starting at `offset`. `offset` plus the length of /// `buf` is guaranteed to not exceed `max_size`. Implementations must not indicate more bytes /// have been written than the size of `buf`. fn pwrite(&mut self, buf: &[u8], offset: types::Filesize) -> Result<usize>;while in POSIX (and WASI
fd_pwrite) theoffsetis a file offset rather than the offset in buffer. AlthoughFileContents::pwriteis currently only used byInMemoryFileimplementation, it would be consistent to treat theoffsetas a file offset.
ueno commented on Issue #2076:
Sorry, this was my misunderstanding and the function actually writes at the file offset.
ueno closed Issue #2076:
The documentation of
wasi_common::virtfs::FileContents::pwritesays:/// Write contents from `buf` to this file starting at `offset`. `offset` plus the length of /// `buf` is guaranteed to not exceed `max_size`. Implementations must not indicate more bytes /// have been written than the size of `buf`. fn pwrite(&mut self, buf: &[u8], offset: types::Filesize) -> Result<usize>;while in POSIX (and WASI
fd_pwrite) theoffsetis a file offset rather than the offset in buffer. AlthoughFileContents::pwriteis currently only used byInMemoryFileimplementation, it would be consistent to treat theoffsetas a file offset.
Last updated: Dec 06 2025 at 06:05 UTC