summaryrefslogtreecommitdiffstats
path: root/sys/miscfs
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-07-04 05:58:30 +0000
committerguenther <guenther@openbsd.org>2014-07-04 05:58:30 +0000
commit644b47884b319d456d6792dca9dee3a804d68b3b (patch)
treedfe947066c6d6a96f92e5a50bc0b470a131b7f99 /sys/miscfs
parentClean up messages related to missing arguments. (diff)
downloadwireguard-openbsd-644b47884b319d456d6792dca9dee3a804d68b3b.tar.xz
wireguard-openbsd-644b47884b319d456d6792dca9dee3a804d68b3b.zip
Track whether a process is a zombie or not yet fully built via flags
PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's thread data. This eliminates the need for the thread-level SDEAD state. Change kvm_getprocs() (both the sysctl() and kvm backends) to report the "most active" scheduler state for the process's threads. tweaks kettenis@ feedback and ok matthew@
Diffstat (limited to 'sys/miscfs')
-rw-r--r--sys/miscfs/procfs/procfs_cmdline.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/miscfs/procfs/procfs_cmdline.c b/sys/miscfs/procfs/procfs_cmdline.c
index b80aff97186..756804ec954 100644
--- a/sys/miscfs/procfs/procfs_cmdline.c
+++ b/sys/miscfs/procfs/procfs_cmdline.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs_cmdline.c,v 1.10 2012/03/10 05:54:28 guenther Exp $ */
+/* $OpenBSD: procfs_cmdline.c,v 1.11 2014/07/04 05:58:31 guenther Exp $ */
/* $NetBSD: procfs_cmdline.c,v 1.3 1999/03/13 22:26:48 thorpej Exp $ */
/*
@@ -55,6 +55,7 @@
int
procfs_docmdline(struct proc *curp, struct proc *p, struct pfsnode *pfs, struct uio *uio)
{
+ struct process *pr = p->p_p;
struct ps_strings pss;
int count, error, i;
size_t len, xlen, upper_bound;
@@ -78,7 +79,7 @@ procfs_docmdline(struct proc *curp, struct proc *p, struct pfsnode *pfs, struct
* System processes also don't have a user stack. This is what
* ps(1) would display.
*/
- if (P_ZOMBIE(p) || (p->p_flag & P_SYSTEM) != 0) {
+ if (pr->ps_flags & (PS_ZOMBIE | PS_SYSTEM)) {
len = snprintf(arg, PAGE_SIZE, "(%s)", p->p_comm);
if (uio->uio_offset >= (off_t)len)
error = 0;
@@ -99,11 +100,11 @@ procfs_docmdline(struct proc *curp, struct proc *p, struct pfsnode *pfs, struct
* Lock the process down in memory.
*/
/* XXXCDC: how should locking work here? */
- if ((p->p_p->ps_flags & PS_EXITING) || (p->p_vmspace->vm_refcnt < 1)) {
+ if ((pr->ps_flags & PS_EXITING) || (pr->ps_vmspace->vm_refcnt < 1)) {
free(arg, M_TEMP);
return (EFAULT);
}
- vm = p->p_vmspace;
+ vm = pr->ps_vmspace;
vm->vm_refcnt++; /* XXX */
/*