Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat No need to pick a "default address" for mmap in c...
details: https://anonhg.NetBSD.org/src/rev/98a20ed3fdf4
branches: trunk
changeset: 542432:98a20ed3fdf4
user: atatat <atatat%NetBSD.org@localhost>
date: Tue Jan 28 21:57:42 2003 +0000
description:
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.
diffstat:
sys/compat/ibcs2/ibcs2_misc.c | 9 ++-------
sys/compat/sunos/sunos_misc.c | 25 ++-----------------------
sys/compat/sunos32/sunos32_misc.c | 24 ++----------------------
sys/compat/svr4/svr4_misc.c | 14 ++------------
sys/compat/svr4_32/svr4_32_misc.c | 14 ++------------
sys/compat/ultrix/ultrix_misc.c | 22 ++--------------------
6 files changed, 12 insertions(+), 96 deletions(-)
diffs (272 lines):
diff -r 9afbc9f30381 -r 98a20ed3fdf4 sys/compat/ibcs2/ibcs2_misc.c
--- a/sys/compat/ibcs2/ibcs2_misc.c Tue Jan 28 21:04:37 2003 +0000
+++ b/sys/compat/ibcs2/ibcs2_misc.c Tue Jan 28 21:57:42 2003 +0000
@@ -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 @@
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);
}
diff -r 9afbc9f30381 -r 98a20ed3fdf4 sys/compat/sunos/sunos_misc.c
--- a/sys/compat/sunos/sunos_misc.c Tue Jan 28 21:04:37 2003 +0000
+++ b/sys/compat/sunos/sunos_misc.c Tue Jan 28 21:57:42 2003 +0000
@@ -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 @@
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 @@
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));
}
diff -r 9afbc9f30381 -r 98a20ed3fdf4 sys/compat/sunos32/sunos32_misc.c
--- a/sys/compat/sunos32/sunos32_misc.c Tue Jan 28 21:04:37 2003 +0000
+++ b/sys/compat/sunos32/sunos32_misc.c Tue Jan 28 21:57:42 2003 +0000
@@ -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 @@
} */ *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 @@
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);
diff -r 9afbc9f30381 -r 98a20ed3fdf4 sys/compat/svr4/svr4_misc.c
--- a/sys/compat/svr4/svr4_misc.c Tue Jan 28 21:04:37 2003 +0000
+++ b/sys/compat/svr4/svr4_misc.c Tue Jan 28 21:57:42 2003 +0000
@@ -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 @@
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 @@
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);
}
diff -r 9afbc9f30381 -r 98a20ed3fdf4 sys/compat/svr4_32/svr4_32_misc.c
--- a/sys/compat/svr4_32/svr4_32_misc.c Tue Jan 28 21:04:37 2003 +0000
+++ b/sys/compat/svr4_32/svr4_32_misc.c Tue Jan 28 21:57:42 2003 +0000
@@ -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 @@
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 @@
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);
diff -r 9afbc9f30381 -r 98a20ed3fdf4 sys/compat/ultrix/ultrix_misc.c
--- a/sys/compat/ultrix/ultrix_misc.c Tue Jan 28 21:04:37 2003 +0000
+++ b/sys/compat/ultrix/ultrix_misc.c Tue Jan 28 21:57:42 2003 +0000
@@ -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 @@
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));
}
Home |
Main Index |
Thread Index |
Old Index