wasi-libc icon indicating copy to clipboard operation
wasi-libc copied to clipboard

_WASI_EMULATED_MMAN is doesn't write changes back to the underlying file

Open sbc100 opened this issue 4 years ago • 2 comments

The munmap is supposed to do this, but also msync is completely missing.

sbc100 avatar Jul 08 '20 14:07 sbc100

The munmap is supposed to do this, but also msync is completely missing.

Same, trying to close my shared memory with 'munmap' and it's not writing to the file even though it works when compiled with emscripten or natively. Were you able to find a solution ?

DebianArch64 avatar Mar 08 '24 07:03 DebianArch64

Implementing these turned out to hit the limitation that wasip1 doesn't have dup, so the emulated mmap can't save the file descriptor to be able to write back into it.

One solution is to change the code to just use file reads and writes, instead of mmap, since that's what the emulated mmap here (and in Emscripten too) does under the covers anyway.

sunfishcode avatar Mar 08 '24 14:03 sunfishcode