summaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_proc.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-06-24 18:19:26 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-06-24 18:19:26 +0000
commita9159e0f7c544774dbdd3cd57c130c2b03b5257e (patch)
tree60514242a439f08ebf3ab35d2f08de6b1c361557 /lib/libkvm/kvm_proc.c
parent6f2f2524a7e8fe661b6ee6c12dc5722e2b206a30 (diff)
Allocate 8 pages for process argv, not one. This should really be ARG_MAX
but sysctl_proc_args() needs changes to support that.
Diffstat (limited to 'lib/libkvm/kvm_proc.c')
-rw-r--r--lib/libkvm/kvm_proc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index df36310abef..c2918404b03 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_proc.c,v 1.24 2004/06/15 03:52:59 deraadt Exp $ */
+/* $OpenBSD: kvm_proc.c,v 1.25 2004/06/24 18:19:25 millert Exp $ */
/* $NetBSD: kvm_proc.c,v 1.30 1999/03/24 05:50:50 mrg Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,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.24 2004/06/15 03:52:59 deraadt Exp $";
+static char *rcsid = "$OpenBSD: kvm_proc.c,v 1.25 2004/06/24 18:19:25 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -909,7 +909,7 @@ kvm_arg_sysctl(kvm_t *kd, pid_t pid, int nchr, int env)
int mib[4], ret;
char *buf;
- orglen = kd->nbpg;
+ orglen = env ? kd->nbpg : 8 * kd->nbpg; /* XXX - should be ARG_MAX */
if (kd->argbuf == NULL &&
(kd->argbuf = _kvm_malloc(kd, orglen)) == NULL)
return (NULL);
@@ -922,8 +922,8 @@ again:
len = orglen;
ret = (sysctl(mib, 4, kd->argbuf, &len, NULL, 0) < 0);
- if (ret && errno == ENOMEM) {
- orglen += kd->nbpg;
+ if (ret && errno == ENOMEM && env) {
+ orglen *= 2;
buf = _kvm_realloc(kd, kd->argbuf, orglen);
if (buf == NULL)
return (NULL);