diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1999-02-26 03:46:26 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1999-02-26 03:46:26 +0000 |
commit | 48775250a313098a40ca1bb5fcc831b288ddef6a (patch) | |
tree | 850d83eeac113b2b18c0c1c3f85bcde1ea903dcc /sys | |
parent | 258f45de0e307224873e11a79a6b8072436d0135 (diff) |
memory reads from other vmspace are different under uvm
Diffstat (limited to 'sys')
-rw-r--r-- | sys/miscfs/procfs/procfs_mem.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/miscfs/procfs/procfs_mem.c b/sys/miscfs/procfs/procfs_mem.c index 8953fe1b665..a54b44d7293 100644 --- a/sys/miscfs/procfs/procfs_mem.c +++ b/sys/miscfs/procfs/procfs_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_mem.c,v 1.8 1998/08/30 13:42:14 pefo Exp $ */ +/* $OpenBSD: procfs_mem.c,v 1.9 1999/02/26 03:46:25 art Exp $ */ /* $NetBSD: procfs_mem.c,v 1.8 1996/02/09 22:40:50 christos Exp $ */ /* @@ -57,8 +57,13 @@ #include <vm/vm_kern.h> #include <vm/vm_page.h> +#if defined(UVM) +#include <uvm/uvm_extern.h> +#endif + #define ISSET(t, f) ((t) & (f)) +#if !defined(UVM) static int procfs_rwmem __P((struct proc *, struct uio *)); static int @@ -203,6 +208,7 @@ procfs_rwmem(p, uio) return (error); } +#endif /* * Copy data in and out of the target process. @@ -224,8 +230,22 @@ procfs_domem(curp, p, pfs, uio) if ((error = procfs_checkioperm(curp, p)) != 0) return (error); +#if defined(UVM) + /* XXXCDC: how should locking work here? */ + if ((p->p_flag & P_WEXIT) || (p->p_vmspace->vm_refcnt < 1)) + return(EFAULT); + PHOLD(p); + p->p_vmspace->vm_refcnt++; /* XXX */ + error = uvm_io(&p->p_vmspace->vm_map, uio); + PRELE(p); + uvmspace_free(p->p_vmspace); +#else + PHOLD(p); + error = procfs_rwmem(p, uio); + PRELE(p); +#endif - return (procfs_rwmem(p, uio)); + return error; } /* |