Skip to content

Commit

Permalink
Remove unused first argument from _mmap_js. NFC (#17011)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 committed May 24, 2022
1 parent 62d10a3 commit d81e048
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
8 changes: 2 additions & 6 deletions src/library_syscall.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,14 @@ var SyscallsLibrary = {
#endif // SYSCALLS_REQUIRE_FILESYSTEM
},

_mmap_js__sig: 'pppiiipp',
_mmap_js__sig: 'ppiiipp',
_mmap_js__deps: ['$SYSCALLS',
#if FILESYSTEM && SYSCALLS_REQUIRE_FILESYSTEM
'$FS',
#endif
],
_mmap_js: function(addr, len, prot, flags, fd, off, allocated) {
_mmap_js: function(len, prot, flags, fd, off, allocated) {
#if FILESYSTEM && SYSCALLS_REQUIRE_FILESYSTEM
if (addr !== 0) {
// We don't currently support location hints for the address of the mapping
return -{{{ cDefine('EINVAL') }}};
}
var stream = FS.getStream(fd);
if (!stream) return -{{{ cDefine('EBADF') }}};
var res = FS.mmap(stream, len, off, prot, flags);
Expand Down
8 changes: 4 additions & 4 deletions system/lib/libc/emscripten_mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static volatile int lock[1];
static struct map* mappings;

// JS library functions. Used only when mapping files (not MAP_ANONYMOUS)
intptr_t _mmap_js(intptr_t addr, size_t length, int prot, int flags, int fd, size_t offset, int* allocated);
intptr_t _mmap_js(size_t length, int prot, int flags, int fd, size_t offset, int* allocated);
int _munmap_js(intptr_t addr, size_t length, int prot, int flags, int fd, size_t offset);
int _msync_js(intptr_t addr, size_t length, int flags, int fd);

Expand Down Expand Up @@ -109,8 +109,8 @@ int __syscall_msync(intptr_t addr, size_t len, int flags) {
}

intptr_t __syscall_mmap2(intptr_t addr, size_t len, int prot, int flags, int fd, size_t off) {
// addr argument must be page aligned if MAP_FIXED flag is set.
if (flags & MAP_FIXED && ((intptr_t)addr % WASM_PAGE_SIZE) != 0) {
if (addr != 0) {
// We don't currently support location hints for the address of the mapping
return -EINVAL;
}

Expand All @@ -133,7 +133,7 @@ intptr_t __syscall_mmap2(intptr_t addr, size_t len, int prot, int flags, int fd,
new_map->allocated = true;
} else {
new_map = emscripten_builtin_malloc(sizeof(struct map));
long rtn = _mmap_js(addr, len, prot, flags, fd, off, &new_map->allocated);
long rtn = _mmap_js(len, prot, flags, fd, off, &new_map->allocated);
if (rtn < 0) {
emscripten_builtin_free(new_map);
return rtn;
Expand Down
3 changes: 1 addition & 2 deletions system/lib/standalone/standalone.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ const unsigned char * __map_file(const char *pathname, size_t *size) {
return NULL;
}

intptr_t _mmap_js(intptr_t addr,
size_t length,
intptr_t _mmap_js(size_t length,
int prot,
int flags,
int fd,
Expand Down

0 comments on commit d81e048

Please sign in to comment.