From 8862541dfd4f372cb74e7c40d90370b1d2dc7c73 Mon Sep 17 00:00:00 2001 From: des Date: Thu, 22 Feb 2001 14:44:39 +0000 Subject: Fix formatting bugs introduced in sysctl_vm_zone() by the previous commit. Also, if SYSCTL_OUT() returns a non-zero value, stop at once. --- sys/vm/vm_zone.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sys/vm/vm_zone.c') diff --git a/sys/vm/vm_zone.c b/sys/vm/vm_zone.c index f2d9622..65c10de 100644 --- a/sys/vm/vm_zone.c +++ b/sys/vm/vm_zone.c @@ -417,6 +417,7 @@ sysctl_vm_zone(SYSCTL_HANDLER_ARGS) int error, len; char tmpbuf[128]; vm_zone_t z; + char *p; mtx_lock(&zone_mtx); len = snprintf(tmpbuf, sizeof(tmpbuf), @@ -425,13 +426,17 @@ sysctl_vm_zone(SYSCTL_HANDLER_ARGS) SLIST_FOREACH(z, &zlist, zent) { mtx_lock(&z->zmtx); len = snprintf(tmpbuf, sizeof(tmpbuf), - "%-14.14s %6.6u, %8.8u, %6.6u, %6.6u, %8.8u\n", + "%-12.12s %6.6u, %8.8u, %6.6u, %6.6u, %8.8u\n", z->zname, z->zsize, z->zmax, (z->ztotal - z->zfreecnt), z->zfreecnt, z->znalloc); + for (p = tmpbuf + 12; p > tmpbuf && *p == ' '; --p) + /* nothing */ ; + p[1] = ':'; mtx_unlock(&z->zmtx); if (SLIST_NEXT(z, zent) == NULL) tmpbuf[len - 1] = 0; - error = SYSCTL_OUT(req, tmpbuf, len); + if ((error = SYSCTL_OUT(req, tmpbuf, len)) != 0) + break; } mtx_unlock(&zone_mtx); return (error); -- cgit v1.1