version 1.41, 2019/06/13 20:38:54 |
version 1.42, 2019/06/28 13:35:02 |
|
|
mib[1] = KERN_MAXCLUSTERS; |
mib[1] = KERN_MAXCLUSTERS; |
size = sizeof(maxclusters); |
size = sizeof(maxclusters); |
|
|
if (sysctl(mib, 2, &maxclusters, &size, NULL, 0) < 0) { |
if (sysctl(mib, 2, &maxclusters, &size, NULL, 0) == -1) { |
printf("Can't retrieve value of maxclusters from the " |
printf("Can't retrieve value of maxclusters from the " |
"kernel: %s\n", strerror(errno)); |
"kernel: %s\n", strerror(errno)); |
return; |
return; |
|
|
mib[1] = KERN_MBSTAT; |
mib[1] = KERN_MBSTAT; |
size = sizeof(mbstat); |
size = sizeof(mbstat); |
|
|
if (sysctl(mib, 2, &mbstat, &size, NULL, 0) < 0) { |
if (sysctl(mib, 2, &mbstat, &size, NULL, 0) == -1) { |
printf("Can't retrieve mbuf statistics from the kernel: %s\n", |
printf("Can't retrieve mbuf statistics from the kernel: %s\n", |
strerror(errno)); |
strerror(errno)); |
return; |
return; |
|
|
mib[2] = KERN_POOL_NPOOLS; |
mib[2] = KERN_POOL_NPOOLS; |
size = sizeof(npools); |
size = sizeof(npools); |
|
|
if (sysctl(mib, 3, &npools, &size, NULL, 0) < 0) { |
if (sysctl(mib, 3, &npools, &size, NULL, 0) == -1) { |
printf("Can't figure out number of pools in kernel: %s\n", |
printf("Can't figure out number of pools in kernel: %s\n", |
strerror(errno)); |
strerror(errno)); |
return; |
return; |
|
|
mib[2] = KERN_POOL_POOL; |
mib[2] = KERN_POOL_POOL; |
mib[3] = i; |
mib[3] = i; |
size = sizeof(pool); |
size = sizeof(pool); |
if (sysctl(mib, 4, &pool, &size, NULL, 0) < 0) { |
if (sysctl(mib, 4, &pool, &size, NULL, 0) == -1) { |
if (errno == ENOENT) |
if (errno == ENOENT) |
continue; |
continue; |
printf("error getting pool: %s\n", |
printf("error getting pool: %s\n", |
|
|
npools--; |
npools--; |
mib[2] = KERN_POOL_NAME; |
mib[2] = KERN_POOL_NAME; |
size = sizeof(name); |
size = sizeof(name); |
if (sysctl(mib, 4, &name, &size, NULL, 0) < 0) { |
if (sysctl(mib, 4, &name, &size, NULL, 0) == -1) { |
printf("error getting pool name: %s\n", |
printf("error getting pool name: %s\n", |
strerror(errno)); |
strerror(errno)); |
return; |
return; |