mirror of https://github.com/xzeldon/htop.git
netbsd: handle repeated ENOMEM from HW_IOSTATS safely
This commit is contained in:
parent
c31fd3c691
commit
6d3b4a0f2e
|
@ -347,6 +347,8 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||||
|
|
||||||
iostats = xRealloc(iostats, size);
|
iostats = xRealloc(iostats, size);
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
|
||||||
if (sysctl(mib, __arraycount(mib), iostats, &size, NULL, 0) == 0)
|
if (sysctl(mib, __arraycount(mib), iostats, &size, NULL, 0) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -354,6 +356,9 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||||
CRT_fatalError("Unable to get disk IO statistics");
|
CRT_fatalError("Unable to get disk IO statistics");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errno == ENOMEM)
|
||||||
|
CRT_fatalError("Unable to get disk IO statistics");
|
||||||
|
|
||||||
uint64_t bytesReadSum = 0;
|
uint64_t bytesReadSum = 0;
|
||||||
uint64_t bytesWriteSum = 0;
|
uint64_t bytesWriteSum = 0;
|
||||||
uint64_t busyTimeSum = 0;
|
uint64_t busyTimeSum = 0;
|
||||||
|
|
Loading…
Reference in New Issue