projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add support for mips and mips64 r6 isa
[musl]
/
src
/
mman
/
mmap.c
diff --git
a/src/mman/mmap.c
b/src/mman/mmap.c
index
b56cff8
..
b85f25c
100644
(file)
--- a/
src/mman/mmap.c
+++ b/
src/mman/mmap.c
@@
-6,17
+6,14
@@
#include "syscall.h"
#include "libc.h"
#include "syscall.h"
#include "libc.h"
-static void dummy1(int x) { }
-static void dummy0(void) { }
-weak_alias(dummy1, __vm_lock);
-weak_alias(dummy0, __vm_unlock);
+static void dummy(void) { }
+weak_alias(dummy, __vm_wait);
-#define OFF_MASK ((-0x2000ULL << (8*sizeof(long)-1)) | 0xfff)
+#define UNIT SYSCALL_MMAP2_UNIT
+#define OFF_MASK ((-0x2000ULL << (8*sizeof(long)-1)) | (UNIT-1))
void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
{
void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
{
- void *ret;
-
if (off & OFF_MASK) {
errno = EINVAL;
return MAP_FAILED;
if (off & OFF_MASK) {
errno = EINVAL;
return MAP_FAILED;
@@
-25,14
+22,14
@@
void *__mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)
errno = ENOMEM;
return MAP_FAILED;
}
errno = ENOMEM;
return MAP_FAILED;
}
- if (flags & MAP_FIXED) __vm_lock(-1);
+ if (flags & MAP_FIXED) {
+ __vm_wait();
+ }
#ifdef SYS_mmap2
#ifdef SYS_mmap2
- ret
= (void *)syscall(SYS_mmap2, start, len, prot, flags, fd, off>>12
);
+ ret
urn (void *)syscall(SYS_mmap2, start, len, prot, flags, fd, off/UNIT
);
#else
#else
- ret
=
(void *)syscall(SYS_mmap, start, len, prot, flags, fd, off);
+ ret
urn
(void *)syscall(SYS_mmap, start, len, prot, flags, fd, off);
#endif
#endif
- if (flags & MAP_FIXED) __vm_unlock();
- return ret;
}
weak_alias(__mmap, mmap);
}
weak_alias(__mmap, mmap);