diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-01-04 07:50:34 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-01-04 07:50:34 +0000 |
commit | 149a07c133348a32770ddc678c554c51cf49ccce (patch) | |
tree | 39da0413aa331de6d124616e677321c2390027bd /sbin | |
parent | 91ff0e4cce94a53dd331b1510f18ca063aa2103e (diff) |
Read a struct kmembuckets, rather than individual values.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/sysctl/sysctl.8 | 9 | ||||
-rw-r--r-- | sbin/sysctl/sysctl.c | 29 |
2 files changed, 17 insertions, 21 deletions
diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8 index d5fd6b1df9a..85d2190544d 100644 --- a/sbin/sysctl/sysctl.8 +++ b/sbin/sysctl/sysctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysctl.8,v 1.58 2001/01/04 06:07:22 angelos Exp $ +.\" $OpenBSD: sysctl.8,v 1.59 2001/01/04 07:50:33 angelos Exp $ .\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $ .\" .\" Copyright (c) 1993 @@ -143,12 +143,7 @@ privilege can change the value. .It kern.sysvshm integer no .It kern.arandom u_int no .It kern.malloc.buckets string no -.It kern.malloc.bucket.<sz>.calls quad no -.It kern.malloc.bucket.<sz>.total_allocated quad no -.It kern.malloc.bucket.<sz>.total_free quad no -.It kern.malloc.bucket.<sz>.elements quad no -.It kern.malloc.bucket.<sz>.high_watermark quad no -.It kern.malloc.bucket.<sz>.could_free quad no +.It kern.malloc.bucket.<sz> string no .It vm.loadavg struct no .It vm.psstrings struct no .It vm.swapencrypt.enable integer yes diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 956089ffd8a..03eee2331f3 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.56 2001/01/04 06:07:22 angelos Exp $ */ +/* $OpenBSD: sysctl.c,v 1.57 2001/01/04 07:50:33 angelos Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)sysctl.c 8.5 (Berkeley) 5/9/95"; #else -static char *rcsid = "$OpenBSD: sysctl.c,v 1.56 2001/01/04 06:07:22 angelos Exp $"; +static char *rcsid = "$OpenBSD: sysctl.c,v 1.57 2001/01/04 07:50:33 angelos Exp $"; #endif #endif /* not lint */ @@ -170,6 +170,7 @@ int Aflag, aflag, nflag, wflag; #define BIOSDEV 0x00000080 #define MAJ2DEV 0x00000100 #define UNSIGNED 0x00000200 +#define KMEMBUCKETS 0x00000400 /* prototypes */ void debuginit __P((void)); @@ -336,6 +337,8 @@ parse(string, flags) len = sysctl_malloc(string, &bufp, mib, flags, &type); if (len < 0) return; + if (mib[2] == KERN_MALLOC_BUCKET) + special |= KMEMBUCKETS; newsize = 0; break; case KERN_VNODE: @@ -587,6 +590,13 @@ parse(string, flags) return; } } + if (special & KMEMBUCKETS) { + struct kmembuckets *kb = (struct kmembuckets *)buf; + if (!nflag) + (void)printf("%s = ", string); + (void)printf("calls = %qu, total_allocated = %qu, total_free = %qu, elements = %qu, high_watermark = %qu, could_free = %qu\n", kb->kb_calls, kb->kb_total, kb->kb_totalfree, kb->kb_elmpercl, kb->kb_highwat, kb->kb_couldfree); + return; + } if (special & CLOCK) { struct clockinfo *clkp = (struct clockinfo *)buf; @@ -1262,25 +1272,16 @@ sysctl_malloc(string, bufpp, mib, flags, typep) for (i = 1; (lp.list[i].ctl_name = strsep(&buf, ",")) != NULL; i++) { - lp.list[i].ctl_type = CTLTYPE_QUAD; + lp.list[i].ctl_type = CTLTYPE_STRUCT; } lp.list[i].ctl_name = buf; - lp.list[i].ctl_type = CTLTYPE_QUAD; + lp.list[i].ctl_type = CTLTYPE_STRUCT; listall(string, &lp); free(lp.list); return(-1); } mib[3] = atoi(name); - if (*bufpp == NULL) { - listall(string, &kernbucketlist); - return(-1); - } - if ((indx = findname(string, "fifth", bufpp, - &kernbucketlist)) == -1) - return (-1); - mib[4] = indx; - *typep = CTLTYPE_QUAD; - return(5); + return(4); } else { *typep = CTLTYPE_STRING; return(3); |