No need to pick a "default address" for mmap in compat code, since we
merely call sys_mmap() at the end anyway, and that will pick the address for us, if it's needed. Likewise for checking if /dev/zero is being mapped.
This commit is contained in:
parent
5e8bddc2e7
commit
59b8237f5e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ibcs2_misc.c,v 1.61 2003/01/20 01:35:11 simonb Exp $ */
|
||||
/* $NetBSD: ibcs2_misc.c,v 1.62 2003/01/28 21:57:42 atatat Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1998 Scott Bartram
|
||||
|
@ -55,7 +55,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.61 2003/01/20 01:35:11 simonb Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.62 2003/01/28 21:57:42 atatat Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -1533,11 +1533,6 @@ ibcs2_sys_mmap(l, v, retval)
|
|||
SCARG(&mm, addr) = SCARG(uap, addr);
|
||||
SCARG(&mm, pos) = SCARG(uap, off);
|
||||
|
||||
rp = (void *) round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ);
|
||||
if ((SCARG(&mm, flags) & MAP_FIXED) == 0 &&
|
||||
SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp)
|
||||
SCARG(&mm, addr) = rp;
|
||||
|
||||
return sys_mmap(l, &mm, retval);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sunos_misc.c,v 1.117 2003/01/18 08:36:15 thorpej Exp $ */
|
||||
/* $NetBSD: sunos_misc.c,v 1.118 2003/01/28 21:57:44 atatat Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -54,7 +54,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.117 2003/01/18 08:36:15 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.118 2003/01/28 21:57:44 atatat Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_nfsserver.h"
|
||||
|
@ -614,9 +614,6 @@ sunos_sys_mmap(l, v, retval)
|
|||
struct sunos_sys_mmap_args *uap = v;
|
||||
struct proc *p = l->l_proc;
|
||||
struct sys_mmap_args ouap;
|
||||
struct filedesc *fdp;
|
||||
struct file *fp;
|
||||
struct vnode *vp;
|
||||
|
||||
/*
|
||||
* Verify the arguments.
|
||||
|
@ -629,29 +626,11 @@ sunos_sys_mmap(l, v, retval)
|
|||
|
||||
SCARG(&ouap, flags) = SCARG(uap, flags) & ~SUNOS__MAP_NEW;
|
||||
SCARG(&ouap, addr) = SCARG(uap, addr);
|
||||
|
||||
if ((SCARG(&ouap, flags) & MAP_FIXED) == 0 &&
|
||||
SCARG(&ouap, addr) != 0 &&
|
||||
SCARG(&ouap, addr) < (void *)round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ))
|
||||
SCARG(&ouap, addr) = (caddr_t)round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ);
|
||||
|
||||
SCARG(&ouap, len) = SCARG(uap, len);
|
||||
SCARG(&ouap, prot) = SCARG(uap, prot);
|
||||
SCARG(&ouap, fd) = SCARG(uap, fd);
|
||||
SCARG(&ouap, pos) = SCARG(uap, pos);
|
||||
|
||||
/*
|
||||
* Special case: if fd refers to /dev/zero, map as MAP_ANON. (XXX)
|
||||
*/
|
||||
fdp = p->p_fd;
|
||||
if ((fp = fd_getfile(fdp, SCARG(&ouap, fd))) != NULL && /*XXX*/
|
||||
fp->f_type == DTYPE_VNODE && /*XXX*/
|
||||
(vp = (struct vnode *)fp->f_data)->v_type == VCHR && /*XXX*/
|
||||
vp->v_rdev == zerodev) { /*XXX*/
|
||||
SCARG(&ouap, flags) |= MAP_ANON;
|
||||
SCARG(&ouap, fd) = -1;
|
||||
}
|
||||
|
||||
return (sys_mmap(l, &ouap, retval));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sunos32_misc.c,v 1.15 2003/01/18 08:38:15 thorpej Exp $ */
|
||||
/* $NetBSD: sunos32_misc.c,v 1.16 2003/01/28 21:57:45 atatat Exp $ */
|
||||
/* from :NetBSD: sunos_misc.c,v 1.107 2000/12/01 19:25:10 jdolecek Exp */
|
||||
|
||||
/*
|
||||
|
@ -83,7 +83,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.15 2003/01/18 08:38:15 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.16 2003/01/28 21:57:45 atatat Exp $");
|
||||
|
||||
#define COMPAT_SUNOS 1
|
||||
|
||||
|
@ -839,9 +839,6 @@ sunos32_sys_mmap(l, v, retval)
|
|||
} */ *uap = v;
|
||||
struct proc *p = l->l_proc;
|
||||
struct sys_mmap_args ua;
|
||||
struct filedesc *fdp;
|
||||
struct file *fp;
|
||||
struct vnode *vp;
|
||||
void *rt;
|
||||
int error;
|
||||
|
||||
|
@ -862,23 +859,6 @@ sunos32_sys_mmap(l, v, retval)
|
|||
SCARG(&ua, pad) = 0;
|
||||
SUNOS32TOX_UAP(pos, off_t);
|
||||
|
||||
if ((SCARG(&ua, flags) & MAP_FIXED) == 0 &&
|
||||
SCARG(&ua, addr) != 0 &&
|
||||
SCARG(&ua, addr) < (void *)round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ))
|
||||
SCARG(&ua, addr) = (void *)round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ);
|
||||
|
||||
/*
|
||||
* Special case: if fd refers to /dev/zero, map as MAP_ANON. (XXX)
|
||||
*/
|
||||
fdp = p->p_fd;
|
||||
if ((fp = fd_getfile(fdp, SCARG(&ua, fd))) != NULL && /*XXX*/
|
||||
fp->f_type == DTYPE_VNODE && /*XXX*/
|
||||
(vp = (struct vnode *)fp->f_data)->v_type == VCHR && /*XXX*/
|
||||
vp->v_rdev == zerodev) { /*XXX*/
|
||||
SCARG(&ua, flags) |= MAP_ANON;
|
||||
SCARG(&ua, fd) = -1;
|
||||
}
|
||||
|
||||
error = sys_mmap(l, &ua, (register_t *)&rt);
|
||||
if ((long)rt > (long)UINT_MAX)
|
||||
printf("sunos32_mmap: retval out of range: %p", rt);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svr4_misc.c,v 1.99 2003/01/18 08:44:26 thorpej Exp $ */
|
||||
/* $NetBSD: svr4_misc.c,v 1.100 2003/01/28 21:57:45 atatat Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The NetBSD Foundation, Inc.
|
||||
|
@ -44,7 +44,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.99 2003/01/18 08:44:26 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_misc.c,v 1.100 2003/01/28 21:57:45 atatat Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -542,11 +542,6 @@ svr4_sys_mmap(l, v, retval)
|
|||
SCARG(&mm, addr) = SCARG(uap, addr);
|
||||
SCARG(&mm, pos) = SCARG(uap, pos);
|
||||
|
||||
rp = (void *) round_page((vaddr_t)l->l_proc->p_vmspace->vm_daddr + MAXDSIZ);
|
||||
if ((SCARG(&mm, flags) & MAP_FIXED) == 0 &&
|
||||
SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp)
|
||||
SCARG(&mm, addr) = rp;
|
||||
|
||||
return sys_mmap(l, &mm, retval);
|
||||
}
|
||||
|
||||
|
@ -578,11 +573,6 @@ svr4_sys_mmap64(l, v, retval)
|
|||
SCARG(&mm, addr) = SCARG(uap, addr);
|
||||
SCARG(&mm, pos) = SCARG(uap, pos);
|
||||
|
||||
rp = (void *) round_page((vaddr_t)l->l_proc->p_vmspace->vm_daddr + MAXDSIZ);
|
||||
if ((SCARG(&mm, flags) & MAP_FIXED) == 0 &&
|
||||
SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp)
|
||||
SCARG(&mm, addr) = rp;
|
||||
|
||||
return sys_mmap(l, &mm, retval);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svr4_32_misc.c,v 1.14 2003/01/19 16:47:14 thorpej Exp $ */
|
||||
/* $NetBSD: svr4_32_misc.c,v 1.15 2003/01/28 21:57:46 atatat Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The NetBSD Foundation, Inc.
|
||||
|
@ -44,7 +44,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.14 2003/01/19 16:47:14 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.15 2003/01/28 21:57:46 atatat Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -546,11 +546,6 @@ svr4_32_sys_mmap(l, v, retval)
|
|||
SCARG(&mm, addr) = (void *)(u_long)SCARG(uap, addr);
|
||||
SCARG(&mm, pos) = SCARG(uap, pos);
|
||||
|
||||
rp = (void *)(u_long) round_page((u_int32_t)(u_long)p->p_vmspace->vm_daddr + MAXDSIZ);
|
||||
if ((SCARG(&mm, flags) & MAP_FIXED) == 0 &&
|
||||
SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp)
|
||||
SCARG(&mm, addr) = rp;
|
||||
|
||||
error = sys_mmap(l, &mm, (register_t *)&rp);
|
||||
if ((u_long)rp > (u_long)UINT_MAX) {
|
||||
printf("svr4_32_mmap: retval out of range: %p", rp);
|
||||
|
@ -590,11 +585,6 @@ svr4_32_sys_mmap64(l, v, retval)
|
|||
SCARG(&mm, addr) = (void *)(u_long)SCARG(uap, addr);
|
||||
SCARG(&mm, pos) = SCARG(uap, pos);
|
||||
|
||||
rp = (void *) round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ);
|
||||
if ((SCARG(&mm, flags) & MAP_FIXED) == 0 &&
|
||||
SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp)
|
||||
SCARG(&mm, addr) = rp;
|
||||
|
||||
error = sys_mmap(l, &mm, (register_t *)&rp);
|
||||
if ((u_long)rp > (u_long)UINT_MAX) {
|
||||
printf("svr4_32_mmap64: retval out of range: %p", rp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ultrix_misc.c,v 1.81 2003/01/18 08:49:22 thorpej Exp $ */
|
||||
/* $NetBSD: ultrix_misc.c,v 1.82 2003/01/28 21:57:47 atatat Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1997 Jonathan Stone (hereinafter referred to as the author)
|
||||
|
@ -80,7 +80,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ultrix_misc.c,v 1.81 2003/01/18 08:49:22 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ultrix_misc.c,v 1.82 2003/01/28 21:57:47 atatat Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_nfsserver.h"
|
||||
|
@ -348,29 +348,11 @@ ultrix_sys_mmap(l, v, retval)
|
|||
|
||||
SCARG(&ouap, flags) = SCARG(uap, flags) & ~SUN__MAP_NEW;
|
||||
SCARG(&ouap, addr) = SCARG(uap, addr);
|
||||
|
||||
if ((SCARG(&ouap, flags) & MAP_FIXED) == 0 &&
|
||||
SCARG(&ouap, addr) != 0 &&
|
||||
SCARG(&ouap, addr) < (void *)round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ))
|
||||
SCARG(&ouap, addr) = (void *)round_page((vaddr_t)p->p_vmspace->vm_daddr+MAXDSIZ);
|
||||
|
||||
SCARG(&ouap, len) = SCARG(uap, len);
|
||||
SCARG(&ouap, prot) = SCARG(uap, prot);
|
||||
SCARG(&ouap, fd) = SCARG(uap, fd);
|
||||
SCARG(&ouap, pos) = SCARG(uap, pos);
|
||||
|
||||
/*
|
||||
* Special case: if fd refers to /dev/zero, map as MAP_ANON. (XXX)
|
||||
*/
|
||||
fdp = p->p_fd;
|
||||
if ((fp = fd_getfile(fdp, SCARG(&ouap, fd))) != NULL && /*XXX*/
|
||||
fp->f_type == DTYPE_VNODE && /*XXX*/
|
||||
(vp = (struct vnode *)fp->f_data)->v_type == VCHR && /*XXX*/
|
||||
vp->v_rdev == zerodev) { /*XXX*/
|
||||
SCARG(&ouap, flags) |= MAP_ANON;
|
||||
SCARG(&ouap, fd) = -1;
|
||||
}
|
||||
|
||||
return (sys_mmap(l, &ouap, retval));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue