Skip to content

Commit d81e048

Browse files
authored
Remove unused first argument from _mmap_js. NFC (#17011)
1 parent 62d10a3 commit d81e048

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

src/library_syscall.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,14 @@ var SyscallsLibrary = {
113113
#endif // SYSCALLS_REQUIRE_FILESYSTEM
114114
},
115115

116-
_mmap_js__sig: 'pppiiipp',
116+
_mmap_js__sig: 'ppiiipp',
117117
_mmap_js__deps: ['$SYSCALLS',
118118
#if FILESYSTEM && SYSCALLS_REQUIRE_FILESYSTEM
119119
'$FS',
120120
#endif
121121
],
122-
_mmap_js: function(addr, len, prot, flags, fd, off, allocated) {
122+
_mmap_js: function(len, prot, flags, fd, off, allocated) {
123123
#if FILESYSTEM && SYSCALLS_REQUIRE_FILESYSTEM
124-
if (addr !== 0) {
125-
// We don't currently support location hints for the address of the mapping
126-
return -{{{ cDefine('EINVAL') }}};
127-
}
128124
var stream = FS.getStream(fd);
129125
if (!stream) return -{{{ cDefine('EBADF') }}};
130126
var res = FS.mmap(stream, len, off, prot, flags);

system/lib/libc/emscripten_mmap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static volatile int lock[1];
3434
static struct map* mappings;
3535

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

@@ -109,8 +109,8 @@ int __syscall_msync(intptr_t addr, size_t len, int flags) {
109109
}
110110

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

@@ -133,7 +133,7 @@ intptr_t __syscall_mmap2(intptr_t addr, size_t len, int prot, int flags, int fd,
133133
new_map->allocated = true;
134134
} else {
135135
new_map = emscripten_builtin_malloc(sizeof(struct map));
136-
long rtn = _mmap_js(addr, len, prot, flags, fd, off, &new_map->allocated);
136+
long rtn = _mmap_js(len, prot, flags, fd, off, &new_map->allocated);
137137
if (rtn < 0) {
138138
emscripten_builtin_free(new_map);
139139
return rtn;

system/lib/standalone/standalone.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ const unsigned char * __map_file(const char *pathname, size_t *size) {
6969
return NULL;
7070
}
7171

72-
intptr_t _mmap_js(intptr_t addr,
73-
size_t length,
72+
intptr_t _mmap_js(size_t length,
7473
int prot,
7574
int flags,
7675
int fd,

0 commit comments

Comments
 (0)