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.
This commit is contained in:
chs 2019-09-07 19:08:28 +00:00
parent 7ec667fc62
commit 45fbe545bb
1 changed files with 5 additions and 10 deletions

View File

@ -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 @@ extern int max_devsw_convs;
#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 @@ get_proc_size_info(struct lwp *l, unsigned long *stext, unsigned long *etext, un
*sstack -= PAGE_SIZE;
vm_map_unlock_read(map);
uvmspace_free(vm);
}
/*
@ -436,7 +431,7 @@ procfs_do_pid_stat(struct lwp *curl, struct lwp *l,
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);