8 static void dummy(void) { }
9 weak_alias(dummy
, __vm_wait
);
11 #define UNIT SYSCALL_MMAP2_UNIT
12 #define OFF_MASK ((-0x2000ULL << (8*sizeof(syscall_arg_t)-1)) | (UNIT-1))
14 void *__mmap(void *start
, size_t len
, int prot
, int flags
, int fd
, off_t off
)
21 if (len
>= PTRDIFF_MAX
) {
25 if (flags
& MAP_FIXED
) {
29 ret
= __syscall(SYS_mmap2
, start
, len
, prot
, flags
, fd
, off
/UNIT
);
31 ret
= __syscall(SYS_mmap
, start
, len
, prot
, flags
, fd
, off
);
33 /* Fixup incorrect EPERM from kernel. */
34 if (ret
== -EPERM
&& !start
&& (flags
&MAP_ANON
) && !(flags
&MAP_FIXED
))
36 return (void *)__syscall_ret(ret
);
39 weak_alias(__mmap
, mmap
);