aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux_mmap.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/compat/linux/linux_mmap.c b/sys/compat/linux/linux_mmap.c
index 1949f3055c8e..941a3388487c 100644
--- a/sys/compat/linux/linux_mmap.c
+++ b/sys/compat/linux/linux_mmap.c
@@ -77,6 +77,7 @@ int
linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot,
int flags, int fd, off_t pos)
{
+ struct mmap_req mr, mr_fixed;
struct proc *p = td->td_proc;
struct vmspace *vms = td->td_proc->p_vmspace;
int bsd_flags, error;
@@ -201,17 +202,25 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot,
* address is not zero, try with MAP_FIXED and MAP_EXCL first,
* and fall back to the normal behaviour if that fails.
*/
+ mr = (struct mmap_req) {
+ .mr_hint = addr,
+ .mr_len = len,
+ .mr_prot = prot,
+ .mr_flags = bsd_flags,
+ .mr_fd = fd,
+ .mr_pos = pos,
+ .mr_check_fp_fn = linux_mmap_check_fp,
+ };
if (addr != 0 && (bsd_flags & MAP_FIXED) == 0 &&
(bsd_flags & MAP_EXCL) == 0) {
- error = kern_mmap_fpcheck(td, addr, len, prot,
- bsd_flags | MAP_FIXED | MAP_EXCL, fd, pos,
- linux_mmap_check_fp);
+ mr_fixed = mr;
+ mr_fixed.mr_flags |= MAP_FIXED | MAP_EXCL;
+ error = kern_mmap_req(td, &mr_fixed);
if (error == 0)
goto out;
}
- error = kern_mmap_fpcheck(td, addr, len, prot, bsd_flags, fd, pos,
- linux_mmap_check_fp);
+ error = kern_mmap_req(td, &mr);
out:
LINUX_CTR2(mmap2, "return: %d (%p)", error, td->td_retval[0]);