Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/procfs have procfs_do_pid_stat() pass the proc's ...



details:   https://anonhg.NetBSD.org/src/rev/91043c7e9835
branches:  trunk
changeset: 454173:91043c7e9835
user:      chs <chs%NetBSD.org@localhost>
date:      Sat Sep 07 19:08:28 2019 +0000

description:
have procfs_do_pid_stat() pass the proc's map to get_proc_size_info(),
rather than having the latter look up the map again and not check
for an error.

diffstat:

 sys/miscfs/procfs/procfs_linux.c |  15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diffs (57 lines):

diff -r 3583aad8d733 -r 91043c7e9835 sys/miscfs/procfs/procfs_linux.c
--- a/sys/miscfs/procfs/procfs_linux.c  Sat Sep 07 18:56:01 2019 +0000
+++ b/sys/miscfs/procfs/procfs_linux.c  Sat Sep 07 19:08:28 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: procfs_linux.c,v 1.75 2019/08/23 14:12:39 maxv Exp $      */
+/*      $NetBSD: procfs_linux.c,v 1.76 2019/09/07 19:08:28 chs Exp $      */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.75 2019/08/23 14:12:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.76 2019/09/07 19:08:28 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -75,19 +75,15 @@
 #define LBFSZ (8 * 1024)
 
 static void
-get_proc_size_info(struct lwp *l, unsigned long *stext, unsigned long *etext, unsigned long *sstack)
+get_proc_size_info(struct proc *p, struct vm_map *map, unsigned long *stext,
+    unsigned long *etext, unsigned long *sstack)
 {
-       struct proc *p = l->l_proc;
-       struct vmspace *vm;
-       struct vm_map *map;
        struct vm_map_entry *entry;
 
        *stext = 0;
        *etext = 0;
        *sstack = 0;
 
-       proc_vmspace_getref(p, &vm);
-       map = &vm->vm_map;
        vm_map_lock_read(map);
 
        for (entry = map->header.next; entry != &map->header;
@@ -128,7 +124,6 @@
        *sstack -= PAGE_SIZE;
 
        vm_map_unlock_read(map);
-       uvmspace_free(vm);
 }
 
 /*
@@ -436,7 +431,7 @@
                goto out;
        }
 
-       get_proc_size_info(l, &stext, &etext, &sstack);
+       get_proc_size_info(p, &vm->vm_map, &stext, &etext, &sstack);
 
        mutex_enter(proc_lock);
        mutex_enter(p->p_lock);



Home | Main Index | Thread Index | Old Index