Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/miscfs/procfs remove dead code and other misc cleanup.



details:   https://anonhg.NetBSD.org/src/rev/4d5a4e7bebb6
branches:  trunk
changeset: 499611:4d5a4e7bebb6
user:      chs <chs%NetBSD.org@localhost>
date:      Fri Nov 24 18:58:37 2000 +0000

description:
remove dead code and other misc cleanup.

diffstat:

 sys/miscfs/procfs/procfs.h       |   3 +-
 sys/miscfs/procfs/procfs_map.c   |  30 +++++--------
 sys/miscfs/procfs/procfs_mem.c   |  88 +---------------------------------------
 sys/miscfs/procfs/procfs_subr.c  |   6 +-
 sys/miscfs/procfs/procfs_vnops.c |   6 +-
 5 files changed, 19 insertions(+), 114 deletions(-)

diffs (223 lines):

diff -r e6f7633525f3 -r 4d5a4e7bebb6 sys/miscfs/procfs/procfs.h
--- a/sys/miscfs/procfs/procfs.h        Fri Nov 24 18:54:31 2000 +0000
+++ b/sys/miscfs/procfs/procfs.h        Fri Nov 24 18:58:37 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs.h,v 1.29 2000/03/16 18:08:26 jdolecek Exp $     */
+/*     $NetBSD: procfs.h,v 1.30 2000/11/24 18:58:37 chs Exp $  */
 
 /*
  * Copyright (c) 1993 Jan-Simon Pendry
@@ -116,7 +116,6 @@
 #define PFIND(pid) ((pid) ? pfind(pid) : &proc0)
 int procfs_freevp __P((struct vnode *));
 int procfs_allocvp __P((struct mount *, struct vnode **, long, pfstype));
-struct vnode *procfs_findtextvp __P((struct proc *));
 int procfs_donote __P((struct proc *, struct proc *, struct pfsnode *,
     struct uio *));
 int procfs_doregs __P((struct proc *, struct proc *, struct pfsnode *,
diff -r e6f7633525f3 -r 4d5a4e7bebb6 sys/miscfs/procfs/procfs_map.c
--- a/sys/miscfs/procfs/procfs_map.c    Fri Nov 24 18:54:31 2000 +0000
+++ b/sys/miscfs/procfs/procfs_map.c    Fri Nov 24 18:58:37 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_map.c,v 1.8 2000/06/28 02:44:07 mrg Exp $       */
+/*     $NetBSD: procfs_map.c,v 1.9 2000/11/24 18:58:37 chs Exp $       */
 
 /*
  * Copyright (c) 1993 Jan-Simon Pendry
@@ -92,26 +92,18 @@
                if (UVM_ET_ISSUBMAP(entry))
                        continue;
 
-               /*
-                * format:
-                *  start, end, resident, private resident, cow, access, type.
-                */
                snprintf(mebuffer, sizeof(mebuffer),
                    "0x%lx 0x%lx %c%c%c %c%c%c %s %s %d %d %d\n",
-                       entry->start, entry->end,
-
-                       (entry->protection & VM_PROT_READ) ? 'r' : '-',
-                       (entry->protection & VM_PROT_WRITE) ? 'w' : '-',
-                       (entry->protection & VM_PROT_EXECUTE) ? 'x' : '-',
-                       (entry->max_protection & VM_PROT_READ) ? 'r' : '-',
-                       (entry->max_protection & VM_PROT_WRITE) ? 'w' : '-',
-                       (entry->max_protection & VM_PROT_EXECUTE) ? 'x' : '-',
-
-                       (entry->etype & UVM_ET_COPYONWRITE) ? "COW" : "NCOW",
-                       (entry->etype & UVM_ET_NEEDSCOPY) ? "NC" : "NNC",
-                   entry->inheritance, entry->wired_count , entry->advice
-                       );
-
+                   entry->start, entry->end,
+                   (entry->protection & VM_PROT_READ) ? 'r' : '-',
+                   (entry->protection & VM_PROT_WRITE) ? 'w' : '-',
+                   (entry->protection & VM_PROT_EXECUTE) ? 'x' : '-',
+                   (entry->max_protection & VM_PROT_READ) ? 'r' : '-',
+                   (entry->max_protection & VM_PROT_WRITE) ? 'w' : '-',
+                   (entry->max_protection & VM_PROT_EXECUTE) ? 'x' : '-',
+                   (entry->etype & UVM_ET_COPYONWRITE) ? "COW" : "NCOW",
+                   (entry->etype & UVM_ET_NEEDSCOPY) ? "NC" : "NNC",
+                   entry->inheritance, entry->wired_count, entry->advice);
 
                len = strlen(mebuffer);
                if (len > uio->uio_resid) {
diff -r e6f7633525f3 -r 4d5a4e7bebb6 sys/miscfs/procfs/procfs_mem.c
--- a/sys/miscfs/procfs/procfs_mem.c    Fri Nov 24 18:54:31 2000 +0000
+++ b/sys/miscfs/procfs/procfs_mem.c    Fri Nov 24 18:58:37 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_mem.c,v 1.26 2000/09/26 23:28:01 thorpej Exp $  */
+/*     $NetBSD: procfs_mem.c,v 1.27 2000/11/24 18:58:37 chs Exp $      */
 
 /*
  * Copyright (c) 1993 Jan-Simon Pendry
@@ -101,25 +101,6 @@
 }
 
 /*
- * Given process (p), find the vnode from which
- * it's text segment is being executed.
- *
- * It would be nice to grab this information from
- * the VM system, however, there is no sure-fire
- * way of doing that.  Instead, fork(), exec() and
- * wait() all maintain the p_textvp field in the
- * process proc structure which contains a held
- * reference to the exec'ed vnode.
- */
-struct vnode *
-procfs_findtextvp(p)
-       struct proc *p;
-{
-
-       return (p->p_textvp);
-}
-
-/*
  * Ensure that a process has permission to perform I/O on another.
  * Arguments:
  *     p       The process wishing to do the I/O (the tracer).
@@ -160,70 +141,3 @@
        
        return (0);
 }
-
-#ifdef probably_never
-/*
- * Given process (p), find the vnode from which
- * it's text segment is being mapped.
- *
- * (This is here, rather than in procfs_subr in order
- * to keep all the VM related code in one place.)
- */
-struct vnode *
-procfs_findtextvp(p)
-       struct proc *p;
-{
-       int error;
-       vm_object_t object;
-       vaddr_t pageno;         /* page number */
-
-       /* find a vnode pager for the user address space */
-
-       for (pageno = VM_MIN_ADDRESS;
-                       pageno < VM_MAXUSER_ADDRESS;
-                       pageno += PAGE_SIZE) {
-               vm_map_t map;
-               vm_map_entry_t out_entry;
-               vm_prot_t out_prot;
-               boolean_t wired, single_use;
-               vaddr_t off;
-
-               map = &p->p_vmspace->vm_map;
-               error = vm_map_lookup(&map, pageno,
-                             VM_PROT_READ,
-                             &out_entry, &object, &off, &out_prot,
-                             &wired, &single_use);
-
-               if (!error) {
-                       vm_pager_t pager;
-
-                       printf("procfs: found vm object\n");
-                       vm_map_lookup_done(map, out_entry);
-                       printf("procfs: vm object = %p\n", object);
-
-                       /*
-                        * At this point, assuming no errors, object
-                        * is the VM object mapping UVA (pageno).
-                        * Ensure it has a vnode pager, then grab
-                        * the vnode from that pager's handle.
-                        */
-
-                       pager = object->pager;
-                       printf("procfs: pager = %p\n", pager);
-                       if (pager)
-                               printf("procfs: found pager, type = %d\n",
-                                   pager->pg_type);
-                       if (pager && pager->pg_type == PG_VNODE) {
-                               struct vnode *vp;
-
-                               vp = (struct vnode *) pager->pg_handle;
-                               printf("procfs: vp = %p\n", vp);
-                               return (vp);
-                       }
-               }
-       }
-
-       printf("procfs: text object not found\n");
-       return (0);
-}
-#endif /* probably_never */
diff -r e6f7633525f3 -r 4d5a4e7bebb6 sys/miscfs/procfs/procfs_subr.c
--- a/sys/miscfs/procfs/procfs_subr.c   Fri Nov 24 18:54:31 2000 +0000
+++ b/sys/miscfs/procfs/procfs_subr.c   Fri Nov 24 18:58:37 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_subr.c,v 1.32 2000/11/08 14:28:14 ad Exp $      */
+/*     $NetBSD: procfs_subr.c,v 1.33 2000/11/24 18:58:37 chs Exp $     */
 
 /*
  * Copyright (c) 1994 Christopher G. Demetriou.  All rights reserved.
@@ -108,7 +108,7 @@
 
        if ((error = getnewvnode(VT_PROCFS, mp, procfs_vnodeop_p, vpp)) != 0) {
                *vpp = NULL;
-               lockmgr(&pfs_hashlock, LK_RELEASE, 0);
+               lockmgr(&pfs_hashlock, LK_RELEASE, NULL);
                return (error);
        }
        vp = *vpp;
@@ -167,7 +167,7 @@
        }
 
        procfs_hashins(pfs);
-       lockmgr(&pfs_hashlock, LK_RELEASE, 0);
+       lockmgr(&pfs_hashlock, LK_RELEASE, NULL);
 
        return (error);
 }
diff -r e6f7633525f3 -r 4d5a4e7bebb6 sys/miscfs/procfs/procfs_vnops.c
--- a/sys/miscfs/procfs/procfs_vnops.c  Fri Nov 24 18:54:31 2000 +0000
+++ b/sys/miscfs/procfs/procfs_vnops.c  Fri Nov 24 18:58:37 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_vnops.c,v 1.74 2000/08/09 23:30:49 tv Exp $     */
+/*     $NetBSD: procfs_vnops.c,v 1.75 2000/11/24 18:58:37 chs Exp $    */
 
 /*
  * Copyright (c) 1993 Jan-Simon Pendry
@@ -806,7 +806,7 @@
 
        found:
                if (pt->pt_pfstype == Pfile) {
-                       fvp = procfs_findtextvp(p);
+                       fvp = p->p_textvp;
                        /* We already checked that it exists. */
                        VREF(fvp);
                        vn_lock(fvp, LK_EXCLUSIVE | LK_RETRY);
@@ -837,7 +837,7 @@
 procfs_validfile(p)
        struct proc *p;
 {
-       return (procfs_findtextvp(p) != NULLVP);
+       return (p->p_textvp != NULL);
 }
 
 #ifdef COMPAT_LINUX



Home | Main Index | Thread Index | Old Index