MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / _msync_js

Function _msync_js

system/lib/wasmfs/syscalls.cpp:1700–1714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1698}
1699
1700int _msync_js(
1701 void* addr, size_t length, int prot, int flags, int fd, off_t offset) {
1702 // TODO: This is not correct! Mappings should be associated with files, not
1703 // fds. Only need to sync if shared and writes are allowed.
1704 int mapType = flags & MAP_TYPE;
1705 if (mapType == MAP_SHARED && (prot & PROT_WRITE)) {
1706 __wasi_ciovec_t iovec;
1707 iovec.buf = (uint8_t*)addr;
1708 iovec.buf_len = length;
1709 __wasi_size_t nwritten;
1710 // Translate from WASI positive error codes to negative error codes.
1711 return -__wasi_fd_pwrite(fd, &iovec, 1, offset, &nwritten);
1712 }
1713 return 0;
1714}
1715
1716int _munmap_js(
1717 void* addr, size_t length, int prot, int flags, int fd, off_t offset) {

Callers 3

libsyscall.jsFile · 0.85
__syscall_msyncFunction · 0.85
_munmap_jsFunction · 0.85

Calls 1

__wasi_fd_pwriteFunction · 0.85

Tested by

no test coverage detected