summaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libkvm/kvm_proc.c')
-rw-r--r--lib/libkvm/kvm_proc.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index 1aede825e90..71488797bf5 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_proc.c,v 1.2 1996/05/05 14:57:42 deraadt Exp $ */
+/* $OpenBSD: kvm_proc.c,v 1.3 1996/10/23 16:43:08 deraadt Exp $ */
/* $NetBSD: kvm_proc.c,v 1.16 1996/03/18 22:33:57 thorpej Exp $ */
/*-
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93";
#else
-static char *rcsid = "$OpenBSD: kvm_proc.c,v 1.2 1996/05/05 14:57:42 deraadt Exp $";
+static char *rcsid = "$OpenBSD: kvm_proc.c,v 1.3 1996/10/23 16:43:08 deraadt Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -761,12 +761,25 @@ kvm_doargv(kd, kp, nchr, info)
u_long addr;
int cnt;
struct ps_strings arginfo;
+ static struct ps_strings *ps;
+
+ if (ps == NULL) {
+ struct _ps_strings _ps;
+ int mib[2];
+ size_t len;
+
+ mib[0] = CTL_VM;
+ mib[1] = VM_PSSTRINGS;
+ len = sizeof(_ps);
+ sysctl(mib, 2, &_ps, &len, NULL, 0);
+ ps = (struct ps_strings *)_ps.val;
+ }
/*
* Pointers are stored at the top of the user stack.
*/
if (p->p_stat == SZOMB ||
- kvm_uread(kd, p, USRSTACK - sizeof(arginfo), (char *)&arginfo,
+ kvm_uread(kd, p, ps, (char *)&arginfo,
sizeof(arginfo)) != sizeof(arginfo))
return (0);