| 1698 | } |
| 1699 | |
| 1700 | int _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 | |
| 1716 | int _munmap_js( |
| 1717 | void* addr, size_t length, int prot, int flags, int fd, off_t offset) { |
no test coverage detected