Index: sys/compat/cloudabi/cloudabi_mem.c =================================================================== --- sys/compat/cloudabi/cloudabi_mem.c +++ sys/compat/cloudabi/cloudabi_mem.c @@ -110,8 +110,15 @@ if (error != 0) return (error); - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot, flags, - uap->fd, uap->off)); + return (kern_mmap(td, + &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = prot, + .mr_flags = flags, + .mr_fd = uap->fd, + .mr_pos = uap->off, + })); } int Index: sys/compat/freebsd32/freebsd32_misc.c =================================================================== --- sys/compat/freebsd32/freebsd32_misc.c +++ sys/compat/freebsd32/freebsd32_misc.c @@ -502,8 +502,15 @@ prot |= PROT_EXEC; #endif - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot, - uap->flags, uap->fd, PAIR32TO64(off_t, uap->pos))); + return (kern_mmap(td, + &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = prot, + .mr_flags = uap->flags, + .mr_fd = uap->fd, + .mr_pos = PAIR32TO64(off_t, uap->pos), + })); } #ifdef COMPAT_FREEBSD6 @@ -519,8 +526,15 @@ prot |= PROT_EXEC; #endif - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot, - uap->flags, uap->fd, PAIR32TO64(off_t, uap->pos))); + return (kern_mmap(td, + &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = prot, + .mr_flags = uap->flags, + .mr_fd = uap->fd, + .mr_pos = PAIR32TO64(off_t, uap->pos), + })); } #endif Index: sys/compat/linux/linux_mmap.c =================================================================== --- sys/compat/linux/linux_mmap.c +++ sys/compat/linux/linux_mmap.c @@ -217,12 +217,12 @@ (bsd_flags & MAP_EXCL) == 0) { mr_fixed = mr; mr_fixed.mr_flags |= MAP_FIXED | MAP_EXCL; - error = kern_mmap_req(td, &mr_fixed); + error = kern_mmap(td, &mr_fixed); if (error == 0) goto out; } - error = kern_mmap_req(td, &mr); + error = kern_mmap(td, &mr); out: LINUX_CTR2(mmap2, "return: %d (%p)", error, td->td_retval[0]); Index: sys/sys/syscallsubr.h =================================================================== --- sys/sys/syscallsubr.h +++ sys/sys/syscallsubr.h @@ -201,12 +201,10 @@ enum uio_seg pathseg, int mode, dev_t dev); int kern_mlock(struct proc *proc, struct ucred *cred, uintptr_t addr, size_t len); -int kern_mmap(struct thread *td, uintptr_t addr, size_t len, int prot, - int flags, int fd, off_t pos); +int kern_mmap(struct thread *td, const struct mmap_req *mrp); int kern_mmap_racct_check(struct thread *td, struct vm_map *map, vm_size_t size); int kern_mmap_maxprot(struct proc *p, int prot); -int kern_mmap_req(struct thread *td, const struct mmap_req *mrp); int kern_mprotect(struct thread *td, uintptr_t addr, size_t size, int prot); int kern_msgctl(struct thread *, int, int, struct msqid_ds *); int kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *); Index: sys/vm/vm_mmap.c =================================================================== --- sys/vm/vm_mmap.c +++ sys/vm/vm_mmap.c @@ -179,8 +179,15 @@ sys_mmap(struct thread *td, struct mmap_args *uap) { - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, uap->prot, - uap->flags, uap->fd, uap->pos)); + return (kern_mmap(td, + &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = uap->prot, + .mr_flags = uap->flags, + .mr_fd = uap->fd, + .mr_pos = uap->pos, + })); } int @@ -197,23 +204,7 @@ } int -kern_mmap(struct thread *td, uintptr_t addr0, size_t len, int prot, int flags, - int fd, off_t pos) -{ - struct mmap_req mr = { - .mr_hint = addr0, - .mr_len = len, - .mr_prot = prot, - .mr_flags = flags, - .mr_fd = fd, - .mr_pos = pos - }; - - return (kern_mmap_req(td, &mr)); -} - -int -kern_mmap_req(struct thread *td, const struct mmap_req *mrp) +kern_mmap(struct thread *td, const struct mmap_req *mrp) { struct vmspace *vms; struct file *fp; @@ -442,9 +433,15 @@ int freebsd6_mmap(struct thread *td, struct freebsd6_mmap_args *uap) { - - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, uap->prot, - uap->flags, uap->fd, uap->pos)); + return (kern_mmap(td, + &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = uap->prot, + .mr_flags = uap->flags, + .mr_fd = uap->fd, + .mr_pos = uap->pos, + })); } #endif @@ -496,8 +493,15 @@ flags |= MAP_PRIVATE; if (uap->flags & OMAP_FIXED) flags |= MAP_FIXED; - return (kern_mmap(td, (uintptr_t)uap->addr, uap->len, prot, flags, - uap->fd, uap->pos)); + return (kern_mmap(td, + &(struct mmap_req){ + .mr_hint = (uintptr_t)uap->addr, + .mr_len = uap->len, + .mr_prot = prot, + .mr_flags = flags, + .mr_fd = uap->fd, + .mr_pos = uap->pos, + })); } #endif /* COMPAT_43 */