diff options
author | Can Erkin Acar <canacar@cvs.openbsd.org> | 2008-12-31 05:37:25 +0000 |
---|---|---|
committer | Can Erkin Acar <canacar@cvs.openbsd.org> | 2008-12-31 05:37:25 +0000 |
commit | 28262836181fcda48774cb80eb76711f94617722 (patch) | |
tree | 29011933fa2cbde534b6626defbd4eb878a83e55 /usr.bin/systat | |
parent | 1a17d4412dc04b2a8f0dbe49d3a6e0cbcb99cb2a (diff) |
Skip missing pool indices instead of printing errors.
Diffstat (limited to 'usr.bin/systat')
-rw-r--r-- | usr.bin/systat/mbufs.c | 5 | ||||
-rw-r--r-- | usr.bin/systat/pool.c | 22 |
2 files changed, 16 insertions, 11 deletions
diff --git a/usr.bin/systat/mbufs.c b/usr.bin/systat/mbufs.c index f7190da9bff..24a97af1209 100644 --- a/usr.bin/systat/mbufs.c +++ b/usr.bin/systat/mbufs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbufs.c,v 1.20 2008/12/18 19:46:39 canacar Exp $ */ +/* $OpenBSD: mbufs.c,v 1.21 2008/12/31 05:37:24 canacar Exp $ */ /* * Copyright (c) 2008 Can Erkin Acar <canacar@openbsd.org> * @@ -132,8 +132,7 @@ initmembufs(void) mib[3] = i; size = sizeof(pname); if (sysctl(mib, 4, &pname, &size, NULL, 0) < 0) { - err(1, "sysctl(KERN_POOL_POOLNAME, %d)", i); - /* NOTREACHED */ + continue; } if (strcmp(pname, "mbpl") == 0) { diff --git a/usr.bin/systat/pool.c b/usr.bin/systat/pool.c index 0d17a3d13d5..374b71127c9 100644 --- a/usr.bin/systat/pool.c +++ b/usr.bin/systat/pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pool.c,v 1.4 2008/12/07 07:46:05 canacar Exp $ */ +/* $OpenBSD: pool.c,v 1.5 2008/12/31 05:37:24 canacar Exp $ */ /* * Copyright (c) 2008 Can Erkin Acar <canacar@openbsd.org> * @@ -227,6 +227,8 @@ read_pool(void) num_pools = np; } + num_disp = num_pools; + for (i = 0; i < num_pools; i++) { mib[0] = CTL_KERN; mib[1] = KERN_POOL; @@ -234,14 +236,14 @@ read_pool(void) mib[3] = i + 1; size = sizeof(struct pool); if (sysctl(mib, 4, &pools[i].pool, &size, NULL, 0) < 0) { - error("sysctl(pool): %s", strerror(errno)); - break; + memset(&pools[i], 0, sizeof(pools[i])); + num_disp--; + continue; } mib[2] = KERN_POOL_NAME; size = sizeof(pools[i].name); if (sysctl(mib, 4, &pools[i].name, &size, NULL, 0) < 0) { - error("sysctl(pool_name): %s", strerror(errno)); - break; + snprintf(pools[i].name, size, "#%d#", mib[3]); } } @@ -257,13 +259,17 @@ read_pool(void) void print_pool(void) { - int n, count = 0; + int i, n, count = 0; if (pools == NULL) return; - for (n = dispstart; n < num_disp; n++) { - showpool(n); + for (n = i = 0; i < num_pools; i++) { + if (pools[i].name[0] == 0) + continue; + if (n++ < dispstart) + continue; + showpool(i); count++; if (maxprint > 0 && count >= maxprint) break; |